/*
 * ============================================================
 * DMS CYBERTRAINING — SHARED MODULE PLAYER SYSTEM
 * One file for all module presentations.
 *
 * Per-module files keep only their scene-specific styles in a
 * local <style> block. Anything chrome/stage/typography/motion
 * lives here and upgrades every deck at once.
 *
 * DESIGN TOKENS      → :root custom properties
 * AMBIENT STAGE      → aurora wash, grain, grid, vignette
 * PLAYER CHROME      → top bar, nav, scrubber, sheet, toast
 * SLIDE BASE         → shared slide structure & transitions
 * SCENE TYPES        → .slide-section-break
 * SURFACES & KIT     → .tile, .glass, frame kit, .takeaway
 * SUBTITLES          → karaoke caption bar
 * ANIMATIONS         → all shared @keyframes
 * ACCESSIBILITY      → reduced motion, focus
 * ============================================================
 */

/* ── DESIGN TOKENS ───────────────────────────────────────── */
@property --part-color {
  syntax: '<color>';
  inherits: true;
  initial-value: #3b82f6;
}

:root {
  --slide-bg:          #0c1220;
  --slide-bg-alt:      #111827;
  --accent-blue:       #38bdf8;
  --accent-navy:       #1e3a5f;
  --accent-green:      #22c55e;
  --accent-red:        #ef4444;
  --accent-amber:      #f59e0b;
  --accent-purple:     #a855f7;
  --text-primary:      #f1f5f9;
  --text-muted:        #94a3b8;
  --text-strong:       #ffffff;
  --font:              'InterVariable', 'Inter', system-ui, sans-serif;
  --nav-height:        64px;
  --top-height:        52px;
  --caption-zone:      84px;
  --transition-slide:  0.45s;

  /* Part accent colors — one per section, desaturated toward brand */
  --part-1-color: #3b82f6;
  --part-2-color: #8b5cf6;
  --part-3-color: #d97706;
  --part-4-color: #16a34a;
  --part-5-color: #e11d48;
  --part-6-color: #0284c7;

  /* Motion */
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-inout:  cubic-bezier(.65, 0, .35, 1);

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;

  /* Surfaces — the one card recipe */
  --tile-grad:    linear-gradient(180deg, #233048 0%, #161e2e 100%);
  --tile-border:  rgba(255,255,255,.09);
  --tile-shadow:  inset 0 1px 0 rgba(255,255,255,.07), 0 16px 40px rgba(0,0,0,.4);
  --shadow-float: 0 24px 48px rgba(0,0,0,.5);

  /* Type scale */
  --text-xs:   .72rem;
  --text-sm:   .82rem;
  --text-md:   .95rem;
  --display-1: clamp(1.7rem, 3.2vw, 2.8rem);
  --display-2: clamp(2.6rem, 5vw, 4rem);
}

@font-face {
  font-family: 'InterVariable';
  src: url('/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/CaveatVariable.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--slide-bg); font-family: var(--font); color: var(--text-primary); }

/* ── AMBIENT STAGE ───────────────────────────────────────── */
#player { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#slide-stage {
  flex: 1; position: relative; overflow: hidden;
  transition: --part-color .8s ease;
  /* blueprint grid + vignette + base */
  background-image:
    radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.35)),
    linear-gradient(var(--slide-bg), var(--slide-bg));
  background-size: 28px 28px, 100% 100%, 100% 100%;
}
/* aurora washes — part-tinted, slow drift */
#slide-stage::before, #slide-stage::after {
  content: ''; position: absolute; pointer-events: none; z-index: 0;
  border-radius: 50%; filter: blur(60px);
}
#slide-stage::before {
  width: 56vw; height: 56vh; top: -14vh; right: 4vw;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--part-color) 14%, transparent), transparent 72%);
  animation: auroraDrift 16s ease-in-out infinite alternate;
}
#slide-stage::after {
  width: 44vw; height: 48vh; bottom: -10vh; left: -6vw;
  background: radial-gradient(closest-side, rgba(56,189,248,.07), transparent 70%);
  animation: auroraDrift 22s 3s ease-in-out infinite alternate-reverse;
}
/* film grain — kills banding, adds tactility */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .05; mix-blend-mode: overlay;
}

