/* ============================================
   haroo.day — Styles
   Glassmorphic meditation on one Korean day
   ============================================ */

/* === CSS Custom Properties === */
:root {
    --night-deep: #0C1028;
    --dawn-indigo: #1E2640;
    --morning-apricot: #E8A87C;
    --midday-white: #F0EDE6;
    --afternoon-gold: #C4A462;
    --twilight-violet: #5C4B8A;
    --navy-steel: #2A3152;
    --silver-mist: #C8D0E0;
    --glass-edge: #8892B0;
    --warm-breath: #D4B896;

    --bg-color: #0C1028;
    --scroll-progress: 0;
}

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

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    line-height: 2.0;
    letter-spacing: 0.06em;
    color: var(--silver-mist);
    background-color: var(--bg-color);
    overflow-x: hidden;
    transition: background-color 0.05s linear;
}

/* === SVG Defs (hidden) === */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* === Sundial Navigation === */
.sundial {
    position: fixed;
    left: 16px;
    top: 10vh;
    height: 80vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.sundial-track {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(200, 208, 224, 0.2);
    transform: translateX(-50%);
}

.sundial-indicator {
    position: absolute;
    left: 50%;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--afternoon-gold);
    transform: translate(-50%, -50%);
    transition: top 0.15s ease-out;
    box-shadow: 0 0 12px rgba(196, 164, 98, 0.5);
}

.sundial-label {
    position: absolute;
    left: 20px;
    top: 0;
    transform: translateY(-50%);
    transition: top 0.15s ease-out;
}

.sundial-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    font-weight: 400;
    color: rgba(200, 180, 140, 0.7);
    transform: rotate(-2deg);
    display: inline-block;
    white-space: nowrap;
    clip-path: inset(0 0 0 0);
    transition: clip-path 0.4s ease;
}

/* === Celestial Indicator (Sun/Moon) === */
.celestial {
    position: fixed;
    right: 24px;
    top: 70vh;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--morning-apricot);
    box-shadow: 0 0 20px rgba(232, 168, 124, 0.4);
    z-index: 100;
    transition: top 0.3s ease-out, background-color 0.5s ease, box-shadow 0.5s ease;
    filter: blur(1px);
    pointer-events: none;
}

/* === Zone Sections === */
.zone {
    position: relative;
    min-height: 100vh;
    padding: 8vh 60px 8vh 60px;
    overflow: hidden;
}

/* === Lattice Background SVGs === */
.lattice-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.06;
    pointer-events: none;
    will-change: transform;
    transform: rotate(calc(var(--scroll-progress) * 3deg));
}

/* === Hanji Paper Grain Texture (applied to glass panels) === */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMElEQVQIW2P4z8DwHwMDAwMDEwMDgwADA8N/BgYGJgYGBgEGBob/DAwM/xkYGP4DAFnCB/lo8hRRAAAAAElFTkSuQmCC");
    background-size: 200px;
    opacity: 0.04;
    border-radius: inherit;
    pointer-events: none;
}

/* === Glass Panel Base === */
.glass-panel {
    position: relative;
    background: rgba(42, 49, 82, 0.25);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(200, 208, 224, 0.15);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(12, 16, 40, 0.3);
    padding: clamp(20px, 3vw, 40px);
    will-change: transform, opacity;
    opacity: 0;
    transform: translateY(24px);
}

.glass-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Panel Text === */
.panel-heading {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.4rem, 3.5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--silver-mist);
    margin-bottom: 0.6em;
}

.panel-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 2.0;
    letter-spacing: 0.06em;
    color: var(--silver-mist);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-panel.visible .panel-text {
    opacity: 1;
    transform: translateY(0);
}

.annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    font-weight: 400;
    color: rgba(200, 180, 140, 0.7);
    display: inline-block;
    transform: rotate(-2deg);
    margin-top: 12px;
}

