/* Lab — consistent with MPL SpaceX / D-DIN system */

@font-face {
  font-family: 'D-DIN';
  src: url('../../assets/fonts/D-DIN.woff2') format('woff2'),
       url('../../assets/fonts/D-DIN.woff') format('woff');
  font-style: normal;
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'D-DIN-Bold';
  src: url('../../assets/fonts/D-DIN-Bold.woff2') format('woff2'),
       url('../../assets/fonts/D-DIN-Bold.woff') format('woff');
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  --black: #000;
  --ink: #0a0a0a;
  --surface: #0e1218;
  --surface-2: #141a22;
  --white: #f0f0fa;
  --white-90: rgba(240, 240, 250, 0.9);
  --white-70: rgba(240, 240, 250, 0.7);
  --white-50: rgba(240, 240, 250, 0.5);
  --white-35: rgba(240, 240, 250, 0.35);
  --white-15: rgba(240, 240, 250, 0.15);
  --white-10: rgba(240, 240, 250, 0.1);
  --accent: #3ecfff;
  --accent-dim: rgba(62, 207, 255, 0.15);
  --header-h: 72px;
  --font-display: 'D-DIN-Bold', 'D-DIN', Arial, sans-serif;
  --font-body: 'D-DIN', Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --max: 1400px;
  --player-h: min(52vh, 480px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  font-size: 16px;
  line-height: 26px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img, video { max-width: 100%; display: block; }

/* ─── Password gate ─────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(26, 107, 255, 0.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(62, 207, 255, 0.08), transparent 45%),
    #000;
  padding: 1.5rem;
}
.gate[hidden],
.gate[hidden="hidden"],
body.lab-unlocked .gate {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
body.lab-locked .gate {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.gate-card {
  width: min(420px, 100%);
  border: 1px solid var(--white-15);
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(16px);
  padding: 2.25rem 2rem 2rem;
}
.gate-card h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.gate-card p {
  color: var(--white-50);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.gate-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.gate-field label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white-50);
}
.gate-field input {
  background: var(--black);
  border: 1px solid var(--white-15);
  color: var(--white);
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.2s;
}
.gate-field input:focus { border-color: var(--accent); }
.gate-error {
  color: #ff6b7a;
  font-size: 0.85rem;
  min-height: 1.25rem;
  margin-bottom: 0.75rem;
}
.gate-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn-lab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid var(--white);
  color: var(--white);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.btn-lab:hover { background: var(--white); color: #000; }
.btn-lab--primary { background: var(--accent); border-color: var(--accent); color: #041018; }
.btn-lab--primary:hover { background: var(--white); border-color: var(--white); color: #000; }
.btn-lab--ghost { border-color: var(--white-35); }
.gate-hint {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--white-35);
  text-transform: uppercase;
}

/* ─── Header ────────────────────────────────────────────────── */
.lab-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--white-10);
}
.lab-header-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.lab-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.lab-brand img { height: 32px; width: auto; }
.lab-brand-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lab-brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--white-50);
  margin-top: 0.1rem;
}
.lab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  flex: 1;
  justify-content: center;
}
.lab-nav a {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--white-70);
  transition: color 0.15s;
}
.lab-nav a:hover, .lab-nav a.is-active { color: var(--accent); }
.lab-header-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.lab-lock-btn {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-50);
  border: 1px solid var(--white-15);
  padding: 0.45rem 0.7rem;
  transition: color 0.15s, border-color 0.15s;
}
.lab-lock-btn:hover { color: var(--white); border-color: var(--white-35); }

/* ─── Layout shells ─────────────────────────────────────────── */
.lab-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.lab-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--white-10);
}
.lab-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}
.lab-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 0.98;
  margin-bottom: 0.85rem;
}
.lab-hero p {
  color: var(--white-70);
  max-width: 52em;
  font-size: 1.05rem;
  line-height: 1.65;
}

/* TOC hub */
.toc-groups { display: flex; flex-direction: column; gap: 2.5rem; }
.toc-group h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--white-90);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--white-10);
}
.toc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--white-10);
  border: 1px solid var(--white-10);
}
.toc-card {
  background: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: background 0.2s;
}
.toc-card:hover { background: var(--surface-2); }
.toc-card-media {
  height: 120px;
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.toc-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  transition: opacity 0.3s, transform 0.5s var(--ease);
}
.toc-card:hover .toc-card-media img { opacity: 1; transform: scale(1.04); }
.toc-type {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.65);
  border: 1px solid var(--white-15);
  color: var(--accent);
  padding: 0.25rem 0.45rem;
}
.toc-card-body { padding: 1rem 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.toc-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
}
.toc-card-body p {
  font-size: 0.88rem;
  color: var(--white-50);
  line-height: 1.45;
  flex: 1;
}
.toc-meta {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-35);
}

/* ─── Session page: player + transcript ─────────────────────── */
.session-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}
.session-player-col,
.session-transcript-col {
  border: 1px solid var(--white-10);
  background: var(--ink);
  min-height: 0;
}

