:root {
  /* labels (Google IntersectionObserver (NOT listeners threshold primary pair */
  --abyss: #0a0d0f;
  --surface: #e8ddd0;
  --parchment: #f0e4d4;
  --ink: #1a1a1a;
  --umber: #2a2520;
  --stone: #d4cdc4;
  --scarlet: #d4382c;
  --tang: #0077b6;
  --cyan: #00e5cc;
  --brass: #a89880;
  --corrosion: #6b6358;
  --amber: #d4a520;
  --photo-mid: #d4c8b8;
  --photo-edge: #c9bca8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--abyss);
  color: var(--ink);
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.72;
  letter-spacing: 0.01em;
}

.dive-log { width: 100vw; }
.zone {
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, 12.5vh);
  gap: 0;
  isolation: isolate;
}

.zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 70%, rgba(168, 152, 128, 0.15) 0%, transparent 70%);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.08;
  pointer-events: none;
  filter: contrast(200%) brightness(150%) hue-rotate(var(--zone-temp, 0deg));
  background-image:
    radial-gradient(circle at 7px 11px, rgba(10, 13, 15, 0.55) 0 1px, transparent 1.6px),
    radial-gradient(circle at 31px 43px, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72px 59px, rgba(107, 99, 88, 0.7) 0 1px, transparent 1.7px),
    radial-gradient(circle at 91px 18px, rgba(10, 13, 15, 0.45) 0 1px, transparent 1.4px);
  background-size: 100px 100px;
}

