/* Where Light Dies — a descent in ten thousand metres. Dark water only. */
:root {
  --bg0: #010507;
  --bg1: #000304;
  --panel: rgba(2, 10, 17, 0.8);
  --ink: #ece7d8;
  --ink-dim: #b9c6cf;
  --muted: #8ba0ad;
  --line: rgba(159, 212, 239, 0.22);
  --line-soft: rgba(159, 212, 239, 0.12);
  --accent: #7fd4e8;
  --accent-deep: #2e7d95;
  --warm: #e8b04b;
  --serif-d: "Fraunces", Georgia, serif;
  --serif-b: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
html:not(.js) .needs-js { display: none !important; }
body {
  margin: 0;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--serif-b);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-x: clip;
}
::selection { background: rgba(127, 212, 232, 0.35); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: fixed; top: -4rem; left: 1rem; z-index: 99;
  background: var(--panel); color: var(--ink);
  padding: 0.5rem 1rem; border-radius: 0 0 10px 10px;
  border: 1px solid var(--line); border-top: 0;
  font-family: var(--mono); font-size: 0.85rem; text-decoration: none;
  transition: top 0.2s;
}
.skip:focus { top: 0; }

/* ---------- chrome ---------- */
.chrome {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.55rem 1rem;
  background: linear-gradient(rgba(1, 5, 7, 0.85), rgba(1, 5, 7, 0));
  font-family: var(--mono); font-size: 0.85rem;
}
.wordmark {
  color: var(--ink); text-decoration: none; letter-spacing: 0.04em;
  font-variation-settings: "opsz" 40; font-family: var(--serif-d);
  font-size: 1rem; font-weight: 600;
}
.langbtn {
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.2rem 0.8rem; font-size: 0.8rem; letter-spacing: 0.08em;
  background: rgba(1, 8, 13, 0.6);
}
.langbtn:hover { border-color: var(--accent); }

