/* ==========================================================================
   THE VERTICAL LINE — Intelligence Explosion Presentation
   High-Contrast Editorial Physics & Cinema Design System
   ========================================================================== */

:root {
  /* Base Void & Surface */
  --bg-void: #040508;
  --bg-carbon: #0a0c12;
  --bg-glass: rgba(10, 13, 20, 0.66);
  --bg-glass-strong: rgba(10, 13, 20, 0.86);
  --border-hairline: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.22);

  /* Ink */
  --ink-primary: #f4f1ea;
  --ink-secondary: rgba(244, 241, 234, 0.72);
  --ink-muted: rgba(244, 241, 234, 0.44);

  /* Dynamic Act Accent Palette (Act I default: Warm Amber / Solar Copper) */
  --accent: #ff9d3b;
  --accent-2: #ff5722;
  --accent-3: #38e8ff;
  --accent-glow: rgba(255, 157, 59, 0.28);
  --accent-soft: rgba(255, 157, 59, 0.12);
  --danger: #ff3355;
  --emerald: #2ee6a6;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Motion */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-cinematic: cubic-bezier(0.65, 0, 0.15, 1);
  --ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Layout Safe Areas */
  --hud-top: 64px;
  --hud-bottom: 66px;
  --pad-x: clamp(28px, 4.8vw, 76px);
}

/* Dynamic Per-Act Atmospheric Palettes */
body[data-act="1"] {
  --accent: #ff9d3b;
  --accent-2: #ff5722;
  --accent-3: #ffe0a3;
  --accent-glow: rgba(255, 157, 59, 0.28);
  --accent-soft: rgba(255, 157, 59, 0.12);
}

body[data-act="2"] {
  --accent: #38e8ff;
  --accent-2: #ff6b2b;
  --accent-3: #ffffff;
  --accent-glow: rgba(56, 232, 255, 0.28);
  --accent-soft: rgba(56, 232, 255, 0.11);
}

body[data-act="3"] {
  --accent: #2ee6a6;
  --accent-2: #ffd166;
  --accent-3: #38e8ff;
  --accent-glow: rgba(46, 230, 166, 0.26);
  --accent-soft: rgba(46, 230, 166, 0.11);
}

body[data-act="4"] {
  --accent: #f4f1ea;
  --accent-2: #ff3355;
  --accent-3: #ffb347;
  --accent-glow: rgba(244, 241, 234, 0.24);
  --accent-soft: rgba(244, 241, 234, 0.10);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-void);
  color: var(--ink-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}

button, input, .progress-seg, .div-card, .overview-card {
  touch-action: manipulation;
}

/* Subtle Ambient Vignette & Film Grain */
#ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, var(--accent-soft), transparent 65%),
    radial-gradient(ellipse 65% 55% at 85% 15%, rgba(56, 232, 255, 0.045), transparent 60%),
    radial-gradient(circle at 50% 50%, #070910 0%, #030407 100%);
  transition: background 1.2s var(--ease-expo);
}

#film-grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Transition Shockwave / Warp Canvas Overlay */
#transition-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 80;
  pointer-events: none;
}

/* Custom Subtle Cursor Reticle */
#cursor-glow {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
  opacity: 0.55;
  transition: opacity 0.4s ease, width 0.3s ease, height 0.3s ease;
  mix-blend-mode: screen;
}

/* ==========================================================================
   HUD CHROME (TOP & BOTTOM)
   ========================================================================== */
.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-top);
  padding: 0 var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(4, 5, 8, 0.78), transparent);
}

.hud-top > * {
  pointer-events: auto;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.65; }
}

.hud-act-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: rgba(10, 13, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.6s ease, border-color 0.6s ease;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  appearance: none;
  background: rgba(12, 16, 24, 0.58);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.22s var(--ease-snap);
}

.hud-btn:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.hud-btn.active {
  color: #040508;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.hud-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Bottom Navigation Bar */
.hud-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--hud-bottom);
  padding: 0 var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  z-index: 60;
  background: linear-gradient(to top, rgba(4, 5, 8, 0.85), transparent);
}

.slide-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 78px;
}

.slide-counter .current {
  color: var(--ink-primary);
  font-weight: 600;
}

.progress-track {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
}

.progress-seg {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  transition: height 0.25s var(--ease-snap), background 0.35s ease;
}

