/* ========================================
   monopole.center - Submarine Laboratory Sci-Fi
   Forest-green palette, organic-flow layout, zoom-focus pattern
   ======================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: #e8f0ec;
    background: #0b2e1a;
    overflow-x: hidden;
    line-height: 1.72;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
}

/* --- Depth Layer 0: Fixed Background --- */
#background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background: linear-gradient(180deg, #0b2e1a 0%, #051a0e 100%);
    pointer-events: none;
}

#noise-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.02;
}

/* --- Depth Layer 1: Ambient Fish --- */
#fish-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.ambient-fish {
    position: absolute;
    color: #1a6b42;
    fill: currentColor;
    transition: opacity 0.6s ease;
}

/* Angelfish 1 - large */
.fish-1 {
    width: 140px;
    height: 160px;
    opacity: 0.06;
    top: 15%;
    left: -160px;
    animation: fishDrift1 45s linear infinite, fishBob1 4s ease-in-out infinite;
    animation-delay: 2s;
}

/* Angelfish 2 - medium */
.fish-2 {
    width: 90px;
    height: 103px;
    opacity: 0.12;
    top: 55%;
    left: -110px;
    animation: fishDrift2 60s linear infinite, fishBob2 5s ease-in-out infinite;
    animation-delay: 2s;
}

/* Angelfish 3 - small */
.fish-3 {
    width: 60px;
    height: 69px;
    opacity: 0.08;
    top: 35%;
    left: -80px;
    animation: fishDrift3 35s linear infinite, fishBob3 3.5s ease-in-out infinite;
    animation-delay: 2s;
}

/* Clownfish */
.fish-4 {
    width: 70px;
    height: 47px;
    opacity: 0.09;
    top: 75%;
    left: -90px;
    animation: fishDrift4 50s linear infinite, fishBob1 4.5s ease-in-out infinite;
    animation-delay: 2s;
}

/* Blue Tang */
.fish-5 {
    width: 80px;
    height: 55px;
    opacity: 0.07;
    top: 25%;
    right: -100px;
    animation: fishDriftReverse1 55s linear infinite, fishBob2 3.8s ease-in-out infinite;
    animation-delay: 2s;
}

/* Lionfish */
.fish-6 {
    width: 100px;
    height: 88px;
    opacity: 0.05;
    top: 65%;
    right: -120px;
    animation: fishDriftReverse2 42s linear infinite, fishBob3 5.5s ease-in-out infinite;
    animation-delay: 2s;
}

/* Seahorse */
.fish-7 {
    width: 50px;
    height: 88px;
    opacity: 0.08;
    top: 45%;
    left: -70px;
    animation: fishDrift5 65s linear infinite, fishBob1 6s ease-in-out infinite;
    animation-delay: 2s;
}

/* Moorish Idol */
.fish-8 {
    width: 65px;
    height: 81px;
    opacity: 0.06;
    top: 85%;
    right: -85px;
    animation: fishDriftReverse3 48s linear infinite, fishBob2 4.2s ease-in-out infinite;
    animation-delay: 2s;
}

/* Triggerfish */
.fish-9 {
    width: 75px;
    height: 58px;
    opacity: 0.07;
    top: 10%;
    right: -95px;
    animation: fishDriftReverse4 38s linear infinite, fishBob3 3.2s ease-in-out infinite;
    animation-delay: 2s;
}

/* Fish initially paused, started by JS after intro */
.ambient-fish {
    animation-play-state: paused;
}

.ambient-fish.swimming {
    animation-play-state: running;
}

/* --- Fish Drift Keyframes (left to right) --- */
@keyframes fishDrift1 {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 300px)); }
}

@keyframes fishDrift2 {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 250px)); }
}

@keyframes fishDrift3 {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 200px)); }
}

@keyframes fishDrift4 {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 250px)); }
}

@keyframes fishDrift5 {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 220px)); }
}

/* Fish Drift Keyframes (right to left) */
@keyframes fishDriftReverse1 {
    0% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(calc(-100vw - 250px)) scaleX(-1); }
}

@keyframes fishDriftReverse2 {
    0% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(calc(-100vw - 300px)) scaleX(-1); }
}

@keyframes fishDriftReverse3 {
    0% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(calc(-100vw - 220px)) scaleX(-1); }
}

@keyframes fishDriftReverse4 {
    0% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(calc(-100vw - 240px)) scaleX(-1); }
}

/* Fish bob/wobble keyframes */
@keyframes fishBob1 {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 15px; }
}

@keyframes fishBob2 {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -20px; }
}

@keyframes fishBob3 {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 25px; }
}

