/* ========================================
   bada.quest — Styles
   Bathymetric Descent / Scholarly Ocean
   ======================================== */

/* --- Design Palette Reference ---
   Surface Light:       #e8f0f5
   Twilight:            #1a3a5e
   Midnight:            #0a1628
   Hadal:               #000000
   Text Primary Light:  #0a1628
   Text Primary Dark:   #c8dce8
   Body Text Dark:      #8ba7bf
   Body Text Light:     #1a2a3e
   Accent Glow:         #4af0e8
   Accent Warm:         #c89a4a
   Gradient Mesh A:     #1afaa0
   Gradient Mesh B:     #3a1a6e
   Footnote:            #5a8aaa
   Data:                #4a7a9a
   Annotation Light:    #3a5a7a
   --- */

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

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

body {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #1a2a3e;
    background: #e8f0f5;
    overflow-x: hidden;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: 0.06em;
    color: #0a1628;
    margin-bottom: 2rem;
}

.heading-dark {
    color: #c8dce8;
}

.heading-sparse {
    margin-bottom: 4rem;
}

.body-text {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #1a2a3e;
    margin-bottom: 2rem;
    max-width: 60ch;
}

.text-dark {
    color: #8ba7bf;
}

.text-sparse {
    margin-bottom: 4rem;
}

/* --- Depth Sections --- */
.depth-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Section 1: Surface */
.section-surface {
    background: #e8f0f5;
    padding: 12vh 8vw 4vh;
}

.title-korean {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #0a1628;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
    opacity: 1;
}

.subtitle-domain {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    color: #3a5a7a;
    margin-bottom: 0.5rem;
}

.surface-tagline {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1rem;
    color: #5a8aaa;
    letter-spacing: 0.08em;
    margin-top: 1rem;
}

/* Section 2: Sunlit */
.section-sunlit {
    background: #e8f0f5;
    padding: 8vh 8vw 4vh;
}

.section-content-columns {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto;
    gap: 4rem;
    max-width: 1200px;
}

.column-main {
    grid-column: 1;
}

.column-sidebar {
    grid-column: 2;
    position: relative;
    min-height: 300px;
}

/* Section 3: Twilight */
.section-twilight {
    background: #1a3a5e;
    padding: 0 8vw;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 12vh;
}

.section-content-twilight {
    max-width: 55ch;
    margin: 0 auto;
}

/* Section 4: Midnight */
.section-midnight {
    background: #0a1628;
    padding: 8vh 8vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-content-midnight {
    max-width: 50ch;
    margin: 0 auto;
    text-align: left;
}

.section-content-midnight .text-sparse:last-child {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-style: italic;
    color: #5a8aaa;
}

.depth-markers-column {
    position: absolute;
    left: 3vw;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Section 5: Abyssal */
.section-abyssal {
    background: #0a1628;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-content-abyssal {
    text-align: center;
    max-width: 40ch;
    z-index: 2;
}

.abyssal-quote {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: rgba(200, 220, 232, 0.6);
    line-height: 1.6;
    letter-spacing: 0.03em;
}

/* Bioluminescent particles */
.bioluminescent-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.bio-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #4af0e8;
    animation: bio-pulse var(--pulse-duration, 4s) ease-in-out infinite;
    animation-delay: var(--pulse-delay, 0s);
    opacity: 0;
}

@keyframes bio-pulse {
    0%, 100% { opacity: 0.1; transform: scale(0.5); }
    50% { opacity: 0.8; transform: scale(1.5); box-shadow: 0 0 6px rgba(74, 240, 232, 0.3); }
}

/* Section 6: Hadal */
.section-hadal {
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-content-hadal {
    text-align: center;
    z-index: 2;
    max-width: 40ch;
}

.hadal-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: rgba(200, 220, 232, 0.6);
    line-height: 1.6;
    margin-bottom: 4rem;
}

.hadal-domain {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: rgba(200, 220, 232, 0.15);
    letter-spacing: 0.12em;
}

.hadal-depth {
    animation: hadal-pulse 12s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes hadal-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; text-shadow: 0 0 12px rgba(74, 240, 232, 0.15); }
}

/* Section 7: Ascent */
.section-ascent {
    background: #e8f0f5;
    padding: 8vh 8vw 0;
    min-height: auto;
    scroll-snap-align: start;
}

.section-content-ascent {
    max-width: 60ch;
    margin-left: 8vw;
    position: relative;
    z-index: 2;
}

.section-content-ascent .section-heading {
    margin-bottom: 2rem;
}

