/* ===== BASE RESET & GLOBALS ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* palette: #b7410e #0a1628 #cc6600 #5bc0be #0d1b2a #1b998b #d4c5a9 #e8a04a #e6f0ef */
}

body {
    background: #0d1b2a;
    color: #d4c5a9;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 500vh;
}

/* ===== BOKEH LAYER ===== */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
}

/* ===== ORGANISMS LAYER ===== */
.organisms {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.jellyfish {
    position: absolute;
    width: 40px;
    height: 30px;
    border-radius: 50% 50% 40% 40%;
    background: rgba(91, 192, 190, 0.12);
    backdrop-filter: blur(2px);
    box-shadow:
        -8px 20px 0 -9px rgba(91, 192, 190, 0.15),
        0px 22px 0 -9px rgba(91, 192, 190, 0.12),
        8px 20px 0 -9px rgba(91, 192, 190, 0.15),
        -4px 28px 0 -9px rgba(91, 192, 190, 0.08);
}

.cargo-crate {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(204, 102, 0, 0.25);
    transform: rotate(15deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: rgba(204, 102, 0, 0.4);
    font-family: 'IBM Plex Mono', monospace;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(230, 240, 239, 0.15);
    background: transparent;
}

/* ===== MAIN CONTENT ===== */
main {
    position: relative;
    z-index: 2;
}

/* ===== ZONE: SURFACE ===== */
.zone-surface {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #cc6600;
    line-height: 1.05;
    position: relative;
    z-index: 3;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(8px);
}

.hero-title .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.cursor {
    display: inline-block;
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 700;
    color: #cc6600;
    animation: blink 1.06s step-end infinite;
    opacity: 0;
    position: relative;
    z-index: 3;
}

.cursor.active {
    opacity: 1;
}

.cursor-inline {
    display: inline;
    color: #cc6600;
    animation: blink 1.06s step-end infinite;
    font-weight: 400;
}

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

.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(27, 153, 139, 0.3);
    animation: ripple 1.2s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
        margin-left: -30px;
        margin-top: -30px;
    }
}

.chevron-down {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    animation: pulse-jellyfish 3s ease-in-out infinite;
    cursor: pointer;
    z-index: 3;
}

@keyframes pulse-jellyfish {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
    50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

.waterline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40vh;
    background: linear-gradient(to bottom, transparent, rgba(13, 27, 42, 0.6));
    pointer-events: none;
    z-index: 1;
}

/* ===== ZONE: THERMOCLINE ===== */
.zone-thermocline {
    min-height: 150vh;
    padding: 10vh 5vw;
    position: relative;
}

.content-pocket {
    max-width: 520px;
    padding: 3rem 2.5rem;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: rgba(13, 27, 42, 0.6);
    backdrop-filter: blur(4px);
    margin-bottom: 12vh;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.content-pocket.in-view {
    opacity: 1;
    transform: translateY(0);
}

.pocket-1 {
    margin-left: 10%;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}

.pocket-2 {
    margin-left: 35%;
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
    transition-delay: 0.2s;
}

.pocket-3 {
    margin-left: 15%;
    border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%;
    transition-delay: 0.4s;
}

.content-pocket h2 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #e8a04a;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.content-pocket p {
    margin-bottom: 0.8rem;
}

.content-pocket code,
.midnight-statement code {
    background: rgba(204, 102, 0, 0.08);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: #e8a04a;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
    letter-spacing: 0.04em;
}

/* ===== WAVE DIVIDERS ===== */
.wave-divider {
    position: relative;
    height: 80px;
    width: 100%;
    overflow: hidden;
}

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

.wave-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.wave-path.drawn {
    stroke-dashoffset: 0;
}

/* ===== ZONE: MIDNIGHT ===== */
.zone-midnight {
    min-height: 150vh;
    padding: 10vh 5vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
}

.midnight-statement {
    text-align: center;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 0.3em;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.midnight-statement.in-view {
    opacity: 1;
    transform: translateY(0);
}

.midnight-statement p {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 400;
    line-height: 1.2;
    color: #cc6600;
    text-shadow:
        0 0 40px rgba(204, 102, 0, 0.3),
        0 0 80px rgba(204, 102, 0, 0.1);
}

.midnight-statement code {
    font-size: clamp(1.5rem, 3.5vw, 3rem);
}

/* ===== ZONE: ABYSS ===== */
.zone-abyss {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    position: relative;
}

.abyss-terminal {
    position: relative;
}

#abyssTextarea {
    background: rgba(10, 22, 40, 0.9);
    border: 1px solid rgba(204, 102, 0, 0.2);
    color: #e8a04a;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    padding: 2rem;
    width: min(90vw, 600px);
    min-height: 200px;
    resize: none;
    caret-color: #cc6600;
    outline: none;
    border-radius: 6px;
    line-height: 1.6;
    letter-spacing: 0.04em;
    transition: border-color 0.3s ease;
}

#abyssTextarea:focus {
    border-color: rgba(204, 102, 0, 0.5);
}

#abyssTextarea::placeholder {
    color: rgba(232, 160, 74, 0.3);
}

.bubble-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.typing-bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(230, 240, 239, 0.2);
    background: transparent;
    animation: float-up 2s cubic-bezier(0.17, 0.67, 0.83, 0.67) forwards;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.5);
    }
}

.abyss-footer {
    margin-top: 8vh;
    text-align: center;
}

.surfacing-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #5bc0be;
    letter-spacing: 0.04em;
    animation: surfacing-fade 3s ease-in-out infinite;
}

@keyframes surfacing-fade {
    0%, 100% { opacity: 0; }
    30%, 70% { opacity: 1; }
}

/* ===== ORGANISM ANIMATIONS ===== */
@keyframes drift-jellyfish {
    0% { transform: translate(0, 0); }
    25% { transform: translate(30px, -60px); }
    50% { transform: translate(-20px, -120px); }
    75% { transform: translate(40px, -180px); }
    100% { transform: translate(0, -240px); }
}

@keyframes drift-crate {
    0% { transform: rotate(15deg) translateY(0); opacity: 0.4; }
    50% { opacity: 0.6; }
    100% { transform: rotate(25deg) translateY(-300px); opacity: 0; }
}

@keyframes rise-bubble {
    0% { transform: translateY(0); opacity: 0.5; }
    100% { transform: translateY(-200px); opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .content-pocket {
        margin-left: 5% !important;
        max-width: 90vw;
        border-radius: 20% 30% 30% 20% / 20% 20% 30% 30% !important;
        padding: 2rem 1.5rem;
    }

    .midnight-statement p {
        font-size: clamp(1.5rem, 7vw, 3rem);
    }
}
