/* ============================================
   bada.quest v2 - Abyssal Descent
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Zone colors */
    --surface-blue: #0A4C6A;
    --twilight-navy: #0B1D3A;
    --abyss-black: #050A14;

    /* Accent colors */
    --biolum-teal: #00E5CC;
    --biolum-violet: #7B68EE;
    --anglerfish-amber: #FFB347;

    /* Text colors */
    --text-white: #E8EDF2;
    --text-muted: #7A8FA6;

    /* Dynamic background (updated by JS) */
    --bg-h: 197;
    --bg-s: 82%;
    --bg-l: 23%;
}

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

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

body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.85;
    letter-spacing: 0.015em;
    color: var(--text-white);
    background-color: hsl(var(--bg-h), var(--bg-s), var(--bg-l));
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.05s linear;
}

/* Vignette overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
    z-index: 1;
}

/* --- Depth Indicator --- */
.depth-indicator {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
    transition: opacity 0.6s ease;
}

.depth-indicator:hover {
    opacity: 1;
}

.depth-track {
    width: 2px;
    height: 200px;
    background: rgba(122, 143, 166, 0.2);
    border-radius: 1px;
    position: relative;
}

.depth-progress {
    width: 2px;
    height: 0%;
    background: var(--biolum-teal);
    border-radius: 1px;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 0 8px var(--biolum-teal), 0 0 16px rgba(0, 229, 204, 0.3);
    transition: height 0.1s linear;
}

.depth-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
}

.depth-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity 0.4s ease, color 0.4s ease;
}

.depth-label.active {
    opacity: 1;
    color: var(--biolum-teal);
}

/* --- Ripple Container --- */
.ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.ripple-ring {
    fill: none;
    stroke: var(--biolum-teal);
    stroke-width: 1;
    opacity: 0;
}

/* --- Zone Base Styles --- */
.zone {
    position: relative;
    width: 100%;
}

.zone-surface {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone-photic {
    min-height: 200vh;
    padding: 20vh 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40vh;
}

.zone-twilight {
    min-height: 200vh;
    padding: 20vh 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30vh;
}

.zone-abyssal {
    min-height: 150vh;
    padding: 20vh 0 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25vh;
}

/* --- Surface Zone --- */
.surface-content {
    text-align: center;
    position: relative;
    z-index: 10;
}

.logotype {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(48px, 8vw, 120px);
    color: var(--text-white);
    letter-spacing: 0.05em;
    margin-bottom: 24px;
    opacity: 0;
    animation: logotypeFadeIn 1.8s ease-out 0.3s forwards;
}

.intro-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(18px, 2.5vw, 28px);
    color: var(--text-white);
    opacity: 0;
    animation: introFadeIn 1.2s ease-out 1.2s forwards;
    max-width: 500px;
    margin: 0 auto;
}

.scroll-chevron {
    position: absolute;
    bottom: -30vh;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: chevronPulse 2.5s ease-in-out 2s infinite, introFadeIn 0.8s ease-out 2s forwards;
}

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

@keyframes introFadeIn {
    from { opacity: 0; }
    to { opacity: 0.85; }
}

@keyframes chevronPulse {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateX(-50%) translateY(8px);
        opacity: 0.9;
    }
}

/* --- Kelp Borders --- */
.kelp {
    position: absolute;
    top: 0;
    height: 100%;
    width: 40px;
    z-index: 5;
    pointer-events: none;
}

.kelp-left {
    left: 5%;
    animation: kelpSway 8s ease-in-out infinite;
}

.kelp-right {
    right: 5%;
    animation: kelpSway 8s ease-in-out infinite reverse;
    animation-delay: -3s;
}

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

/* --- Content Blocks --- */
.content-block {
    max-width: 520px;
    width: 90%;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.content-block.visible .section-heading {
    opacity: 1;
    transform: translateY(0);
}

.content-block.visible p {
    opacity: 1;
    transform: translateY(0);
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(24px, 4vw, 40px);
    color: var(--text-white);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out 0.15s, transform 0.6s ease-out 0.15s;
}

.content-block p {
    color: var(--text-white);
    opacity: 0;
    transform: translateY(15px);
    margin-bottom: 16px;
}

.content-block p:nth-child(2) {
    transition: opacity 0.6s ease-out 0.3s, transform 0.6s ease-out 0.3s;
}

.content-block p:nth-child(3) {
    transition: opacity 0.6s ease-out 0.45s, transform 0.6s ease-out 0.45s;
}

.content-block p:nth-child(4) {
    transition: opacity 0.6s ease-out 0.6s, transform 0.6s ease-out 0.6s;
}

/* --- Organisms --- */
.organism {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 0 8px currentColor);
}

.organism-jellyfish {
    width: 120px;
    height: 160px;
    right: 8%;
    top: 15%;
    color: #00E5CC;
    animation: organismFloat 12s ease-in-out infinite, organismRotate 15s ease-in-out infinite;
}

.organism-plankton {
    width: 80px;
    height: 80px;
    left: 6%;
    top: 35%;
    color: #7B68EE;
    animation: organismFloat 18s ease-in-out infinite, organismPulse 4s ease-in-out infinite;
    animation-delay: -5s;
}

.organism-kelp-strand {
    width: 60px;
    height: 400px;
    right: 12%;
    top: 50%;
    color: #0A4C6A;
    animation: kelpSway 10s ease-in-out infinite;
}

