/*
  ChaosLab — Redesigned Presentation
  
  Scene sentence: A physics student presents a mini-documentary in a dim
  lecture hall. The data IS the spectacle. Deep indigo darkness, gold math,
  cyan trajectories. No scaffolding, no badges, no cards. Just physics.

  Fonts: Spectral (Display), Public Sans (Body), Fira Code (Math only)
  Color: Committed dark mode, OKLCH
  Motion: ease-out-expo, no bounce
*/

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Public+Sans:wght@400;500;600&family=Spectral:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

:root {
  color-scheme: dark;
  --bg: oklch(12% 0.025 285);
  --surface: oklch(18% 0.035 285);
  --text: oklch(93% 0.012 285);
  --muted: oklch(68% 0.025 285);
  --gold: oklch(80% 0.15 80);
  --cyan: oklch(85% 0.14 200);
  --magenta: oklch(72% 0.18 335);
  --green: oklch(78% 0.15 145);
  --red: oklch(72% 0.16 25);
  --line: oklch(24% 0.03 285);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'Public Sans', system-ui, sans-serif;
  --font-math: 'Fira Code', 'SF Mono', monospace;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body { isolation: isolate; }

/* Ambient glow — two soft ellipses, barely there */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%, oklch(16% 0.04 285 / 0.35), transparent),
    radial-gradient(ellipse 50% 40% at 80% 75%, oklch(14% 0.05 210 / 0.12), transparent),
    var(--bg);
}

/* ── Deck ── */
#deck { position: relative; width: 100%; height: 100%; }

.slide {
  position: absolute; inset: 0;
  display: grid;
  padding: clamp(3rem, 6vw, 7rem);
  padding-bottom: clamp(5rem, 8vw, 8rem);
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
  will-change: opacity, transform;
}

.slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  transition-delay: 60ms;
}

/* ── Canvas — the hero ── */
.scene-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

/* ── Typography ── */
h1, h2 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.08;
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  max-width: 14ch;
}

h2 {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  max-width: 16ch;
}

p {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  max-width: 50ch;
  margin: 1.2rem 0 0;
  line-height: 1.7;
}

/* Math — Fira Code, gold, the only monospace */
code, .state-vector, .equation, .formula-stack p {
  font-family: var(--font-math);
  color: var(--gold);
}

code {
  font-size: 0.9em;
  padding: 0.1em 0.25em;
  background: oklch(80% 0.15 80 / 0.06);
  border-radius: 2px;
}

.state-vector {
  font-size: clamp(1.4rem, 2.2vw, 2.2rem);
  display: block;
  margin-top: 1.8rem;
}

.equation {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  display: block;
  margin-top: 1rem;
}

.equation.dim {
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}

sub { font-size: 0.65em; vertical-align: sub; }

.formula-stack {
  margin-top: 2rem;
  display: grid;
  gap: 0.6rem;
}
.formula-stack p {
  margin: 0;
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
}
.formula-stack span { color: var(--text); font-family: var(--font-body); }

/* Caveat — subtle inline footnote, NO bordered box */
.caveat {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  color: var(--gold);
  opacity: 0.8;
  margin-top: 1.5rem;
  max-width: 42ch;
  line-height: 1.6;
}

.sources {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1.5rem;
  opacity: 0.5;
}

/* ── Claim layout — text floating over canvas ── */
.claim {
  position: relative;
  z-index: 2;
  align-self: end;
  justify-self: start;
  max-width: 44vw;
  padding: 2rem 2.5rem;
  background: oklch(12% 0.025 285 / 0.6);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 6px;
}

.claim.right {
  justify-self: end;
  text-align: right;
}
.claim.right p, .claim.right .caveat { margin-left: auto; }

.claim.center {
  place-self: center;
  text-align: center;
  max-width: 55vw;
}
.claim.center p, .claim.center .caveat {
  margin-left: auto;
  margin-right: auto;
}

.claim.compact { max-width: 32vw; }

/* ── KILLED: kickers, pills ── */
.kicker { display: none; }
.pill, .metric-row { display: none; }

/* ── Map scene ── */
.slide[data-scene="map"] .claim,
.slide[data-scene="islands"] .claim {
  align-self: center;
  max-width: 24vw;
}

.slide[data-scene="map"] h2,
.slide[data-scene="islands"] h2 {
  font-size: clamp(1.8rem, 4.5vw, 3.5rem);
}

.map-stage {
  position: absolute;
  inset: clamp(2rem, 4vw, 5rem) clamp(2rem, 4vw, 5rem) clamp(5rem, 7vw, 8rem) 32vw;
  background: var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.map-scan { display: none; }

/* ── Periodic orbits — NO cards, just canvases ── */
.orbit-trio {
  position: absolute;
  bottom: clamp(6rem, 10vw, 10rem);
  left: clamp(3rem, 6vw, 7rem);
  right: clamp(3rem, 6vw, 7rem);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
}

.orbit-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.orbit-canvas {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: transparent;
}

.orbit-name {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Legacy selectors for backward compat */
.mini-sims-grid { display: none; }

/* ── Zoom ── */
.zoom-container {
  margin-top: 1.5rem;
  border-radius: 4px;
  overflow: hidden;
}
.zoom-gif {
  width: 100%;
  max-width: 360px;
  display: block;
}

/* ── Chrome — nearly invisible ── */
.chrome {
  position: fixed;
  left: clamp(3rem, 6vw, 7rem);
  right: clamp(3rem, 6vw, 7rem);
  bottom: 1.5rem;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 1.2rem;
  align-items: center;
}

button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: color 400ms var(--ease);
}
button:hover, button:focus-visible {
  color: var(--text);
  outline: none;
}

.progress {
  height: 1px;
  background: var(--line);
  position: relative;
}
#progress-bar {
  position: absolute;
  left: 0; top: -0.5px;
  height: 2px;
  width: 8.33%;
  background: var(--cyan);
  transition: width 600ms var(--ease);
  border-radius: 1px;
}

#counter {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 3ch;
  opacity: 0.6;
}

/* ── Notes ── */
.notes { display: none; }
.notes-panel {
  position: fixed;
  bottom: 3.5rem;
  left: clamp(3rem, 6vw, 7rem);
  right: clamp(3rem, 6vw, 7rem);
  z-index: 9;
  background: oklch(10% 0.02 285 / 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 4px;
  padding: 1rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  max-height: 16vh;
  overflow-y: auto;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .claim, .claim.right, .claim.compact,
  .slide[data-scene="map"] .claim,
  .slide[data-scene="islands"] .claim {
    max-width: 100%;
    text-align: left;
    justify-self: start;
    align-self: end;
    padding-bottom: 5rem;
  }
  .claim.right p, .claim.right .caveat { margin-left: 0; }
  .map-stage { inset: 2rem 2rem 50vh 2rem; }
  .chrome { grid-template-columns: auto 1fr auto; }
  #notes-toggle { display: none; }
  .orbit-trio { grid-template-columns: 1fr; bottom: auto; top: 55vh; }
}

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