/* ---------- dots rail ---------- */
.dots {
  position: fixed; left: 0.85rem; top: 50%; transform: translateY(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 0.8rem;
}
.dots a { display: block; padding: 0.15rem; }
.dots a span {
  display: block; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--muted); background: transparent;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.dots a:hover span { border-color: var(--accent); }
.dots a.on span { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }

/* ---------- gauge ---------- */
.gauge {
  position: fixed; right: 0.9rem; top: 50%; transform: translateY(-50%);
  z-index: 30; width: 5.2rem; text-align: right;
  font-family: var(--mono);
}
.gauge-readout { font-size: 0.95rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.gauge-zone { font-size: 0.68rem; color: var(--accent); min-height: 2em; line-height: 1.3; margin: 0.15rem 0 0.4rem; }
.gauge-track {
  position: relative; height: 38vh; width: 2px; margin-left: auto;
  background: rgba(159, 212, 239, 0.18); border-radius: 2px;
}
.gauge-fill {
  position: absolute; top: 0; left: 0; width: 100%;
  background: linear-gradient(var(--accent), var(--accent-deep));
  border-radius: 2px; height: 0;
}
.gauge-marker {
  position: absolute; left: 50%; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--accent);
  transform: translate(-50%, -50%); top: 0;
  box-shadow: 0 0 10px rgba(127, 212, 232, 0.7);
}
.gauge-tick { position: absolute; right: 4px; width: 5px; height: 1px; background: var(--muted); opacity: 0.6; }
.gauge-wp {
  position: absolute; right: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg0); border: 1px solid var(--warm);
  transform: translateY(-50%);
}
.gauge-wp.passed { background: var(--warm); }
.gauge-wp i {
  display: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 0.62rem; color: var(--ink-dim);
  white-space: nowrap; letter-spacing: 0.02em;
}
@media (min-width: 1100px) { .gauge-wp i { display: block; } .gauge { width: 12rem; } }
.gauge-meta {
  margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.1rem;
  font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ---------- scenes ---------- */
.scene { position: relative; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: var(--bg0);
}
.stage canvas.fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.steps { position: relative; margin-top: -100vh; margin-top: -100svh; }
.step {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: 14vh 7vw; margin: 0 auto; max-width: 110rem;
}
.step[data-side="left"] { justify-content: flex-start; }
.step[data-side="right"] { justify-content: flex-end; }
.step[data-side="center"] { justify-content: center; text-align: center; }

.card {
  max-width: 33rem; padding: 1.35rem 1.6rem;
  background: var(--panel);
  border: 1px solid var(--line-soft); border-radius: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.card p { margin: 0.7em 0 0; }
.card p:first-child, .card h2:first-child { margin-top: 0; }
.card h2 {
  font-family: var(--serif-d); font-weight: 600; font-size: 1.7rem;
  line-height: 1.15; margin: 0 0 0.4rem; letter-spacing: -0.01em;
}
.chapter { border-color: var(--line); }
.chapter-num {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.14em;
  color: var(--accent); text-transform: uppercase; margin: 0 0 0.5rem !important;
}

/* ---------- hero ---------- */
.hero { justify-content: center; text-align: center; }
.hero-inner { max-width: 62rem; }
.kicker {
  font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1rem;
}
.hero h1 {
  font-family: var(--serif-d); font-weight: 650;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 1.02; letter-spacing: -0.02em; margin: 0 auto;
  max-width: 20ch; font-variation-settings: "opsz" 144;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.8);
}
.lede {
  font-size: clamp(1.1rem, 2.2vw, 1.4rem); line-height: 1.6;
  max-width: 62ch; margin: 1.2rem auto 0; color: var(--ink);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
}
.cue {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); margin-top: 2.2rem;
  animation: cue 2.6s ease-in-out infinite;
}
@keyframes cue { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cue { animation: none; } }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 1.2rem; bottom: 1.4rem; font-family: var(--mono); }
.hud-label { margin: 0; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hud-value { margin: 0.1rem 0 0; font-size: 1.5rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud.static .hud-label { color: var(--ink-dim); font-size: 0.78rem; }
.hud-chips { margin: 0.4rem 0 0; display: flex; gap: 0.45rem; flex-wrap: wrap; }
.chip {
  font-size: 0.72rem; padding: 0.2rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--line-soft); color: var(--muted);
  transition: color 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.chip.lit { color: var(--warm); border-color: var(--warm); box-shadow: 0 0 12px rgba(232, 176, 75, 0.35); }
.wreck-tag {
  position: absolute; right: 6.5rem; bottom: 22%; margin: 0;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.1em;
  color: var(--warm); opacity: 0; transition: opacity 0.8s;
  text-shadow: 0 2px 10px #000;
}
.wreck-tag.lit { opacity: 1; }

/* ---------- flash ---------- */
.flash {
  margin-top: 1rem; font-family: var(--mono); font-size: 0.9rem;
  letter-spacing: 0.06em; color: #04121c; background: var(--accent);
  border: 0; border-radius: 999px; padding: 0.65rem 1.5rem; cursor: pointer;
}
.flash:hover { background: #a5e2f2; }
.flash:disabled { opacity: 0.45; cursor: default; }

/* ---------- banner ---------- */
.banner {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  z-index: 40; display: flex; align-items: center; gap: 0.9rem;
  background: rgba(3, 14, 22, 0.94); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.5rem 0.6rem 0.5rem 1.2rem;
  font-size: 0.95rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  max-width: calc(100vw - 2rem);
}
.banner p { margin: 0; color: var(--ink-dim); }
.banner a {
  color: #04121c; background: var(--accent); text-decoration: none;
  border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.85rem;
  font-family: var(--mono); white-space: nowrap;
}
.banner button {
  background: none; border: 0; color: var(--muted); font-size: 1.3rem;
  cursor: pointer; padding: 0.1rem 0.5rem; line-height: 1;
}

/* ---------- footer ---------- */
.footer { background: var(--bg1); border-top: 1px solid var(--line-soft); padding: 4rem 0 3rem; }
.footer .wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.5rem; }
.footer h2 {
  font-family: var(--serif-d); font-size: 1.5rem; font-weight: 600; margin: 0 0 0.8rem;
}
.related { margin-bottom: 2.5rem; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.related a {
  display: block; padding: 0.8rem 1.1rem; border: 1px solid var(--line-soft);
  border-radius: 12px; text-decoration: none; color: var(--ink);
  font-size: 1.05rem; line-height: 1.4;
}
.related a:hover { border-color: var(--accent); }
.sources ul { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.45rem; }
.sources li a { font-size: 0.98rem; text-decoration: none; border-bottom: 1px dotted var(--accent-deep); }
.sources li a:hover { border-bottom-style: solid; }
.method { color: var(--muted); font-size: 1rem; }
.colophon { color: var(--muted); font-size: 0.95rem; margin-top: 2.5rem; }
.colophon a { color: var(--ink-dim); }

/* ---------- share row ---------- */
.share { margin: 0 0 2.5rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.share-row .lab { font-size: 0.95rem; color: var(--muted); margin-right: 0.2rem; }
.share-row a, .share-row button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-soft); background: transparent;
  color: var(--ink); cursor: pointer; padding: 0;
}
.share-row a:hover, .share-row button:hover { border-color: var(--accent); color: var(--accent); }
@media (pointer: coarse) { .share-row a, .share-row button { width: 44px; height: 44px; } }
.share-status { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; margin: 0.4rem 0 0; font-family: var(--mono); }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  body { font-size: 1.05rem; }
  .step { padding: 12vh 5vw; align-items: flex-end; }
  .step.hero { align-items: center; }
  .card { max-width: none; width: 100%; }
  .gauge { width: auto; right: 0.7rem; }
  .gauge-zone { display: none; }
  .gauge-meta { display: none; }
  .gauge-track { height: 26vh; }
  .gauge-readout { font-size: 0.8rem; }
  .dots { left: 0.5rem; gap: 0.6rem; }
  .hud { left: 0.9rem; bottom: 1rem; }
  .hud-value { font-size: 1.15rem; }
  .wreck-tag { right: 1rem; bottom: 30%; }
  .banner { font-size: 0.85rem; border-radius: 18px; }
}