/* === Jamo Characters (Saebyeok zone) === */
.jamo-char {
    font-family: 'Nunito', 'Noto Sans KR', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 800;
    color: var(--silver-mist);
    text-align: center;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-panel.visible .jamo-char {
    opacity: 1;
    transform: translateY(0);
}

/* === Grid Layouts per Zone === */

/* Zone grids - base */
.zone-grid {
    display: grid;
    gap: clamp(12px, 2vw, 24px);
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
}

/* Saebyeok: 3 narrow vertical panels, asymmetric */
.zone-grid-saebyeok {
    grid-template-columns: 1fr 1fr 1fr;
    min-height: 70vh;
    align-items: start;
    padding-top: 15vh;
}

.panel-saebyeok-1 {
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    background: rgba(42, 49, 82, 0.08);
    border-color: rgba(200, 208, 224, 0.06);
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-saebyeok-2 {
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    background: rgba(42, 49, 82, 0.06);
    border-color: rgba(200, 208, 224, 0.05);
    min-height: 50vh;
    margin-top: 8vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-saebyeok-3 {
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    background: rgba(42, 49, 82, 0.10);
    border-color: rgba(200, 208, 224, 0.07);
    min-height: 35vh;
    margin-top: 3vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Achim: 3x2 grid with misaligned tops */
.zone-grid-achim {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
}

.panel-achim-1 { padding-top: clamp(24px, 4vw, 48px); }
.panel-achim-2 { margin-top: 3vh; }
.panel-achim-3 { margin-top: 6vh; }
.panel-achim-4 { margin-top: 2vh; }
.panel-achim-5 { margin-top: 5vh; }
.panel-achim-6 { margin-top: 1vh; }

/* Achim glass - gaining opacity and warmth */
.zone-achim .glass-panel {
    background: rgba(42, 49, 82, 0.20);
    border-color: rgba(232, 168, 124, 0.12);
}

/* Nat: Dense grid, 8-10 blocks */
.zone-grid-nat {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: start;
}

.zone-nat .glass-panel {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(200, 208, 224, 0.20);
}

.zone-nat .panel-heading {
    color: var(--dawn-indigo);
}

.zone-nat .panel-text {
    color: var(--dawn-indigo);
}

.zone-nat .annotation {
    color: rgba(42, 49, 82, 0.5);
}

.span-col-2 {
    grid-column: span 2;
}

.span-row-2 {
    grid-row: span 2;
}

/* Ohu: L-shaped arrangement with dominant 2x2 block */
.zone-grid-ohu {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: start;
}

.zone-ohu .glass-panel {
    background: rgba(196, 164, 98, 0.12);
    border-color: rgba(196, 164, 98, 0.18);
}

.zone-ohu .panel-heading {
    color: var(--afternoon-gold);
}

/* Jeonyeok: Descending staircase */
.zone-grid-jeonyeok {
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
}

.panel-jeonyeok-1 { margin-top: 0; }
.panel-jeonyeok-2 { margin-top: 8vh; }
.panel-jeonyeok-3 { margin-top: 16vh; }
.panel-jeonyeok-4 { margin-top: 24vh; }

.zone-jeonyeok .glass-panel {
    background: rgba(42, 49, 82, 0.35);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border-color: rgba(92, 75, 138, 0.2);
}

/* Bam: Two blocks, widely spaced */
.zone-grid-bam {
    grid-template-columns: 1fr 1fr;
    gap: clamp(40px, 10vw, 200px);
    min-height: 70vh;
    align-items: center;
}

.zone-bam .glass-panel {
    background: rgba(18, 22, 42, 0.6);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-color: rgba(120, 140, 200, 0.1);
    box-shadow: inset 0 0 40px rgba(120, 140, 200, 0.08),
                0 8px 32px rgba(12, 16, 40, 0.4);
}

.bam-closing {
    font-family: 'Nunito', 'Noto Sans KR', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    text-align: center;
    color: var(--silver-mist);
}

/* === Light Bloom Gradients between zones === */
.zone::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.zone-saebyeok::after {
    background: radial-gradient(ellipse, rgba(30, 38, 64, 0.12) 0%, transparent 70%);
}

.zone-achim::after {
    background: radial-gradient(ellipse, rgba(232, 168, 124, 0.10) 0%, transparent 70%);
}

.zone-nat::after {
    background: radial-gradient(ellipse, rgba(240, 237, 230, 0.10) 0%, transparent 70%);
}

.zone-ohu::after {
    background: radial-gradient(ellipse, rgba(196, 164, 98, 0.10) 0%, transparent 70%);
}

.zone-jeonyeok::after {
    background: radial-gradient(ellipse, rgba(92, 75, 138, 0.10) 0%, transparent 70%);
}

.zone-bam::after {
    background: radial-gradient(ellipse, rgba(12, 16, 40, 0.08) 0%, transparent 70%);
}

/* === Elastic Animation Variants by Zone === */

/* Morning: bouncier (more overshoot) */
.zone-achim .glass-panel {
    transition: opacity 0.7s cubic-bezier(0.34, 1.8, 0.64, 1),
                transform 0.7s cubic-bezier(0.34, 1.8, 0.64, 1);
}

.zone-achim .panel-text {
    transition: opacity 0.6s cubic-bezier(0.34, 1.8, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.8, 0.64, 1);
}

/* Midday: moderate */
.zone-nat .glass-panel {
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Afternoon: slower */
.zone-ohu .glass-panel {
    transition: opacity 0.8s cubic-bezier(0.34, 1.3, 0.64, 1),
                transform 0.8s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.zone-ohu .panel-text {
    transition: opacity 0.7s cubic-bezier(0.34, 1.3, 0.64, 1),
                transform 0.7s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* Evening: slower, more dampened */
.zone-jeonyeok .glass-panel {
    transition: opacity 1.0s cubic-bezier(0.34, 1.1, 0.64, 1),
                transform 1.0s cubic-bezier(0.34, 1.1, 0.64, 1);
}

.zone-jeonyeok .panel-text {
    transition: opacity 0.9s cubic-bezier(0.34, 1.1, 0.64, 1),
                transform 0.9s cubic-bezier(0.34, 1.1, 0.64, 1);
}

/* Night: barely moves */
.zone-bam .glass-panel {
    transition: opacity 1.4s cubic-bezier(0.25, 1.0, 0.5, 1),
                transform 1.4s cubic-bezier(0.25, 1.0, 0.5, 1);
}

.zone-bam .panel-text {
    transition: opacity 1.2s cubic-bezier(0.25, 1.0, 0.5, 1),
                transform 1.2s cubic-bezier(0.25, 1.0, 0.5, 1);
}

/* Pre-dawn: subtle */
.zone-saebyeok .glass-panel {
    transition: opacity 1.2s cubic-bezier(0.34, 1.2, 0.64, 1),
                transform 1.2s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* === Staggered Text Reveal Delays === */
.glass-panel.visible .panel-text:nth-child(1) { transition-delay: 0ms; }
.glass-panel.visible .panel-text:nth-child(2) { transition-delay: 120ms; }
.glass-panel.visible .panel-text:nth-child(3) { transition-delay: 240ms; }
.glass-panel.visible .panel-text:nth-child(4) { transition-delay: 360ms; }

/* === Responsive === */
@media (max-width: 768px) {
    .zone {
        padding: 6vh 20px 6vh 50px;
    }

    .zone-grid-saebyeok {
        grid-template-columns: 1fr;
        padding-top: 10vh;
    }

    .panel-saebyeok-2 { margin-top: 0; }
    .panel-saebyeok-3 { margin-top: 0; }

    .zone-grid-achim {
        grid-template-columns: 1fr;
    }

    .panel-achim-2,
    .panel-achim-3,
    .panel-achim-4,
    .panel-achim-5,
    .panel-achim-6 {
        margin-top: 0;
    }

    .zone-grid-nat {
        grid-template-columns: 1fr;
    }

    .span-col-2 {
        grid-column: span 1;
    }

    .zone-grid-ohu {
        grid-template-columns: 1fr;
    }

    .span-row-2 {
        grid-row: span 1;
    }

    .zone-grid-jeonyeok {
        grid-template-columns: 1fr;
    }

    .panel-jeonyeok-2,
    .panel-jeonyeok-3,
    .panel-jeonyeok-4 {
        margin-top: 0;
    }

    .zone-grid-bam {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .sundial {
        left: 8px;
    }

    .sundial-label {
        left: 16px;
    }

    .celestial {
        right: 12px;
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .zone {
        padding: 4vh 16px 4vh 44px;
    }
}