#slide-stage.anim-paused .slide * { animation-play-state: paused !important; }

/* ── PLAYER CHROME · TOP ─────────────────────────────────── */
#top-chrome {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--top-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.2rem;
  transition: opacity .3s var(--ease-out), translate .3s var(--ease-out);
}
#player-back {
  color: var(--text-muted); font-size: .82rem; text-decoration: none;
  background: rgba(255,255,255,.06); padding: .35rem .75rem;
  border-radius: 8px; transition: background .2s, color .2s;
  display: inline-flex; align-items: center; gap: .35rem;
}
#player-back:hover { background: rgba(255,255,255,.12); color: var(--text-primary); }
#dms-wordmark {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; pointer-events: none;
}
#dms-wordmark img { height: 24px; opacity: .92; display: block; }
#part-label {
  font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--part-color) 60%, #fff);
  background: color-mix(in oklab, var(--part-color) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--part-color) 28%, transparent);
  padding: .3rem .7rem; border-radius: 20px;
  transition: color .8s, background .8s, border-color .8s;
}
#part-label:empty { display: none; }

/* ── PLAYER CHROME · NAV ─────────────────────────────────── */
#player-nav {
  position: relative; z-index: 100;
  height: var(--nav-height); background: rgba(8,12,22,.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
  flex-shrink: 0;
  transition: opacity .3s var(--ease-out), translate .3s var(--ease-out);
}
#player-nav button {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: var(--text-primary); border-radius: 10px;
  height: 40px; min-width: 40px; font-size: .85rem; cursor: pointer;
  transition: background .15s; flex-shrink: 0; font-family: var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
#player-nav button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
#player-nav button:disabled { opacity: .3; cursor: default; }
#player-nav button svg { width: 18px; height: 18px; }
#btn-playpause { padding: 0 1rem; font-weight: 650; }
#btn-speed { font-variant-numeric: tabular-nums; font-weight: 600; padding: 0 .7rem; }

#nav-center { flex: 1; display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
#nav-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .74rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
#scene-counter { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#time-remaining { flex-shrink: 0; margin-left: 1rem; }

/* chaptered scrubber */
#progress-track {
  display: flex; gap: 3px; height: 14px; align-items: center;
  cursor: pointer; touch-action: none;
}
.chapter-seg {
  position: relative; height: 4px; border-radius: 3px; overflow: hidden;
  background: color-mix(in oklab, var(--seg-color, var(--accent-blue)) 22%, rgba(255,255,255,.06));
  transition: height .15s var(--ease-out);
}
#progress-track:hover .chapter-seg { height: 6px; }
.chapter-seg .seg-fill {
  position: absolute; inset: 0; transform-origin: left;
  background: var(--seg-color, var(--accent-blue));
  transform: scaleX(0); transition: transform .3s var(--ease-out);
  border-radius: 3px;
}
#scrub-tip {
  position: fixed; z-index: 130; bottom: calc(var(--nav-height) + 10px);
  background: rgba(15,23,42,.95); border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; padding: .35rem .7rem; font-size: .74rem;
  color: var(--text-primary); pointer-events: none; opacity: 0;
  transform: translateX(-50%); transition: opacity .15s;
  max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#scrub-tip.visible { opacity: 1; }

/* auto-hide while playing + idle */
body.chrome-hidden #top-chrome { opacity: 0; translate: 0 -8px; pointer-events: none; }
body.chrome-hidden #player-nav { opacity: 0; translate: 0 10px; pointer-events: none; }
body.chrome-hidden { cursor: none; }

/* Embedded demo mode (marketing-site snippets): drop the back-link header so a single
   role scene plays with its karaoke captions in a card; keep the play/caption controls. */
body.embed #top-chrome { display: none; }
/* Embed mode keeps the deck at its normal desktop layout (the iframe is given a fixed
   1280-wide viewport by the host page, which then scales the whole iframe to fit the
   card; see index.html). That keeps the deck above its mobile breakpoints so the scene
   composition never collapses at small card sizes. We only reclaim the hidden-chrome
   top padding so dense scenes get the vertical room they were authored for. */
