/* Motion layer (2026-10-26), shared by every page.
   Everything here is behind html.m, which the inline head script sets only when the visitor hasn't asked for
   reduced motion. Without it the pages render exactly as before. Entrances use the individual `translate` and
   `scale` properties so they stack with the card tilt, which owns `transform`. */

:root{--m-ease:cubic-bezier(.16,1,.3,1);--m-out:cubic-bezier(.4,0,.2,1)}

/* Page transitions: a short fade and lift between pages, in browsers that support cross-document view
   transitions (Chrome, Edge, Safari 18+). The logo tile is its own layer, so it stays put while the page changes. */
@media (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto}
  ::view-transition-old(root){animation:m-page-out 220ms var(--m-out) both}
  ::view-transition-new(root){animation:m-page-in 520ms var(--m-ease) 60ms both}
  .os-top .brain{view-transition-name:brain}
  ::view-transition-group(brain){animation-duration:420ms;animation-timing-function:var(--m-ease)}
}
@keyframes m-page-out{to{opacity:0;transform:translateY(-10px)}}
@keyframes m-page-in{from{opacity:0;transform:translateY(14px)}}

/* Preview cards on the home and About stages: stacked in one cell so the outgoing card fades out while the
   next one fades in, instead of switching instantly. */
@media (min-width:1024px){
  html.m .stage-in .pv{display:grid;grid-area:1/1;opacity:0;visibility:hidden;translate:0 16px;scale:.97;
    transition:opacity 220ms var(--m-out),translate 220ms var(--m-out),scale 220ms var(--m-out),visibility 0s 220ms}
  html.m .stage-in .pv.on,
  html.m .stage-in:not(:has(.pv.on)) .pv.default{opacity:1;visibility:visible;translate:0 0;scale:1;
    transition:opacity 380ms var(--m-ease) 60ms,translate 560ms var(--m-ease) 60ms,scale 560ms var(--m-ease) 60ms,visibility 0s}
  /* The image settles a beat after the card. */
  html.m .stage-in .pv .pv-img{transition:clip-path 600ms var(--m-ease) 120ms;clip-path:inset(0 0 0 0)}
  html.m .stage-in .pv:not(.on):not(.default) .pv-img{clip-path:inset(8% 0 8% 0)}
}

/* Scroll reveals: content fades up as it enters the screen, and the steps of a list follow one after another.
   The hidden state is set here, not by script, so nothing flashes before motion.js runs; the list must match
   REVEAL in motion.js. */
html.m :is(.read > .ch > .ch-h,.read > .ch > .sheet,.read > .ends,.read > .coda,.sheet .log li,.sheet .stats .stat,.sheet .tldr-cols > div,.ix:not(.toc) li,.tl-r){
  transition:opacity 700ms var(--m-ease),translate 900ms var(--m-ease);transition-delay:calc(var(--i,0) * 70ms)}
html.m :is(.read > .ch > .ch-h,.read > .ch > .sheet,.read > .ends,.read > .coda,.sheet .log li,.sheet .stats .stat,.sheet .tldr-cols > div,.ix:not(.toc) li,.tl-r):not(.in){opacity:0;translate:0 28px}

/* Parallax: images and videos inside case-study figures drift a little slower than the page.
   The value is set per frame by motion.js; the ground's padding gives them room to move. */
html.m .px{translate:0 var(--py,0px);will-change:translate}