.section-content-ascent .body-text {
    margin-bottom: 4rem;
}

.references {
    margin-bottom: 4rem;
}

.references-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 1.5rem;
    color: #0a1628;
    letter-spacing: 0.04em;
    margin-bottom: 1.5rem;
}

.references-list {
    list-style: decimal;
    padding-left: 1.5rem;
}

.reference-item {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #3a5a7a;
    margin-bottom: 1rem;
}

.reference-item em {
    font-style: italic;
}

.coda-domain {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #0a1628;
    letter-spacing: 0.06em;
    margin-bottom: 4rem;
}

.ascent-whitespace {
    height: 30vh;
}

/* --- Ascent layers (cross-section diagram) --- */
.ascent-layers {
    position: absolute;
    right: 5vw;
    top: 10vh;
    width: 220px;
    height: 70vh;
    z-index: 1;
    pointer-events: none;
}

.ascent-layer {
    position: absolute;
    width: 100%;
    border-radius: 50%;
    filter: blur(30px);
}

.ascent-layer-1 {
    top: 0;
    height: 120px;
    background: radial-gradient(circle, rgba(26, 250, 160, 0.15), rgba(58, 26, 110, 0.08));
    opacity: 0.6;
}

.ascent-layer-2 {
    top: 15%;
    height: 100px;
    background: radial-gradient(circle, rgba(90, 138, 170, 0.2), rgba(26, 58, 94, 0.1));
    opacity: 0.5;
}

.ascent-layer-3 {
    top: 35%;
    height: 100px;
    background: radial-gradient(circle, rgba(74, 240, 232, 0.15), rgba(10, 22, 40, 0.1));
    opacity: 0.4;
}

.ascent-layer-4 {
    top: 55%;
    height: 100px;
    background: radial-gradient(circle, rgba(58, 26, 110, 0.2), rgba(0, 0, 0, 0.15));
    opacity: 0.3;
}

.ascent-layer-5 {
    top: 75%;
    height: 100px;
    background: radial-gradient(circle, rgba(200, 154, 74, 0.15), rgba(0, 0, 0, 0.2));
    opacity: 0.2;
}

/* --- Gradient Mesh Orbs --- */
.mesh-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* Surface orb */
.mesh-orb-surface {
    width: 60vmin;
    height: 60vmin;
    bottom: 10%;
    right: 5%;
    background: radial-gradient(circle at 40% 40%, rgba(26, 250, 160, 0.25), rgba(58, 26, 110, 0.15), transparent 70%);
    filter: blur(40px);
    opacity: 0;
    animation: mesh-pulse 10s cubic-bezier(0.4, 0, 0.6, 1) infinite, mesh-fadein 1.5s ease-out 1.2s forwards;
}

@keyframes mesh-fadein {
    from { opacity: 0; }
    to { opacity: 0.15; }
}

@keyframes mesh-pulse {
    0%, 100% { transform: scale(0.95) translate(0, 0); }
    33% { transform: scale(1.03) translate(1%, -1%); }
    66% { transform: scale(0.98) translate(-1%, 0.5%); }
}

@keyframes mesh-drift {
    0%, 100% { transform: translate(0, 0) scale(0.97); }
    25% { transform: translate(2%, -1%) scale(1.02); }
    50% { transform: translate(-1%, 2%) scale(1.05); }
    75% { transform: translate(1%, 1%) scale(0.98); }
}

@keyframes mesh-hue {
    0% { filter: blur(40px) hue-rotate(0deg); }
    100% { filter: blur(40px) hue-rotate(15deg); }
}

