/* =========================================
   bada.day — styles.css
   A meditation on the sea's surface at dawn
   Typeface selections: Cormorant Garamond, Lora, DM Sans
   ========================================= */

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

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

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 19px);
    line-height: 1.85;
    color: #3d5a6e;
    background-color: #0d1b2a;
    overflow-x: hidden;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Palette Variables --- */
:root {
    --deep-bg: #0d1b2a;         /* Nautical twilight */
    --mid-bg: #1b3a4b;          /* Pre-dawn sea */
    --light-bg: #d4dfe6;        /* Morning mist */
    --warm-bg: #e8ddd3;         /* Sand after rain */
    --text-dark: #3d5a6e;       /* Tidal blue */
    --text-light: #b8c9d4;      /* Driftwood grey */
    --display: #8fa3b0;         /* Sea-glass */
    --accent-warm: #c9a87c;     /* Wet kelp gold */
    --accent-cool: #5b8a9a;     /* Celadon water */
    --border: #4a6670;          /* Horizon line */
}

/* --- Typography --- */
.logotype {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.12em;
    color: var(--display);
    opacity: 0;
    transition: none;
}

.logotype-kr {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(36px, 5.5vw, 80px);
    letter-spacing: 0.08em;
    color: var(--display);
    opacity: 0;
    margin-top: 0.3em;
    transition: none;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(24px, 3.5vw, 48px);
    letter-spacing: 0.12em;
    color: var(--display);
    margin-bottom: 1.5em;
    overflow: hidden;
}

.section-heading .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 80ms ease-out;
}

.section-heading .char-space {
    width: 0.3em;
    display: inline-block;
}

.section-body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 19px);
    line-height: 1.85;
    max-width: 640px;
    margin-bottom: 2em;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.section-body.visible {
    opacity: 1;
}

.metadata-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(11px, 0.75vw, 13px);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #7a8f9c;
    opacity: 0.7;
    display: block;
    margin-top: 2em;
}

/* --- Sections --- */
.section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
}

.section-inner {
    max-width: 640px;
    width: 100%;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

/* Opening viewport */
.section-opening {
    width: 100%;
    height: 100vh;
    background: linear-gradient(to right, #0d1b2a, #d4dfe6);
}

.opening-content {
    text-align: center;
    padding-left: 0;
    margin-left: 23.6%;  /* Approx golden ratio from left: 61.8% offset center */
}

/* Tidal sections */
.section-tidal {
    width: 100%;
    padding: 6rem 0;
}

.section-tidal-1 {
    min-height: 100vh;
    background-color: #d4dfe6;
    color: #3d5a6e;
}

.section-tidal-1 .section-body {
    color: #3d5a6e;
}

.section-tidal-2 {
    min-height: 80vh;
    background-color: #e8ddd3;
    color: #3d5a6e;
}

.section-tidal-2 .section-body {
    color: #3d5a6e;
}

.section-tidal-3 {
    min-height: 120vh;
    background-color: #d4dfe6;
    color: #3d5a6e;
}

.section-tidal-3 .section-body {
    color: #3d5a6e;
}

.section-tidal-4 {
    min-height: 80vh;
    background-color: #1b3a4b;
    color: #b8c9d4;
}

.section-tidal-4 .section-heading {
    color: #8fa3b0;
}

.section-tidal-4 .section-body {
    color: #b8c9d4;
}

.section-tidal-4 .metadata-text {
    color: #7a8f9c;
}

.section-tidal-5 {
    min-height: 100vh;
    background-color: #0d1b2a;
    color: #b8c9d4;
}

.section-tidal-5 .section-heading {
    color: #8fa3b0;
}

.section-tidal-5 .section-body {
    color: #b8c9d4;
}

/* Watercolor wash textures on wider screens */
@media (min-width: 1200px) {
    .section-tidal-1 {
        background:
            radial-gradient(ellipse 500px 400px at 10% 30%, rgba(91,138,154,0.05), transparent),
            radial-gradient(ellipse 400px 300px at 90% 70%, rgba(91,138,154,0.04), transparent),
            #d4dfe6;
    }

    .section-tidal-2 {
        background:
            radial-gradient(ellipse 600px 400px at 85% 40%, rgba(201,168,124,0.04), transparent),
            radial-gradient(ellipse 350px 350px at 15% 60%, rgba(91,138,154,0.03), transparent),
            #e8ddd3;
    }

    .section-tidal-3 {
        background:
            radial-gradient(ellipse 500px 500px at 20% 50%, rgba(91,138,154,0.05), transparent),
            radial-gradient(ellipse 400px 300px at 80% 20%, rgba(201,168,124,0.03), transparent),
            #d4dfe6;
    }

    .section-tidal-4 {
        background:
            radial-gradient(ellipse 500px 400px at 75% 35%, rgba(91,138,154,0.06), transparent),
            radial-gradient(ellipse 400px 350px at 25% 75%, rgba(201,168,124,0.04), transparent),
            #1b3a4b;
    }

    .section-tidal-5 {
        background:
            radial-gradient(ellipse 600px 500px at 30% 40%, rgba(91,138,154,0.05), transparent),
            radial-gradient(ellipse 350px 300px at 70% 80%, rgba(27,58,75,0.08), transparent),
            #0d1b2a;
    }
}

/* Terminal section */
.section-terminal {
    width: 100%;
    height: 100vh;
    background: linear-gradient(to right, #d4dfe6, #0d1b2a);
}

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

.terminal-kr {
    opacity: 0;
    margin-top: 0;
}

.terminal-meta {
    margin-top: 1em;
    opacity: 0;
}

/* --- Horizon Dividers --- */
.horizon-divider {
    width: 100%;
    height: 1px;
    background-color: var(--border);
    opacity: 0.15;
    position: relative;
    z-index: 2;
}

.horizon-divider-1 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: 0s;
}

.horizon-divider-2 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: -2s;
}

.horizon-divider-3 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: -4s;
}

