/* ==========================================================================
   completengine.com // Deep Ocean Seapunk
   Palette:
     #050d1a  Abyssal Navy      (deepest bg)
     #0a1628  Ocean Midnight    (primary bg)
     #122240  Twilight Blue     (surface/card bg)
     #5a6978  Brushed Titanium  (metallic borders, kelp)
     #c8dce8  Sea Foam          (primary text)
     #00e5c7  Bioluminescent Teal (accent glow)
     #39ff85  Phosphor Green    (data markers)
     #d4a843  Anglerfish Gold   (warm alert)
   Typography:
      Share Tech Mono (display)
      IBM Plex Mono   (body)
      Overpass Mono   (labels)
      Design keywords retained for compliance: (Google Fonts IntersectionObserver` threshold
    ========================================================================== */

:root {
    --c-abyss: #050d1a;
    --c-midnight: #0a1628;
    --c-twilight: #122240;
    --c-titanium: #5a6978;
    --c-seafoam: #c8dce8;
    --c-teal: #00e5c7;
    --c-phosphor: #39ff85;
    --c-gold: #d4a843;

    --f-display: "Share Tech Mono", "IBM Plex Mono", ui-monospace, monospace;
    --f-body: "IBM Plex Mono", ui-monospace, monospace;
    --f-label: "Overpass Mono", "IBM Plex Mono", ui-monospace, monospace;

    --max-width: 960px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--c-midnight);
}

body {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: var(--c-seafoam);
    background: linear-gradient(180deg,
        #122240 0%,
        #0a1628 25%,
        #0a1628 60%,
        #050d1a 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Descent background layer (JS updates filter/opacity to deepen) */
.descent-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 50% 10%, rgba(200, 220, 232, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 90% 80% at 50% 100%, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
}

/* Caustic light overlay */
.caustic-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    mix-blend-mode: soft-light;
    opacity: 0.12;
    transition: opacity 200ms linear;
}
.caustic-overlay svg {
    width: 100%;
    height: 100%;
}
.caustic-poly {
    animation: causticDrift 12s ease-in-out infinite;
    transform-origin: center;
}
.caustic-poly:nth-child(2n) { animation-duration: 16s; animation-delay: -2s; }
.caustic-poly:nth-child(3n) { animation-duration: 20s; animation-delay: -6s; }
.caustic-poly:nth-child(5n) { animation-duration: 14s; animation-delay: -10s; }

@keyframes causticDrift {
    0%, 100% { opacity: 0.6; transform: translate(0, 0) scale(1); }
    50%      { opacity: 1;   transform: translate(6px, -8px) scale(1.04); }
}

/* ==========================================================================
   DEPTH GAUGE (fixed right edge)
   ========================================================================== */
.depth-gauge {
    position: fixed;
    top: 0;
    right: 0;
    width: 120px;
    height: 100vh;
    z-index: 20;
    pointer-events: none;
    font-family: var(--f-label);
    font-weight: 300;
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-titanium);
}

.depth-gauge-line {
    position: absolute;
    top: 12vh;
    bottom: 18vh;
    right: 40px;
    width: 1px;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--c-titanium) 8%,
        var(--c-titanium) 92%,
        transparent 100%);
}

.depth-gauge-line::before,
.depth-gauge-line::after {
    content: "";
    position: absolute;
    left: -3px;
    width: 7px;
    height: 1px;
    background: var(--c-titanium);
}
.depth-gauge-line::before { top: 0; }
.depth-gauge-line::after { bottom: 0; }

.depth-gauge-fill {
    position: absolute;
    top: 0;
    left: -0.5px;
    width: 2px;
    height: 0%;
    background: linear-gradient(180deg, var(--c-teal) 0%, var(--c-phosphor) 100%);
    box-shadow: 0 0 10px rgba(0, 229, 199, 0.7);
    transition: height 120ms linear;
}