/* Sunlit sidebar orbs */
.mesh-orb-sunlit-a {
    width: 180px;
    height: 180px;
    top: 10%;
    right: 10%;
    background: radial-gradient(circle at 50% 50%, rgba(26, 250, 160, 0.2), rgba(90, 138, 170, 0.1), transparent 70%);
    filter: blur(30px);
    opacity: 0.4;
    animation: mesh-drift 12s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mesh-orb-sunlit-b {
    width: 140px;
    height: 140px;
    top: 40%;
    right: 30%;
    background: radial-gradient(circle at 60% 40%, rgba(58, 26, 110, 0.15), rgba(74, 240, 232, 0.1), transparent 70%);
    filter: blur(25px);
    opacity: 0.3;
    animation: mesh-drift 15s cubic-bezier(0.4, 0, 0.6, 1) infinite 2s;
}

.mesh-orb-sunlit-c {
    width: 100px;
    height: 100px;
    top: 70%;
    right: 15%;
    background: radial-gradient(circle at 40% 60%, rgba(26, 58, 94, 0.2), rgba(26, 250, 160, 0.08), transparent 70%);
    filter: blur(20px);
    opacity: 0.25;
    animation: mesh-drift 10s cubic-bezier(0.4, 0, 0.6, 1) infinite 1s;
}

/* Midnight orbs */
.mesh-orb-midnight-a {
    width: 25vmin;
    height: 25vmin;
    top: 20%;
    right: 15%;
    background: radial-gradient(circle at 50% 50%, rgba(74, 240, 232, 0.15), rgba(58, 26, 110, 0.1), transparent 70%);
    filter: blur(40px);
    opacity: 0.25;
    animation: mesh-drift 12s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mesh-orb-midnight-b {
    width: 20vmin;
    height: 20vmin;
    bottom: 25%;
    left: 20%;
    background: radial-gradient(circle at 40% 60%, rgba(26, 250, 160, 0.12), rgba(74, 240, 232, 0.08), transparent 70%);
    filter: blur(35px);
    opacity: 0.2;
    animation: mesh-drift 15s cubic-bezier(0.4, 0, 0.6, 1) infinite 3s;
}

/* Hadal orb */
.mesh-orb-hadal {
    width: 40vmin;
    height: 40vmin;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle at 45% 45%,
        rgba(26, 250, 160, 0.2),
        rgba(58, 26, 110, 0.15) 30%,
        rgba(74, 240, 232, 0.1) 55%,
        rgba(200, 154, 74, 0.08) 75%,
        transparent 90%
    );
    filter: blur(50px);
    opacity: 0.3;
    animation: hadal-mesh-pulse 12s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: 1;
}

@keyframes hadal-mesh-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.2; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.35; }
}

/* --- Depth Markers --- */
.depth-marker {
    position: absolute;
    bottom: 3vh;
    left: 3vw;
}

.depth-marker-dark .depth-value {
    color: #4a7a9a;
}

.depth-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #4a7a9a;
}

.depth-value-glow {
    color: #4a7a9a;
    animation: footnote-glow 4s ease-in-out infinite;
}

/* --- Footnotes --- */
.footnote-margin {
    position: absolute;
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 200px;
}

.footnote-margin-dark {
    left: 2vw;
}

.footnote {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.25rem;
}

.footnote-line {
    display: block;
    width: 60px;
    height: 2px;
    margin-bottom: 0.25rem;
}

.footnote-line line {
    stroke: #4a7a9a;
    stroke-width: 1;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.footnote-line.drawn line {
    stroke-dashoffset: 0;
}

.footnote-line-dark line {
    stroke: #4a7a9a;
}

.footnote-marker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #3a5a7a;
    margin-right: 0.5rem;
}

.footnote-marker-glow {
    color: #4af0e8;
    animation: footnote-glow 4s ease-in-out infinite;
}

@keyframes footnote-glow {
    0%, 100% {
        opacity: 0.5;
        text-shadow: 0 0 0px rgba(74, 240, 232, 0);
    }
    50% {
        opacity: 1.0;
        text-shadow: 0 0 8px rgba(74, 240, 232, 0.2);
    }
}

.footnote-text {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #5a8aaa;
    display: block;
    width: 100%;
}

.footnote-dark .footnote-text {
    color: #5a8aaa;
    animation: footnote-glow 4s ease-in-out infinite;
}

/* --- Thermocline dividers --- */
.section-twilight::before,
.section-midnight::before,
.section-abyssal::before,
.section-hadal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
    pointer-events: none;
    z-index: 3;
}

.section-ascent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.08), transparent);
    pointer-events: none;
    z-index: 3;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .section-content-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .column-sidebar {
        display: none;
    }

    .footnote-margin {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        margin-top: 2rem;
        max-width: 100%;
    }

    .depth-markers-column {
        left: 2vw;
        gap: 2rem;
    }

    .ascent-layers {
        display: none;
    }

    .section-content-ascent {
        margin-left: 0;
    }

    .section-surface {
        padding: 8vh 6vw 4vh;
    }

    .section-sunlit,
    .section-twilight,
    .section-midnight {
        padding: 6vh 6vw;
    }

    .section-content-twilight {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .title-korean {
        font-size: clamp(3rem, 15vw, 5rem);
    }

    .section-heading {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .abyssal-quote,
    .hadal-text {
        font-size: clamp(1.1rem, 4vw, 1.6rem);
    }
}
