/* =====================================================================
   MOTION SYSTEM — shared by every page.
   All timing/easing lives here; tune once, applies site-wide.
   Paired with assets/motion.js. Every rule is gated on .mo-js so the
   site renders fully without JavaScript.
   ===================================================================== */

:root{
  --mo-ease:cubic-bezier(.22,.61,.36,1);   /* standard decelerate */
  --mo-spring:cubic-bezier(.22,1.2,.36,1); /* slight overshoot     */
  --mo-reveal:.62s;
}

/* ---------- SCROLL REVEAL ----------------------------------------------
   Both markup conventions in this repo are supported: .reveal (index.html)
   and [data-reveal] (project pages). --mo-delay is set by motion.js to
   cascade siblings inside a grid.                                       */
.mo-js .reveal,
.mo-js [data-reveal]{
  opacity:0;
  transform:translateY(18px);
  transition:opacity var(--mo-reveal) var(--mo-ease),
             transform var(--mo-reveal) var(--mo-ease);
  transition-delay:var(--mo-delay,0ms);
}
/* Directional entry. motion.js stamps data-slide from the card's column
   position, so a 3-up grid converges inward and a single column just rises.
   Lower specificity than the .in rule below, which always wins on arrival. */
.mo-js [data-slide="left"]{transform:translate3d(-30px,14px,0)}
.mo-js [data-slide="right"]{transform:translate3d(30px,14px,0)}
.mo-js [data-slide="up"]{transform:translate3d(0,22px,0)}

.mo-js .reveal.in,
.mo-js [data-reveal].in{opacity:1;transform:none}

/* ---------- HERO ENTRANCE ---------------------------------------------
   Above the fold, so it plays on load rather than on scroll. motion.js
   stamps .mo-step + an animation-delay onto each item in order.         */
.mo-js [data-hero] > :not(.shot) > *,
.mo-js [data-hero] > .shot{opacity:0}
.mo-js [data-hero] .mo-step{animation:mo-rise .72s var(--mo-ease) both}
@keyframes mo-rise{
  from{opacity:0;transform:translateY(22px)}
  to{opacity:1;transform:none}
}

/* ---------- STAT COUNTERS ---------------------------------------------
   Tabular figures keep digit width fixed while the number climbs, so
   nothing twitches. Matters most on the project pages, where values are
   set in Space Grotesk (proportional numerals by default).              */
[data-count] .v,
[data-count] .num,
[data-count] b,
[data-count].mo-counting,
.mo-counting{
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
}

/* ---------- HEADER: SCROLL STATE + PROGRESS ---------------------------
   Deliberately no height change — the header sits in flow, so resizing it
   mid-scroll would shove the page content. Depth only.                   */
.mo-js header{transition:box-shadow .28s ease,border-color .28s ease}
.mo-js header.mo-stuck{
  box-shadow:0 10px 30px -12px rgba(0,0,0,.55);
  border-bottom-color:var(--primary);
}
[data-theme="light"] .mo-js header.mo-stuck,
.mo-js[data-theme="light"] header.mo-stuck{
  box-shadow:0 10px 30px -14px rgba(31,26,15,.22);
}
.mo-progress{
  position:absolute;left:0;right:0;bottom:-1px;height:1.5px;
  background:linear-gradient(90deg,var(--primary),var(--primary-dark));
  transform:scaleX(0);transform-origin:0 50%;
  will-change:transform;pointer-events:none;
}

/* ---------- REDUCED MOTION -------------------------------------------
   One global kill switch, replacing the per-page rules this file
   supersedes. Everything renders in its final state, instantly.        */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .mo-js .reveal,
  .mo-js [data-reveal]{
    opacity:1!important;transform:none!important;transition:none!important;
  }
  .mo-js [data-hero] > :not(.shot) > *,
  .mo-js [data-hero] > .shot{opacity:1!important;animation:none!important}
  .mo-js header{transition:none}
  .mo-progress{display:none}
}