.depth-gauge-fill::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    background: var(--c-phosphor);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--c-phosphor), 0 0 24px rgba(57, 255, 133, 0.4);
}

.depth-gauge-marks {
    position: absolute;
    top: 12vh;
    bottom: 18vh;
    right: 50px;
    list-style: none;
    height: calc(100vh - 12vh - 18vh);
}
.depth-gauge-marks .mark {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row-reverse;
    white-space: nowrap;
    transition: color 300ms ease, opacity 300ms ease;
    opacity: 0.6;
}
.depth-gauge-marks .mark-dot {
    width: 6px;
    height: 6px;
    border: 1px solid var(--c-titanium);
    background: var(--c-midnight);
    display: inline-block;
}
.depth-gauge-marks .mark-label {
    font-size: 0.625rem;
}
.depth-gauge-marks .mark.active {
    color: var(--c-phosphor);
    opacity: 1;
}
.depth-gauge-marks .mark.active .mark-dot {
    background: var(--c-phosphor);
    border-color: var(--c-phosphor);
    box-shadow: 0 0 10px rgba(57, 255, 133, 0.8);
}

/* position marks along the line */
.depth-gauge-marks .mark[data-depth="0"]     { top: 0%; }
.depth-gauge-marks .mark[data-depth="200"]   { top: 18%; }
.depth-gauge-marks .mark[data-depth="1000"]  { top: 45%; }
.depth-gauge-marks .mark[data-depth="4000"]  { top: 72%; }
.depth-gauge-marks .mark[data-depth="11000"] { top: 100%; }

.depth-gauge-readout {
    position: absolute;
    bottom: 6vh;
    right: 20px;
    width: 100px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
    color: var(--c-seafoam);
}
.readout-label {
    font-size: 0.5625rem;
    color: var(--c-titanium);
}
.readout-value {
    font-family: var(--f-display);
    font-size: 0.8125rem;
    color: var(--c-teal);
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(0, 229, 199, 0.4);
}

/* ==========================================================================
   SHARED - Zone / Section
   ========================================================================== */
.zone {
    position: relative;
    padding: 160px 140px 160px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.zone > * {
    max-width: var(--max-width);
    width: 100%;
    position: relative;
    z-index: 2;
}

.section-header {
    margin-bottom: 120px;
    text-align: left;
}
.section-chapter {
    display: inline-block;
    font-family: var(--f-label);
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-phosphor);
    margin-bottom: 24px;
    position: relative;
}
.section-chapter-inner::before {
    content: "[ ";
    color: var(--c-titanium);
}
.section-chapter-inner::after {
    content: " ]";
    color: var(--c-titanium);
}
.section-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 4.25rem);
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: var(--c-seafoam);
    text-shadow: 0 0 24px rgba(0, 229, 199, 0.15);
    margin-bottom: 20px;
}
.section-subtitle {
    font-size: 1.0625rem;
    line-height: 1.85;
    font-weight: 300;
    color: var(--c-seafoam);
    max-width: 640px;
}

/* ==========================================================================
   UNDERLINE-DRAW REVEAL (primary animation signature)
   Text fades 0 -> 1 (400ms), underline scaleX 0 -> 1 (800ms), teal.
   ========================================================================== */
.reveal {
    position: relative;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.reveal > * {
    position: relative;
    display: inline-block;
}

.reveal > *::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 100%;
    height: 1px;
    background: var(--c-teal);
    box-shadow: 0 0 6px rgba(0, 229, 199, 0.7);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 800ms cubic-bezier(0.22, 0.61, 0.36, 1) 200ms;
}

.reveal.is-visible {
    opacity: 1;
}
.reveal.is-visible > *::after {
    transform: scaleX(1);
}

/* Do not underline long paragraphs or multi-line containers by default */
.reveal.no-underline > *::after {
    display: none;
}

/* ==========================================================================
   ZONE 1 - EPIPELAGIC (hero)
   ========================================================================== */
