/* === NAMU.DAY STYLES === */

/* Root Variables */
:root {
    --predawn-bg: #2a1f2d;
    --dawn-bg: #c4856e;
    --morning-bg: #e8c9a0;
    --noon-bg: #f0e6d8;
    --afternoon-bg: #d4a574;
    --dusk-bg: #8b4a2e;
    --night-bg: #1f1712;

    --right-panel-base: #e0d4c8;
    --right-panel-dark: #c8b8a8;
    --text-primary: #2a2018;
    --text-light: #e8ddd0;
    --divider-line: #c4a060;
    --data-accent: #d4883c;
    --cursor-blink: #6b8c42;

    --grain-opacity: 0.06;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-primary);
}

body {
    background: #f0e6d8;
}

/* === GRAIN OVERLAY === */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: var(--grain-opacity);
    mix-blend-mode: overlay;
}

/* === DIVIDER LINE === */
#divider {
    position: fixed;
    left: 50vw;
    top: 0;
    width: 2px;
    height: 100vh;
    background-color: var(--divider-line);
    z-index: 1000;
    opacity: 0.5;
    transform: translateX(-50%);
    animation: divider-pulse 4s ease-in-out infinite;
}

@keyframes divider-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* === CANDLE GLOW === */
#candle-glow {
    position: fixed;
    top: 50vh;
    left: 50%;
    width: 60vw;
    height: 60vw;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 500;
    background: radial-gradient(circle at center, rgba(212, 136, 60, 0.1) 0%, transparent 70%);
    opacity: 0;
}

@keyframes candle-pulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

#candle-glow.active {
    animation: candle-pulse 3s ease-in-out forwards;
}

/* === SYNC LABEL === */
.sync-label {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.4em;
    color: var(--text-primary);
    opacity: 0;
    z-index: 1500;
    pointer-events: none;
}

@keyframes sync-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.sync-label.visible {
    animation: sync-fade 3s ease-out forwards;
}

/* === PANELS === */
.panel {
    position: fixed;
    top: 0;
    width: 50vw;
    height: 100vh;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

#left-panel {
    left: 0;
    background-color: var(--noon-bg);
    transition: background-color 2s ease;
}

#right-panel {
    right: 0;
    background-color: var(--right-panel-base);
}

/* Scrollbar Styling */
.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track {
    background: transparent;
}