.zone-surface { background: var(--surface); color: var(--ink); --zone-temp: 0deg; }
.zone-shallows { background: #d4cdc4; color: var(--umber); --zone-temp: 28deg; }
.zone-reef { background: var(--photo-edge); color: var(--ink); --zone-temp: -14deg; }
.zone-abyss { background: var(--abyss); color: var(--parchment); --zone-temp: 165deg; }
.zone-floor { background: #020305; color: var(--parchment); --zone-temp: 190deg; }

.zone-shallows::before { background: radial-gradient(ellipse at 68% 28%, rgba(0, 119, 182, 0.18) 0%, transparent 61%), radial-gradient(ellipse at 18% 80%, rgba(168, 152, 128, 0.16) 0%, transparent 58%); }
.zone-reef::before { background: radial-gradient(ellipse at 55% 46%, rgba(212, 56, 44, 0.23) 0%, transparent 48%), radial-gradient(ellipse at 72% 70%, rgba(0, 119, 182, 0.16) 0%, transparent 50%); }
.zone-abyss::before { background: radial-gradient(ellipse at 70% 58%, rgba(0, 229, 204, 0.11) 0%, transparent 54%), radial-gradient(ellipse at 15% 22%, rgba(168, 152, 128, 0.07) 0%, transparent 49%); }
.zone-floor::before { background: radial-gradient(ellipse at 49% 74%, rgba(0, 229, 204, 0.06) 0%, transparent 61%), radial-gradient(ellipse at 18% 38%, rgba(168, 152, 128, 0.05) 0%, transparent 53%); }

.note {
  position: relative;
  z-index: 3;
  padding: clamp(1.2rem, 3vw, 2.8rem);
  max-width: 58ch;
  border: 1px solid rgba(107, 99, 88, 0.62);
  border-radius: 2px 4px 3px 1px;
  background: linear-gradient(135deg, #e8ddd0 0%, #d4c8b8 50%, #c9bca8 100%);
  box-shadow: inset 0 0 80px rgba(139, 119, 90, 0.4), 0 28px 90px rgba(10, 13, 15, 0.18);
  transform: translateX(var(--offset, 0));
}

.zone-abyss .note,
.zone-floor .note {
  background: linear-gradient(135deg, rgba(42, 37, 32, 0.88) 0%, rgba(10, 13, 15, 0.96) 58%, rgba(0, 229, 204, 0.06) 100%);
  border-color: rgba(168, 152, 128, 0.54);
  box-shadow: inset 0 0 80px rgba(0, 229, 204, 0.08), 0 28px 120px rgba(0, 0, 0, 0.55);
}

.note-surface { grid-column: 2 / 7; grid-row: 3 / 7; --offset: -3px; }
.note-shallows { grid-column: 7 / 12; grid-row: 2 / 6; --offset: 4px; }
.note-reef { grid-column: 2 / 6; grid-row: 2 / 7; --offset: -2px; }
.note-abyss { grid-column: 3 / 8; grid-row: 3 / 7; --offset: 3px; }
.note-floor { grid-column: 6 / 11; grid-row: 2 / 7; --offset: -4px; }

.zone-title {
  margin: 0 0 1.25rem;
  font-family: "Cormorant Garamond", Cormorant, serif;
  font-weight: 700;
  font-size: clamp(2.8rem, 6vw, 6.5rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px currentColor;
  background: linear-gradient(90deg, currentColor 0 48%, transparent 52% 100%);
  background-size: 220% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  transform: translateY(18px);
}

.zone-surface .zone-title,
.zone-shallows .zone-title,
.zone-reef .zone-title { color: #1a1a1a; }
.zone-abyss .zone-title,
.zone-floor .zone-title { color: #f0e4d4; }
.zone-title.reveal { animation: titleFill 1800ms cubic-bezier(0.65, 0, 0.35, 1) forwards; }

@keyframes titleFill {
  0% { opacity: 0; transform: translateY(18px); background-position: 100% 0; }
  20% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); background-position: 0 0; }
}

.zone-text {
  margin: 0 0 1rem;
  color: #2a2520;
  max-width: 58ch;
}
.zone-abyss .zone-text,
.zone-floor .zone-text { color: #d4cdc4; }
.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 520ms ease, transform 520ms ease;
  transition-delay: calc(var(--i) * 40ms);
}
.zone-text.reveal .word { opacity: 1; transform: translateY(0); }

.specimen.label {
  position: relative;
  z-index: 3;
  align-self: start;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a89880;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(168, 152, 128, 0.7);
  background: rgba(10, 13, 15, 0.06);
  border-radius: 1px 3px 2px 4px;
}
.label-one { grid-column: 9 / 12; grid-row: 2; }
.label-two { grid-column: 2 / 6; grid-row: 6; }
.label-three { grid-column: 8 / 12; grid-row: 7; }
.label-four { grid-column: 8 / 12; grid-row: 2; color: #00e5cc; border-color: rgba(0, 229, 204, 0.42); }
.label-five { grid-column: 2 / 5; grid-row: 2; }

.fish,
.jelly,
.crack,
.divider,
.floor-gauge-specimen {
  position: relative;
  z-index: 2;
  overflow: visible;
}
.draw-lines, .crack path, .divider path, .floor-gauge-specimen .draw-lines, .gauge-ticks, #depth-line {
  stroke: #6b6358;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.fish .draw-lines { stroke: #1a1a1a; stroke-width: 2.4; }
.zone-abyss .draw-lines, .zone-floor .draw-lines, .jelly .draw-lines { stroke: #00e5cc; }
.fill-shapes { opacity: 0; transition: opacity 800ms ease 2400ms; }
.revealed .fill-shapes { opacity: 0.82; }
.revealed .draw-lines path,
.revealed .draw-lines circle,
.revealed .draw-lines ellipse,
.revealed .crack path,
.revealed.crack path,
.revealed.divider path,
.revealed.floor-gauge-specimen path { stroke-dashoffset: 0 !important; }

.vermillion { fill: #d4382c; }
.scarlet { fill: #d4382c; opacity: 0.85; }
.scarlet-soft { fill: #d4382c; opacity: 0.58; }
.blue-trim { fill: #0077b6; opacity: 0.82; }
.tang-blue { fill: #0077b6; }
.gold-tail { fill: #d4a520; }
.amber { fill: #d4a520; opacity: 0.76; }

.ghost-fish { grid-column: 7 / 13; grid-row: 3 / 7; width: 49vw; opacity: 0.72; filter: sepia(0.45) saturate(1.3); animation: drift 22s ease-in-out infinite alternate, wobble 15s ease-in-out infinite; animation-play-state: paused; }
.reef-angel { grid-column: 6 / 13; grid-row: 2 / 6; width: 43vw; filter: blur(0.6px) saturate(1.4); animation: drift 20s ease-in-out infinite alternate, wobble 14s ease-in-out infinite; animation-play-state: paused; }
.school { position: relative; z-index: 2; grid-column: 1 / 8; grid-row: 2 / 7; }
.tang { position: absolute; width: 15vw; min-width: 115px; filter: sepia(0.25) saturate(1.55); animation: drift 18s ease-in-out infinite alternate, wobble 12.6s ease-in-out infinite; animation-play-state: paused; }
.tang-one { left: 9vw; top: 8vh; animation-duration: 15s, 10.5s; }
.tang-two { left: 22vw; top: 31vh; width: 11vw; animation-duration: 24s, 16.8s; }
.tang-three { left: 3vw; top: 51vh; width: 9vw; animation-duration: 30s, 21s; }
.discus { position: absolute; filter: blur(1px) saturate(1.4); animation: drift 26s ease-in-out infinite alternate, wobble 18s ease-in-out infinite; animation-play-state: paused; }
.discus-one { width: 18vw; right: 15vw; bottom: 7vh; }
.discus-two { width: 10vw; right: 3vw; top: 14vh; animation-duration: 19s, 13.3s; }
.jelly-one { grid-column: 8 / 12; grid-row: 3 / 8; width: 22vw; min-width: 180px; opacity: 0.62; filter: drop-shadow(0 0 22px rgba(0, 229, 204, 0.32)); animation: drift 28s ease-in-out infinite alternate, wobble 19.6s ease-in-out infinite; animation-play-state: paused; }
.floor-gauge-specimen { grid-column: 2 / 5; grid-row: 3 / 8; width: 24vw; max-height: 67vh; opacity: 0.58; }
.crack { position: absolute; z-index: 2; opacity: 0.55; }
.crack-a { left: -6vw; bottom: 10vh; width: 86vw; height: 18vh; }
.crack-b { right: -8vw; bottom: 6vh; width: 72vw; height: 24vh; opacity: 0.35; }
.divider { position: absolute; left: 0; bottom: -10px; width: 100vw; height: 34px; }
.divider path { stroke: #a89880; stroke-width: 1.5; fill: none; }
.crack path { fill: none; stroke: #6b6358; stroke-width: 1; }
.zone.active .fish,
.zone.active .jelly,
.zone.active .discus { animation-play-state: running; }

@keyframes drift { from { transform: translateX(-5vw); } to { transform: translateX(5vw); } }
@keyframes wobble { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }

.depth-gauge {
  position: fixed;
  z-index: 10;
  top: 3vh;
  right: 1.1vw;
  height: 94vh;
  width: 64px;
  pointer-events: none;
  opacity: 0.88;
}
#depth-line { fill: none; stroke: #a89880; stroke-width: 1.6; filter: drop-shadow(0 0 6px rgba(0, 229, 204, 0.16)); }
.gauge-ticks path { stroke: #a89880; stroke-width: 1; fill: none; opacity: 0.78; }
.depth-readout {
  position: fixed;
  z-index: 11;
  right: 1.65vw;
  bottom: 2vh;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: #a89880;
  text-transform: uppercase;
}

@media (max-width: 800px) {
  .zone { grid-template-rows: repeat(10, 10vh); }
  .note { grid-column: 2 / 12; grid-row: 3 / 8; }
  .label-one, .label-two, .label-three, .label-four, .label-five { grid-column: 2 / 10; grid-row: 2; }
  .ghost-fish, .reef-angel { grid-column: 4 / 13; grid-row: 6 / 10; width: 78vw; }
  .school { grid-column: 1 / 12; grid-row: 6 / 10; }
  .discus-one { width: 34vw; right: 7vw; bottom: 4vh; }
  .discus-two { width: 22vw; top: 10vh; }
  .jelly-one { grid-column: 6 / 12; grid-row: 6 / 10; width: 34vw; }
  .floor-gauge-specimen { grid-column: 1 / 6; grid-row: 6 / 10; width: 42vw; }
  .depth-gauge { right: -12px; }
  .depth-readout { right: 14px; }
}
