/* ============================================================
   Voice Audition — a latent-space listening deck
   Spectral / experimental. Dark, glassy, oversized serif.
   ============================================================ */

:root {
  /* Spectral identity: low freq = magenta, high freq = cyan */
  --hue-lo: 322;          /* magenta */
  --hue-hi: 176;          /* cyan    */
  --slide-hue: 280;       /* per-slide accent, set by JS */

  --void-0: #05050c;
  --void-1: #070713;
  --ink: #efeeff;
  --muted: rgba(236, 235, 255, 0.62);
  --faint: rgba(236, 235, 255, 0.34);
  --hair: rgba(186, 176, 255, 0.14);
  --hair-strong: rgba(186, 176, 255, 0.30);

  --glass: rgba(18, 17, 38, 0.42);
  --glass-hi: rgba(30, 27, 58, 0.55);

  --accent: hsl(var(--slide-hue) 90% 76%);
  --accent-dim: hsl(var(--slide-hue) 70% 70% / 0.5);
  --glow: hsl(var(--slide-hue) 95% 65% / 0.55);

  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.6s;

  --hud-h: 92px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--void-0);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  transition: background-color 1.2s var(--ease);
}

::selection { background: hsl(var(--slide-hue) 90% 70% / 0.32); }

kbd {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 1px 5px;
  border: 1px solid var(--hair);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

/* ----------------------------------------------------------------
   Backdrop: drifting spectral mesh + grain + vignette
   ---------------------------------------------------------------- */
.void {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(140% 120% at 50% -10%, var(--void-1), var(--void-0) 60%);
}

.mesh { position: absolute; inset: -20%; filter: blur(70px); }

.blob {
  position: absolute;
  width: 56vw;
  height: 56vw;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.55;
  transition: background-color 1.2s var(--ease);
  will-change: transform;
}

.b1 {
  top: -10%; left: -8%;
  background: radial-gradient(circle, hsl(var(--slide-hue) 88% 56% / 0.9), transparent 68%);
  animation: drift1 26s var(--ease) infinite alternate;
}
.b2 {
  top: 18%; right: -14%;
  background: radial-gradient(circle, hsl(calc(var(--slide-hue) - 58) 86% 56% / 0.85), transparent 68%);
  animation: drift2 32s var(--ease) infinite alternate;
}
.b3 {
  bottom: -22%; left: 14%;
  background: radial-gradient(circle, hsl(calc(var(--slide-hue) + 46) 84% 54% / 0.8), transparent 70%);
  animation: drift3 38s var(--ease) infinite alternate;
}
.b4 {
  bottom: 4%; right: 6%;
  width: 38vw; height: 38vw;
  background: radial-gradient(circle, hsl(var(--hue-hi) 84% 56% / 0.7), transparent 70%);
  animation: drift1 30s var(--ease) infinite alternate-reverse;
}

@keyframes drift1 { to { transform: translate(8vw, 6vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-10vw, 8vh) scale(1.2); } }
@keyframes drift3 { to { transform: translate(6vw, -8vh) scale(1.1); } }

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
}

/* ----------------------------------------------------------------
   Deck + slides
   ---------------------------------------------------------------- */
.deck {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: safe center;
  padding: clamp(28px, 6vw, 104px);
  padding-bottom: calc(var(--hud-h) + 24px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
              visibility 0s linear var(--dur);
  scrollbar-width: thin;
  scrollbar-color: var(--hair-strong) transparent;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
              visibility 0s;
}

/* huge ghost numeral behind each question slide */
.slide-ordinal {
  position: absolute;
  top: clamp(8px, 3vw, 40px);
  right: clamp(12px, 4vw, 72px);
  font-family: var(--font-display);
  font-size: clamp(9rem, 30vw, 30rem);
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1px hsl(var(--slide-hue) 80% 72% / 0.13);
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.slide-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 clamp(14px, 2vw, 26px);
  display: flex;
  align-items: center;
  gap: 14px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.prompt {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.012em;
  margin: 0 0 clamp(18px, 3vw, 40px);
  color: var(--ink);
  max-width: 22ch;
  text-wrap: balance;
}
.prompt em {
  font-style: italic;
  color: var(--accent);
}

.lead {
  font-size: clamp(0.95rem, 1.4vw, 1.12rem);
  line-height: 1.65;
  color: var(--muted);
  max-width: 56ch;
  margin: 0 0 clamp(18px, 3vw, 34px);
}

/* ----------------------------------------------------------------
   Cover (slide 00) + closing (slide 09)
   ---------------------------------------------------------------- */
/* cover hides the HUD, so it can use the full height */
.kind-cover { padding-bottom: clamp(28px, 6vw, 104px); }
.cover .prompt { font-size: clamp(2.4rem, 7.6vw, 6rem); max-width: none; margin-bottom: 0.1em; }
.cover-mark {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 clamp(20px, 3vw, 34px);
}
.cover-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  color: var(--muted);
  margin: 0.2em 0 1.4em;
}
.begin {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--void-0);
  background: linear-gradient(120deg, hsl(var(--hue-lo) 90% 72%), hsl(var(--slide-hue) 92% 74%), hsl(var(--hue-hi) 88% 66%));
  border: none;
  border-radius: 999px;
  padding: 16px 30px;
  cursor: pointer;
  box-shadow: 0 0 0 1px hsl(var(--slide-hue) 90% 70% / 0.4), 0 18px 50px -16px var(--glow);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.begin:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px hsl(var(--slide-hue) 90% 80% / 0.6), 0 26px 70px -18px var(--glow); }
.begin .begin-arrow { font-size: 1.1rem; }

