/* The Feel pass (owner, 2026-11-25: "make it feel very interactive - improve the feel / transitions to feel more like
   video - animations"; EdGames docs/social/PLAN.md "Feel: like a video, calm"). The same file in Math Cube and Word Cube
   (css/motion.css, loaded after game.css; keep them alike), in Math Racing's motion language (its css/motion.css), with
   src/feel.js (the end card's steps, the counts, the start card's arrivals).
     - cards and sheets fade in and rise; they lift and fade out (one continuous move, ~380 ms, eased; no blank frame:
       the card that leaves fades while the cube, or the next card, is already under it). Leaving, a card takes no touches.
     - the maze comes forward as the card in front of it leaves (#mazewrap.feel-go: a small settle in scale)
     - every button presses in under the finger at once (scale .96) and springs back
     - the end card plays in steps (.feel-seq, feel.js); a tap anywhere shows its end state; a new best's one soft glow
   Transform and opacity only (scale is a transform). Comfort: no roll, no shake, no flashing. Reduced motion (and
   html.calm) switches every one of these off: the end states show at once. */
:root{
  --feel-t:.38s;
  --feel-in:cubic-bezier(.2,.75,.25,1);        /* arriving: quick start, soft landing */
  --feel-out:cubic-bezier(.55,.085,.68,.53);   /* leaving: stays, then goes (a cross-fade keeps the scrim's strength even) */
  --feel-io:cubic-bezier(.45,0,.25,1);         /* a whole move, eased in and out */
}

/* ----- cards and sheets. display waits for the fade (allow-discrete; a transition outranks [hidden]'s !important) ----- */
.overlay{transition:opacity var(--feel-t) var(--feel-in), display var(--feel-t) allow-discrete}
.overlay[hidden]{opacity:0; pointer-events:none; transition-timing-function:var(--feel-out)}
.overlay[hidden] *{pointer-events:none}
@starting-style{ .overlay{opacity:0} }
.overlay > .card{animation:none; transition:transform var(--feel-t) var(--feel-io)}
.overlay[hidden] > .card{transform:translateY(-14px) scale(.985)}      /* lifts as it fades */
@starting-style{ .overlay > .card{transform:translateY(22px)} }       /* rises in */
.overlay > .card.sheet{transition-duration:.42s}
@starting-style{ .overlay > .card.sheet{transform:translateY(36px)} } /* a sheet slides up a little further */

/* one card for another (feel.js sets body.feel-swap): the scrim stays, the old card fades out quickly, the new one rises
   in just after it (two cards never show through each other) */
body.feel-swap .overlay[hidden]{background:transparent; transition-duration:.16s; transition-timing-function:linear}
body.feel-swap .overlay:not([hidden]){transition:none}
body.feel-swap .overlay:not([hidden]) > .card{animation:feel-card-in .36s var(--feel-in) .12s both}
@keyframes feel-card-in{from{opacity:0; transform:translateY(22px)}}

/* the maze comes forward as the card in front of it goes (feel.js) */
#mazewrap.feel-go{animation:feel-world .46s var(--feel-io) both}
@keyframes feel-world{from{scale:1.045}}

/* ----- buttons: in at once under the finger, back with a short spring (scale, which adds to a button's own press) ----- */
.overlay :is(button, summary, [role="button"]){transition:scale .18s cubic-bezier(.3,1.35,.5,1)}
.overlay :is(button, summary, [role="button"]):active{scale:.96; transition-duration:0s}

/* ----- the end card, in steps (feel.js sets --feel-d on each part) ----- */
.feel-seq .feel-step{animation:feel-rise .34s var(--feel-in) var(--feel-d, 0ms) both}
@keyframes feel-rise{from{opacity:0; transform:translateY(12px)}}
/* "New best": one soft glow that rises and settles (never a flash) */
.feel-best{position:relative}
.feel-best::after{content:""; position:absolute; inset:-6px -10px; border-radius:16px; pointer-events:none; opacity:0;
  box-shadow:0 0 0 3px rgba(255,200,61,.5), 0 0 22px 6px rgba(255,200,61,.4)}
.feel-seq .feel-best::after{animation:feel-glow 1.4s ease-in-out .25s both}
@keyframes feel-glow{40%{opacity:1} 100%{opacity:0}}
/* "+14" travels into the week's total, which counts up (feel.js travel) */
.feel-part{position:relative}
.feel-ghost{position:absolute; left:0; top:0; pointer-events:none; white-space:pre; will-change:transform, opacity}
.feel-n, .tally b{font-variant-numeric:tabular-nums}

/* ----- reduced motion (and html.calm): nothing above moves ----- */
html.calm :is(.overlay, .overlay > .card, .overlay :is(button, summary, [role="button"])){transition:none!important}
html.calm :is(#mazewrap.feel-go, body.feel-swap .overlay > .card, .feel-seq .feel-step, .feel-seq .feel-best::after){animation:none!important}
html.calm .overlay :is(button, summary, [role="button"]):active{scale:none}
html.calm .feel-ghost{display:none}
@media (prefers-reduced-motion: reduce){
  :is(.overlay, .overlay > .card, .overlay :is(button, summary, [role="button"])){transition:none!important}
  :is(#mazewrap.feel-go, body.feel-swap .overlay > .card, .feel-seq .feel-step, .feel-seq .feel-best::after){animation:none!important}
  .overlay :is(button, summary, [role="button"]):active{scale:none}
  .feel-ghost{display:none}
}
