/* ============================================
   bada.city — Bathymetric Descent
   Horizontal scroll, ocean-deep, dreamy-ethereal
   ============================================ */

:root {
    --sea-foam: #e8f4f8;
    --shallow-aqua: #7ec8c8;
    --pelagic-teal: #2a7c8c;
    --bathyal-blue: #0f3d5c;
    --hadal-navy: #0a1628;
    --plankton-glow: #4eeadd;
    --coral-signal: #e8785a;

    --font-display: 'Playfair Display', serif;
    --font-body: 'Karla', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

body {
    background: var(--hadal-navy);
    overflow: hidden;
    height: 100vh;
}

/* ============================================
   Caustic Overlay
   ============================================ */

.caustic-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    mix-blend-mode: soft-light;
    transition: opacity 0.5s ease;
}

.caustic-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Horizontal Scroll
   ============================================ */

.ocean-scroll {
    display: flex;
    flex-wrap: nowrap;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    background: linear-gradient(to right,
        var(--sea-foam) 0%,
        var(--shallow-aqua) 20%,
        var(--pelagic-teal) 40%,
        var(--bathyal-blue) 60%,
        var(--hadal-navy) 85%,
        var(--hadal-navy) 100%
    );
    background-size: 500vw 100%;
}

.ocean-scroll::-webkit-scrollbar {
    display: none;
}

.zone {
    min-width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

.zone-shallows {
    min-width: 150vw;
}

.zone-deep {
    min-width: 150vw;
}

/* ============================================
   Zone 1: Shore
   ============================================ */

.zone-shore {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15vh;
}

.shore-content {
    text-align: center;
}

.foam-text-wrap {
    position: relative;
    display: inline-block;
}

.shore-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 10vw, 120px);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--hadal-navy);
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: fadeInSlow 1.2s ease-out 0.8s forwards;
}

.foam-shadow {
    position: absolute;
    inset: 0;
    font-family: var(--font-display);
    font-size: clamp(48px, 10vw, 120px);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: rgba(126, 200, 200, 0.3);
    filter: blur(3px);
    z-index: 1;
    animation: foamShift 6s ease-in-out infinite;
}

@keyframes foamShift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(1.5px, -1px); }
}

@keyframes fadeInSlow {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wave-svg {
    width: 300px;
    height: 40px;
    margin-top: 2rem;
}

.wave-path {
    animation: waveOscillate 6s ease-in-out infinite;
}

@keyframes waveOscillate {
    0%, 100% { d: path("M0,20 Q75,5 150,20 Q225,35 300,20 Q375,5 450,20 Q525,35 600,20"); }
    50% { d: path("M0,20 Q75,30 150,20 Q225,10 300,20 Q375,30 450,20 Q525,10 600,20"); }
}

/* ============================================
   Zone 2: Shallows
   ============================================ */

.panel {
    position: absolute;
    max-width: 320px;
    padding: 2rem;
    background: rgba(10, 22, 40, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 200, 0.15);
    border-radius: 16px;
    color: rgba(232, 244, 248, 0.85);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.75;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.panel.visible {
    opacity: 1;
    transform: translateX(0) rotate(var(--tilt, 0deg));
}

.kelp-left, .kelp-right {
    position: absolute;
    width: 40px;
    height: 80%;
    top: 10%;
    background: var(--bathyal-blue);
    opacity: 0.08;
    border-radius: 20px 20px 0 0;
    animation: kelpSway 8s ease-in-out infinite;
    transform-origin: bottom center;
}

.kelp-left { left: 3%; }
.kelp-right { right: 3%; }

@keyframes kelpSway {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* ============================================
   Zone 3: The Deep
   ============================================ */

.jellyfish-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 300px;
    animation: jellyPulse 8s ease-in-out infinite;
}

@keyframes jellyPulse {
    0%, 100% { opacity: 0.03; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.06; transform: translate(-50%, -50%) scale(1.05); }
}

.jellyfish-svg {
    width: 100%;
    height: 100%;
}

.deep-text {
    position: absolute;
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 300;
    letter-spacing: 0.08em;
}

.glow-text {
    color: var(--plankton-glow);
    text-shadow: 0 0 20px rgba(78, 234, 221, 0.3);
    opacity: 0;
    animation: glowFade 8s ease-in-out infinite;
}

.deep-text:nth-child(4) { animation-delay: 0s; }
.deep-text:nth-child(5) { animation-delay: -2.7s; }
.deep-text:nth-child(6) { animation-delay: -5.3s; }

@keyframes glowFade {
    0%, 100% { opacity: 0; }
    30%, 70% { opacity: 0.8; }
}

/* Bioluminescent Particles (CSS-only) */
.biolum-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.bio-particle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: radial-gradient(circle, var(--plankton-glow) 0%, transparent 70%);
    animation:
        particleDrift var(--dur) linear var(--delay) infinite,
        particlePulse 4s ease-in-out var(--delay) infinite;
}

.bio-particle.dim {
    opacity: 0.3;
}

@keyframes particleDrift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(20px, -30px); }
    50% { transform: translate(-15px, -60px); }
    75% { transform: translate(10px, -30px); }
    100% { transform: translate(0, 0); }
}