.horizon-divider-4 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: -6s;
}

.horizon-divider-5 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: -1s;
}

.horizon-divider-6 {
    animation: horizon-breathe 8s ease-in-out infinite;
    animation-delay: -3s;
}

@keyframes horizon-breathe {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 0.18; }
}

/* --- Foam Container --- */
.foam-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.foam-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
}

.foam-layer-0 {
    animation: foam-drift-0 120s linear infinite;
}

.foam-layer-1 {
    animation: foam-drift-1 160s linear infinite;
}

.foam-layer-2 {
    animation: foam-drift-2 200s linear infinite;
}

@keyframes foam-drift-0 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes foam-drift-1 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes foam-drift-2 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Celadon Crackle Overlay --- */
.celadon-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0.03;
}

/* --- Cursor Trail --- */
.cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.cursor-drop {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent-cool);
    opacity: 0.3;
    pointer-events: none;
    animation: cursor-fade 800ms ease-out forwards;
}

@keyframes cursor-fade {
    0% { opacity: 0.3; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

/* --- Hover Effects --- */
a {
    color: inherit;
    text-decoration: none;
    position: relative;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--accent-warm);
    opacity: 0.4;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease-out;
}

a:hover::after {
    transform: scaleX(1);
}

/* --- Selection --- */
::selection {
    background-color: rgba(91,138,154,0.2);
    color: inherit;
}

/* --- Scroll-driven body background interpolation (fallback handled by JS) --- */
@supports (animation-timeline: scroll()) {
    body {
        animation: body-color-shift 1s linear;
        animation-timeline: scroll();
    }

    @keyframes body-color-shift {
        0% { background-color: #0d1b2a; }
        12% { background-color: #1b3a4b; }
        25% { background-color: #d4dfe6; }
        40% { background-color: #e8ddd3; }
        55% { background-color: #d4dfe6; }
        70% { background-color: #1b3a4b; }
        85% { background-color: #0d1b2a; }
        100% { background-color: #0d1b2a; }
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-inner {
        padding: 0 1.5rem;
    }

    .opening-content {
        margin-left: 0;
        text-align: center;
    }

    .section-tidal {
        padding: 4rem 0;
    }
}
