/* ============================================================
   ABYSS — art direction
   Display: Italiana · Body: Archivo · Instruments: IBM Plex Mono
   ============================================================ */

:root {
  --bg-surface: #17655b;
  --bg-deep: #010304;
  --biolume: #7fffe4;
  --lure: #ffc97f;
  --bone: #e6f0ed;
  --bone-dim: rgba(230, 240, 237, 0.55);
  --hairline: rgba(230, 240, 237, 0.18);
  --font-display: "Italiana", serif;
  --font-body: "Archivo", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --pad-edge: 6vw;
}

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

/* overflow-x: clip (not hidden) — stops wide hero type expanding the
   mobile layout viewport, which mis-sizes every vw unit on the page */
html {
  scrollbar-width: thin; scrollbar-color: rgba(127, 255, 228, 0.25) transparent;
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  color: var(--bone);
  background: var(--bg-deep);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(127, 255, 228, 0.3); }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: #041a17;
  display: flex; align-items: center; justify-content: center;
}
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }
.loader-brand {
  font-family: var(--font-display);
  font-size: 2.2rem; letter-spacing: 0.42em; text-indent: 0.42em;
  color: var(--bone);
}
.loader-track { width: 180px; height: 1px; background: rgba(230, 240, 237, 0.15); overflow: hidden; }
#loader-bar { width: 100%; height: 100%; background: var(--biolume); transform: translateX(-100%); }
#loader-status {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--bone-dim);
}

/* ---------- Canvas ---------- */
.canvas-wrap { position: fixed; inset: 0; z-index: 1; }
#canvas { width: 100%; height: 100%; display: block; }

/* ---------- Dark overlay ---------- */
#dark-overlay {
  position: fixed; inset: 0; z-index: 3;
  background: radial-gradient(ellipse at 50% 50%, rgba(1, 4, 6, 0.82) 0%, rgba(0, 1, 2, 0.96) 100%);
  opacity: 0; pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 1.6rem var(--pad-edge) 0;
  mix-blend-mode: screen;
}
.header-brand {
  font-family: var(--font-display); font-size: 1.15rem;
  letter-spacing: 0.38em; color: var(--bone);
}
.header-meta {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em;
  color: var(--bone-dim); text-transform: uppercase;
}

/* ---------- HUD readouts (top right) ---------- */
.hud {
  position: fixed; right: var(--pad-edge); top: 50%; transform: translateY(-50%);
  z-index: 20; display: flex; flex-direction: column; gap: 1.1rem;
  font-family: var(--font-mono);
  text-align: right;
}
.hud-readouts { display: flex; flex-direction: column; gap: 0.45rem; }
.hud-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 0.9rem; }
.hud-label { font-size: 0.55rem; letter-spacing: 0.22em; color: var(--bone-dim); }
.hud-value {
  font-size: 0.78rem; font-weight: 500; color: var(--bone);
  font-variant-numeric: tabular-nums; min-width: 6.2ch;
}
.hud-value span { color: var(--biolume); }
.hud-zone {
  font-size: 0.55rem; letter-spacing: 0.3em; color: var(--bone-dim);
  border-top: 1px solid var(--hairline); padding-top: 0.7rem;
}

/* ---------- Depth rail (left) ---------- */
.depth-rail {
  position: fixed; left: var(--pad-edge); top: 50%; transform: translateY(-50%);
  z-index: 20; height: 52vh;
}
.rail-line { position: relative; width: 1px; height: 100%; background: var(--hairline); }
.rail-tick {
  position: absolute; left: 0; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 0.52rem; letter-spacing: 0.1em;
  color: var(--bone-dim); white-space: nowrap; padding-left: 12px;
}
.rail-tick i { position: absolute; left: -2px; top: 50%; width: 5px; height: 1px; background: var(--bone-dim); }
#rail-marker {
  position: absolute; left: -3.5px; top: 0; width: 8px; height: 8px;
  border-radius: 50%; background: var(--biolume);
  box-shadow: 0 0 10px 1px rgba(127, 255, 228, 0.7);
  transform: translateY(-50%);
}

