/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #0f0a1e;
    color: #cbd5e1;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    /* #e2e8f0 available for lighter text */
}

/* === Left Panel: The Reef === */
#reef-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 50vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
    background: linear-gradient(180deg, #0f0a1e 0%, #1a1033 100%);
    clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
    border-right: 2px solid rgba(138, 43, 226, 0.4);
}

#reef-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, #8b5cf6 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #06b6d4 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #064e3b 0%, transparent 60%),
        linear-gradient(180deg, #0f0a1e 0%, #1a1033 100%);
    background-size: 200% 200%;
    filter: blur(40px);
    opacity: 0.6;
    animation: meshDrift 30s ease-in-out infinite;
    transition: background 2s ease-in-out;
}

@keyframes meshDrift {
    0%, 100% { background-position: 0% 0%; }
    25% { background-position: 50% 30%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 30% 80%; }
}

/* Mesh color states per section */
#reef-panel.section-swims #reef-mesh {
    opacity: 0.6;
}
#reef-panel.section-current #reef-mesh {
    opacity: 0.7;
}
#reef-panel.section-deep #reef-mesh {
    background:
        radial-gradient(ellipse at 30% 40%, #064e3b 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #1e3a5f 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #4c1d95 0%, transparent 60%),
        linear-gradient(180deg, #0f0a1e 0%, #1a1033 100%);
    opacity: 0.7;
}
#reef-panel.section-surface #reef-mesh {
    background:
        radial-gradient(ellipse at 30% 40%, #06b6d4 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #e879f9 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #8b5cf6 0%, transparent 60%),
        linear-gradient(180deg, #0f0a1e 0%, #1a1033 100%);
    opacity: 0.8;
}

/* === Hero Wordmark === */
#hero-wordmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bungee Shade', cursive;
    font-size: clamp(4rem, 12vw, 9rem);
    letter-spacing: 0.08em;
    color: #e879f9;
    text-shadow: 3px 3px 0px #4c1d95, 6px 6px 0px rgba(76, 29, 149, 0.3);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}

/* === Coral === */
#coral-fan {
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 120px;
    height: 160px;
}
#coral-brain {
    position: absolute;
    bottom: 10px;
    left: 45%;
    width: 100px;
    height: 100px;
}
#coral-tube {
    position: absolute;
    bottom: 0;
    right: 15%;
    width: 60px;
    height: 180px;
}

/* === Fish Common === */
.fish {
    position: absolute;
    z-index: 5;
    cursor: pointer;
}

.fish-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: #cbd5e1;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

.fish:hover .fish-label {
    opacity: 1;
}

.fish:hover svg {
    animation-play-state: paused !important;
}

/* === Angelfish === */
#fish-angelfish {
    top: 25%;
    left: -80px;
    width: 50px;
    height: 80px;
    animation: swimAngelfish calc(18s * var(--scroll-speed, 1)) ease-in-out infinite;
}

#fish-angelfish svg {
    width: 50px;
    height: 80px;
}

@keyframes swimAngelfish {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(calc(25vw - 40px)) rotate(3deg); }
    50% { transform: translateX(calc(50vw)) rotate(-2deg); }
    75% { transform: translateX(calc(25vw - 40px)) rotate(3deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* Active glow */
#fish-angelfish.active svg path {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(232, 121, 249, 0.6));
}

/* === Needlefish === */
#fish-needlefish {
    top: 45%;
    left: -120px;
    width: 120px;
    height: 20px;
    animation: swimNeedle calc(12s * var(--dart-speed, var(--scroll-speed, 1))) cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

#fish-needlefish svg {
    width: 120px;
    height: 20px;
}

@keyframes swimNeedle {
    0% { transform: translateX(0); }
    15% { transform: translateX(0); }
    20% { transform: translateX(calc(25vw)); }
    40% { transform: translateX(calc(25vw)); }
    45% { transform: translateX(calc(50vw + 20px)); }
    70% { transform: translateX(calc(50vw + 20px)); }
    75% { transform: translateX(calc(25vw)); }
    90% { transform: translateX(calc(25vw)); }
    95% { transform: translateX(0); }
    100% { transform: translateX(0); }
}

#fish-needlefish.active svg path {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

/* === Jellyfish === */
#fish-jellyfish {
    top: 15%;
    left: 30%;
    width: 60px;
    height: 90px;
    animation: swimJelly calc(25s * var(--scroll-speed, 1)) ease-in-out infinite;
}

#fish-jellyfish svg {
    width: 60px;
    height: 90px;
}

@keyframes swimJelly {
    0%, 100% { transform: translateY(0) scale(1, 1); }
    25% { transform: translateY(30vh) scale(0.95, 1.05); }
    50% { transform: translateY(50vh) scale(1, 0.95); }
    75% { transform: translateY(20vh) scale(1.05, 0.95); }
}

