/* bada.coffee - Dawn to Mid-Morning Coastal Coffee Ritual */

/* ========================================
   CSS Custom Properties (scroll-driven)
   Dawn Palette:
     05:30 Approach:   #0f1724, #c8d0d8, #2a4060
     06:00 First Light: #162038, #d0d8e0, #3a5068
     07:15 The Pour:    #4a6a82, #f0e8d8, #c4a46a
     08:30 Golden Hour: #d4c4a0, #3a2e20, #8a7a60
     09:45 The Linger:  #8a9aaa, #f4f0ec, #b8d4d0
   ======================================== */
:root {
    --bg-color-start: #0f1724;
    --bg-color-end: #162038;
    --text-color: #c8d0d8;
    --accent-color: #2a4060;
    --scroll-progress: 0;

    /* Section color references (driven by JS scroll interpolation) */
    --approach-bg: #0f1724;
    --approach-text: #c8d0d8;
    --approach-accent: #2a4060;
    --first-light-bg: #162038;
    --first-light-text: #d0d8e0;
    --first-light-accent: #3a5068;
    --pour-bg: #4a6a82;
    --pour-text: #f0e8d8;
    --pour-accent: #c4a46a;
    --golden-bg: #d4c4a0;
    --golden-text: #3a2e20;
    --golden-accent: #8a7a60;
    --linger-bg: #8a9aaa;
    --linger-text: #f4f0ec;
    --linger-accent: #b8d4d0;
}

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

html {
    font-size: 17px;
    scroll-behavior: auto;
    overflow-x: hidden;
}

body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 400;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: var(--text-color);
    background: linear-gradient(180deg, var(--bg-color-start), var(--bg-color-end));
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Grain Texture Overlay
   ======================================== */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABhGlDQ1BJQ0MgcHJvZmlsZQAAeJx9kT1Iw0AYht+mSkUqDhYRcchQnSyIijhqFYpQIdQKrTqYXPoHTRqSFBdHwVXg4M9i1cHFWVcHV0EQ/AExdHRSdJESv0sKLWI8OO7Hu3fvAOGhiqnZHQdUzTJSiYSQza0KoVf4EEA/RjAmM1OZpexUMo7n+x4+XuSxrOv+7z6lHzTAJ9EPMU004RfEM5sWjTnfUIcYWVJIT4nnjAoQOJH7muuPzGudCzwzJCRTc4Rh4h5sYNlB8ouJioePqoSjcZv5B1qdTC2ps05wgvESK7wwhECpDJKnXB0FiX1GBVwsnaWaz4gccfiZEKF8kKBLy5ACP+IN/d3b2x/03aKJ4AOhe6/hgDQruAq0a7/slrjxA+BUBrpZ+v0CBlL+k7q4CwNkBqLq9tfdA+jvA0GptuU/IIBJmUxke60hT0FhF8DFNvpSEBTIPJF+tA/EbehZd3p7fOeY/gByo8pyAQ0CoUQln+/z7u7Ondt37d6e/v1paufy1/l1jL8BLWNvUAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+cDGAAKMzWNaFIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAZklEQVRo3u3SQQ0AIAzAQMAfggcS8GdlhTvpJununu8/swYhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISGhvwcLABv2BRmkzHYeAAAAAElFTkSuQmCC");
    background-repeat: repeat;
}

/* ========================================
   Floating Time Indicator
   ======================================== */
#time-indicator {
    position: fixed;
    top: 32px;
    right: 40px;
    z-index: 100;
    transition: opacity 0.6s ease;
}

#time-display {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.4;
    filter: blur(0px);
    transition: filter 0.8s ease, opacity 0.8s ease;
}

/* ========================================
   Sections / Moments
   ======================================== */
.moment {
    position: relative;
    width: 100%;
    overflow: hidden;
}

#section-approach {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5vh), 0 100%);
    padding-bottom: 5vh;
}

#section-first-light {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    clip-path: polygon(0 0, 100% 5vh, 100% 100%, 0 calc(100% - 5vh));
    margin-top: -5vh;
    padding: 8vh 0;
}

#section-pour {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 5vh, 100% 0, 100% calc(100% - 5vh), 0 100%);
    margin-top: -5vh;
    padding: 8vh 0;
}

#section-golden {
    min-height: 130vh;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 5vh, 100% 100%, 0 calc(100% - 5vh));
    margin-top: -5vh;
    padding: 8vh 0;
}

#section-linger {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 5vh, 100% 0, 100% 100%, 0 100%);
    margin-top: -5vh;
    padding: 8vh 0;
    position: relative;
}

/* ========================================
   Content Layout
   ======================================== */
.moment-content {
    max-width: 680px;
    width: 90%;
    margin-left: calc(50% - 340px - 8%);
    position: relative;
    z-index: 2;
}

.moment-content.offset-right {
    margin-left: auto;
    margin-right: calc(50% - 340px - 8%);
}

.moment-content.ma-space {
    margin-left: calc(50% - 340px - 8%);
}

.moment-content.linger-content {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ========================================
   Typography
   ======================================== */
.korean-display {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2rem, 7vw, 6rem);
    letter-spacing: 0.25em;
    line-height: 1.3;
    color: var(--text-color);
}

.body-text {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: var(--text-color);
    max-width: 38em;
    margin-bottom: 28px;
}

