/* ============================================================
   SOUNDING — a descent in four zones
   Palette: water-column blues, bioluminal cyan, lure amber
   Type: Instrument Serif (display) + IBM Plex Mono (instrument)
   ============================================================ */

@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/instrumentserif-roman-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/instrumentserif-italic-400.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibmplexmono-roman-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibmplexmono-roman-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --mist: #eaf6f6;
  --faint: rgba(234, 246, 246, 0.58);
  --ghost: rgba(234, 246, 246, 0.32);
  --cyan: #66f2e8;
  --warm: #ffd9a0;
  --deep: #010409;
  --surface: #2fa3c7;
  --hairline: rgba(234, 246, 246, 0.16);
}

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

html { scrollbar-width: thin; scrollbar-color: rgba(102,242,232,.25) #02080f; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #02080f; }
::-webkit-scrollbar-thumb { background: rgba(102,242,232,.22); border-radius: 5px; border: 2px solid #02080f; }

::selection { background: rgba(102, 242, 232, 0.35); color: #01131a; }

html, body { height: 100%; }

body {
  font-family: var(--serif);
  background: var(--deep);
  color: var(--mist);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- fixed layers ---------- */

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 130% 100% at 50% 42%, transparent 52%, rgba(1, 4, 9, 0.62) 100%);
}

.grain {
  position: fixed; inset: -60px; z-index: 3; pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.4s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-22px, 14px); }
  50% { transform: translate(14px, -20px); }
  75% { transform: translate(-8px, -12px); }
  100% { transform: translate(0, 0); }
}

/* ---------- chrome: brand / hud / rail ---------- */

.brand {
  position: fixed; top: 28px; left: 32px; z-index: 10;
  display: flex; flex-direction: column; gap: 3px;
  mix-blend-mode: screen;
}
.brand .word {
  font-family: var(--serif); font-size: 21px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--mist); text-decoration: none;
}
.brand .word em { letter-spacing: 0.28em; }
.brand .tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--faint);
}

.topnav {
  position: fixed; top: 32px; right: 36px; z-index: 10;
  display: flex; gap: 26px; align-items: center;
}
.topnav a {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--faint); text-decoration: none;
  padding-bottom: 3px; border-bottom: 1px solid transparent;
  transition: color .45s ease, border-color .45s ease;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--cyan); border-color: rgba(102,242,232,.5); outline: none; }

.hud {
  position: fixed; left: 32px; bottom: 30px; z-index: 10;
  font-family: var(--mono); user-select: none; pointer-events: none;
  transition: opacity 1.1s ease;
}
body.arrived .hud, body.arrived .rail { opacity: 0; }
.rail { transition: opacity 1.1s ease; }
.hud .depth-row { display: flex; align-items: baseline; gap: 10px; }
.hud .depth-num {
  font-size: clamp(38px, 4.6vw, 56px); font-weight: 500;
  letter-spacing: 0.06em; color: var(--mist);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(102, 242, 232, 0.25);
}
.hud .depth-unit { font-size: 13px; letter-spacing: 0.3em; color: var(--faint); }
.hud .zone-name {
  margin-top: 4px; font-size: 10px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--cyan);
  min-height: 14px;
}
.hud .stats { margin-top: 14px; display: grid; gap: 5px; }
.hud .stat {
  display: flex; gap: 12px; align-items: baseline;
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
}
.hud .stat .k { color: var(--ghost); width: 92px; white-space: nowrap; }
.hud .stat .v { color: var(--faint); font-variant-numeric: tabular-nums; }

.rail {
  position: fixed; right: 40px; top: 50%; transform: translateY(-50%);
  height: 46vh; z-index: 10; pointer-events: none; user-select: none;
}
.rail .track { position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: var(--hairline); }
.rail .marker {
  position: absolute; right: -3.5px; top: 0; width: 8px; height: 8px;
  border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 14px rgba(102, 242, 232, 0.9);
}
.rail .tick { position: absolute; right: 0; width: 10px; height: 1px; background: var(--hairline); }
.rail .tick span {
  position: absolute; right: 18px; top: -4px;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.22em;
  color: var(--ghost); white-space: nowrap;
}

.scroll-hint {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%);
  z-index: 10; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
}
.scroll-hint .line { width: 1px; height: 44px; overflow: hidden; position: relative; }
.scroll-hint .line::after {
  content: ''; position: absolute; left: 0; top: -100%; width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--cyan));
  animation: drop 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes drop { 0% { top: -100%; } 60%, 100% { top: 100%; } }

.cursor-glow {
  position: fixed; top: 0; left: 0; z-index: 4;
  width: 80px; height: 80px; pointer-events: none;
  border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(102,242,232,.34) 0%, rgba(102,242,232,.08) 42%, transparent 70%);
  mix-blend-mode: screen;
  will-change: transform, opacity;
}
@media (hover: none) { .cursor-glow { display: none; } }

.depth-rule {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(520px, 74vw); text-align: center;
  border-top: 1px solid rgba(234, 246, 246, 0.14);
  padding-top: 10px;
}
.depth-rule span {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--ghost);
}

/* ---------- flowing content ---------- */

main { position: relative; z-index: 5; }