body.embed { overflow: hidden; background: #0a1526; }
body.embed .slide { padding-top: 1.2rem; }

/* captions toggle */
body.captions-off #subtitle-bar { opacity: 0 !important; }
#btn-cc.cc-off { opacity: .45; }
#btn-cc.cc-off span { text-decoration: line-through; }

/* ── SCENES SHEET ────────────────────────────────────────── */
#scenes-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 120;
  background: rgba(13,19,33,.82);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-left: 1px solid rgba(255,255,255,.08);
  transform: translateX(calc(100% + 20px));
  transition: transform .45s var(--ease-out);
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(0,0,0,.45);
}
#scenes-sheet.open { transform: translateX(0); }
#scenes-sheet header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.07);
  font-weight: 700; font-size: .95rem;
}
#scenes-sheet header button {
  background: rgba(255,255,255,.07); border: none; color: var(--text-primary);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: .9rem;
}
#scenes-list { overflow-y: auto; padding: .75rem 0 1.5rem; flex: 1; }
.sheet-part {
  font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: color-mix(in oklab, var(--seg-color, var(--accent-blue)) 70%, #fff);
  padding: 1rem 1.25rem .45rem;
  display: flex; align-items: center; gap: .5rem;
}
.sheet-part::before { content: ''; width: 8px; height: 8px; border-radius: 3px; background: var(--seg-color, var(--accent-blue)); }
.sheet-scene {
  display: flex; gap: .75rem; align-items: baseline; width: 100%;
  padding: .5rem 1.25rem; border: none; background: none; text-align: left;
  color: var(--text-muted); font-size: .84rem; font-family: var(--font);
  cursor: pointer; transition: background .15s, color .15s; line-height: 1.4;
}
.sheet-scene:hover { background: rgba(255,255,255,.05); color: var(--text-primary); }
.sheet-scene.current { color: var(--text-strong); background: rgba(255,255,255,.07); }
.sheet-scene .ss-num { font-variant-numeric: tabular-nums; font-size: .72rem; opacity: .55; flex-shrink: 0; min-width: 1.4em; }
.sheet-scene.seen .ss-num { color: var(--accent-green); opacity: .9; }

/* ── TOAST / RESUME CHIP ─────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--nav-height) + 16px); left: 50%; z-index: 130;
  transform: translateX(-50%) translateY(8px);
  background: rgba(15,23,42,.95); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: .6rem 1rem; font-size: .82rem;
  display: flex; align-items: center; gap: .75rem;
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
#toast.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#toast button {
  background: var(--accent-blue); color: #04131f; border: none; border-radius: 8px;
  padding: .35rem .8rem; font-weight: 700; font-size: .78rem; cursor: pointer; font-family: var(--font);
}
#toast button.ghost { background: rgba(255,255,255,.08); color: var(--text-primary); font-weight: 500; }

/* ── SLIDE BASE ──────────────────────────────────────────── */
.slide {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--top-height) + 1rem) 3rem calc(var(--caption-zone) + .75rem);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition-slide) var(--ease-out);
  background: transparent;
}
.slide.active { opacity: 1; pointer-events: auto; }
/* directional transition choreography */
.slide.active .scene-visual { animation: stageRise .65s var(--ease-out) both; }
.slide.leaving { opacity: 0; transition: opacity .4s var(--ease-inout); }
.slide.leaving .scene-visual { animation: stageLeave .4s var(--ease-inout) both; }

.scene-eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--part-color) 75%, #cde8ff);
  margin-bottom: .6rem;
  opacity: 0;
}
.slide.active .scene-eyebrow { animation: fadeUp .55s .1s var(--ease-out) forwards; }

.scene-headline {
  font-size: var(--display-1); font-weight: 680;
  letter-spacing: -.025em;
  font-feature-settings: 'ss01', 'cv11';
  text-align: center; line-height: 1.18; max-width: 900px;
  text-wrap: balance;
  color: var(--text-strong); margin-bottom: .4rem;
  opacity: 0;
}
.slide.active .scene-headline { animation: headlineIn .7s .2s var(--ease-out) forwards; }