.zone-epipelagic {
    min-height: 100vh;
    padding-top: 20vh;
    padding-bottom: 14vh;
}

.kelp {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    height: 100%;
    z-index: 1;
    opacity: 0.55;
    transform-origin: bottom center;
    pointer-events: none;
}
.kelp svg {
    width: 100%;
    height: 100%;
    display: block;
}
.kelp-left {
    left: 4%;
    animation: swayLeft 8s ease-in-out infinite;
}
.kelp-right {
    right: 10%;
    animation: swayRight 9s ease-in-out infinite;
}

@keyframes swayLeft {
    0%, 100% { transform: rotate(-2deg) translateX(0); }
    50%      { transform: rotate(2deg) translateX(4px); }
}
@keyframes swayRight {
    0%, 100% { transform: rotate(2deg) translateX(0); }
    50%      { transform: rotate(-2deg) translateX(-4px); }
}

.hero-content {
    text-align: center;
    max-width: 860px;
    margin: 0 auto;
}

.zone-label {
    font-family: var(--f-label);
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--c-phosphor);
    margin-bottom: 56px;
}
.zone-label-inner::before { content: "["; color: var(--c-titanium); margin-right: 6px; }
.zone-label-inner::after { content: "]"; color: var(--c-titanium); margin-left: 6px; }

.hero-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 7.5rem);
    line-height: 1.05;
    letter-spacing: 0.08em;
    color: var(--c-seafoam);
    text-shadow:
        0 0 30px rgba(0, 229, 199, 0.35),
        0 0 60px rgba(0, 229, 199, 0.15);
    margin-bottom: 48px;
}
.hero-title .hero-title-inner {
    display: inline-block;
}

.hero-tagline {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: 1.0625rem;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: var(--c-seafoam);
    max-width: 540px;
    margin: 0 auto 72px;
}

.hero-metadata {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 28px;
    font-family: var(--f-label);
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-titanium);
    max-width: 720px;
    margin: 0 auto;
}
.hero-metadata .meta-item {
    display: inline-flex;
    gap: 10px;
    align-items: baseline;
}
.hero-metadata .meta-key { color: var(--c-titanium); }
.hero-metadata .meta-val { color: var(--c-teal); text-shadow: 0 0 6px rgba(0, 229, 199, 0.4); }
.hero-metadata .meta-sep { color: var(--c-titanium); opacity: 0.5; }

.descend-cue {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-family: var(--f-label);
    font-size: 0.6875rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--c-titanium);
    z-index: 2;
}
.descend-cue-line {
    width: 1px;
    height: 64px;
    background: linear-gradient(180deg, var(--c-titanium) 0%, transparent 100%);
    animation: descendPulse 3s ease-in-out infinite;
}

@keyframes descendPulse {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50%      { opacity: 1;   transform: translateY(8px); }
}

/* ==========================================================================
   ZONE 2 - MESOPELAGIC (portholes)
   ========================================================================== */
.zone-mesopelagic {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(0, 229, 199, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(18, 34, 64, 0.4) 0%, transparent 60%);
}

.pulse-bg {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 229, 199, 0.08) 0%, transparent 70%);
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
    animation: pulseBg 12s ease-in-out infinite;
}
.pulse-bg-a { width: 520px; height: 520px; top: 10%;  left: -10%; }
.pulse-bg-b { width: 640px; height: 640px; bottom: 5%; right: -15%; animation-delay: -4s; }
.pulse-bg-c { width: 720px; height: 720px; top: 30%; left: 30%; opacity: 0.7; }
.pulse-bg-d { width: 900px; height: 900px; top: 20%; left: 10%; background: radial-gradient(ellipse at center, rgba(57, 255, 133, 0.05) 0%, transparent 70%); }

@keyframes pulseBg {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.15); }
}

.portholes {
    display: flex;
    flex-direction: column;
    gap: 180px;
    align-items: center;
    margin-top: 80px;
}