.progress-seg:hover {
  height: 6px;
  background: rgba(255, 255, 255, 0.36);
}

.progress-seg.passed {
  background: rgba(255, 255, 255, 0.36);
}

.progress-seg.active {
  height: 5px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.progress-seg::after {
  content: attr(data-label);
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-hairline);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.progress-seg:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.nav-arrows {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: rgba(12, 16, 24, 0.6);
  color: var(--ink-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.22s var(--ease-snap);
}

.nav-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: scale(1.06);
}

.nav-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Autoplay ring indicator */
.autoplay-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  z-index: 95;
  box-shadow: 0 0 10px var(--accent);
  pointer-events: none;
}

/* ==========================================================================
   SLIDE STAGE & TRANSITIONS
   ========================================================================== */
#deck {
  position: fixed;
  inset: 0;
  z-index: 10;
  perspective: 1400px;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  padding: calc(var(--hud-top) + 12px) var(--pad-x) calc(var(--hud-bottom) + 12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.965) translateY(24px);
  filter: blur(8px);
  transition:
    opacity 0.72s var(--ease-expo),
    transform 0.85s var(--ease-expo),
    filter 0.72s var(--ease-expo),
    visibility 0s linear 0.72s;
  will-change: transform, opacity, filter;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1) translateY(0);
  filter: blur(0px);
  transition:
    opacity 0.78s var(--ease-expo) 0.08s,
    transform 0.92s var(--ease-expo) 0.04s,
    filter 0.78s var(--ease-expo) 0.06s,
    visibility 0s linear 0s;
  z-index: 20;
}

.slide.exit-forward {
  opacity: 0;
  transform: scale(1.06) translateY(-18px);
  filter: blur(10px);
  z-index: 15;
}

.slide.exit-backward {
  opacity: 0;
  transform: scale(0.92) translateY(28px);
  filter: blur(10px);
  z-index: 15;
}

/* Full-Bleed Slide Canvas */
.slide-canvas-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
}

.slide-content {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
}

.slide-content * {
  pointer-events: auto;
}

/* Staggered Reveal Elements */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.78s var(--ease-expo), transform 0.88s var(--ease-expo);
  transition-delay: calc(var(--d, 0) * 95ms + 120ms);
}

.slide.active .reveal {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   TYPOGRAPHY & EDITORIAL COMPONENTS
   ========================================================================== */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: clamp(10px, 0.78vw, 12px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

.display-hero {
  font-family: var(--font-display);
  font-size: clamp(46px, 7.6vw, 122px);
  font-weight: 700;
  line-height: 0.93;
  letter-spacing: -0.04em;
  color: var(--ink-primary);
}

.display-xl {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 66px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink-primary);
}

.display-lg {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.1vw, 48px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.serif-italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.lead {
  font-size: clamp(15px, 1.25vw, 19px);
  line-height: 1.56;
  color: var(--ink-secondary);
  max-width: 56ch;
}

.mono-stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.highlight {
  color: var(--accent);
}

.highlight-2 {
  color: var(--accent-2);
}

.highlight-danger {
  color: var(--danger);
}

/* Glass Panels & Telemetry Cards */
.glass-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat-card {
  background: rgba(12, 16, 25, 0.62);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 16px 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.3s ease, transform 0.3s var(--ease-snap);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.3vw, 34px);
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 5px;
  line-height: 1.4;
}

/* ==========================================================================
   SPLIT & GRID LAYOUTS FOR SLIDES
   ========================================================================== */
.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(380px, 1.25fr);
  gap: clamp(24px, 3.6vw, 56px);
  align-items: center;
  height: 100%;
  max-height: 78vh;
}

.split-layout.reverse {
  grid-template-columns: minmax(380px, 1.25fr) minmax(320px, 0.92fr);
}

.viz-frame {
  position: relative;
  width: 100%;
  height: clamp(380px, 58vh, 610px);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  background: rgba(5, 7, 12, 0.72);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.viz-frame canvas,
.stage-viz-wide canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.viz-overlay-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 4;
}

.viz-overlay-top > * {
  pointer-events: auto;
}

.viz-overlay-bottom {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 4;
}

.viz-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 5px;
  background: rgba(4, 5, 8, 0.75);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  backdrop-filter: blur(8px);
}