/* spectral specimen counter on cover */
.cover-stat {
  display: flex;
  gap: clamp(24px, 5vw, 64px);
  margin-top: clamp(24px, 4vw, 48px);
  flex-wrap: wrap;
}
.cover-stat div { display: grid; gap: 6px; }
.cover-stat b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--ink);
  line-height: 1;
}
.cover-stat span { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); }

/* ----------------------------------------------------------------
   Voice cells (the audio specimens)
   ---------------------------------------------------------------- */
.cells {
  display: grid;
  gap: clamp(14px, 1.6vw, 22px);
  grid-template-columns: repeat(auto-fit, minmax(min(238px, 100%), 1fr));
}
.cells.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* dense — many specimens on one slide (e.g. the 7-up pick) */
.cells.dense { gap: 12px; }
.cells.dense .cell { padding: 12px 15px; gap: 9px; }
.cells.dense .scope { aspect-ratio: 16 / 3.4; }
.cells.dense .play { width: 38px; height: 38px; }

.pair-wrap { display: grid; gap: clamp(16px, 2.4vw, 30px); }
.pair {
  display: grid;
  gap: clamp(10px, 1.4vw, 18px);
}
.pair-label {
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}
.pair-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: clamp(10px, 1.6vw, 20px);
}
.vs {
  align-self: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--accent);
  opacity: 0.7;
}

.cell {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: clamp(16px, 1.6vw, 22px);
  background: var(--glass);
  border: 1px solid var(--hair);
  border-radius: 18px;
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.4s var(--ease), box-shadow 0.5s var(--ease), transform 0.4s var(--ease);
}
.cell.is-playing {
  border-color: hsl(var(--slide-hue) 90% 72% / 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px hsl(var(--slide-hue) 90% 70% / 0.25), 0 30px 70px -30px var(--glow);
  transform: translateY(-2px);
}

.cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cell-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.cell-tag {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.scope {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 5;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.18));
}
.scope canvas { display: block; width: 100%; height: 100%; }

.cell-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.play {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hair-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.2s var(--ease);
}
.play:hover { background: hsl(var(--slide-hue) 80% 60% / 0.16); border-color: var(--accent); }
.play:active { transform: scale(0.93); }
.play svg { width: 16px; height: 16px; fill: currentColor; }
.play .icon-pause { display: none; }
.cell.is-playing .play .icon-play { display: none; }
.cell.is-playing .play .icon-pause { display: block; }

.seek {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p, 0%), rgba(255,255,255,0.12) var(--p, 0%));
  cursor: pointer;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 10px var(--glow);
  cursor: pointer;
}
.seek::-moz-range-thumb {
  width: 13px; height: 13px; border: none;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 10px var(--glow);
  cursor: pointer;
}

.time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 76px;
  text-align: right;
}

/* compact variant for replay trays */
.cells.compact { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; }
.cells.compact .cell { padding: 12px 14px; gap: 10px; }
.cells.compact .scope { aspect-ratio: 16 / 4; }
.cells.compact .cell-tag { display: none; }
.cells.compact .time { display: none; } /* play is the action in a replay tray; scope shows progress */
.tray-note {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 14px;
}

/* descriptor chips (slide 07) + accent options (slide 08) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; max-width: 60ch; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px dashed var(--hair-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: clamp(24px, 3vw, 40px); }
.option {
  padding: clamp(18px, 2vw, 28px);
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  gap: 8px;
}
.option b { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.2rem, 2vw, 1.7rem); color: var(--ink); }
.option span { font-size: 0.82rem; color: var(--faint); line-height: 1.5; }
.option:nth-child(1) { --slide-hue: var(--hue-hi); }
.option:nth-child(3) { --slide-hue: var(--hue-lo); }
.option b { color: var(--accent); }

/* ----------------------------------------------------------------
   HUD / transport
   ---------------------------------------------------------------- */
.hud {
  position: fixed;
  z-index: 5;
  left: 0; right: 0; bottom: 0;
  height: var(--hud-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 56px);
  background: linear-gradient(0deg, rgba(5, 5, 12, 0.82), transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hud[hidden] { display: none; }

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.hud-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--accent); background: hsl(var(--slide-hue) 80% 60% / 0.1); }
.hud-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.hud-btn:first-child { justify-self: start; }
.hud-btn:last-child { justify-self: end; }
.hud-arrow { font-size: 1rem; }

.hud-center { display: grid; justify-items: center; gap: 10px; width: min(440px, 60vw); }
.counter {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.counter #counter-now { color: var(--accent); }
.counter-sep { margin: 0 8px; color: var(--faint); }

.rail {
  width: 100%;
  height: 2px;
  background: var(--hair);
  border-radius: 999px;
  overflow: hidden;
}
.rail-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, hsl(var(--hue-lo) 90% 70%), hsl(var(--slide-hue) 90% 72%), hsl(var(--hue-hi) 86% 64%));
  box-shadow: 0 0 12px var(--glow);
  transition: width var(--dur) var(--ease);
}
.kbd-hint { font-size: 0.66rem; letter-spacing: 0.06em; color: var(--faint); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--ink);
  background: var(--void-0);
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 760px) {
  .cells.cols-2, .cells.cols-4 { grid-template-columns: 1fr; }
  .pair-grid { grid-template-columns: 1fr; }
  .vs { justify-self: center; transform: rotate(90deg); }
  .options { grid-template-columns: 1fr; }
  .hud-btn-label { display: none; }
  .kbd-hint { display: none; }
  .hud-center { width: 56vw; }
}

/* ----------------------------------------------------------------
   Reduced motion: freeze the drift, keep it usable
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none !important; }
  .slide, .slide.is-active { transition: opacity 0.2s linear, visibility 0s; transform: none; }
  .rail-fill { transition: width 0.2s linear; }
  body { transition: background-color 0.3s linear; }
}