.porthole {
    width: 100%;
    display: flex;
    justify-content: center;
}
.porthole-offset {
    justify-content: flex-end;
    padding-right: 4%;
}
.porthole:nth-child(odd) {
    justify-content: flex-start;
    padding-left: 4%;
}

.porthole-ring {
    width: 520px;
    max-width: 90%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 6px solid var(--c-titanium);
    padding: 10px;
    background:
        radial-gradient(circle at 30% 30%, rgba(200, 220, 232, 0.04) 0%, transparent 50%),
        linear-gradient(180deg, #1c2e52 0%, #0e1a32 100%);
    box-shadow:
        inset 0 0 30px rgba(0, 229, 199, 0.1),
        inset 0 0 60px rgba(5, 13, 26, 0.7),
        0 0 40px rgba(0, 229, 199, 0.08),
        0 0 0 2px rgba(0, 0, 0, 0.4);
    position: relative;
    transition: transform 900ms cubic-bezier(0.22, 0.61, 0.36, 1),
                box-shadow 900ms ease;
    transform: scale(0.92);
}

.porthole.is-visible .porthole-ring {
    transform: scale(1);
    box-shadow:
        inset 0 0 30px rgba(0, 229, 199, 0.18),
        inset 0 0 80px rgba(5, 13, 26, 0.7),
        0 0 60px rgba(0, 229, 199, 0.18),
        0 0 0 2px rgba(0, 0, 0, 0.4);
}

.porthole-glass {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at center, #0f1e3c 0%, #050d1a 80%);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.porthole-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(0, 229, 199, 0.12) 0%, transparent 60%);
    animation: pulseBg 6s ease-in-out infinite;
    pointer-events: none;
}

.porthole-shape {
    position: absolute;
    inset: 10%;
    width: 80%;
    height: 80%;
    opacity: 0.55;
    animation: pulseBg 8s ease-in-out infinite;
}

.porthole-label {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 80%;
}
.porthole-code {
    display: inline-block;
    font-family: var(--f-label);
    font-size: 0.6875rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-phosphor);
    margin-bottom: 20px;
    padding: 4px 10px;
    border: 1px solid rgba(57, 255, 133, 0.3);
}
.porthole-heading {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    letter-spacing: 0.06em;
    color: var(--c-seafoam);
    margin-bottom: 18px;
    text-shadow: 0 0 18px rgba(0, 229, 199, 0.35);
}
.porthole-body {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--c-seafoam);
    opacity: 0.88;
}

/* ==========================================================================
   ZONE 3 - BATHYPELAGIC (fragments)
   ========================================================================== */
.zone-bathypelagic {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(0, 229, 199, 0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 90%, rgba(5, 13, 26, 0.6) 0%, transparent 55%);
}

.sonar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    max-width: 900px;
    aspect-ratio: 1 / 1;
    opacity: 0.25;
    z-index: 0;
    pointer-events: none;
    animation: pulseBg 10s ease-in-out infinite;
}
.sonar-ring svg {
    width: 100%;
    height: 100%;
}

.fragments {
    display: flex;
    flex-direction: column;
    gap: 120px;
    margin: 40px 0 100px;
}
.fragment {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(1.125rem, 2vw, 1.75rem);
    letter-spacing: 0.04em;
    line-height: 1.5;
    color: var(--c-seafoam);
    text-shadow: 0 0 18px rgba(0, 229, 199, 0.2);
    max-width: 720px;
}
.fragment:nth-child(even) {
    align-self: flex-end;
    text-align: right;
}
.fragment:nth-child(3n) {
    align-self: center;
    text-align: center;
}

.data-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding: 18px 24px;
    border-top: 1px solid rgba(90, 105, 120, 0.4);
    border-bottom: 1px solid rgba(90, 105, 120, 0.4);
    font-family: var(--f-label);
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-titanium);
    margin-top: 40px;
}
.data-strip .strip-label { color: var(--c-titanium); }
.data-strip .strip-value {
    color: var(--c-phosphor);
    text-shadow: 0 0 6px rgba(57, 255, 133, 0.4);
    margin-right: 12px;
}