.korean-annotation {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    color: var(--text-color);
    opacity: 0.5;
    margin-top: 12px;
}

/* ========================================
   Section 1: The Approach
   ======================================== */
.approach-text {
    opacity: 0;
    animation: fogFadeIn 4s ease-out forwards;
    animation-delay: 0.5s;
}

.bottom-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30vh;
    background: linear-gradient(to top, rgba(42, 64, 96, 0.15), transparent);
    pointer-events: none;
    opacity: 0;
    animation: glowFadeIn 3s ease-out forwards;
    animation-delay: 2s;
}

@keyframes fogFadeIn {
    0% { opacity: 0; filter: blur(8px); transform: translateY(10px); }
    100% { opacity: 0.85; filter: blur(0px); transform: translateY(0); }
}

@keyframes glowFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

#section-approach .korean-annotation {
    opacity: 0;
    animation: fogFadeIn 3s ease-out forwards;
    animation-delay: 2.5s;
}

/* ========================================
   Section 2: First Light - Watermark
   ======================================== */
.bada-watermark {
    position: absolute;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 30vw;
    letter-spacing: 0.15em;
    color: var(--text-color);
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
    line-height: 1;
    transition: opacity 0.1s linear;
}

/* ========================================
   Section 3: The Pour - Split Layout
   ======================================== */
.pour-split {
    display: flex;
    align-items: center;
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
    gap: 40px;
    position: relative;
    z-index: 2;
}

.pour-left {
    flex: 0 0 33.333%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pour-right {
    flex: 1;
}

.pour-right .moment-content {
    margin-left: 0;
    width: 100%;
}

#pour-over-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

#pour-over-svg .svg-draw {
    stroke: var(--text-color);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    will-change: stroke-dashoffset;
}

#pour-over-svg #drip-point {
    stroke: var(--accent-color);
}

/* Droplet animation */
@keyframes dropFall {
    0% {
        transform: translateY(0);
        opacity: 0.8;
    }
    70% {
        transform: translateY(95px);
        opacity: 0.6;
    }
    85% {
        transform: translateY(88px);
        opacity: 0.4;
    }
    100% {
        transform: translateY(95px);
        opacity: 0;
    }
}

.coffee-droplet {
    fill: #c4a46a;
    animation: dropFall 1.8s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Steam Canvas */
#steam-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   Section 4: Golden Hour - Ma Space
   ======================================== */
#section-golden .moment-content.ma-space {
    padding: 60px 0;
}

/* ========================================
   Section 5: The Linger
   ======================================== */
.linger-text {
    opacity: 0;
    transform: translateY(30px);
}

.linger-annotation {
    opacity: 0;
    transform: translateY(20px);
}

/* Wave Container */
#wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    overflow: hidden;
    z-index: 2;
}

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

.wave-path {
    stroke: #b8d4d0;
    fill: none;
}

#wave-1 { opacity: 0.15; }
#wave-2 { opacity: 0.10; }
#wave-3 { opacity: 0.08; }

/* ========================================
   SVG Horizon Line
   ======================================== */
#horizon-line {
    position: fixed;
    top: 55%;
    left: 0;
    width: 100%;
    height: 10px;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

#horizon-path {
    stroke: var(--accent-color);
    opacity: 0.25;
}

/* ========================================
   Diagonal Light Beams
   ======================================== */
.diagonal-light-beams {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.light-beam {
    position: absolute;
    width: 1px;
    background: var(--accent-color);
    opacity: 0.04;
}

.beam-1 {
    height: 150vh;
    top: -20vh;
    left: 25%;
    transform: rotate(18deg);
}

.beam-2 {
    height: 120vh;
    top: -10vh;
    left: 70%;
    transform: rotate(-22deg);
}

.beam-3 {
    height: 180vh;
    top: -30vh;
    left: 15%;
    transform: rotate(20deg);
}

.beam-4 {
    height: 140vh;
    top: -15vh;
    left: 50%;
    transform: rotate(-17deg);
}

.beam-5 {
    height: 160vh;
    top: -25vh;
    left: 80%;
    transform: rotate(24deg);
}

.beam-6 {
    height: 130vh;
    top: -10vh;
    left: 35%;
    transform: rotate(-20deg);
}

.beam-7 {
    height: 170vh;
    top: -20vh;
    left: 65%;
    transform: rotate(16deg);
}

.beam-8 {
    height: 200vh;
    top: -30vh;
    left: 20%;
    transform: rotate(22deg);
}

.beam-9 {
    height: 140vh;
    top: -10vh;
    left: 55%;
    transform: rotate(-15deg);
}

.beam-10 {
    height: 160vh;
    top: -20vh;
    left: 85%;
    transform: rotate(19deg);
}

/* ========================================
   Fade-Reveal Animation (applied via JS)
   ======================================== */
.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fade-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .moment-content {
        margin-left: 5%;
        margin-right: 5%;
        width: 90%;
    }

    .moment-content.offset-right {
        margin-left: 5%;
        margin-right: 5%;
    }

    .pour-split {
        flex-direction: column;
        width: 90%;
    }

    .pour-left {
        flex: 0 0 auto;
    }

    #pour-over-svg {
        max-width: 150px;
    }

    .bada-watermark {
        font-size: 40vw;
    }

    #time-indicator {
        top: 16px;
        right: 16px;
    }
}
