/* Ikigai Traveler — screen "appear" animations
   Entrance motion that re-runs every time `.is-active` is added (each navigation
   and re-entry). Router is untouched. We animate a screen's *content layers*, never
   the positioned container's opacity, so base.css's "reliable paint" opacity-snap
   guard stays intact. Reduced-motion is handled globally in motion.css
   (`*{animation:none!important}` with !important, so it wins regardless of order). */

@keyframes scr-rise  { from { opacity:0; transform:translateY(12px) } to { opacity:1; transform:none } }
@keyframes scr-fade  { from { opacity:0 }                            to { opacity:1 } }
@keyframes scr-sheet { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:none } }

/* ---- A. Push-in (default) — standard appbar screens -------------------------
   The appbar cross-fades; the body's flow sections rise + fade in *sequence* so
   a dense screen reads as alive rather than one moving block. Router tags each
   animatable child with `data-si` + a `--si` index (skipping absolutely-
   positioned art layers, which stay put). A sibling dock trails at the end. */
.screen:not(.fullbleed):not(.sheet-screen).is-active > .appbar { animation: scr-fade .26s var(--ease) both }
.screen:not(.fullbleed):not(.sheet-screen).is-active > .screen-body [data-si]{
  animation: scr-rise .46s var(--ease) both;
  animation-delay: calc(min(var(--si,0), 8) * .045s);
}
.screen:not(.sheet-screen).is-active > .dock { animation: scr-rise .40s var(--ease) .06s both }

/* ---- B. Immersive — fullbleed scenes ---------------------------------------
   Fade + rise only the plain content layers (top nav + bottom body/dock/foot).
   Backgrounds, scrims and self-animating effect layers (reticle, scanbox, rain,
   radar, stars, sun, video, halftone) are deliberately left untouched — the
   container's opacity snap already paints them, and setting `animation:` on them
   would override their own keyframes. */
.screen.fullbleed.is-active > .cam-nav        { animation: scr-fade .30s var(--ease) both }
.screen.fullbleed.is-active > [class*="-body"],
.screen.fullbleed.is-active > [class*="-foot"],
.screen.fullbleed.is-active > [class*="-dock"],
.screen.fullbleed.is-active > .cam-bottom,
.screen.fullbleed.is-active > .cam-hint,
.screen.fullbleed.is-active > .save-sheet,
.screen.fullbleed.is-active > .reco-card,
.screen.fullbleed.is-active > .match-finding,
.screen.fullbleed.is-active > .sm-player,
.screen.fullbleed.is-active > .jd-cover       { animation: scr-rise .42s var(--ease) both }

/* Immersive "-body" panels whose inner content the router marked `.stag`:
   animate the children (eyebrow → title → text → button), not the panel block. */
.screen.fullbleed.is-active > [class*="-body"].stag { animation: none }
.screen.fullbleed.is-active > .stag [data-si]{
  animation: scr-rise .46s var(--ease) both;
  animation-delay: calc(min(var(--si,0), 6) * .05s);
}

/* RL0 Reels: immersive video feed — fade the overlay bar only, no rise, so the
   first video never jumps (autoplay in initReelAutoplay is unaffected). */
.screen.is-active > .rl-topbar { animation: scr-fade .30s var(--ease) both }

/* S0 splash keeps its own brand intro — do not double-animate (its children carry
   no class matched above, so nothing here touches it). */

/* ---- C. Sheet slide-up — modal sheet screens (L4, M4) ----------------------
   Grabber + appbar + body rise together from +16px as one panel. */
.screen.sheet-screen.is-active > .grabber,
.screen.sheet-screen.is-active > .appbar,
.screen.sheet-screen.is-active > .screen-body { animation: scr-sheet .40s var(--ease) both }

/* ---- Phase 2. Directional push (iOS forward / back) ------------------------
   Router sets #app[data-nav="fwd"|"back"]. Standard push-in screens (archetype A)
   swap their vertical rise for a horizontal slide by direction — forward enters
   from the right, back from the left. Immersive + sheet stay direction-agnostic
   (they keep their Phase 1 motion). Only `animation-name` is overridden; the
   duration / easing / delay / fill from the Phase 1 shorthand still apply.
   The container's own translateX slide is neutralised so the content layers
   carry the motion cleanly (opacity still snaps on the container per base.css). */
#app[data-nav] .screen.is-active { transition:none; transform:none }

@keyframes scr-fwd  { from { opacity:0; transform:translateX(22px) }  to { opacity:1; transform:none } }
@keyframes scr-back { from { opacity:0; transform:translateX(-22px) } to { opacity:1; transform:none } }

#app[data-nav="fwd"]  .screen:not(.fullbleed):not(.sheet-screen).is-active > .screen-body [data-si],
#app[data-nav="fwd"]  .screen:not(.sheet-screen).is-active > .dock { animation-name: scr-fwd }
#app[data-nav="back"] .screen:not(.fullbleed):not(.sheet-screen).is-active > .screen-body [data-si],
#app[data-nav="back"] .screen:not(.sheet-screen).is-active > .dock { animation-name: scr-back }

/* The staggered directional keyframes keep the same vertical settle at the end;
   the horizontal offset only affects the entry, so a cascade of sections reads
   as an iOS push while still arriving in sequence. */

/* ---- Tap feedback: subtle press-scale on interactive primitives ------------
   Gives the prototype a responsive, physical feel on touch/click. Matches the
   house style (several custom cards already use `:active{transform:scale(.99)}`);
   those more-specific rules still win. Only primitives lacking feedback get it. */
.btn, .chip, .seg, .glass-btn, .qa-round, .tile,
.ab-round, .ab-chevron, .ab-textbtn, .row-tap, .tab {
  /* include background so segmented / row-tap keep their existing colour fade
     (a `transition` shorthand replaces rather than merges) */
  transition: transform .14s var(--ease), background-color .15s var(--ease);
}
.btn:active, .glass-btn:active, .qa-round:active, .tile:active,
.ab-round:active, .ab-chevron:active, .ab-textbtn:active { transform: scale(.95) }
.chip:active, .seg:active { transform: scale(.94) }
.row-tap:active, .tab:active { transform: scale(.98) }