/* --- Main Content --- */
#content {
    position: relative;
    z-index: 2;
}

/* --- Zone 1: The Surface (Hero) --- */
#the-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 3;
}

/* Hero Seahorse */
.hero-seahorse-icon {
    width: 120px;
    height: 210px;
    color: #1a6b42;
    display: block;
    margin: 0 auto 2rem;
    opacity: 0;
    transform: translateY(100vh);
    animation: seahorseRise 1400ms cubic-bezier(0.22, 1, 0.36, 1) 600ms forwards,
               seahorseBob 3s ease-in-out 2000ms infinite;
}

@keyframes seahorseRise {
    0% {
        opacity: 0;
        transform: translateY(60vh);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes seahorseBob {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -8px; }
}

/* Hero Title */
.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #e8f0ec;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    filter: blur(2px);
    animation: letterReveal 400ms ease-out forwards;
    animation-delay: calc(2000ms + var(--delay) * 40ms);
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Hero Tagline */
.hero-tagline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    color: #c2d9cc;
    opacity: 0;
    animation: taglineFade 800ms ease-out forwards;
    animation-delay: 3400ms;
}

@keyframes taglineFade {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Observation Zone Shared --- */
.observation-zone {
    padding: 6rem 1.5rem;
    position: relative;
}

/* --- Content Panels (Depth Layer 2) --- */
.content-panel {
    background: rgba(11, 46, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    border: 1px solid rgba(45, 155, 94, 0.2);
    padding: 2.5rem 3rem;
    position: relative;
    overflow: hidden;
    transform: scale(0.92);
    opacity: 0.7;
    transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 400ms ease,
                box-shadow 400ms ease,
                backdrop-filter 400ms ease,
                -webkit-backdrop-filter 400ms ease;
}

.content-panel.in-view {
    transform: scale(1);
    opacity: 1;
    border-color: rgba(45, 155, 94, 0.5);
    box-shadow: 0 0 30px rgba(45, 155, 94, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.content-panel h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3rem);
    color: #1a6b42;
    letter-spacing: 0.04em;
    margin-bottom: 1.2rem;
    line-height: 1.2;
}

.content-panel p {
    color: #e8f0ec;
    margin-bottom: 1rem;
    max-width: 65ch;
}

.content-panel p:last-of-type {
    margin-bottom: 0.5rem;
}

/* Data annotations */
.data-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: #c2d9cc;
    opacity: 0.7;
    display: block;
    margin-top: 1rem;
}

/* Monopole watermark inside panels */
.monopole-watermark {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 300px;
    height: 300px;
    color: rgba(194, 217, 204, 0.06);
    pointer-events: none;
    z-index: 0;
}

.monopole-watermark svg {
    width: 100%;
    height: 100%;
}

.content-panel > *:not(.monopole-watermark) {
    position: relative;
    z-index: 1;
}

/* Hover states for headings - Reef Glow accent */
.content-panel h2:hover {
    color: #2d9b5e;
    transition: color 300ms ease;
}

/* Anemone Coral - interactive feedback pulse */
.content-panel:active {
    border-color: #d4654a;
    box-shadow: 0 0 20px rgba(212, 101, 74, 0.15);
}

/* Section fish marker */
.section-fish-marker {
    width: 48px;
    height: 55px;
    color: #c4a035;
    margin-bottom: 1rem;
}

.section-fish-marker svg {
    width: 100%;
    height: 100%;
}

/* --- Zone 2: The Reef --- */
#the-reef {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.reef-cluster {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.panel-reef.panel-1 {
    grid-column: 1 / 5;
}

.panel-reef.panel-2 {
    grid-column: 3 / 7;
}

.panel-reef.panel-3 {
    grid-column: 1 / 4;
}

.panel-reef.panel-4 {
    grid-column: 4 / 7;
}

/* --- Zone 3: The Trench --- */
#the-trench {
    background: #0e3d4a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 8rem 2rem;
}

/* Manta Ray */
.manta-ray {
    position: absolute;
    width: 600px;
    height: 200px;
    color: rgba(26, 107, 66, 0.1);
    top: 50%;
    left: -700px;
    transform: translateY(-50%);
    z-index: 1;
    pointer-events: none;
}