section.hero {
  height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: 0 6vw;
}
.hero h1 {
  font-size: clamp(4.2rem, 16vw, 13rem); font-weight: 400;
  letter-spacing: 0.045em; line-height: 0.94;
  text-transform: uppercase;
  text-shadow: 0 2px 60px rgba(1, 19, 26, 0.45);
}
.hero h1 .ch { display: inline-block; }
.hero .def {
  margin-top: 3vh; font-style: italic;
  font-size: clamp(1.15rem, 2.1vw, 1.6rem); color: var(--mist); opacity: 0.92;
  max-width: 34em;
}
.hero .def b { font-style: normal; font-weight: 400; color: var(--cyan); }
.hero .kicker {
  margin-top: 4.5vh; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--faint);
}

section.zone { position: relative; padding: 0 7vw; }
#z-epi { height: 225vh; }
#z-meso { height: 265vh; }
#z-bathy { height: 360vh; }
#z-abyss { height: 175vh; }

.zone-head { position: absolute; top: 8vh; max-width: 620px; }
.zone-head.right { right: 7vw; text-align: right; }
.zone-head.left { left: 7vw; text-align: left; }
.zone-head .meta {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 18px;
}
.zone-head h2 {
  font-style: italic; font-weight: 400;
  font-size: clamp(3rem, 8.4vw, 7.6rem); line-height: 0.96;
  letter-spacing: -0.01em;
}
.zone-head p {
  margin-top: 3vh; font-size: clamp(1.05rem, 1.55vw, 1.35rem);
  line-height: 1.55; color: var(--faint); font-style: normal;
}
.zone-head.right p { margin-left: auto; max-width: 30em; }
.zone-head.left p { max-width: 30em; }

.caption {
  position: absolute; left: 50%; transform: translateX(-50%);
  text-align: center; max-width: 560px; width: 86%;
}
.caption .meta {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--ghost); margin-bottom: 14px;
}
.caption p {
  font-style: italic; font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  line-height: 1.42; color: var(--mist);
}
.caption p b { color: var(--cyan); font-weight: 400; font-style: normal; }

/* ---------- floor / arrival ---------- */

section.floor { height: 190vh; position: relative; }
.floor-panel {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 6vw;
}
.floor-panel .meta {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 3vh;
}
.floor-panel h2 {
  font-size: clamp(4rem, 13vw, 11rem); font-weight: 400; line-height: 0.95;
  letter-spacing: 0.01em;
}
.floor-panel h2 em { letter-spacing: 0.03em; }
.floor-panel .close-line {
  margin-top: 3.6vh; font-style: italic;
  font-size: clamp(1.1rem, 1.9vw, 1.5rem); color: var(--faint); max-width: 36em; line-height: 1.6;
}
.floor-actions { margin-top: 6vh; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em;
  text-transform: uppercase; text-decoration: none; cursor: pointer;
  color: var(--mist); background: transparent;
  border: 1px solid rgba(234, 246, 246, 0.28); border-radius: 999px;
  padding: 15px 30px; transition: all .5s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex; align-items: center; gap: 10px;
}
.btn svg { display: block; }
.btn:hover, .btn:focus-visible {
  border-color: var(--cyan); color: var(--cyan);
  box-shadow: 0 0 30px rgba(102, 242, 232, 0.22), inset 0 0 18px rgba(102, 242, 232, 0.08);
  outline: none;
}
.btn.solid { background: rgba(102, 242, 232, 0.12); border-color: rgba(102, 242, 232, 0.45); color: var(--cyan); }

.colophon {
  position: absolute; bottom: 26px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ghost); padding: 0 4vw; text-align: center;
}
.colophon a { color: var(--faint); text-decoration: none; border-bottom: 1px solid var(--hairline); }
.colophon a:hover { color: var(--cyan); }

/* ---------- preloader ---------- */

#preloader {
  position: fixed; inset: 0; z-index: 50;
  background: #041827;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 26px;
}
#preloader .word {
  font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0.42em; text-transform: uppercase; color: var(--mist);
  padding-left: 0.42em;
}
#preloader .bar { width: min(240px, 50vw); height: 1px; background: rgba(234,246,246,.14); overflow: hidden; }
#preloader .bar i { display: block; height: 100%; width: 0%; background: var(--cyan); }
#preloader .status {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--faint);
}

/* ---------- reveals ---------- */

[data-reveal] { opacity: 0; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .rail { display: none; }
  .topnav { right: 28px; }
}
@media (max-width: 720px) {
  .brand { top: 20px; left: 20px; }
  .topnav { top: 24px; right: 20px; gap: 16px; }
  .hud { left: 20px; bottom: 22px; }
  .hud .depth-num { font-size: 34px; }
  .hud .stats { display: none; }
  section.zone { padding: 0 24px; }
  .zone-head.right, .zone-head.left { left: 24px; right: 24px; text-align: left; }
  .zone-head.right p { margin-left: 0; }
  .scroll-hint { display: none; }
  .floor-panel h2 { font-size: clamp(3.2rem, 15vw, 5.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .scroll-hint .line::after { animation: none; }
}

noscript .ns {
  position: fixed; inset: 0; z-index: 100; background: var(--deep);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--faint); padding: 24px;
}