/* Interactive Controls Inside Slides */
.ctrl-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.ctrl-btn {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-primary);
  cursor: pointer;
  transition: all 0.22s var(--ease-snap);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 20px var(--accent-glow);
}

.ctrl-btn.primary,
.ctrl-btn.active {
  background: var(--accent);
  color: #040508;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 24px var(--accent-glow);
}

.ctrl-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.ctrl-slider-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.ctrl-slider-head span:last-child {
  color: var(--accent);
  font-weight: 600;
}

input[type="range"].cyber-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  cursor: pointer;
}

input[type="range"].cyber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #040508;
  box-shadow: 0 0 14px var(--accent);
  cursor: grab;
  transition: transform 0.15s ease;
}

input[type="range"].cyber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.22);
}

/* ==========================================================================
   SLIDE-SPECIFIC COMPOSITIONS
   ========================================================================== */

/* Slide 1: Hero Title */
.hero-center {
  text-align: center;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.hero-telemetry {
  display: flex;
  gap: 28px;
  margin-top: 28px;
  padding: 14px 26px;
  border-radius: 999px;
  background: rgba(6, 8, 14, 0.64);
  border: 1px solid var(--border-hairline);
  backdrop-filter: blur(14px);
}

.hero-telemetry-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-telemetry-item .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.hero-telemetry-item .v {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.enter-cue {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.28s var(--ease-snap);
}

.enter-cue:hover {
  border-color: var(--accent);
  color: var(--ink-primary);
  background: var(--accent-soft);
  box-shadow: 0 0 28px var(--accent-glow);
  transform: translateY(-2px);
}

/* Feature List (Clean Hairline Rows) */
.thesis-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.thesis-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: rgba(12, 16, 24, 0.45);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.thesis-row:hover {
  border-color: var(--border-strong);
  background: rgba(18, 24, 36, 0.65);
}

.thesis-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  padding-top: 2px;
}

.thesis-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink-primary);
  margin-bottom: 3px;
}

.thesis-desc {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

/* Stat Grid */
.stat-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stat-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

/* Full-Stage Stacked Layout (e.g. Slide 3, Slide 6, Slide 13) */
.stage-stack {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 80vh;
  gap: 18px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.stage-viz-wide {
  flex: 1;
  min-height: 300px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  background: rgba(5, 7, 12, 0.72);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.stage-viz-wide canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Slide 12: Divergence Quadrant Cards */
.divergence-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.div-card {
  padding: 15px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: rgba(12, 15, 22, 0.62);
  cursor: pointer;
  transition: all 0.25s var(--ease-snap);
}

.div-card:hover,
.div-card.active {
  border-color: var(--accent);
  background: rgba(20, 26, 38, 0.82);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.div-card .tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 5px;
}

.div-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
}

.div-card p {
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

/* Quote Callout */
.pull-quote {
  margin-top: 18px;
  padding: 14px 18px;
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  border-radius: 0 10px 10px 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 1.65vw, 24px);
  line-height: 1.35;
  color: var(--ink-primary);
}

/* ==========================================================================
   OVERLAYS: GRID OVERVIEW, SPEAKER NOTES, SHORTCUTS
   ========================================================================== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 4, 7, 0.92);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease-expo), visibility 0s linear 0.35s;
  display: flex;
  flex-direction: column;
  padding: 36px var(--pad-x);
  overflow-y: auto;
}

.overlay-backdrop.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s var(--ease-expo), visibility 0s linear 0s;
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.overview-card {
  position: relative;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: rgba(14, 18, 28, 0.78);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 138px;
  transition: all 0.25s var(--ease-snap);
  overflow: hidden;
}

.overview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
}

.overview-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-accent, var(--accent));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.overview-card.current {
  border-color: var(--card-accent, var(--accent));
  background: rgba(24, 30, 44, 0.92);
}

.overview-card .ov-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--card-accent, var(--accent));
  text-transform: uppercase;
}

.overview-card .ov-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.25;
}

.overview-card .ov-sub {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.4;
}

/* Speaker Notes Drawer */
#notes-drawer {
  position: fixed;
  right: var(--pad-x);
  bottom: calc(var(--hud-bottom) + 12px);
  width: min(460px, 90vw);
  max-height: 34vh;
  z-index: 85;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(8, 10, 16, 0.92);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease-expo);
  overflow-y: auto;
}

