:root {
  --ink: #e7eef6;
  --muted: #9aafc4;
  --blue: #8eb6de;
  --line: rgba(158, 190, 220, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #07111c; color: var(--ink); }
body {
  font-family: "Outfit", sans-serif;
  font-weight: 300;
}
#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
.vignette, .grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.vignette {
  background:
    linear-gradient(180deg, rgba(7, 17, 28, 0.78) 0%, rgba(7, 17, 28, 0.2) 16%, transparent 30% 44%, rgba(7, 17, 28, 0.55) 64%, rgba(7, 17, 28, 0.94) 100%),
    radial-gradient(ellipse at center, transparent 34%, rgba(7, 17, 28, 0.42) 100%);
}
.grain {
  opacity: 0.14;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>");
}
.top, .caption, .play, .scrub, .scroll-hint { position: fixed; z-index: 2; }
.top {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 7vw;
}
.brand {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 34px;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: white;
}
.brand em { font-style: normal; color: var(--blue); }
.top-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}
.caption {
  left: 7vw;
  bottom: 11vh;
  max-width: min(640px, 86vw);
}
.copy {
  transition: opacity 0.45s ease;
}
.copy.is-out { opacity: 0; }
.caption::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -30vw;
  right: -22vw;
  top: -24vh;
  bottom: -18vh;
  background: radial-gradient(ellipse 68% 74% at 16% 82%, rgba(7, 17, 28, 0.92), rgba(7, 17, 28, 0.5) 48%, transparent 74%);
  pointer-events: none;
}
.kicker {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
}
.kicker.is-logo {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 34px;
  letter-spacing: 0.12em;
  text-transform: none;
  color: white;
}
.kicker.is-logo em { font-style: normal; color: var(--blue); }
.chapter-name.is-logo, .chapter-list .is-logo { text-transform: none; }
.chapter-name.is-logo em, .chapter-list .is-logo em { font-style: normal; color: var(--blue); }
h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.line {
  margin: 16px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}
body[data-chapter="close"] .kicker { display: none; }
.radio {
  margin: 14px 0 0;
  max-width: 46ch;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: #d5e6f7;
}
.radio[hidden] { display: none; }
.end-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.end-actions[hidden] { display: none; }
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  color: #07111c;
  background: #d5e6f7;
  font-size: 15px;
}
.btn-ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}
.play, .scroll-hint {
  font: inherit;
  color: var(--ink);
}
.controls {
  position: fixed;
  z-index: 2;
  right: 7vw;
  bottom: 11vh;
  display: flex;
  gap: 10px;
}
.controls .play { position: static; }
.play {
  right: 7vw;
  bottom: 11vh;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}
.play[aria-pressed="true"] { border-color: #d5e6f7; }
.play.sound { right: calc(7vw + 104px); }
body.is-intro .controls {
  right: auto;
  bottom: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}
body.is-intro .controls .sound { display: none; }
body.is-intro .play {
  padding: 16px 36px;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: #fff;
  border-color: #d5e6f7;
  background: rgba(7, 17, 28, 0.55);
  box-shadow: 0 0 0 10px rgba(213, 230, 247, 0.06), 0 18px 50px rgba(0, 0, 0, 0.45);
}
body.is-intro .scrub { opacity: 0; }
.scroll-hint {
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.scrub {
  left: 7vw;
  right: 7vw;
  bottom: 22px;
  height: 1px;
  background: rgba(158, 190, 220, 0.25);
}
#scrub-bar {
  display: block;
  height: 1px;
  width: 0;
  background: #d5e6f7;
}
#plate {
  position: fixed;
  z-index: 2;
  top: 16vh;
  right: 6vw;
  width: min(460px, 36vw);
  height: min(300px, 34vh);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  background: #07111c;
}
.plate-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#plate-img,
#plate-video {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  will-change: transform;
}
#plate-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
#plate-video[hidden] { display: none; }
.plate-glow,
.plate-cursor {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
}
.plate-glow {
  width: 210px;
  height: 210px;
  margin: -105px 0 0 -105px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.22), transparent 68%);
  mix-blend-mode: screen;
}
.plate-cursor {
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 1.5px solid rgba(213, 230, 247, 0.95);
  box-shadow: 0 0 0 7px rgba(56, 189, 248, 0.16);
}
.plate-cursor::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d5e6f7;
}
.nav {
  position: fixed;
  z-index: 4;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 10px;
  width: min(880px, calc(100% - 8vw));
}
.step, .pick, .menu-btn, .chapter-list button {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(7, 17, 28, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.step:disabled {
  opacity: 0.35;
  cursor: default;
}
.chapter-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
}
.chapter-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--blue);
}
.chapter-name {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.45s ease;
}
.chapter-name.is-out { opacity: 0; }
.copy.is-out { pointer-events: none; }
.chapter-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.pick { min-width: 36px; padding: 8px 0; }
.pick[aria-current="true"], .chapter-list button[aria-current="true"] {
  border-color: #d5e6f7;
  color: white;
  background: rgba(20, 40, 62, 0.95);
}
.menu-btn { display: none; }
.chapter-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, 88vw);
  max-height: 36vh;
  margin: 0;
  padding: 8px;
  overflow: auto;
  list-style: none;
  background: rgba(7, 17, 28, 0.96);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.chapter-list[hidden] { display: none; }
.chapter-list li { margin: 0; }
.chapter-list button {
  display: block;
  width: 100%;
  margin: 2px 0;
  border-radius: 10px;
  text-align: left;
  background: transparent;
}
.step:focus-visible,
.pick:focus-visible,
.menu-btn:focus-visible,
.chapter-list button:focus-visible,
.play:focus-visible,
.top a:focus-visible,
.btn:focus-visible {
  outline: 2px solid #d5e6f7;
  outline-offset: 3px;
}
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

@media (max-width: 720px) {
  .top { padding: 16px 5vw; }
  .brand { font-size: 28px; }
  .top-link { font-size: 12px; }
  .nav {
    top: 76px;
    width: calc(100% - 8vw);
    flex-wrap: nowrap;
    gap: 6px;
  }
  .chapter-picks { display: none; }
  .menu-btn { display: inline-flex; flex: 0 0 auto; }
  .chapter-status { flex: 1 1 auto; }
  .chapter-name { max-width: 34vw; font-size: 15px; }
  .step { padding: 8px 10px; }
  .controls { right: 5vw; bottom: 7vh; }
  .caption { bottom: 18vh; max-width: 90vw; }
  h1 { font-size: 30px; }
  .line { max-width: 34ch; font-size: 15px; }
  body[data-chapter="airspace"] .caption,
  body[data-chapter="exercise"] .caption,
  body[data-chapter="pilots"] .caption { bottom: 26vh; }
  #plate { width: 46vw; height: 22vh; top: auto; bottom: 34vh; }
}
@media (prefers-reduced-motion: reduce) {
  .copy, .chapter-name { transition: none; }
}
