/* =========================================================
   Deep Dive — editorial ocean explainer
   Hand-written CSS. No frameworks. Serif type. Long page.
   ========================================================= */

:root {
  --serif: "Charter", "Iowan Old Style", "Source Serif Pro", "Georgia",
    "Times New Roman", serif;
  --sans: "Inter", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  --measure: 36rem;

  /* Depth palette (set by JS as we descend) */
  --bg: #cfeaf2;
  --bg-2: #a4d4e3;
  --ink: #0a1820;
  --rule: rgba(10, 24, 32, 0.18);
  --accent: #0a1820;
  --muted: rgba(10, 24, 32, 0.62);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  letter-spacing: 0.005em;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  transition: background-color 1200ms ease, color 1200ms ease;
  overflow-x: hidden;
}

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

a { color: inherit; }

/* ---------- Top masthead ---------- */
.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 2rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(4px);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  transition: background-color 1200ms ease, border-color 1200ms ease, color 1200ms ease;
}
.masthead .title { font-weight: 600; }
.masthead .depth-readout {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- Layout primitives ---------- */
.measure {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.zone {
  position: relative;
  min-height: 110vh;
  padding: 8rem 0 6rem;
  overflow: hidden;
}

.zone__label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.2rem;
  display: flex;
  gap: 1.2rem;
  align-items: center;
}
.zone__label::before {
  content: "";
  display: inline-block;
  width: 2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.zone__title {
  font-size: clamp(2.4rem, 5.5vw, 4.6rem);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 1.6rem;
}

.zone__caption {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--ink);
  font-style: italic;
  border-left: 2px solid var(--rule);
  padding-left: 1.4rem;
  margin: 0 0 2.4rem;
  max-width: 32rem;
}

.zone__body p {
  margin: 0 0 1.4rem;
}

.zone__body p:first-of-type::first-letter {
  font-size: 3.6rem;
  float: left;
  line-height: 0.92;
  padding: 0.4rem 0.5rem 0 0;
  font-weight: 500;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  padding-top: 12vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}
.hero .kicker {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  margin-bottom: 1.6rem;
  color: var(--muted);
}
.hero h1 {
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.96;
  margin: 0 auto 2rem;
  max-width: 14ch;
  letter-spacing: -0.025em;
  font-weight: 500;
}
.hero .lede {
  max-width: 32rem;
  font-size: 1.18rem;
  margin: 0 auto 4rem;
  line-height: 1.55;
  color: var(--ink);
}
.hero .scroll-cue {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.hero .scroll-cue .line {
  width: 1px;
  height: 56px;
  background: currentColor;
  opacity: 0.6;
  animation: drop 2.4s ease-in-out infinite;
  transform-origin: top;
}
@keyframes drop {
  0%, 100% { transform: scaleY(0.2); opacity: 0.2; }
  50% { transform: scaleY(1); opacity: 0.7; }
}

/* ---------- Species illustrations on the page ---------- */
.species-stage {
  position: relative;
  width: 100%;
  height: 0;
  pointer-events: none;
}
.species {
  position: absolute;
  width: clamp(190px, 26vw, 360px);
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.25));
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 400ms;
  will-change: transform;
}
.species:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 22px 60px rgba(0, 0, 0, 0.35));
}
.species[data-parallax="slow"] { z-index: 1; opacity: 0.92; }
.species[data-parallax="med"]  { z-index: 2; }
.species[data-parallax="fast"] { z-index: 3; }

.species figcaption {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ---------- Bioluminescence (deep zones) ---------- */
.biolum {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1500ms ease;
}
.biolum.is-on { opacity: 1; }
.biolum span {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #d8f0ff;
  box-shadow: 0 0 8px 2px rgba(216, 240, 255, 0.7);
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ---------- Drawer (tour guide) ---------- */
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(560px, 92vw);
  height: 100vh;
  background: #faf6ee;
  color: #161410;
  z-index: 50;
  transform: translateX(101%);
  transition: transform 520ms cubic-bezier(0.7, 0, 0.2, 1);
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }

.drawer__head {
  padding: 2rem 2.4rem 1rem;
  border-bottom: 1px solid rgba(22, 20, 16, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.drawer__kicker {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(22, 20, 16, 0.55);
}
.drawer__title {
  font-size: 2.2rem;
  margin: 0.4rem 0 0;
  letter-spacing: -0.015em;
  font-weight: 500;
  line-height: 1.05;
}
.drawer__close {
  background: none;
  border: 1px solid rgba(22, 20, 16, 0.2);
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  color: inherit;
  border-radius: 999px;
  transition: background 200ms;
}
.drawer__close:hover { background: rgba(22, 20, 16, 0.08); }

.drawer__art {
  padding: 1rem 2.4rem 0.5rem;
}
.drawer__art svg { width: 100%; height: auto; max-height: 28vh; }

.drawer__body {
  padding: 1.2rem 2.4rem 2.4rem;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.7;
  flex: 1 1 auto;
}
.drawer__body .byline {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(22, 20, 16, 0.5);
  margin-bottom: 1.4rem;
}
.drawer__body .essay {
  white-space: pre-wrap;
}
.drawer__body .essay::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  background: currentColor;
  vertical-align: -0.18em;
  margin-left: 2px;
  animation: blink 900ms steps(1) infinite;
  opacity: 0.7;
}
.drawer.is-done .drawer__body .essay::after { display: none; }
@keyframes blink { 50% { opacity: 0; } }

.scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 380ms ease;
}
.scrim.is-on { opacity: 1; pointer-events: auto; }

/* ---------- Multiplayer cursors ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 60;
  transform: translate(-50%, -50%);
  transition: transform 80ms linear;
}
.cursor .dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #f5d97a;
  box-shadow: 0 0 16px 4px rgba(245, 217, 122, 0.6);
}
.cursor .name {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f5d97a;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.colophon {
  padding: 6rem 0 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  background: #050a10;
  color: rgba(220, 230, 240, 0.6);
}
.colophon p { margin: 0.4rem 0; }

/* ---------- Pull-quote ---------- */
.pullquote {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  line-height: 1.3;
  font-style: italic;
  letter-spacing: -0.01em;
  text-align: center;
  margin: 4rem auto;
  max-width: 32rem;
}
.pullquote cite {
  display: block;
  font-size: 0.74rem;
  font-style: normal;
  font-family: var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 1.2rem;
  color: var(--muted);
}

/* ---------- Section transitions ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1200ms ease, transform 1200ms ease;
}
.fade-up.is-in {
  opacity: 1;
  transform: none;
}

@media (max-width: 700px) {
  body { font-size: 17px; }
  .masthead { padding: 0.8rem 1.1rem; font-size: 0.62rem; }
  .zone { padding: 5rem 0 4rem; min-height: 90vh; }
  .species { width: 60vw; }
}