/* Custom player */
.mpl-player {
  display: flex;
  flex-direction: column;
  background: #000;
}
.mpl-player-stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  max-height: var(--player-h);
}
.mpl-player-stage.is-audio {
  aspect-ratio: auto;
  min-height: 280px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(62, 207, 255, 0.14), transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(26, 107, 255, 0.1), transparent 45%),
    #05080f;
  cursor: pointer;
}
.mpl-player-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}
/* Hidden native audio element — custom deck + controls only */
.mpl-audio-el {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mpl-audio-deck {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  width: 100%;
  padding: 1.75rem 1.75rem 1.5rem;
  align-items: center;
}
.mpl-audio-cover {
  position: relative;
  width: 160px;
  height: 160px;
  border: 1px solid var(--white-15);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}
.mpl-audio-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}
.mpl-audio-cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(62,207,255,0.2), rgba(26,107,255,0.15));
}
.mpl-audio-bigplay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: rgba(0, 0, 0, 0.55);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
  z-index: 2;
  pointer-events: auto;
}
.mpl-audio-bigplay:hover {
  background: var(--accent);
  color: #041018;
  border-color: var(--accent);
  transform: scale(1.05);
}
.mpl-audio-bigplay svg { width: 22px; height: 22px; fill: currentColor; }
.mpl-audio-bigplay.is-playing {
  border-color: var(--accent);
  color: var(--accent);
}

.mpl-audio-meta { min-width: 0; }
.mpl-audio-kicker {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}
.mpl-audio-title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.mpl-audio-sub {
  font-size: 0.9rem;
  color: var(--white-50);
  line-height: 1.45;
  margin-bottom: 1rem;
}

/* Playing EQ bars */
.mpl-audio-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
  opacity: 0.35;
  transition: opacity 0.25s;
}
.mpl-audio-bars.is-playing { opacity: 1; }
.mpl-audio-bars i {
  display: block;
  width: 4px;
  height: 20%;
  background: var(--accent);
  border-radius: 1px;
  transform-origin: bottom;
}
.mpl-audio-bars.is-playing i {
  animation: eq 0.9s ease-in-out infinite alternate;
}
.mpl-audio-bars i:nth-child(4n) { animation-duration: 0.7s; height: 35%; }
.mpl-audio-bars i:nth-child(4n+1) { animation-duration: 1.1s; height: 55%; }
.mpl-audio-bars i:nth-child(4n+2) { animation-duration: 0.85s; height: 40%; }
.mpl-audio-bars i:nth-child(4n+3) { animation-duration: 1.25s; height: 70%; }
@keyframes eq {
  from { transform: scaleY(0.35); }
  to { transform: scaleY(1); }
}

.mpl-btn--play {
  width: 42px;
  height: 42px;
  border-color: var(--accent);
  color: var(--accent);
}
.mpl-player.is-playing .mpl-btn--play {
  background: var(--accent-dim);
}
.mpl-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  .mpl-audio-deck {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 1.25rem;
  }
  .mpl-audio-bars { justify-content: center; }
}

/* Document viewer */
.mpl-doc-frame {
  width: 100%;
  height: min(70vh, 640px);
  border: none;
  background: #111;
}

.mpl-controls {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--white-10);
  background: var(--surface);
}
.mpl-progress-wrap {
  position: relative;
  height: 6px;
  background: var(--white-10);
  cursor: pointer;
  touch-action: none;
}
.mpl-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  pointer-events: none;
}
.mpl-progress-buf {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--white-15);
  pointer-events: none;
}
.mpl-controls-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.mpl-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--white-15);
  color: var(--white);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mpl-btn:hover { border-color: var(--accent); color: var(--accent); }
.mpl-btn svg { width: 16px; height: 16px; fill: currentColor; }
.mpl-time {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--white-50);
  font-variant-numeric: tabular-nums;
  min-width: 6.5rem;
}
.mpl-spacer { flex: 1; }
.mpl-select {
  background: var(--black);
  border: 1px solid var(--white-15);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.55rem;
  outline: none;
}
.mpl-volume {
  width: 80px;
  accent-color: var(--accent);
}

/* Transcript panel */
.session-transcript-col {
  display: flex;
  flex-direction: column;
  max-height: calc(var(--player-h) + 140px);
}
.transcript-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--white-10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}
.transcript-head h2 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.transcript-head span {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-35);
}
.transcript-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0;
}
.transcript-intro {
  padding: 0.75rem 1.1rem 1rem;
  border-bottom: 1px solid var(--white-10);
  margin-bottom: 0.35rem;
}
.transcript-intro h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}
.transcript-intro p {
  font-size: 0.92rem;
  color: var(--white-70);
  line-height: 1.55;
}
.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.topic-chips span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--white-15);
  color: var(--white-50);
  padding: 0.25rem 0.45rem;
}
.cue {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1.1rem;
  border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.cue:hover { background: var(--accent-dim); }
.cue.is-active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.cue-time {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.cue-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.cue-text {
  font-size: 0.88rem;
  color: var(--white-50);
  line-height: 1.5;
}
.doc-text {
  padding: 1rem 1.15rem 1.5rem;
  font-size: 0.88rem;
  color: var(--white-70);
  line-height: 1.55;
  white-space: pre-wrap;
  font-family: var(--font-body);
}

/* Session TOC footer on page */
.session-toc {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--white-10);
}
.session-toc h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.session-toc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.session-toc-list a {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--white-50);
  padding: 0.25rem 0;
}
.session-toc-list a:hover { color: var(--accent); }
.session-toc-list a.is-current { color: var(--accent); }

.lab-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--white-10);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-35);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.lab-footer a { color: var(--white-50); text-decoration: none; }
.lab-footer a:hover { color: var(--accent); }

/* Locked body */
body.lab-locked .lab-shell { visibility: hidden; }
body.lab-unlocked .lab-shell { visibility: visible; }

@media (max-width: 960px) {
  .session-layout { grid-template-columns: 1fr; }
  .session-transcript-col { max-height: 50vh; }
  .lab-nav { display: none; }
}
@media (max-width: 600px) {
  .lab-main { padding: 1.25rem 1rem 3rem; }
  .mpl-volume { width: 56px; }
}
