:root {
    --bg-deep: #0a0e1a;
    --bg-elevated: #131929;
    --accent-teal: #00e5c7;
    --accent-coral: #ff2d7b;
    --accent-gold: #ffd166;
    --text-primary: #f0f0f0;
    --text-body: #a8b4c0;
    --text-muted: #5a6a7a;
    --timeline-width: 2px;
    --station-max-width: 380px;
    --reveal-duration: 0.9s;
    --reveal-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --fish-draw-duration: 2.5s;
    --caustic-speed-1: 15s;
    --caustic-speed-2: 23s;
    --caustic-speed-3: 19s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-body);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* Caustic Light Overlay */
.caustic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse, rgba(0, 229, 199, 0.03), transparent 50%) 0 0 / 200px 200px,
        radial-gradient(ellipse, rgba(255, 209, 102, 0.02), transparent 50%) 0 0 / 300px 300px,
        radial-gradient(ellipse, rgba(255, 45, 123, 0.015), transparent 50%) 0 0 / 250px 250px;
    animation:
        caustic1 var(--caustic-speed-1) linear infinite,
        caustic2 var(--caustic-speed-2) linear infinite,
        caustic3 var(--caustic-speed-3) linear infinite;
}

@keyframes caustic1 {
    from { background-position: 0 0, 0 0, 0 0; }
    to { background-position: 200px 100px, 0 0, 0 0; }
}

@keyframes caustic2 {
    from { background-position: 0 0, 0 0, 0 0; }
    to { background-position: 0 0, -300px 150px, 0 0; }
}

@keyframes caustic3 {
    from { background-position: 0 0, 0 0, 0 0; }
    to { background-position: 0 0, 0 0, 150px -250px; }
}

/* Vignette Overlay */
.vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(0, 229, 199, 0.04) 0%, transparent 60%);
}

/* Timeline Spine */
.timeline-spine {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.timeline-spine line {
    stroke: var(--accent-teal);
    stroke-width: var(--timeline-width);
    opacity: 0.6;
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1.0; }
}

/* Station Layout */
.station {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 80vh;
    padding: 10vh 40px;
    z-index: 2;
}

.station[data-station="1"] { min-height: 100vh; padding-top: 20vh; }
.station[data-station="2"] { min-height: 80vh; }
.station[data-station="3"] { min-height: 90vh; }
.station[data-station="4"] { min-height: 85vh; }
.station[data-station="5"] { min-height: 95vh; }
.station[data-station="6"] { min-height: 100vh; }
.station[data-station="7"] { min-height: 60vh; }

/* Station Node */
.station__node {
    position: absolute;
    left: 50%;
    top: 12vh;
    transform: translateX(-50%);
    z-index: 3;
}

.node-marker {
    display: block;
}

.node-dot {
    transition: transform 0.3s ease;
}

.node-pulse {
    opacity: 0;
    transform-origin: center;
}

.station.is-visible .node-pulse {
    animation: nodePulse 0.8s var(--reveal-easing) forwards;
}

@keyframes nodePulse {
    0% {
        r: 6;
        opacity: 1;
        stroke-width: 2;
    }
    100% {
        r: 24;
        opacity: 0;
        stroke-width: 0.5;
    }
}

/* Branch Lines */
.station__branch {
    position: absolute;
    top: calc(12vh + 22px);
    width: 40px;
    height: var(--timeline-width);
    background-color: var(--accent-teal);
    z-index: 2;
    transform: scaleX(0);
    transition: transform 0.6s var(--reveal-easing) 0.2s;
}

.station.is-visible .station__branch {
    transform: scaleX(1);
}

.station--right .station__branch {
    left: calc(50% + 24px);
    transform-origin: left center;
}

.station--left .station__branch {
    right: calc(50% + 24px);
    transform-origin: right center;
}

/* Station Content */
.station__content {
    max-width: var(--station-max-width);
    position: relative;
    padding: 32px;
    background-color: var(--bg-elevated);
    border-radius: 2px;
}

.station--right .station__content {
    margin-left: calc(50% + 80px);
}

.station--left .station__content {
    margin-right: calc(50% + 80px);
}