.scene-visual {
  width: 100%; max-width: 1100px; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
/* spotlight glow behind the focal visual */
.scene-visual::before {
  content: ''; position: absolute; z-index: -1;
  width: min(60%, 640px); height: 70%;
  left: 50%; top: 50%; translate: -50% -50%;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--part-color) 13%, transparent), transparent);
  filter: blur(40px);
  pointer-events: none;
}

/* takeaway — reserved slot for post-headline captions; can't collide with captions */
.takeaway {
  display: flex; align-items: center; gap: .75rem;
  font-size: .88rem; color: var(--text-muted); line-height: 1.55;
  border-left: 3px solid var(--part-color);
  background: color-mix(in oklab, var(--part-color) 7%, transparent);
  padding: .55rem 1rem; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  max-width: 760px; margin-top: .9rem;
  text-align: left; text-wrap: balance;
  opacity: 0;
}
.slide.active .takeaway { animation: fadeUp .55s var(--d, .5s) var(--ease-out) forwards; }
.takeaway strong, .takeaway .whi { color: var(--text-primary); }

/* ── SCENE TYPES ─────────────────────────────────────────── */

/* Section break slides — navy base, part color as light */
.slide-section-break {
  background:
    radial-gradient(120% 100% at 65% 0%, color-mix(in oklab, var(--part-color, var(--part-1-color)) 32%, #0c1220), #0c1220 78%);
  overflow: hidden;
}
.slide-section-break::before {
  /* ghost part numeral */
  content: attr(data-part);
  position: absolute; right: -2.5rem; bottom: -7rem;
  font-size: 26rem; font-weight: 800; letter-spacing: -.04em;
  color: rgba(255,255,255,.045); line-height: 1;
  pointer-events: none; user-select: none;
}
.slide-section-break::after {
  /* slow diagonal light sweep for the hold */
  content: ''; position: absolute; inset: -50%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.045) 50%, transparent 58%);
  animation: lightSweep 12s var(--ease-inout) infinite;
  pointer-events: none;
}
.section-inner { text-align: center; position: relative; z-index: 1; }
.section-part-num {
  font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.65); margin-bottom: 1rem;
  opacity: 0;
}
.slide.active .section-part-num { animation: fadeUp .55s .1s var(--ease-out) forwards; }
.section-title {
  font-size: var(--display-2); font-weight: 760; color: #fff;
  letter-spacing: -.03em; line-height: 1.1; margin-bottom: 1.2rem;
  text-wrap: balance;
  opacity: 0;
}
.slide.active .section-title { animation: headlineIn .8s .25s var(--ease-out) forwards; }
.section-line {
  width: 0; height: 3px; background: rgba(255,255,255,.45);
  margin: 0 auto 1.2rem; border-radius: 2px;
}
.slide.active .section-line { animation: expandWidth .6s .5s var(--ease-out) forwards; }
.section-sub {
  font-size: 1rem; color: rgba(255,255,255,.72); max-width: 520px; margin: 0 auto;
  text-wrap: balance;
  opacity: 0;
}
.slide.active .section-sub { animation: fadeUp .55s .65s var(--ease-out) forwards; }

/* ── SURFACES & KIT ──────────────────────────────────────── */

/* the one elevated card recipe */
.tile {
  background: var(--tile-grad);
  border: 1px solid var(--tile-border);
  box-shadow: var(--tile-shadow);
  border-radius: var(--r-md);
}
.tile-danger, .tile-safe, .tile-warn { position: relative; }
.tile-danger { border-left: 3px solid var(--accent-red);   box-shadow: var(--tile-shadow), 0 0 36px -14px rgba(239,68,68,.4); }
.tile-safe   { border-left: 3px solid var(--accent-green); box-shadow: var(--tile-shadow), 0 0 36px -14px rgba(34,197,94,.35); }
.tile-warn   { border-left: 3px solid var(--accent-amber); box-shadow: var(--tile-shadow), 0 0 36px -14px rgba(245,158,11,.35); }

/* glass — floating artifacts only (mocks, sheets); cap usage per scene */
.glass {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--shadow-float);
  border-radius: var(--r-md);
}

