/* NapMap cats: a placed cat is a curled-up sleeper (<symbol id="cat"> in index.html). The symbol reads its colors from
   custom properties, which inherit into the <use> tree, so each .coat-* class below is just a palette.
   --fur body, --st stripes (--sto their opacity), --pa/--pb patches, --pts siamese mask, --bib tuxedo blaze,
   --ear/--tip/--paw points, --eye closed-eye line, --earin inner-ear pink opacity, --zz the little "z". */
.coat-tabby{--fur:#F4A259;--st:#D9762B;--sto:1}
.coat-black{--fur:#52597A;--sto:0;--eye:#E6E9F4}
.coat-white{--fur:#FFFFFF;--sto:0}
.coat-grey{--fur:#A7B0C6;--st:#808AA6;--sto:.8}
.coat-calico{--fur:#FFF6EA;--pa:#F29A4A;--pb:#52597A;--sto:0}
.coat-tuxedo{--fur:#52597A;--bib:#FFFFFF;--paw:#FFFFFF;--tip:#FFFFFF;--sto:0;--eye:#E6E9F4}
.coat-siamese{--fur:#F6EBD6;--pts:#7A5A45;--ear:#7A5A45;--tip:#7A5A45;--sto:0;--eye:#F6EBD6;--earin:0}
.zz{--zz:1}

/* bigger than other marks, with a soft light halo so it reads on patterned fabric and furniture art */
.cell.cat svg{width:86%;height:86%;color:inherit;overflow:visible;
  filter:drop-shadow(0 0 1.2px rgba(255,255,255,.95)) drop-shadow(0 0 2.4px rgba(255,255,255,.6)) drop-shadow(0 1px 0 rgba(43,47,69,.18));
  transform-origin:50% 88%;animation:cat-settle .26s cubic-bezier(.3,.7,.4,1)}
.board-wrap[data-n="10"] .cell.cat svg{width:92%;height:92%}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .cell.cat svg{
  filter:drop-shadow(0 0 1.2px rgba(255,255,255,.8)) drop-shadow(0 0 2.6px rgba(238,241,248,.45))}}
:root[data-theme="dark"] .cell.cat svg{filter:drop-shadow(0 0 1.2px rgba(255,255,255,.8)) drop-shadow(0 0 2.6px rgba(238,241,248,.45))}

/* settle in: drops in, squashes onto the cushion, then relaxes */
@keyframes cat-settle{
  0%{transform:translateY(-14%) scale(.82,1.1);opacity:.4}
  45%{transform:translateY(0) scale(1.14,.84);opacity:1}
  75%{transform:scale(.97,1.03)}
  100%{transform:none}}
@media (prefers-reduced-motion:reduce){.cell.cat svg{animation:none}}

/* archive: a solved day shows the default (tabby) sleeper */
.arc-cat{overflow:visible}

/* ---------- walk-in (js/cats.js) ---------- */
/* the curled cat waits hidden while its walker strolls over; dropping the class replays the settle-in squash */
.cell.cat-arriving svg{opacity:0;animation:none}
/* the walker lives inside #board: z-index 1 just before the first .furn while it is behind the furniture
   (above the room blocks and cell fabric, under the art), then z-index 3 above cats, marks and art */
.cat-walker{position:absolute;left:0;top:0;z-index:3;transform-origin:50% 86.5%;pointer-events:none;will-change:transform,opacity;
  filter:drop-shadow(0 0 1.2px rgba(255,255,255,.95)) drop-shadow(0 0 2.4px rgba(255,255,255,.6)) drop-shadow(0 1px 0 rgba(43,47,69,.18))}
.cat-walker.behind{z-index:1}
/* the furniture hides the cat properly while it is behind (the art is normally a little see-through) */
.furn.cat-behind svg{opacity:1!important}
.cw-face,.cw{display:block;width:100%;height:100%}
.cw{overflow:visible}
.cw .pw,.cw .ps{transition:opacity .12s linear}
.cw .leg{transform-box:fill-box;transform-origin:50% 12%}
.cw .leg.f{filter:brightness(.84)}
.cw .tail{transform-box:view-box;transform-origin:16px 27px}
.cw .sway{transform-box:view-box;transform-origin:34px 40px}
.cw .nod{transform-box:view-box;transform-origin:50px 27px}
.cw .yawn{transform-box:fill-box;transform-origin:50% 20%;transform:scale(var(--yawn,0))}
/* a slow four-beat walk: each leg a quarter cycle apart (hind, fore, hind, fore), gentle sway, lazy tail swish */
.cw.walking .leg{animation:cw-leg calc(.96s / var(--sp,1)) ease-in-out infinite}
.cw.walking .leg.lh{animation-delay:0s}.cw.walking .leg.lf{animation-delay:calc(-.24s / var(--sp,1))}
.cw.walking .leg.rh{animation-delay:calc(-.48s / var(--sp,1))}.cw.walking .leg.rf{animation-delay:calc(-.72s / var(--sp,1))}
.cw.walking .sway{animation:cw-sway calc(.48s / var(--sp,1)) ease-in-out infinite alternate}
.cw.walking .nod{animation:cw-nod calc(.96s / var(--sp,1)) ease-in-out infinite}
.cw .tail{animation:cw-tail 1.6s ease-in-out infinite alternate}
@keyframes cw-leg{0%,100%{transform:rotate(20deg)}50%{transform:rotate(-20deg)}}
@keyframes cw-sway{from{transform:translateY(0) rotate(-1deg)}to{transform:translateY(-1.2px) rotate(1deg)}}
@keyframes cw-nod{0%,100%{transform:rotate(0)}50%{transform:rotate(3deg)}}
@keyframes cw-tail{from{transform:rotate(-7deg)}to{transform:rotate(9deg)}}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .cat-walker{
  filter:drop-shadow(0 0 1.2px rgba(255,255,255,.8)) drop-shadow(0 0 2.6px rgba(238,241,248,.45))}}
:root[data-theme="dark"] .cat-walker{filter:drop-shadow(0 0 1.2px rgba(255,255,255,.8)) drop-shadow(0 0 2.6px rgba(238,241,248,.45))}
@media (prefers-reduced-motion:reduce){.cat-walker{display:none}.cell.cat-arriving svg{opacity:1}}

/* ---------- win finale (js/cats.js): card jiggle, then zoomies ---------- */
/* when the jiggle starts the card melts to half strength so the runners show through; the button stays solid */
.card{transition:background-color 1.3s ease,border-color 1.3s ease,box-shadow 1.3s ease}
.card > *{transition:opacity 1.3s ease}
.card.card-dim{background-color:color-mix(in srgb,var(--surface) 50%,transparent);border-color:color-mix(in srgb,var(--ink) 50%,transparent);
  box-shadow:6px 6px 0 color-mix(in srgb,var(--ink) 50%,transparent)}
.card.card-dim > :not(.row){opacity:.5}
.overlay .card{position:relative;z-index:1}
.card.card-jiggle{animation:card-jiggle .32s cubic-bezier(.3,.6,.4,1)}
@keyframes card-jiggle{
  0%{transform:none}
  12%{transform:translateY(-6px) rotate(-3.2deg) scale(1.02)}
  28%{transform:translateY(1px) rotate(2.6deg)}
  44%{transform:translateY(-2px) rotate(-1.8deg)}
  60%{transform:rotate(1.1deg)}
  76%{transform:rotate(-.5deg)}
  100%{transform:none}}
.zoom-layer{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:10px;z-index:0}
.zoom-layer .cat-walker{z-index:auto}
.cell.zoomed svg:not(.x){opacity:0;transition:opacity .12s}
/* awake: ears perk up, eyes wide */
.cw .eye-w{display:none}
.cw.zoomy .eye-w{display:inline}.cw.zoomy .eye-c{display:none}
.cw.zoomy .tail{animation:cw-tail .18s ease-in-out infinite alternate}
.cw.running .leg{animation:cw-run .16s linear infinite}
.cw.running .leg.lh,.cw.running .leg.rf{animation-delay:-.08s}
.cw.running .sway{animation:cw-sway .08s ease-in-out infinite alternate}
@keyframes cw-run{0%,100%{transform:rotate(42deg)}50%{transform:rotate(-42deg)}}
.zoom-dust{position:absolute;width:9px;height:9px;margin:-7px 0 0 -4.5px;border-radius:50%;pointer-events:none;box-shadow:0 0 0 1.5px rgba(43,47,69,.25);
  background:color-mix(in srgb,var(--surface) 80%,var(--muted));opacity:.85;animation:zoom-dust .42s ease-out forwards}
@keyframes zoom-dust{to{transform:translate(var(--dx),-6px) scale(2.2);opacity:0}}
@media (prefers-reduced-motion:reduce){.card,.card > *{transition:none}.card.card-jiggle{animation:none}.zoom-layer{display:none}.cell.zoomed svg:not(.x){opacity:1}}