.manta-ray.gliding {
    animation: mantaGlide 8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes mantaGlide {
    0% { left: -700px; }
    100% { left: calc(100vw + 100px); }
}

/* Trench Field Diagram */
.trench-field-diagram {
    position: relative;
    width: 400px;
    height: 400px;
    color: rgba(194, 217, 204, 0.4);
    margin-bottom: 3rem;
    z-index: 2;
    transform: scale(0.5);
    opacity: 0;
    transition: transform 2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 1.5s ease;
}

.trench-field-diagram.revealed {
    transform: scale(1.2);
    opacity: 1;
}

.trench-field-diagram svg {
    width: 100%;
    height: 100%;
}

/* Field ring stroke-dashoffset animation */
.field-ring {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease-out;
}

.trench-field-diagram.revealed .field-ring {
    stroke-dashoffset: 0;
}

.field-line,
.field-curve {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2.5s ease-out 0.5s;
}

.trench-field-diagram.revealed .field-line,
.trench-field-diagram.revealed .field-curve {
    stroke-dashoffset: 0;
}

/* Trench panel */
.panel-trench {
    max-width: 700px;
    z-index: 3;
    background: rgba(14, 61, 74, 0.9);
    border-color: rgba(45, 155, 94, 0.2);
}

.panel-trench.in-view {
    border-color: rgba(45, 155, 94, 0.5);
}

/* Trench text blur reveal */
#trench-content {
    filter: blur(4px);
    transition: filter 800ms ease-out 2s,
                transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 400ms ease,
                box-shadow 400ms ease;
}

#trench-content.text-clear {
    filter: blur(0);
}

/* Section divider fish */
.section-divider-fish {
    width: 80px;
    height: 100px;
    color: rgba(26, 107, 66, 0.25);
    margin: 3rem auto 0;
    z-index: 3;
    position: relative;
}

.section-divider-fish svg {
    width: 100%;
    height: 100%;
}

/* --- Zone 4: The Current --- */
#the-current {
    padding: 6rem 1.5rem;
}

.current-flow {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.panel-current {
    max-width: 700px;
}

.panel-current[data-flow="left"] {
    align-self: flex-start;
    transform: scale(0.92) translateX(-30px);
}

.panel-current[data-flow="right"] {
    align-self: flex-end;
    transform: scale(0.92) translateX(30px);
}

.panel-current.in-view[data-flow="left"] {
    transform: scale(1) translateX(0);
}

.panel-current.in-view[data-flow="right"] {
    transform: scale(1) translateX(0);
}

/* --- Zone 5: The Seafloor --- */
#the-seafloor {
    padding: 8rem 2rem 6rem;
    position: relative;
}

.seafloor-artifacts {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2rem;
    align-items: end;
}

.artifact {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.artifact.visible {
    opacity: 1;
    transform: translateY(0);
}

.artifact-1 {
    grid-column: 1 / 3;
}

.artifact-2 {
    grid-column: 2 / 6;
}

.artifact-3 {
    grid-column: 5 / 7;
}

.artifact-4 {
    grid-column: 1 / 7;
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.artifact-5 {
    grid-column: 2 / 5;
}

.artifact-fish {
    width: 50px;
    height: 38px;
    color: #c4a035;
    opacity: 0.5;
}

.artifact-fish svg {
    width: 100%;
    height: 100%;
}

.seafloor-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: #c2d9cc;
    line-height: 1.72;
    display: block;
}

.seafloor-manta {
    width: 300px;
    height: 100px;
    color: rgba(26, 107, 66, 0.15);
    display: block;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .reef-cluster {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .panel-reef.panel-1,
    .panel-reef.panel-2,
    .panel-reef.panel-3,
    .panel-reef.panel-4 {
        grid-column: 1 / -1;
    }

    .content-panel {
        padding: 2rem 1.5rem;
    }

    .current-flow {
        padding: 0 1rem;
    }

    .panel-current {
        max-width: 100%;
    }

    .panel-current[data-flow="left"],
    .panel-current[data-flow="right"] {
        align-self: stretch;
        transform: scale(0.92) translateX(0);
    }

    .panel-current.in-view[data-flow="left"],
    .panel-current.in-view[data-flow="right"] {
        transform: scale(1) translateX(0);
    }

    .seafloor-artifacts {
        grid-template-columns: 1fr;
    }

    .artifact-1,
    .artifact-2,
    .artifact-3,
    .artifact-4,
    .artifact-5 {
        grid-column: 1 / -1;
    }

    .trench-field-diagram {
        width: 280px;
        height: 280px;
    }

    .manta-ray {
        width: 400px;
        height: 133px;
    }

    #the-trench {
        padding: 5rem 1.5rem;
    }

    .hero-seahorse-icon {
        width: 80px;
        height: 140px;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .content-panel h2 {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .observation-zone {
        padding: 4rem 1rem;
    }

    .trench-field-diagram {
        width: 220px;
        height: 220px;
    }
}