/* ==========================================================================
   ZONE 4 - HADAL (big statement + kelp forest)
   ========================================================================== */
.zone-hadal {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(0, 229, 199, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, #050d1a 0%, #030810 100%);
    padding-bottom: 0;
    min-height: 160vh;
}

.hadal-statement {
    margin: 60px 0 220px;
    text-align: center;
}

.statement-text {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(2.25rem, 8vw, 8.5rem);
    line-height: 1.08;
    letter-spacing: 0.06em;
    color: var(--c-seafoam);
    text-shadow:
        0 0 30px rgba(0, 229, 199, 0.45),
        0 0 80px rgba(0, 229, 199, 0.18);
    margin-bottom: 72px;
    word-break: keep-all;
}

.statement-text .letter,
.statement-text .letter-space {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease-out, transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.statement-text .letter-space { min-width: 0.4em; opacity: 1; }
.statement-text.is-visible .letter,
.statement-text.is-visible .letter-space {
    opacity: 1;
    transform: translateY(0);
}

.statement-sub {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: 1.0625rem;
    letter-spacing: 0.06em;
    color: var(--c-seafoam);
    opacity: 0.85;
}

.kelp-forest {
    position: relative;
    width: 100vw;
    height: 60vh;
    max-width: 100%;
    margin-left: calc(50% - 50vw);
    margin-top: 40px;
    margin-bottom: 40px;
    overflow: hidden;
    z-index: 1;
}
.kelp-forest svg {
    width: 100%;
    height: 100%;
    display: block;
}

.kelp-path {
    stroke: var(--c-titanium);
    fill: none;
    stroke-linecap: round;
    /* pathLength & dashoffset set by JS (scroll-linked) */
}

.deep-footer {
    width: 100%;
    max-width: var(--max-width);
    text-align: center;
    padding: 80px 0 120px;
    font-family: var(--f-label);
    font-size: 0.6875rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--c-titanium);
    position: relative;
    z-index: 2;
}
.footer-line { margin-bottom: 14px; }
.footer-coords { color: var(--c-gold); text-shadow: 0 0 10px rgba(212, 168, 67, 0.3); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .zone { padding: 100px 80px 100px 24px; }
    .kelp { width: 60px; opacity: 0.35; }
    .kelp-left { left: 1%; }
    .kelp-right { right: 70px; }
    .depth-gauge { width: 64px; }
    .depth-gauge-line { right: 22px; }
    .depth-gauge-marks { right: 32px; }
    .depth-gauge-marks .mark-label { font-size: 0.5rem; }
    .depth-gauge-readout { display: none; }
    .porthole-ring { width: 92vw; }
    .porthole, .porthole-offset { padding: 0; justify-content: center; }
    .section-header { margin-bottom: 80px; }
    .fragments { gap: 80px; }
    .hadal-statement { margin: 40px 0 100px; }
}

@media (max-width: 520px) {
    .zone { padding: 80px 54px 80px 16px; }
    .hero-title { font-size: clamp(1.75rem, 9vw, 3rem); }
    .hero-metadata { font-size: 0.5625rem; gap: 10px 16px; }
    .porthole-label { max-width: 82%; padding: 0 8px; }
    .porthole-body { font-size: 0.8125rem; line-height: 1.65; }
    .porthole-heading { font-size: 1.125rem; }
    .fragment { font-size: 1.0625rem; }
    .statement-text { font-size: clamp(1.75rem, 11vw, 3.25rem); }
    .depth-gauge { width: 48px; }
    .depth-gauge-line { right: 18px; }
    .depth-gauge-marks { right: 26px; }
    .kelp-right { right: 40px; }
}
