/* sm-motion.css — StudentMenu's motion, v1.0: the glass theme's (sm-glass.css v1.4) companion for movement.
   One set of timings and curves for the student and society pages, the glass palette for glows, halos and
   skeleton shimmers, and the reduced-motion path. MOTION-REPORT.md lists every animation and what it became.

   Load it BEFORE the page's own <style>, so a page can still override a token:
     <link rel="stylesheet" href="/sm-motion.css">
   Scripts that inject their own CSS (sm-rewards.js, sm-claim.js, sm-tour.js…) read the same tokens with
   fallbacks — var(--m-base, 220ms) — so they move the same on pages that don't load this file.

   House rules
   · transform and opacity only, on anything large or frequent; colours may fade. Never width/height/top/left
     or box-shadow on big areas (a few-px progress fill is the one allowed exception, marked where it happens).
   · loops only on live things (you on the map, a live deal, something loading), slow, and never beside text
     you are reading. Decorative motion plays once and rests.
   · entrances ease out (--m-out), exits are quicker than entrances (--m-in), presses spring back (--m-spring).
   · glows come from the brand: purple for StudentMenu and PLUS+, orange for deals and OTW, green for savings;
     "you are here" stays map blue because it means you.
   · reduced motion: nothing travels and nothing loops; changes become short cross-fades or happen at once. */

:root {
  /* time */
  --m-fast: 140ms;      /* presses, hovers, small state flips */
  --m-base: 220ms;      /* fades, toasts, chips, tabs */
  --m-slow: 360ms;      /* sheets and drawers arriving */
  --m-slower: 640ms;    /* progress settling, a one-off glint */
  /* curves */
  --m-ease: cubic-bezier(.2, .8, .2, 1);      /* the house curve: quick to start, long soft settle */
  --m-out: cubic-bezier(.16, 1, .3, 1);       /* arriving */
  --m-in: cubic-bezier(.5, 0, .75, 0);        /* leaving */
  --m-in-out: cubic-bezier(.45, 0, .55, 1);   /* breathing, halos, shimmer */
  --m-spring: cubic-bezier(.34, 1.36, .64, 1);/* a press let go, a pop */
  /* distance: 0 under reduced motion, so the same keyframes become plain fades */
  --m-rise: 10px;       /* content arriving */
  --m-sheet: 28px;      /* a sheet arriving from below */
  --m-pop: .96;         /* a card or dialog arriving */
  --m-lift: -2px;       /* hover lift */
  --m-press: .97;       /* press-down scale */
  /* the palette, as r, g, b so any alpha can be used: rgba(var(--m-plus-rgb), .3) */
  --m-plus-rgb: 108, 63, 197;       /* #6C3FC5 StudentMenu and PLUS+ */
  --m-plus-hi-rgb: 157, 92, 255;    /* #9D5CFF the bright purple, for glows on smoked glass */
  --m-deal-rgb: 255, 138, 61;       /* #FF8A3D deals and OTW */
  --m-save-rgb: 47, 168, 106;       /* #2FA86A savings, done */
  --m-you-rgb: 59, 130, 246;        /* #3B82F6 you, on the map */
  /* skeletons: frosted plate with light passing over it */
  --m-skel: rgba(108, 63, 197, .07);
  --m-skel-light: rgba(255, 255, 255, .72);
  --m-shimmer-time: 1.6s;
}
body.dark, html.dark body, body[data-theme="dark"] {
  --m-skel: rgba(157, 92, 255, .12);
  --m-skel-light: rgba(203, 183, 242, .16);
}

/* ── the keyframes every page shares (prefixed m- so nothing collides with a page's own) ────────────────── */
@keyframes m-spin { to { transform: rotate(1turn); } }
/* a live dot's halo: a ring that grows and fades (transform + opacity on a pseudo-element, not box-shadow) */
@keyframes m-halo { 0% { transform: scale(.55); opacity: .6; } 75%, 100% { transform: scale(2.1); opacity: 0; } }
/* a live indicator breathing, slowly */
@keyframes m-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .42; } }
/* the light passing over a skeleton */
@keyframes m-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
/* a single glint across a card (glass catching the light) — run it on --m-in-out so the light is seen crossing */
@keyframes m-glint { from { transform: translateX(-130%) skewX(-18deg); } to { transform: translateX(330%) skewX(-18deg); } }
/* arrivals; the distances are tokens, so reduced motion turns them into fades */
/* (translate and scale are the individual properties, so they add to an element's own transform — a centred
   pill keeps its translateX(-50%) while it rises) */
@keyframes m-rise { from { opacity: 0; translate: 0 var(--m-rise, 10px); } }
@keyframes m-sheet-in { from { opacity: 0; translate: 0 var(--m-sheet, 28px); } }
@keyframes m-pop-in { from { opacity: 0; scale: var(--m-pop, .96); } }
@keyframes m-fade-in { from { opacity: 0; } }
/* a soft glow that comes and goes (animate the glow layer's opacity, never the box-shadow itself) */
@keyframes m-glow { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* ── shared pieces ─────────────────────────────────────────────────────────────────────────────────────── */
/* a skeleton block: <div class="m-skel"></div> (pages with their own skeleton class use the same recipe) */
.m-skel { position: relative; overflow: hidden; background: var(--m-skel); border-radius: 14px; }
.m-skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); pointer-events: none;
  background: linear-gradient(100deg, transparent 18%, var(--m-skel-light) 50%, transparent 82%);
  animation: m-shimmer var(--m-shimmer-time) var(--m-in-out) infinite; }

/* ── reduced motion ────────────────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  :root { --m-rise: 0px; --m-sheet: 0px; --m-pop: 1; --m-lift: 0px; --m-press: 1; }
  html { scroll-behavior: auto !important; }
  .m-skel::after { animation: none; opacity: 0; }
}