/* stat protagonist numbers */
.stat-hero {
  font-size: clamp(4rem, 9vw, 7rem); font-weight: 760;
  letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  text-shadow: 0 0 32px color-mix(in oklab, var(--part-color) 55%, transparent);
}

/* device frame kit */
.browser-frame {
  background: var(--tile-grad); border: 1px solid var(--tile-border);
  border-radius: var(--r-md); overflow: hidden; width: 100%;
  box-shadow: var(--shadow-float);
}
.browser-frame .bf-chrome {
  background: rgba(10,16,28,.85); padding: .55rem .8rem;
  display: flex; align-items: center; gap: .65rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.browser-frame .bf-dots { display: flex; gap: .35rem; flex-shrink: 0; }
.browser-frame .bf-dot { width: 10px; height: 10px; border-radius: 50%; }
.browser-frame .bf-dot.r { background: #f87171; } .browser-frame .bf-dot.y { background: #fbbf24; } .browser-frame .bf-dot.g { background: #34d399; }
.browser-frame .bf-url {
  flex: 1; min-width: 0; background: rgba(255,255,255,.06); border-radius: 7px;
  padding: .3rem .65rem; font-size: .74rem; color: var(--text-muted);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  display: flex; align-items: center; gap: .45rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.browser-frame .bf-url svg { width: 12px; height: 12px; flex-shrink: 0; }
.browser-frame .bf-body { padding: 1.1rem; }

.phone-frame {
  background: var(--tile-grad); border: 1px solid rgba(255,255,255,.14);
  border-radius: 26px; overflow: hidden; width: 100%; max-width: 300px;
  box-shadow: var(--shadow-float);
}
.phone-frame .pf-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .9rem .3rem; font-size: .66rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.phone-frame .pf-status svg { width: 13px; height: 13px; }
.phone-frame .pf-body { padding: .8rem .9rem 1rem; }
.msg-bubble {
  background: #243049; border-radius: 16px 16px 16px 5px;
  padding: .6rem .85rem; font-size: .8rem; line-height: 1.5; color: var(--text-primary);
  max-width: 92%;
}

.window-frame {
  background: var(--tile-grad); border: 1px solid var(--tile-border);
  border-radius: var(--r-md); overflow: hidden; width: 100%;
  box-shadow: var(--shadow-float);
}
.window-frame .wf-bar {
  background: rgba(10,16,28,.85); padding: .5rem .8rem;
  display: flex; align-items: center; gap: .6rem;
  font-size: .72rem; color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* perspective ease-in for hero mocks: .focusable starts tilted, .focused flattens */
.persp { perspective: 1200px; }
.persp .focusable {
  transform: rotateX(4deg) rotateY(-5deg);
  transition: transform .9s var(--ease-out);
}
.persp .focusable.focused, .slide.active .persp .focusable.auto-focus { transform: none; }

/* ── REVEAL UTILITIES ────────────────────────────────────── */
/* class="rv rv-up" style="--d:14.2s" — narration-synced reveals without inline animation strings */
.rv { opacity: 0; }
.slide.active .rv-up    { animation: fadeUp var(--dur, .65s) var(--d, 0s) var(--ease-out) both; }
.slide.active .rv-in    { animation: fadeIn var(--dur, .55s) var(--d, 0s) var(--ease-out) both; }
.slide.active .rv-scale { animation: popIn var(--dur, .6s) var(--d, 0s) var(--ease-spring) both; }
.slide.active .rv-left  { animation: riseLeft var(--dur, .65s) var(--d, 0s) var(--ease-out) both; }
.slide.active .rv-right { animation: riseRight var(--dur, .65s) var(--d, 0s) var(--ease-out) both; }
.slide.active .rv-draw  { animation: draw var(--dur, 1.2s) var(--d, 0s) var(--ease-out) both; }
svg .rv { opacity: 1; }
svg path.rv-draw, svg circle.rv-draw, svg line.rv-draw, svg polyline.rv-draw, svg rect.rv-draw {
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 1;
}

/* ambient loops — one hero element per scene stays alive */
.breathe   { animation: breathe 6s ease-in-out infinite; }
.glow-loop { animation: glowPulse 3.2s ease-in-out infinite; }
.dash-march { stroke-dasharray: 6 6; animation: dashMarch 1.6s linear infinite; }

/* ── MISC HELPERS ────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: .82rem; }
.text-danger { color: var(--accent-red); }
.text-success { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.label-pill { display: inline-block; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .6rem; border-radius: 20px; }
.label-pill.danger { background: rgba(239,68,68,.2); color: #f87171; }
.label-pill.success { background: rgba(34,197,94,.2); color: #4ade80; }
.label-pill.info { background: rgba(56,189,248,.15); color: var(--accent-blue); }
.icon-svg { display: inline-flex; align-items: center; justify-content: center; }
.icon-svg svg { width: 1em; height: 1em; stroke-width: 1.75; }

/* ── SCENE 1 HOOK — pause until Play pressed ─────────────── */
[data-scene="1"] .s1-anim { animation-play-state: paused !important; }
[data-scene="1"].s1-go .s1-anim { animation-play-state: running !important; }

/* ── SUBTITLE BAR ────────────────────────────────────────── */
#subtitle-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  height: var(--caption-zone);
  padding: 10px 48px 14px;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
  opacity: 0; transition: opacity .35s var(--ease-out);
}
#subtitle-bar.has-text { opacity: 1; }
#subtitle-bar::before {
  content: ''; position: absolute; inset: -28px 0 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(8,12,22,.92) 55%);
  z-index: -1;
}
#subtitle-text {
  font-size: .92rem; line-height: 1.6; text-align: center; max-width: 1080px;
  font-weight: 500; letter-spacing: .005em;
  color: var(--text-muted);
  text-wrap: balance;
}
#subtitle-text span { transition: color .15s linear, text-shadow .25s var(--ease-out); }
#subtitle-text .spoken { color: var(--text-primary); }
#subtitle-text .whi {
  color: var(--text-strong);
  text-shadow: 0 0 18px rgba(56,189,248,.5);
}