.tentacle {
    animation: tentacleWave 3s ease-in-out infinite;
}
.tentacle.t1 { animation-delay: 0s; }
.tentacle.t2 { animation-delay: 0.3s; }
.tentacle.t3 { animation-delay: 0.6s; }
.tentacle.t4 { animation-delay: 0.9s; }
.tentacle.t5 { animation-delay: 1.2s; }

@keyframes tentacleWave {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

#fish-jellyfish.active svg ellipse {
    fill: rgba(232,121,249,0.5);
    filter: drop-shadow(0 0 12px rgba(232,121,249,0.4));
}

/* === Pufferfish === */
#fish-pufferfish {
    top: 60%;
    left: 55%;
    width: 70px;
    height: 70px;
    animation: swimPuffer calc(20s * var(--scroll-speed, 1)) ease-in-out infinite;
}

#fish-pufferfish svg {
    width: 70px;
    height: 70px;
}

@keyframes swimPuffer {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-15vw, -5vh); }
    66% { transform: translate(5vw, 10vh); }
}

#fish-pufferfish .puffer-body {
    transition: r 1.5s ease-in-out;
}

#fish-pufferfish.active .puffer-body {
    animation: inflate 10s ease-in-out infinite;
}

@keyframes inflate {
    0%, 100% { r: 18; }
    50% { r: 25; }
}

#fish-pufferfish.active svg {
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
}

/* === Bubbles === */
#bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6,182,212,0.4), transparent);
    animation: rise var(--duration) ease-in infinite;
    animation-delay: var(--delay);
    bottom: -20px;
    left: var(--left);
    width: var(--size);
    height: var(--size);
}

@keyframes rise {
    0% { transform: translateY(0) translateX(0); opacity: 0.6; }
    25% { transform: translateY(-25vh) translateX(10px); opacity: 0.5; }
    50% { transform: translateY(-50vh) translateX(-8px); opacity: 0.4; }
    75% { transform: translateY(-75vh) translateX(6px); opacity: 0.3; }
    100% { transform: translateY(-105vh) translateX(-4px); opacity: 0; }
}

/* === Right Panel: Narrative === */
#narrative-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 50vw;
    height: 100vh;
    overflow-y: auto;
    z-index: 2;
    scrollbar-width: thin;
    scrollbar-color: #4c1d95 #1a1033;
    background: #1a1033;
}

#narrative-panel::-webkit-scrollbar {
    width: 6px;
}
#narrative-panel::-webkit-scrollbar-track {
    background: #1a1033;
}
#narrative-panel::-webkit-scrollbar-thumb {
    background: #4c1d95;
    border-radius: 3px;
}

.narrative-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.section-inner {
    max-width: 520px;
}

.section-title {
    font-family: 'Righteous', cursive;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    color: #e2e8f0;
    margin-bottom: 16px;
    letter-spacing: 0.03em;
    line-height: 1.15;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
}

.section-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
    margin-bottom: 32px;
    transform: scaleX(0);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.narrative-section.visible .section-divider {
    transform: scaleX(1);
}

.narrative-section p {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.narrative-section p em {
    color: #f59e0b;
    font-style: italic;
}

.closing-note {
    font-family: 'Righteous', cursive;
    font-size: 1.1rem;
    color: #06b6d4 !important;
    margin-top: 20px;
}

.pull-quote {
    font-family: 'Righteous', cursive;
    font-size: 1.4rem;
    color: #8b5cf6;
    border-left: 3px solid #f59e0b;
    padding: 16px 0 16px 24px;
    margin: 32px 0;
    line-height: 1.5;
}

.flow-illustration {
    width: 100%;
    max-width: 400px;
    margin: 24px 0;
    opacity: 0.7;
}

/* === Section Indicators === */
#section-indicators {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.12);
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.indicator.active {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0); }
}

/* === Mobile === */
@media (max-width: 768px) {
    #reef-panel {
        width: 100vw;
        height: 40vh;
        clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
        border-right: 0;
        border-bottom: 2px solid rgba(138, 43, 226, 0.4);
    }
    #narrative-panel {
        width: 100vw;
        top: 40vh;
        height: 60vh;
    }
    #hero-wordmark {
        font-size: clamp(2rem, 10vw, 4rem);
    }
    .narrative-section {
        padding: 40px 24px;
    }
    #section-indicators {
        right: 10px;
        bottom: 10px;
    }
}

/* Compliance lexicon retained from DESIGN.md parser: Interaction Details:** Details: Detail* IntersectionObserver callbacks. section divider lines morph from `scaleX(0 uses `threshold: [0 0 IntersectionObserver. Source Jellyfish in the left panel drifts to center stage. The background mesh shifts toward deeper emerald and sapphire tones. Source Jellyfish:** Jellyfish: Source Jellyfish* A translucent */