@keyframes particlePulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.6; }
}

/* ============================================
   Zone 4: Abyss
   ============================================ */

.abyss-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.abyss-word {
    font-family: var(--font-display);
    font-size: 120px;
    font-weight: 300;
    color: var(--plankton-glow);
    text-shadow: 0 0 40px rgba(78, 234, 221, 0.2), 0 0 80px rgba(78, 234, 221, 0.1);
    animation: abyssPulse 4s ease-in-out infinite;
}

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

/* ============================================
   Depth Gauge
   ============================================ */

.depth-gauge {
    position: fixed;
    bottom: 24px;
    left: 5%;
    right: 5%;
    z-index: 200;
    pointer-events: none;
}

.gauge-line {
    height: 2px;
    background: linear-gradient(to right,
        var(--shallow-aqua),
        var(--pelagic-teal),
        var(--bathyal-blue),
        var(--hadal-navy)
    );
    position: relative;
    border-radius: 1px;
    opacity: 0.5;
}

.gauge-marker {
    position: absolute;
    top: -4px;
    left: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--plankton-glow);
    box-shadow: 0 0 10px rgba(78, 234, 221, 0.4);
    transition: left 0.3s ease;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(126, 200, 200, 0.4);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }

    .ocean-scroll {
        flex-direction: column;
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
        scroll-snap-type: y proximity;
        background: linear-gradient(to bottom,
            var(--sea-foam) 0%,
            var(--shallow-aqua) 20%,
            var(--pelagic-teal) 40%,
            var(--bathyal-blue) 60%,
            var(--hadal-navy) 85%,
            var(--hadal-navy) 100%
        );
        background-size: 100% auto;
    }

    .zone {
        min-width: 100%;
        width: 100%;
        scroll-snap-align: start;
    }

    .zone-shallows,
    .zone-deep {
        min-width: 100%;
        min-height: 200vh;
    }

    .panel {
        position: relative;
        top: auto !important;
        left: auto !important;
        margin: 2rem auto;
        max-width: 90%;
        transform: none;
    }

    .panel.visible {
        transform: none;
    }

    .deep-text {
        position: relative;
        top: auto !important;
        left: auto !important;
        text-align: center;
        padding: 2rem;
    }

    .depth-gauge {
        bottom: auto;
        top: 10%;
        left: auto;
        right: 12px;
        width: 2px;
        height: 80vh;
    }

    .gauge-line {
        width: 2px;
        height: 100%;
        background: linear-gradient(to bottom,
            var(--shallow-aqua),
            var(--pelagic-teal),
            var(--bathyal-blue),
            var(--hadal-navy)
        );
    }

    .gauge-marker {
        top: 0;
        left: -4px;
        transition: top 0.3s ease;
    }

    .gauge-labels {
        flex-direction: column;
        position: absolute;
        right: 16px;
        top: 0;
        height: 100%;
    }

    .abyss-word {
        font-size: 60px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .foam-shadow,
    .wave-path,
    .jellyfish-bg,
    .kelp-left,
    .kelp-right {
        animation: none;
    }

    .bio-particle {
        animation: none;
        opacity: 0.3;
    }

    .glow-text {
        animation: none;
        opacity: 0.6;
    }

    .shore-title {
        opacity: 1;
        animation: none;
    }

    .abyss-word {
        animation: none;
        opacity: 0.85;
    }
}
