/* ============================================================================
   Motion, after apple.com (studied 2026-11-21).
   What Apple does, and what this file copies:
   - Reveals fire late (when a block is ~30% up the screen), once, and never
     reverse. Fade + a short rise, slow ease-out, about a second.
   - Lines of a headline arrive one after another, ~120ms apart.
   - Nothing loops forever on text. A metal sheen passes once, then rests.
   - Media grows into place as it scrolls in, tied to the scroll, not a timer.
   - The hero gently recedes as you scroll away from it.
   - A key paragraph brightens word by word as you read down.
   - UI state changes are quick (0.24 to 0.32s) on cubic-bezier(.4,0,.6,1).
   - The nav is frosted glass: saturate(180%) blur(20px).
   - Everything stops for prefers-reduced-motion.
   ========================================================================= */
:root{
  --m-reveal:cubic-bezier(.25,.1,.25,1);
  --m-ui:cubic-bezier(.4,0,.6,1);
  --m-out:cubic-bezier(.16,1,.3,1);
}

/* page to page: a quiet cross-fade, the nav holds still */
@view-transition{navigation:auto}
::view-transition-old(root), ::view-transition-new(root){animation-duration:.42s; animation-timing-function:var(--m-ui)}
.nav{view-transition-name:sitenav}

/* reveals: later, slower, softer than before */
.rv{transform:translateY(28px); transition:opacity 1.1s var(--m-reveal), transform 1.1s var(--m-reveal); transition-delay:var(--d,0s)}
.rv.in{transform:none}

/* headline lines arrive in turn (motion.js wraps each line) */
.rv.m-lines{opacity:1; transform:none}
.m-line{display:block; opacity:0; transform:translateY(.42em);
  transition:opacity 1s var(--m-reveal), transform 1.1s var(--m-out);
  transition-delay:calc(var(--d,0s) + var(--i,0) * .12s)}
.rv.in .m-line{opacity:1; transform:none}

/* the metal sheen: one pass on arrival, then at rest */
html .big b, html h1.display b, html h2.head b{animation:none; background-position:-120% 0}
html .rv.in .big b, html .rv.in b, html .big.rv.in b, html h1.display.rv.in b, html h2.head.rv.in b, html .m-sheen-now b{
  animation:sheen-once 2.8s cubic-bezier(.45,.05,.25,1) both; animation-delay:calc(var(--d,0s) + .45s)}
@keyframes sheen-once{from{background-position:120% 0} to{background-position:-120% 0}}
.gleam{animation:none; background-position:-120% 0}
.rv.in .gleam, .m-sheen-now .gleam{animation:sheen-once 2.8s cubic-bezier(.45,.05,.25,1) .45s both}

/* media grows into place, tied to scroll (motion.js sets --ms) */
.m-grow{scale:var(--ms,1); transform-origin:50% 100%; will-change:scale}

/* the hero recedes as you leave it (motion.js sets --hp, 0..1) */
.m-hero{opacity:calc(1 - var(--hp,0) * .55); translate:0 calc(var(--hp,0) * 46px); scale:calc(1 - var(--hp,0) * .035); transform-origin:50% 0}

/* a paragraph that brightens as you read down */
.m-scrub .m-w{color:var(--faint); transition:color .5s var(--m-ui)}
.m-scrub .m-w.on{color:inherit}

/* frosted nav, as Apple's */
.nav{transition:background .32s var(--m-ui), border-color .32s var(--m-ui), backdrop-filter .32s var(--m-ui)}
.nav.stuck{background:rgba(246,241,230,.72); -webkit-backdrop-filter:saturate(180%) blur(20px); backdrop-filter:saturate(180%) blur(20px)}

/* buttons: a press you can feel, no bounce */
.btn, .navcta, .cta{transition:transform .24s var(--m-ui), filter .24s var(--m-ui), background .24s var(--m-ui)}
.btn:active, .navcta:active, .cta:active{transform:scale(.97)}

/* links: the underline draws in */
.navlinks a::after{content:""; position:absolute; left:0; right:0; bottom:0; height:1px; background:currentColor;
  transform:scaleX(0); transform-origin:left; transition:transform .32s var(--m-ui); opacity:.5}
.navlinks a:hover::after, .navlinks a.here::after{transform:scaleX(1)}
.navlinks a.navcta::after{display:none}

/* live dots breathe, they do not flash */
.pill.live .dot, .dot.live{animation-duration:3.2s}

@media (prefers-reduced-motion: reduce){
  ::view-transition-old(root), ::view-transition-new(root){animation:none}
  .rv, .m-line{opacity:1 !important; transform:none !important; transition:none !important}
  html .big b, .gleam, html .rv.in b{animation:none !important}
  .m-grow, .m-hero{scale:1; translate:none; opacity:1}
  .m-scrub .m-w{color:inherit}
}