.panel::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* === SCENES (LEFT PANEL) === */
.scene {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.watercolor-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: url(#watercolor-soft);
    opacity: 0.3;
}

/* Pre-Dawn Blobs */
.scene-predawn .blob-1 {
    width: 40vw;
    height: 40vw;
    bottom: -15vw;
    left: -10vw;
    background: radial-gradient(circle at 30% 30%, #4a3a52, #2a1f2d);
}

.scene-predawn .blob-2 {
    width: 35vw;
    height: 35vw;
    top: -5vw;
    right: -15vw;
    background: radial-gradient(circle at 40% 40%, #3d2d45, #2a1f2d);
}

.scene-predawn .blob-3 {
    width: 25vw;
    height: 25vw;
    top: 20%;
    left: 15%;
    background: radial-gradient(circle at 50% 50%, #6a5a72, #4a3a52);
    opacity: 0.2;
}

.scene-predawn .blob-4 {
    width: 20vw;
    height: 20vw;
    bottom: 10%;
    right: 20%;
    background: radial-gradient(circle at 50% 50%, #5a4a62, #2a1f2d);
    opacity: 0.25;
}

/* Dawn Blobs */
.scene-dawn .blob-1 {
    width: 50vw;
    height: 40vw;
    bottom: -10vw;
    left: -15vw;
    background: radial-gradient(circle at 30% 30%, #d4856e, #b87060);
}

.scene-dawn .blob-2 {
    width: 45vw;
    height: 45vw;
    top: -20vw;
    right: -20vw;
    background: radial-gradient(circle at 40% 40%, #e8a080, #d4856e);
    opacity: 0.25;
}

.scene-dawn .blob-3 {
    width: 30vw;
    height: 30vw;
    top: 15%;
    left: 20%;
    background: radial-gradient(circle at 50% 50%, #f0b8a0, #d4856e);
    opacity: 0.2;
}

.scene-dawn .blob-4 {
    width: 25vw;
    height: 25vw;
    bottom: 25%;
    right: 15%;
    background: radial-gradient(circle at 50% 50%, #d4956e, #8b6a52);
    opacity: 0.3;
}

.scene-dawn .blob-5 {
    width: 15vw;
    height: 15vw;
    top: 30%;
    right: 30%;
    background: radial-gradient(circle at 50% 50%, #e8c9a0, #d4856e);
    opacity: 0.15;
}

/* Morning Blobs */
.scene-morning .blob-1 {
    width: 50vw;
    height: 45vw;
    bottom: -10vw;
    left: -15vw;
    background: radial-gradient(circle at 30% 30%, #e8c9a0, #d4a574);
}

.scene-morning .blob-2 {
    width: 40vw;
    height: 40vw;
    top: -15vw;
    right: -15vw;
    background: radial-gradient(circle at 40% 40%, #f0d8b8, #e8c9a0);
    opacity: 0.25;
}

.scene-morning .blob-3 {
    width: 28vw;
    height: 28vw;
    top: 20%;
    left: 18%;
    background: radial-gradient(circle at 50% 50%, #f0e6d8, #e8c9a0);
    opacity: 0.2;
}

.scene-morning .blob-4 {
    width: 22vw;
    height: 22vw;
    bottom: 20%;
    right: 18%;
    background: radial-gradient(circle at 50% 50%, #e8d8c0, #d4a574);
    opacity: 0.3;
}

/* Late Morning Blobs */
.scene-late-morning .blob-1 {
    width: 55vw;
    height: 50vw;
    bottom: -12vw;
    left: -20vw;
    background: radial-gradient(circle at 30% 30%, #f0d8b8, #d4a574);
}

.scene-late-morning .blob-2 {
    width: 42vw;
    height: 42vw;
    top: -18vw;
    right: -18vw;
    background: radial-gradient(circle at 40% 40%, #f0e6d8, #e8c9a0);
    opacity: 0.2;
}

.scene-late-morning .blob-3 {
    width: 25vw;
    height: 25vw;
    bottom: 18%;
    right: 20%;
    background: radial-gradient(circle at 50% 50%, #e8d8c0, #d4a574);
    opacity: 0.25;
}

/* Noon Blobs */
.scene-noon .blob-1 {
    width: 50vw;
    height: 48vw;
    bottom: -12vw;
    left: -18vw;
    background: radial-gradient(circle at 30% 30%, #f0e6d8, #e8d8c0);
}

.scene-noon .blob-2 {
    width: 38vw;
    height: 38vw;
    top: -15vw;
    right: -12vw;
    background: radial-gradient(circle at 40% 40%, #ffffff, #f0e6d8);
    opacity: 0.2;
}

.scene-noon .blob-3 {
    width: 20vw;
    height: 20vw;
    bottom: 25%;
    right: 22%;
    background: radial-gradient(circle at 50% 50%, #f0e6d8, #e8d8c0);
    opacity: 0.15;
}

/* Afternoon Blobs */
.scene-afternoon .blob-1 {
    width: 50vw;
    height: 45vw;
    bottom: -10vw;
    left: -15vw;
    background: radial-gradient(circle at 30% 30%, #d4a574, #c49060);
}

.scene-afternoon .blob-2 {
    width: 40vw;
    height: 40vw;
    top: -18vw;
    right: -15vw;
    background: radial-gradient(circle at 40% 40%, #e8b588, #d4a574);
    opacity: 0.25;
}

.scene-afternoon .blob-3 {
    width: 28vw;
    height: 28vw;
    top: 22%;
    left: 20%;
    background: radial-gradient(circle at 50% 50%, #e8c9a0, #d4a574);
    opacity: 0.2;
}

.scene-afternoon .blob-4 {
    width: 24vw;
    height: 24vw;
    bottom: 22%;
    right: 18%;
    background: radial-gradient(circle at 50% 50%, #c49060, #8b4a2e);
    opacity: 0.3;
}

/* Dusk Blobs */
.scene-dusk .blob-1 {
    width: 50vw;
    height: 45vw;
    bottom: -10vw;
    left: -15vw;
    background: radial-gradient(circle at 30% 30%, #8b4a2e, #5a3820);
}

.scene-dusk .blob-2 {
    width: 45vw;
    height: 45vw;
    top: -20vw;
    right: -20vw;
    background: radial-gradient(circle at 40% 40%, #b86a48, #8b4a2e);
    opacity: 0.2;
}

.scene-dusk .blob-3 {
    width: 32vw;
    height: 32vw;
    top: 18%;
    left: 18%;
    background: radial-gradient(circle at 50% 50%, #c48060, #8b4a2e);
    opacity: 0.2;
}

.scene-dusk .blob-4 {
    width: 26vw;
    height: 26vw;
    bottom: 18%;
    right: 16%;
    background: radial-gradient(circle at 50% 50%, #6a3a20, #3a2810);
    opacity: 0.35;
}

.scene-dusk .blob-5 {
    width: 18vw;
    height: 18vw;
    top: 35%;
    right: 25%;
    background: radial-gradient(circle at 50% 50%, #a85a38, #8b4a2e);
    opacity: 0.15;
}

/* Night Blobs */
.scene-night .blob-1 {
    width: 48vw;
    height: 42vw;
    bottom: -12vw;
    left: -18vw;
    background: radial-gradient(circle at 30% 30%, #1f1712, #0a0a08);
}

.scene-night .blob-2 {
    width: 42vw;
    height: 42vw;
    top: -15vw;
    right: -12vw;
    background: radial-gradient(circle at 40% 40%, #3a2a20, #1f1712);
    opacity: 0.25;
}

.scene-night .blob-3 {
    width: 24vw;
    height: 24vw;
    bottom: 20%;
    right: 20%;
    background: radial-gradient(circle at 50% 50%, #2a1a10, #0a0a08);
    opacity: 0.2;
}

/* Deep Night Blobs */
.scene-deep-night .blob-1 {
    width: 48vw;
    height: 42vw;
    bottom: -12vw;
    left: -18vw;
    background: radial-gradient(circle at 30% 30%, #1f1712, #0a0a08);
}

.scene-deep-night .blob-2 {
    width: 40vw;
    height: 40vw;
    top: -15vw;
    right: -12vw;
    background: radial-gradient(circle at 40% 40%, #2a1a10, #0a0a08);
    opacity: 0.2;
}

.scene-deep-night .blob-3 {
    width: 22vw;
    height: 22vw;
    bottom: 22%;
    right: 22%;
    background: radial-gradient(circle at 50% 50%, #1a0a00, #0a0a08);
    opacity: 0.15;
}

/* Scene Content */
.scene-content {
    position: relative;
    z-index: 10;
    padding: 4rem 3rem;
    max-width: 90%;
    text-align: left;
}

.timestamp {
    display: block;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.narrative {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.8;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    max-width: 35vw;
}

/* Scene-specific text colors */
.scene-predawn .narrative,
.scene-night .narrative,
.scene-deep-night .narrative {
    color: var(--text-light);
}

/* === DATA SECTIONS (RIGHT PANEL) === */
.data-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.data-content {
    max-width: 90%;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
}

.data-timestamp {
    display: block;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 400;
    margin-bottom: 2rem;
    opacity: 0.7;
}

.data-block {
    display: flex;
    align-items: baseline;
    margin-bottom: 1.2rem;
    gap: 1rem;
    font-variant-numeric: tabular-nums;
}

.data-label {
    display: inline-block;
    width: 16rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
}

.data-value {
    font-weight: 400;
    color: var(--data-accent);
    min-width: 8rem;
    display: inline-block;
}

.data-value[data-text] {
    color: var(--text-primary);
}

.data-unit {
    opacity: 0.6;
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    color: var(--text-primary);
}

.cursor-blink {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--cursor-blink);
    margin-left: 0.3rem;
    animation: cursor-blink 1s steps(1) infinite;
}

@keyframes cursor-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.data-annotation {
    margin-top: 2rem;
    font-size: clamp(0.65rem, 0.85vw, 0.8rem);
    opacity: 0.6;
    line-height: 1.6;
    color: var(--text-primary);
}

/* === TIME-OF-DAY BACKGROUND TRANSITIONS === */
.scene-predawn, .data-predawn {
    --current-bg: var(--predawn-bg);
}

.scene-dawn, .data-dawn {
    --current-bg: var(--dawn-bg);
}

.scene-morning, .data-morning {
    --current-bg: var(--morning-bg);
}

.scene-late-morning, .data-late-morning {
    --current-bg: var(--morning-bg);
}

.scene-noon, .data-noon {
    --current-bg: var(--noon-bg);
}

.scene-afternoon, .data-afternoon {
    --current-bg: var(--afternoon-bg);
}

.scene-dusk, .data-dusk {
    --current-bg: var(--dusk-bg);
}

.scene-night, .data-night {
    --current-bg: var(--night-bg);
}

.scene-deep-night, .data-deep-night {
    --current-bg: var(--night-bg);
}

/* === ANIMATION: Data Counter === */
@keyframes count-up {
    from { content: "0"; }
    to { content: attr(data-value); }
}

/* Numeric animation using CSS counter */
.data-value {
    transition: color 0.3s ease;
}

.data-value.animating {
    animation: value-change 1.5s ease-out forwards;
}

@keyframes value-change {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* === RESPONSIVE: MOBILE (under 768px) === */
@media (max-width: 767px) {
    .panel {
        position: static;
        width: 100%;
        height: auto;
        overflow: visible;
    }

    #left-panel {
        background: var(--noon-bg);
    }

    #right-panel {
        background: var(--right-panel-base);
    }

    #divider {
        display: none;
    }

    .scene, .data-section {
        min-height: 50vh;
        height: auto;
    }

    .scene-content, .data-content {
        max-width: 100%;
    }

    .narrative {
        max-width: 100%;
    }

    .data-label {
        width: auto;
        display: block;
        margin-bottom: 0.3rem;
    }

    .data-block {
        flex-direction: column;
        gap: 0.3rem;
    }

    .sync-label {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }

    .timestamp {
        font-size: 0.75rem;
    }

    .data-timestamp {
        font-size: 0.75rem;
    }
}

/* === GRAIN OPACITY VARIATION === */
#grain-overlay {
    transition: opacity 1s ease;
}

/* Increase grain at dawn/dusk, decrease at noon */
.scene-predawn ~ #grain-overlay,
.scene-dawn ~ #grain-overlay,
.scene-dusk ~ #grain-overlay,
.scene-night ~ #grain-overlay,
.scene-deep-night ~ #grain-overlay {
    --grain-opacity: 0.08;
}

.scene-noon ~ #grain-overlay,
.scene-late-morning ~ #grain-overlay {
    --grain-opacity: 0.04;
}
