/* ============================================
   BBOTTL.com - Deep Ocean Descent
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --surface-light: #b8e6f0;
    --sunlight-water: #1a6b7a;
    --twilight-deep: #0d1f3c;
    --midnight-black: #060b14;
    --bioluminescence: #00ffc8;
    --warm-accent: #e8a87c;
    --glass-frost: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);

    --bg-gradient-pos: 0%;
    --current-bg: #b8e6f0;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.85);
    background: #060b14;
    overflow-x: hidden;
}

/* --- Ocean Background --- */
#ocean-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(
        to bottom,
        #b8e6f0 0%,
        #1a6b7a 25%,
        #0d1f3c 50%,
        #060b14 75%,
        #060b14 100%
    );
    background-size: 100% 500vh;
    background-position: 0 var(--bg-gradient-pos);
    transition: background-position 0.05s linear;
}

/* --- Caustic Light Overlay --- */
#caustic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: var(--caustic-opacity, 1);
    transition: opacity 1.5s ease;
}

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

/* --- Particles --- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
    pointer-events: none;
}

/* --- Bubble Overlay --- */
#bubble-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.2);
    pointer-events: none;
    will-change: transform, opacity;
    animation: bubble-rise 1.5s ease-out forwards;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-120px) scale(0.3);
        opacity: 0;
    }
}

/* --- Depth Indicator --- */
#depth-indicator {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    height: 60vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.depth-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
}

.depth-dot {
    position: absolute;
    top: 0%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bioluminescence);
    box-shadow: 0 0 12px var(--bioluminescence), 0 0 24px rgba(0, 255, 200, 0.3);
    transform: translateX(0);
    transition: top 0.3s ease;
    z-index: 2;
}

.depth-label {
    position: absolute;
    right: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    transform: translateY(-50%);
}

.depth-label[data-depth="0"] { top: 0%; }
.depth-label[data-depth="1"] { top: 25%; }
.depth-label[data-depth="2"] { top: 50%; }
.depth-label[data-depth="3"] { top: 75%; }
.depth-label[data-depth="4"] { top: 100%; }

/* --- Depth Zones (Sections) --- */
.depth-zone {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    scroll-snap-align: start;
    padding: 4rem 2rem;
}

/* --- Zone 1: Surface --- */
#zone-surface {
    position: relative;
    overflow: hidden;
}

.wave-separator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 4;
}

.wave-separator svg {
    width: 100%;
    height: 100%;
    display: block;
}

.wave-1 {
    animation: wave-drift-1 20s linear infinite;
}
.wave-2 {
    animation: wave-drift-2 30s linear infinite;
}
.wave-3 {
    animation: wave-drift-3 45s linear infinite;
}

@keyframes wave-drift-1 {
    0% { transform: translateX(0); }
    50% { transform: translateX(-30px); }
    100% { transform: translateX(0); }
}
@keyframes wave-drift-2 {
    0% { transform: translateX(0); }
    50% { transform: translateX(40px); }
    100% { transform: translateX(0); }
}
@keyframes wave-drift-3 {
    0% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
    100% { transform: translateX(0); }
}

/* --- Bottle --- */
#bottle-container {
    animation: bottle-bob 6s ease-in-out infinite;
}

#bottle-svg {
    width: 120px;
    height: 280px;
    filter: drop-shadow(0 4px 20px rgba(232, 168, 124, 0.2));
}

@keyframes bottle-bob {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    25% { transform: rotate(0deg) translateY(-10px); }
    50% { transform: rotate(5deg) translateY(0); }
    75% { transform: rotate(0deg) translateY(10px); }
}

.surface-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.scroll-hint {
    margin-top: 2rem;
    opacity: 0.5;
    animation: scroll-hint-pulse 2s ease-in-out infinite;
}

.scroll-hint-arrow {
    display: block;
    width: 20px;
    height: 20px;
    border-right: 2px solid rgba(255, 255, 255, 0.5);
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
}

@keyframes scroll-hint-pulse {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(8px); opacity: 0.2; }
}

/* --- Glass Panels --- */
.glass-panel {
    background: var(--glass-frost);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 2.5rem 3rem;
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    .glass-panel {
        background: rgba(13, 31, 60, 0.85);
    }
}

/* --- Content Panels --- */
.content-panel {
    max-width: 680px;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

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

.content-panel h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 2.5rem;
    margin-bottom: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

.content-panel p {
    color: rgba(255, 255, 255, 0.7);
}

/* --- Zone 2: Sunlight --- */
#zone-sunlight .content-panel {
    padding: 2.5rem 3rem;
}

/* --- Zone 3: Twilight --- */
#zone-twilight .content-panel h2 {
    font-size: 2.8rem;
}

.reveal-text {
    overflow: hidden;
}

.reveal-text .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-right: 0.25em;
}

.reveal-text .word.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Zone 4: Midnight --- */
.midnight-panel {
    border: 1px solid rgba(0, 255, 200, 0.08);
    padding: 2.5rem 3rem;
    border-radius: 12px;
    background: rgba(0, 255, 200, 0.02);
    box-shadow: 0 0 30px rgba(0, 255, 200, 0.03);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    will-change: transform;
}

.midnight-panel:hover {
    box-shadow: 0 0 50px rgba(0, 255, 200, 0.08);
}

#zone-midnight .content-panel h2 {
    font-size: 3rem;
    color: rgba(0, 255, 200, 0.7);
}

#zone-midnight .content-panel p {
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 20px rgba(0, 255, 200, 0.05);
}

/* --- Zone 5: Abyss --- */
#zone-abyss {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.abyss-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 200, 0.08) 0%, transparent 70%);
    animation: abyss-pulse 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes abyss-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

#final-message {
    text-align: center;
    max-width: 680px;
    z-index: 5;
    position: relative;
}

.message-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 3.5rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 40px rgba(0, 255, 200, 0.3);
}

.message-text .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--bioluminescence);
    margin-left: 2px;
    animation: cursor-blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#message-bottle-reveal {
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#message-bottle-reveal.visible {
    opacity: 1;
}

.message-bottle-svg {
    width: 60px;
    height: 140px;
}

.domain-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: rgba(232, 168, 124, 0.4);
    margin-top: 1rem;
    text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-panel {
        padding: 1.5rem 1.8rem;
    }

    .glass-panel {
        padding: 1.5rem 1.8rem;
    }

    .midnight-panel {
        padding: 1.5rem 1.8rem;
    }

    .content-panel h2 {
        font-size: 2rem;
    }

    .message-text {
        font-size: 2.2rem;
    }

    .surface-text {
        font-size: 1.2rem;
    }

    #depth-indicator {
        right: 12px;
    }

    .depth-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .message-text {
        font-size: 1.8rem;
    }

    .content-panel h2 {
        font-size: 1.6rem;
    }

    #zone-midnight .content-panel h2 {
        font-size: 2rem;
    }
}