/* ── ANIMATIONS (shared) ─────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px) scale(.985); filter: blur(5px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes headlineIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(7px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes riseLeft {
  from { opacity: 0; transform: translateX(-28px); filter: blur(4px); }
  to   { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes riseRight {
  from { opacity: 0; transform: translateX(28px); filter: blur(4px); }
  to   { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes expandWidth { from { width: 0; } to { width: 120px; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes sway { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); } 50% { box-shadow: 0 0 0 10px rgba(245,158,11,0); } }
@keyframes typewrite { from { width: 0; } to { width: 100%; } }
@keyframes blinkCursor { 50% { border-color: transparent; } }
@keyframes shimmer { 0%,100% { background-position: -200% center; } 50% { background-position: 200% center; } }
@keyframes svgGlow { 0%,100% { filter: drop-shadow(0 0 3px rgba(245,158,11,.5)); } 50% { filter: drop-shadow(0 0 12px rgba(252,211,77,.9)); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes breathe { 50% { transform: scale(1.025); } }
@keyframes glowPulse { 0%,100% { filter: drop-shadow(0 0 4px color-mix(in oklab, var(--part-color) 45%, transparent)); } 50% { filter: drop-shadow(0 0 16px color-mix(in oklab, var(--part-color) 70%, transparent)); } }
@keyframes dashMarch { to { stroke-dashoffset: -12; } }
@keyframes auroraDrift { to { transform: translate(22px, -14px) rotate(3deg) scale(1.06); } }
@keyframes lightSweep { 0%, 55% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
@keyframes stageRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes stageLeave { to { opacity: 0; transform: translateY(-14px) scale(.99); } }
@keyframes countPop { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ── ACCESSIBILITY & RESPONSIVE ──────────────────────────── */
:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-height: 720px) {
  :root { --caption-zone: 72px; --top-height: 44px; }
  .scene-visual { max-height: 52vh; }
}
@media (max-width: 768px) {
  .slide { padding-left: 1.25rem; padding-right: 1.25rem; }
  .scene-headline { font-size: clamp(1.3rem, 5.5vw, 1.8rem); }
  #scene-counter { max-width: 40vw; }
}
