/* ==== Motion, shared layer (loop/tools/combined/motion/core.py) ====
   One set of motion tokens for the whole site. Values from Emil Kowalski's animate skill tables;
   ambient values are ours (slow on purpose, see the motion brief). Every duration is divided by
   --motion-speed, which the review switch ?speed=0.25 sets, so timing can be judged slowed down. */
:root{
  --motion-speed:1;
  --ease-out:cubic-bezier(0.23,1,0.32,1);
  --ease-in-out:cubic-bezier(0.77,0,0.175,1);
  --ease-drawer:cubic-bezier(0.32,0.72,0,1);
  --dur-press:calc(140ms / var(--motion-speed));
  --dur-hover:calc(180ms / var(--motion-speed));
  --dur-tab:calc(220ms / var(--motion-speed));
  --dur-enter:calc(600ms / var(--motion-speed));     /* a block arriving as it scrolls in: explanatory, so longer than UI */
  --dur-tell:calc(1400ms / var(--motion-speed));     /* a diagram telling its story once */
  --dur-ambient:calc(7s / var(--motion-speed));      /* one ambient cycle: a pigeon's idle, a line's pulse */
  --enter-distance:14px;
  --pixel:2px;                                        /* pixel art moves in whole pixels of its own grid */
}

/* On only when motion.js has run and motion is allowed: it sets html.m-on unless the visitor asks for
   reduced motion or the address says ?motion=off. Every motion rule on the site starts with html.m-on,
   so with motion off, or without JS, the page is the locked page, pixel for pixel. */

/* Ambient loops pause off screen and in a hidden tab. */
html.m-on .m-offscreen, html.m-on .m-offscreen *, html.m-on .m-offscreen::before, html.m-on .m-offscreen::after,
html.m-on.m-hidden [data-m-ambient], html.m-on.m-hidden [data-m-ambient] *,
html.m-on.m-hidden [data-m-ambient]::before, html.m-on.m-hidden [data-m-ambient]::after{animation-play-state:paused !important}

/* Entrance: a block arrives once as it scrolls into view. Hidden only once JS has run (html.m-on),
   so without JS nothing stays invisible. */
html.m-on [data-m-enter]:not(.m-in){opacity:0;transform:translateY(var(--enter-distance))}
html.m-on [data-m-enter]{transition:opacity var(--dur-enter) var(--ease-out),transform var(--dur-enter) var(--ease-out);
  transition-delay:calc(var(--m-delay,0ms) / var(--motion-speed))}

/* A hint that something can be played with: one small twitch the first time it scrolls into view. */
@keyframes m-hint{0%,100%{transform:translateY(0)}30%{transform:translateY(calc(-1 * var(--pixel)))}60%{transform:translateY(0)}}
html.m-on .m-hinting{animation:m-hint calc(420ms / var(--motion-speed)) steps(3,end) 1}

/* ---- The review panel (review builds only; ?clean hides it) ---- */
.m-panel{position:fixed;left:12px;bottom:12px;z-index:2000;background:var(--color-paper,#F8F5F0);color:var(--color-ink,#0b1d47);
  box-shadow:inset 0 0 0 1px var(--color-blue,#2b3fe0),4px 4px 0 rgba(43,63,224,.18);font:500 11px/1.3 ui-monospace,Menlo,monospace;
  letter-spacing:.04em;text-transform:uppercase;max-width:min(360px,calc(100vw - 24px))}
.m-panel summary{list-style:none;cursor:pointer;padding:8px 12px;display:flex;gap:8px;align-items:center}
.m-panel summary::-webkit-details-marker{display:none}
.m-panel summary::before{content:"";width:8px;height:8px;background:var(--color-blue,#2b3fe0)}
.m-panel[open] summary{border-bottom:1px solid var(--color-blue,#2b3fe0)}
.m-panel .m-rows{padding:8px 12px 10px;display:grid;gap:8px;max-height:60vh;overflow:auto}
.m-panel .m-row{display:grid;gap:4px}
.m-panel .m-row b{font-weight:600;opacity:.7}
.m-panel .m-opts{display:flex;flex-wrap:wrap;gap:4px}
.m-panel button{font:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer;padding:4px 7px;border:0;
  background:transparent;color:inherit;box-shadow:inset 0 0 0 1px currentColor}
.m-panel button[aria-pressed="true"]{background:var(--color-blue,#2b3fe0);color:var(--color-paper,#F8F5F0);box-shadow:none}
.m-panel .m-note{text-transform:none;letter-spacing:0;opacity:.7;font-size:11px}
@media (max-width:700px){.m-panel{left:8px;bottom:8px}}