.organism-jelly-small {
    width: 60px;
    height: 80px;
    left: 10%;
    top: 70%;
    color: #7B68EE;
    animation: organismFloat 14s ease-in-out infinite, organismRotate 20s ease-in-out infinite reverse;
    animation-delay: -8s;
}

@keyframes organismFloat {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-15px) translateX(5px); }
    50% { transform: translateY(-8px) translateX(-3px); }
    75% { transform: translateY(-20px) translateX(4px); }
}

@keyframes organismRotate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

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

/* --- Specimen Panels --- */
.specimen-panel {
    width: 100%;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.specimen-svg {
    width: min(80vw, 500px);
    height: auto;
    filter: drop-shadow(0 0 8px currentColor);
    color: #00E5CC;
    animation: specimenGlow 3s ease-in-out infinite alternate;
}

.specimen-siphonophore {
    color: #7B68EE;
    animation: specimenGlowViolet 3s ease-in-out infinite alternate;
}

.specimen-comb-jelly {
    color: #00E5CC;
    animation: specimenGlowCycle 6s ease-in-out infinite;
}

@keyframes specimenGlow {
    0% {
        filter: drop-shadow(0 0 8px #00E5CC) drop-shadow(0 0 16px rgba(0, 229, 204, 0.3));
    }
    100% {
        filter: drop-shadow(0 0 16px #00E5CC) drop-shadow(0 0 32px rgba(0, 229, 204, 0.5));
    }
}

@keyframes specimenGlowViolet {
    0% {
        filter: drop-shadow(0 0 8px #7B68EE) drop-shadow(0 0 16px rgba(123, 104, 238, 0.3));
    }
    100% {
        filter: drop-shadow(0 0 16px #7B68EE) drop-shadow(0 0 32px rgba(123, 104, 238, 0.5));
    }
}

@keyframes specimenGlowCycle {
    0%, 100% {
        filter: drop-shadow(0 0 10px #00E5CC) drop-shadow(0 0 20px rgba(0, 229, 204, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 10px #7B68EE) drop-shadow(0 0 20px rgba(123, 104, 238, 0.4));
    }
}

/* Anglerfish lure glow */
.anglerfish-lure {
    filter: drop-shadow(0 0 12px #FFB347) drop-shadow(0 0 24px rgba(255, 179, 71, 0.6));
    animation: lureGlow 2s ease-in-out infinite alternate;
}

@keyframes lureGlow {
    0% {
        filter: drop-shadow(0 0 8px #FFB347) drop-shadow(0 0 16px rgba(255, 179, 71, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 16px #FFB347) drop-shadow(0 0 32px rgba(255, 179, 71, 0.8));
    }
}

/* --- Final Message (Abyssal) --- */
.final-message {
    text-align: center;
}

.glow-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(22px, 3.5vw, 36px);
    color: var(--biolum-teal);
    text-shadow: 0 0 12px var(--biolum-teal), 0 0 24px rgba(0, 229, 204, 0.3);
    animation: glowTextPulse 3s ease-in-out infinite;
}

@keyframes glowTextPulse {
    0%, 100% {
        text-shadow: 0 0 8px var(--biolum-teal), 0 0 16px rgba(0, 229, 204, 0.2);
    }
    50% {
        text-shadow: 0 0 16px var(--biolum-teal), 0 0 32px rgba(0, 229, 204, 0.4);
    }
}

/* --- Marine Snow --- */
.marine-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.marine-snow.active {
    opacity: 1;
}

.snow-particle {
    position: absolute;
    border-radius: 50%;
    background: var(--text-white);
    pointer-events: none;
}

@keyframes snowDrift {
    0% {
        transform: translateY(110vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--particle-opacity);
    }
    90% {
        opacity: var(--particle-opacity);
    }
    100% {
        transform: translateY(-10vh) translateX(var(--drift-x));
        opacity: 0;
    }
}

/* --- Surface Return Link --- */
.surface-return {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
    z-index: 10;
}

.surface-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.3;
    transition: opacity 0.4s ease, text-shadow 0.4s ease, color 0.4s ease;
}

.surface-link:hover {
    opacity: 1;
    color: var(--biolum-teal);
    text-shadow: 0 0 12px var(--biolum-teal), 0 0 24px rgba(0, 229, 204, 0.3);
}

/* --- Bioluminescent Link Hover States --- */
a {
    color: var(--biolum-teal);
    text-decoration: none;
    transition: text-shadow 0.3s ease;
    animation: linkGlowIdle 3s ease-in-out infinite;
}

a:hover {
    text-shadow: 0 0 12px #00E5CC, 0 0 24px rgba(0, 229, 204, 0.3);
}

@keyframes linkGlowIdle {
    0%, 100% {
        text-shadow: 0 0 8px rgba(0, 229, 204, 0.1);
    }
    50% {
        text-shadow: 0 0 16px rgba(0, 229, 204, 0.2);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .depth-indicator {
        right: 10px;
    }

    .depth-labels {
        display: none;
    }

    .depth-track {
        height: 120px;
    }

    .organism-jellyfish {
        width: 80px;
        right: 3%;
    }

    .organism-plankton {
        width: 50px;
        left: 3%;
    }

    .organism-jelly-small {
        width: 40px;
        left: 5%;
    }

    .kelp-left {
        left: 1%;
    }

    .kelp-right {
        right: 1%;
    }

    .specimen-svg {
        width: 90vw;
    }
}

@media (max-width: 480px) {
    .depth-indicator {
        display: none;
    }
}