.station--center {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.station--center .station__node {
    top: 5vh;
}

.station__content--centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    padding: 0;
    margin: 0 !important;
}

/* Coral Fragments */
.coral-fragment {
    position: absolute;
    opacity: 0.6;
}

.coral-fragment--tl {
    top: -8px;
    left: -8px;
}

.coral-fragment--br {
    bottom: -8px;
    right: -8px;
}

/* Typography */
.station__meta {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.station__title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--text-primary);
    text-shadow: 0 0 40px rgba(0, 229, 199, 0.15);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.station__title--hero {
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    text-shadow: 0 0 60px rgba(0, 229, 199, 0.25);
    animation: heroBreath 4s ease-in-out infinite;
}

@keyframes heroBreath {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.station.is-visible .station__title--hero {
    animation: heroBreath 4s ease-in-out infinite;
}

.station__body {
    color: var(--text-body);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.station__body--large {
    font-size: clamp(1.05rem, 1.3vw, 1.3rem);
    line-height: 1.65;
}

/* Metadata Block */
.station__metadata {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.meta-line {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-teal);
    opacity: 0.7;
}

/* Readout Block (Station 4 - Stress) */
.station__readout {
    border: 1px solid var(--accent-coral);
    padding: 16px;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.readout-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 45, 123, 0.15);
}

.readout-line:last-child {
    border-bottom: none;
}

.readout-label {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.readout-value {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--accent-coral);
}

/* Fish SVGs */
.fish {
    display: block;
    margin: 20px auto;
    max-width: 160px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

.fish--angelfish { max-width: 120px; }
.fish--surgeonfish { max-width: 130px; }
.fish--butterflyfish { max-width: 80px; }
.fish--wrasse { max-width: 160px; }
.fish--pufferfish { max-width: 140px; }

.fish-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset var(--fish-draw-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.station.is-visible .fish-path {
    stroke-dashoffset: 0;
}

/* Fish idle animation */
.station.is-visible .fish {
    animation: fishFloat 5s ease-in-out infinite;
}

.station.is-visible .fish--offset-1 {
    animation: fishFloat 5s ease-in-out 0.8s infinite;
}

.station.is-visible .fish--offset-2 {
    animation: fishFloat 5s ease-in-out 1.6s infinite;
}

@keyframes fishFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.fish--drift {
    max-width: 100px;
    margin-bottom: 24px;
}

/* Fish Formation */
.fish-formation {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--reveal-easing),
                transform var(--reveal-duration) var(--reveal-easing);
}

/* Reveal States */
.station.is-visible [data-delay="0"] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0ms;
}

.station.is-visible [data-delay="1"] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 120ms;
}

.station.is-visible [data-delay="2"] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 240ms;
}

.station.is-visible [data-delay="3"] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 360ms;
}

.station.is-visible [data-delay="4"] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 480ms;
}

/* Hover States */
.station__node:hover .node-dot {
    transform: scale(1.3);
}

.station:hover .station__branch {
    transform: scaleX(1.2);
}

/* Stress station border accent */
.station--stress .station__content {
    border-left: 2px solid var(--accent-coral);
}

/* Release station larger whitespace */
.station--release .station__content {
    padding: 48px 32px;
}

/* Responsive: below 768px */
@media (max-width: 768px) {
    .station {
        padding: 8vh 20px 8vh 60px;
        justify-content: flex-start;
    }

    .station__node {
        left: 24px;
        transform: translateX(-50%);
    }

    .station__branch {
        left: 48px !important;
        right: auto !important;
        transform-origin: left center !important;
    }

    .station--right .station__content,
    .station--left .station__content {
        margin-left: 0;
        margin-right: 0;
        max-width: calc(100vw - 72px);
    }

    .station__content--centered {
        margin-left: 0 !important;
    }

    .station__title {
        font-size: clamp(1.8rem, 4vw, 3rem);
    }

    .station__title--hero {
        font-size: clamp(2rem, 5vw, 3.5rem);
    }

    .fish {
        transform: scale(0.7) translateY(24px);
    }

    .station.is-visible .fish {
        transform: scale(0.7) translateY(0);
    }

    .fish-formation {
        flex-direction: column;
        gap: 12px;
    }
}