#notes-drawer.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.notes-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.notes-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.notes-body strong {
  color: var(--ink-primary);
}

/* Keyboard Help Modal */
.help-box {
  max-width: 520px;
  width: 100%;
  margin: auto;
  padding: 28px;
  border-radius: 16px;
  background: rgba(12, 15, 22, 0.95);
  border: 1px solid var(--border-strong);
}

.kbd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.kbd-row:last-child {
  border-bottom: none;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
}

/* Responsive Adjustments — Tablet & Mobile */
@media (hover: none) {
  #cursor-glow {
    display: none;
  }
}

@media (max-width: 980px) {
  :root {
    --hud-top: calc(56px + env(safe-area-inset-top, 0px));
    --hud-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    --pad-x: clamp(16px, 4.5vw, 32px);
  }

  .hud-top {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .hud-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    gap: 12px;
  }

  .hud-act-pill {
    display: none;
  }

  .slide {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: calc(var(--hud-top) + 10px) var(--pad-x) calc(var(--hud-bottom) + 28px);
  }

  .slide-content {
    height: auto;
    min-height: 100%;
    justify-content: flex-start;
  }

  .slide-content.hero-center {
    justify-content: center;
    padding: 16px 0;
  }

  .split-layout,
  .split-layout.reverse {
    grid-template-columns: 1fr;
    gap: 20px;
    height: auto;
    max-height: none;
    align-items: start;
  }

  /* Keep headline/narrative above the canvas on mobile for reverse splits */
  .split-layout.reverse > .viz-frame {
    order: 2;
  }
  .split-layout.reverse > :not(.viz-frame) {
    order: 1;
  }

  .viz-frame {
    height: clamp(270px, 38vh, 380px);
    min-height: 260px;
  }

  .stage-stack {
    height: auto;
    max-height: none;
    gap: 14px;
  }

  .stage-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .stage-viz-wide {
    flex: none;
    height: clamp(260px, 38vh, 360px);
    min-height: 250px;
  }

  .hero-telemetry {
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 22px;
    padding: 12px 18px;
    border-radius: 16px;
  }

  .stat-grid-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .hud-brand span:last-child {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .hud-actions {
    gap: 5px;
  }

  .hud-btn {
    padding: 6px 8px;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    gap: 4px;
  }

  /* Keep top bar clean on phones: hide secondary desktop buttons */
  #btn-autoplay,
  #btn-fullscreen,
  #btn-help {
    display: none;
  }

  #btn-notes span,
  #btn-grid span {
    display: none;
  }

  .display-hero {
    font-size: clamp(38px, 11.5vw, 58px);
    line-height: 0.96;
  }

  .display-xl {
    font-size: clamp(28px, 8vw, 40px);
  }

  .display-lg {
    font-size: clamp(22px, 6.6vw, 30px);
  }

  .lead {
    font-size: 14.5px;
    line-height: 1.5;
  }

  .eyebrow {
    font-size: 9.5px;
    letter-spacing: 0.18em;
    margin-bottom: 10px;
  }

  .eyebrow::before {
    width: 14px;
  }

  .stat-grid-2,
  .divergence-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 22px;
  }

  .thesis-row {
    padding: 10px 12px;
    grid-template-columns: 26px 1fr;
  }

  .pull-quote {
    font-size: 17px;
    padding: 12px 14px;
  }

  .ctrl-bar {
    gap: 8px;
    margin-top: 14px;
  }

  .ctrl-btn {
    padding: 8px 12px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .viz-overlay-top,
  .viz-overlay-bottom {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .viz-overlay-bottom {
    top: auto;
    bottom: 10px;
  }

  .viz-badge {
    font-size: 8.5px;
    letter-spacing: 0.1em;
    padding: 4px 7px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Avoid crowded badges on tiny canvases */
  .viz-overlay-top .viz-badge:first-child:not(:only-child) {
    display: none;
  }

  .slide-counter {
    font-size: 11px;
    min-width: 52px;
  }

  .progress-track {
    gap: 3px;
  }

  .progress-seg::after {
    display: none;
  }

  .nav-arrow {
    width: 34px;
    height: 34px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .overview-card {
    min-height: 92px;
    padding: 14px;
  }

  #notes-drawer {
    left: var(--pad-x);
    right: var(--pad-x);
    width: auto;
    max-height: 42vh;
  }
}