/* ---------- Floodlight hint ---------- */
#light-hint {
  position: fixed; z-index: 20; left: 50%; top: 62%;
  transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 0.8rem;
  font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--biolume);
  opacity: 0; pointer-events: none;
}
.hint-ring {
  width: 26px; height: 26px; border: 1px solid var(--biolume); border-radius: 50%;
  animation: hint-pulse 2.2s ease-out infinite;
}
@keyframes hint-pulse {
  0% { transform: scale(0.7); opacity: 1; }
  70%, 100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Marquee ---------- */
.marquee-wrap {
  position: fixed; top: 50%; left: 0; right: 0; z-index: 4;
  transform: translateY(-50%);
  overflow: hidden; white-space: nowrap;
  opacity: 0; pointer-events: none;
  mix-blend-mode: screen;
}
.marquee-text {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11vw; line-height: 1;
  letter-spacing: 0.06em;
  color: rgba(127, 255, 228, 0.1);
  -webkit-text-stroke: 1px rgba(127, 255, 228, 0.32);
}

/* ---------- Scroll container & sections ---------- */
#scroll-container { position: relative; height: 1050vh; z-index: 10; }

.scroll-section {
  position: absolute; left: 0; right: 0;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  pointer-events: none;
  visibility: hidden;
}
.scroll-section .section-inner,
.scroll-section .stats-grid,
.scroll-section .hero-inner { pointer-events: auto; }

/* Side zones — creatures own the centre of the frame.
   Left copy clears the depth rail; right copy clears the HUD column. */
.align-left { padding-left: calc(var(--pad-edge) + 84px); padding-right: 55vw; align-items: flex-start; }
.align-right { padding-left: 52vw; padding-right: calc(var(--pad-edge) + 150px); align-items: flex-start; }
.align-left .section-inner, .align-right .section-inner { max-width: 34rem; }

/* ---------- Hero ---------- */
.section-hero { text-align: center; align-items: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero-label { margin-bottom: 2.2rem; }
.hero-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(6rem, 21vw, 19rem);
  line-height: 0.86;
  letter-spacing: 0.08em; text-indent: 0.08em;
  color: var(--bone);
  text-shadow: 0 0 60px rgba(127, 255, 228, 0.25);
  display: flex;
}
.hero-heading span { display: inline-block; }
.hero-tagline {
  margin-top: 2.4rem;
  font-size: 1.02rem; font-weight: 400; letter-spacing: 0.04em;
  color: var(--bone-dim); line-height: 1.7;
}
.scroll-indicator {
  margin-top: 4.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--bone-dim);
}
.scroll-arrow { animation: sink 2s cubic-bezier(0.45, 0, 0.55, 1) infinite; color: var(--biolume); }
@keyframes sink {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(9px); opacity: 1; }
}

/* ---------- Section typography ---------- */
.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--biolume);
  margin-bottom: 1.6rem;
}
.section-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 5.6vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
  color: var(--bone);
  margin-bottom: 1.8rem;
}
.section-body {
  font-size: 1.02rem; font-weight: 400;
  line-height: 1.75; letter-spacing: 0.01em;
  color: var(--bone-dim);
  max-width: 30rem;
}
.section-note {
  margin-top: 1.6rem;
  font-family: var(--font-mono); font-size: 0.66rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--lure);
}

/* ---------- Stats ---------- */
.section-stats { align-items: center; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, auto);
  gap: 5.5vw;
  padding: 0 var(--pad-edge);
}
.stat { display: flex; flex-direction: column; align-items: flex-start; }
/* Numerals in Archivo — Italiana's figures read as Roman capitals (10 → IO) */
.stat-number {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(3rem, 5.6vw, 5.4rem);
  letter-spacing: -0.03em;
  line-height: 1; color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.stat-suffix {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--biolume); letter-spacing: 0.14em;
  margin-top: 0.5rem;
}
.stat-label {
  margin-top: 0.9rem;
  font-size: 0.74rem; letter-spacing: 0.06em;
  color: var(--bone-dim); max-width: 13rem; line-height: 1.5;
}

/* ---------- Finale ---------- */
.finale-depth {
  font-family: var(--font-body); font-weight: 500;
  letter-spacing: -0.035em;
  font-size: clamp(4rem, 8.6vw, 8.2rem);
  line-height: 1; color: var(--bone);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.6rem;
  text-shadow: 0 0 80px rgba(127, 255, 228, 0.3);
}
.finale-unit { font-size: 0.35em; color: var(--biolume); margin-left: 0.18em; }
.finale-name {
  font-family: var(--font-mono); font-weight: 400;
  font-size: 0.85rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--biolume); margin-bottom: 2rem;
}
/* Note: GSAP owns transform/opacity on this element — only colors transition here */
.cta-button {
  margin-top: 2.6rem;
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--bone); background: transparent;
  border: 1px solid rgba(127, 255, 228, 0.4);
  padding: 1.1rem 2.4rem; cursor: pointer;
  transition: border-color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              color 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.cta-button:hover { border-color: var(--biolume); background: rgba(127, 255, 228, 0.08); color: #ffffff; }
.cta-button:focus-visible { outline: 2px solid var(--biolume); outline-offset: 4px; }
.cta-button:active { background: rgba(127, 255, 228, 0.16); }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  :root { --pad-edge: 7vw; }
  #scroll-container { height: 750vh; }
  .align-left, .align-right {
    padding-left: var(--pad-edge); padding-right: var(--pad-edge);
    align-items: flex-start;
  }
  .align-left .section-inner, .align-right .section-inner {
    max-width: 100%;
    background: linear-gradient(180deg, rgba(1, 4, 6, 0.55), rgba(1, 4, 6, 0.72));
    padding: 1.6rem 1.4rem; border-left: 1px solid rgba(127, 255, 228, 0.25);
  }
  .hud { right: var(--pad-edge); top: auto; bottom: 4vh; transform: none; }
  #light-hint { display: none; }
  .hud-row { gap: 0.5rem; }
  .depth-rail { display: none; }
  .header-meta { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 2.2rem; }
  .hero-heading { font-size: clamp(4.2rem, 24vw, 8rem); }
  .marquee-text { font-size: 16vw; }
}

/* Touch devices have no cursor to guide */
@media (hover: none) {
  #light-hint { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-arrow, .hint-ring { animation: none; }
}
