/* SITE-MOTION-01: one shared gaming-style motion system for every public page (presentation only, local preview).
   Vocabulary (same family as the approved homepage HOME-MOTION-01):
     sm-soft   bars/headers: short fade down          sm-up     headings: rise and settle
     sm-light  articles/info headings: lighter rise   sm-fade   intro paragraphs + decorative frames: opacity only
     sm-settle game artwork: drop, overshoot, settle  sm-lift   Home/Games cards: lift-and-settle
     sm-card   article cards: lighter lift            sm-shine  one glass-edge sweep along a card rim
   Rules: everything plays once; no loops; transform-free keyframes (individual translate/scale/rotate) so existing
   transforms and hover effects still compose; nothing blocks pointer, focus or scroll. Every rule sits inside the
   motion+scripting media query, so with reduced motion or JavaScript off nothing is ever hidden or moved.
   Held-for-scroll classes (sm-wait / sm-in) are only ever added by site-motion.mjs, and only below the fold.
   Never targeted: game boards, controls, timers, dialogs, gameplay feedback, the age gate, consent UI, navigation links. */
@media (prefers-reduced-motion:no-preference) and (scripting:enabled){
  :root{--sm-out:cubic-bezier(.2,.8,.2,1);--sm-spring:cubic-bezier(.2,1.2,.35,1);--sm-pop:cubic-bezier(.2,1.25,.35,1)}

  /* ---------- Games hub (/games/): same sequence as the homepage hero ---------- */
  body:has(.hub-intro)>header{animation:sm-soft 420ms ease-out both}
  .hub-intro>.eyebrow{animation:sm-up 420ms var(--sm-out) 40ms both}
  .hub-intro>#hero-title{animation:sm-up 520ms var(--sm-out) 90ms both}
  .hub-intro>.hero-intro{animation:sm-up 460ms var(--sm-out) 170ms both}
  /* Quick staggered card entrance (cards in view at load). Replaces the older 'arrive' fade on this page only. */
  body:not([data-home-quickplay]) #games>.card{animation:sm-lift 640ms var(--sm-spring) calc(var(--sm-i,0)*70ms + 160ms) both}

  /* ---------- Cards (Home + Games): one glass-edge shine per entrance; span injected by site-motion.mjs ---------- */
  #games>.card>.sm-shine,.ar-list>.ar-card>.sm-shine{position:absolute;z-index:4;inset:-1.5px;border-radius:inherit;padding:2.5px;pointer-events:none;opacity:0;
    background:linear-gradient(115deg,#FFFFFF00 35%,#FFFFFF 50%,#FFFFFF00 65%) no-repeat;background-size:260% 100%;background-position:160% 0;
    -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}
  body:not([data-home-quickplay]) #games>.card>.sm-shine{animation:sm-shine 1000ms ease-out calc(var(--sm-i,0)*70ms + 560ms) 1 both}
  /* Homepage: its catalogue entrance stays exactly as approved (home-quickplay.mjs); the shine follows its reveal. */
  body[data-home-quickplay] #games>.card>.sm-shine{animation:sm-shine 1000ms ease-out 420ms 1 both}
  body[data-home-quickplay] #games>.card.hm-wait>.sm-shine{animation:none}
  body[data-home-quickplay] #games>.card.hm-in>.sm-shine{animation:sm-shine 1000ms ease-out calc(var(--hm-d,0ms) + 380ms) 1 both}

  /* ---------- Articles + Credits (articles.css template): lighter version ---------- */
  .ar-header{animation:sm-soft 380ms ease-out both}
  main>.ar-intro:first-child>.ar-back,main>.ar-intro:first-child>.ar-eyebrow{animation:sm-light 400ms var(--sm-out) 40ms both}
  main>.ar-intro:first-child>h1{animation:sm-light 460ms var(--sm-out) 90ms both}
  main>.ar-intro:first-child>p:not(.ar-eyebrow){animation:sm-fade 420ms ease-out 170ms both}
  .ar-categories{animation:sm-light 420ms var(--sm-out) 200ms both}
  .ar-list>.ar-card{animation:sm-card 520ms var(--sm-spring) calc(var(--sm-i,0)*60ms + 220ms) both}
  .ar-list>.ar-card:has(>.sm-shine){position:relative}
  .ar-list>.ar-card>.sm-shine{background-image:linear-gradient(115deg,#E9B94900 35%,#E9B949C0 50%,#E9B94900 65%);animation:sm-shine 900ms ease-out calc(var(--sm-i,0)*60ms + 560ms) 1 both}
  /* Article detail: heading block only; the prose itself never moves. */
  .ar-reading>.ar-back{animation:sm-light 380ms var(--sm-out) 30ms both}
  .ar-reading>header>.ar-category{animation:sm-light 400ms var(--sm-out) 60ms both}
  .ar-reading>header>h1{animation:sm-light 480ms var(--sm-out) 100ms both}
  .ar-reading>header>.ar-lead,.ar-reading>header>.ar-meta{animation:sm-fade 420ms ease-out 180ms both}

  /* ---------- Help, legal, 404 (site.css template): lighter version ---------- */
  .ac-light>.ac-header{animation:sm-soft 380ms ease-out both}
  .ac-legal>.ac-back,.ac-legal>nav[aria-label="Breadcrumb"]{animation:sm-light 380ms var(--sm-out) 30ms both}
  .ac-legal>h1{animation:sm-light 480ms var(--sm-out) 80ms both}
  .ac-legal>.ac-updated{animation:sm-fade 420ms ease-out 160ms both}
  .ac-legal>nav[aria-label="On this page"]{animation:sm-light 460ms var(--sm-out) 200ms both}
  .ac-404>h1{animation:sm-up 520ms var(--sm-out) 60ms both}
  .ac-404>p:not(:last-child){animation:sm-fade 420ms ease-out 160ms both}
  .ac-404>p:last-child{animation:sm-light 460ms var(--sm-spring) 240ms both}

  /* ---------- Game pages: title, artwork and decorative frame only (plays when the game host is shown) ---------- */
  /* Word Connect + Color Puzzle headers (Word Predictor keeps its own existing header rise and logo-tile pop). */
  body:not([data-premium-game]) .game>.game-header>.eyebrow{animation:sm-up 420ms var(--sm-out) 60ms both}
  body:not([data-premium-game]) .game>.game-header>#game-title{animation:sm-up 520ms var(--sm-pop) 110ms both}
  body:not([data-premium-game]) .game>.game-header>.header-meta{animation:sm-fade 420ms ease-out 220ms both}
  /* Decorative frames (opacity only, so fixed/absolute layers never shift). */
  #amzc-age-game>.ambient,#amzc-age-game>.backdrop,#amzc-age-game>.cpg-ambient{animation:sm-fade 900ms ease-out both}
  /* Quiz: heading, card artwork, floating marks. */
  .quiz-app>.topbar{animation:sm-soft 380ms ease-out both}
  .quiz-app .intro>div>.eyebrow{animation:sm-up 420ms var(--sm-out) 50ms both}
  .quiz-app .intro>div>h1{animation:sm-up 520ms var(--sm-pop) 100ms both}
  .quiz-app .intro>div>.lead{animation:sm-fade 420ms ease-out 200ms both}
  .quiz-app .illustration .quiz-card-art{animation:sm-settle 720ms var(--sm-pop) 160ms both}
  .quiz-app .illustration>.float{animation:sm-pop 460ms var(--sm-pop) calc(420ms + var(--sm-f,0)*90ms) both}
  .quiz-app .illustration>.float.two{--sm-f:1}
  .quiz-app .illustration>.float.three{--sm-f:2}
  /* Spin Wheel: heading and the decorative frame around the wheel (halo, orbit, platform). The wheel, pointer and
     buttons are gameplay and are not touched. */
  main.sw>header{animation:sm-soft 380ms ease-out both}
  main.sw>.intro>*{animation:sm-up 460ms var(--sm-out) calc(var(--sm-k,0)*60ms + 50ms) both}
  main.sw>.intro>h1{--sm-k:1;animation-timing-function:var(--sm-pop)}
  main.sw>.intro>p:not(.eyebrow){--sm-k:2;animation-name:sm-fade}
  .wheel-card>.stage-label{animation:sm-up 420ms var(--sm-out) 160ms both}
  .wheel-wrap>.halo,.wheel-wrap>.orbit,.wheel-wrap>.platform{animation:sm-frame 760ms var(--sm-pop) 180ms both}
  .wheel-wrap>.platform{animation-delay:120ms}

  /* ---------- Scroll reveal (classes from site-motion.mjs, below-the-fold elements only) ---------- */
  .sm-wait{animation:none!important;opacity:0}
  .sm-wait>.sm-shine{animation:none!important}
  .sm-in{animation:sm-light 480ms var(--sm-out) var(--sm-d,0ms) both!important}
  #games>.card.sm-in{animation:sm-lift 680ms var(--sm-spring) var(--sm-d,0ms) both!important}
  #games>.card.sm-in>.sm-shine{animation:sm-shine 1000ms ease-out calc(var(--sm-d,0ms) + 380ms) 1 both!important}
  .ar-list>.ar-card.sm-in{animation:sm-card 520ms var(--sm-spring) var(--sm-d,0ms) both!important}
  .ar-list>.ar-card.sm-in>.sm-shine{animation:sm-shine 900ms ease-out calc(var(--sm-d,0ms) + 340ms) 1 both!important}
}
/* Stagger index for cards in view at load (CSS only, so it applies from the first paint). */
#games>.card:nth-child(2),.ar-list>.ar-card:nth-child(2){--sm-i:1}
#games>.card:nth-child(3),.ar-list>.ar-card:nth-child(3){--sm-i:2}
#games>.card:nth-child(4),.ar-list>.ar-card:nth-child(4){--sm-i:3}
#games>.card:nth-child(5),.ar-list>.ar-card:nth-child(5){--sm-i:4}
#games>.card:nth-child(n+6),.ar-list>.ar-card:nth-child(n+6){--sm-i:5}
@keyframes sm-soft{from{opacity:0;translate:0 -8px}to{opacity:1;translate:none}}
@keyframes sm-up{from{opacity:0;translate:0 18px}to{opacity:1;translate:none}}
@keyframes sm-light{from{opacity:0;translate:0 10px}to{opacity:1;translate:none}}
@keyframes sm-fade{from{opacity:0}to{opacity:1}}
@keyframes sm-settle{0%{opacity:0;translate:0 -18px;scale:1.07;rotate:-4deg}60%{opacity:1;translate:0 3px;scale:.98;rotate:1deg}100%{opacity:1;translate:none;scale:none;rotate:none}}
@keyframes sm-pop{0%{opacity:0;scale:.6}60%{opacity:1;scale:1.12}100%{opacity:1;scale:none}}
@keyframes sm-frame{0%{opacity:0;scale:.9}60%{opacity:1;scale:1.02}100%{opacity:1;scale:none}}
@keyframes sm-lift{0%{opacity:0;translate:0 30px;scale:.97;filter:brightness(1)}55%{opacity:1;translate:0 -6px;scale:1.01;filter:brightness(1.1)}100%{opacity:1;translate:none;scale:none;filter:brightness(1)}}
@keyframes sm-card{0%{opacity:0;translate:0 14px}60%{opacity:1;translate:0 -2px}100%{opacity:1;translate:none}}
@keyframes sm-shine{0%{opacity:0;background-position:160% 0}15%{opacity:1}100%{opacity:0;background-position:-60% 0}}
