/* ==========================================
   20241204.com — Parallax Storytelling Journey
   Commemorating December 4, 2024
   ========================================== */

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

:root {
    --void-black: #0a0a12;
    --emergency-blue: #0047AB;
    --alert-red: #C8102E;
    --screen-white: #E8E8F0;
    --dawn-gold: #C9A84C;
    --concrete-gray: #3B3B4F;
    --signal-green: #2E7D32;
    --deep-night: #1a1a2e;
    --pale-blue: #C9D4E8;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--void-black);
    color: var(--screen-white);
    font-family: 'IBM Plex Mono', monospace;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scroll Container --- */
#scroll-container {
    scroll-snap-type: y proximity;
    overflow-y: auto;
    height: 100vh;
    position: relative;
}

/* --- Full-screen Sections --- */
.fullscreen-section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    overflow: hidden;
}

.section-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    padding: 60px 80px 60px 120px;
}

/* --- Timeline Spine --- */
#timeline-spine {
    position: fixed;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--emergency-blue);
    z-index: 100;
    opacity: 0.6;
}

#timeline-glow {
    position: absolute;
    left: -4px;
    top: 0;
    width: 10px;
    height: 80px;
    background: radial-gradient(ellipse at center, rgba(0, 71, 171, 0.8) 0%, transparent 70%);
    animation: timeline-pulse 4s ease-in-out infinite;
    border-radius: 50%;
}

@keyframes timeline-pulse {
    0% { top: 0%; opacity: 0.3; }
    50% { opacity: 1; }
    100% { top: 100%; opacity: 0.3; }
}

/* Timeline branches */
.timeline-branch {
    position: absolute;
    left: 0;
    top: 50%;
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, var(--emergency-blue), transparent);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.timeline-branch.visible {
    opacity: 0.6;
}

/* --- Progress Indicator --- */
#progress-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--concrete-gray);
    transition: all 0.4s ease;
    cursor: pointer;
}

.progress-dot.active {
    background: var(--emergency-blue);
    box-shadow: 0 0 12px rgba(0, 71, 171, 0.8);
    transform: scale(1.3);
}

/* --- Timestamp Markers --- */
.timestamp-marker {
    margin-bottom: 30px;
}

.timestamp-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(48px, 8vw, 120px);
    color: var(--screen-white);
    letter-spacing: 0.05em;
    line-height: 1;
    display: block;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease-out, transform 0.3s ease-out;
}

.timestamp-marker.visible .timestamp-text,
.slide-reveal.visible .timestamp-text {
    opacity: 1;
    transform: translateX(0);
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--screen-white);
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

/* --- Section 1: Opening Void --- */
#section-opening {
    background-color: var(--void-black);
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
}

.opening-content .timestamp-marker {
    margin-bottom: 60px;
}

.opening-content .timestamp-text {
    font-size: clamp(36px, 6vw, 96px);
}

#typewriter-container {
    max-width: 800px;
    text-align: center;
    position: relative;
    min-height: 200px;
}

#typewriter-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(18px, 2.5vw, 28px);
    color: var(--screen-white);
    line-height: 1.8;
    letter-spacing: 0.03em;
    white-space: pre-wrap;
}

#typewriter-cursor {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(18px, 2.5vw, 28px);
    color: var(--screen-white);
    animation: blink-cursor 0.8s step-end infinite;
    margin-left: 2px;
}

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

/* --- Section 2: The Decree --- */
#section-decree {
    background-color: var(--void-black);
    min-height: 120vh;
}

.split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    width: 100%;
    align-items: start;
}

.split-left {
    padding-right: 40px;
}

.decree-text {
    margin-top: 30px;
}

.decree-line {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 1.8vw, 22px);
    color: var(--screen-white);
    line-height: 2;
    opacity: 0.9;
    margin-bottom: 8px;
}

.decree-emphasis {
    color: var(--alert-red);
    font-weight: 700;
}

.split-right {
    position: relative;
    height: 500px;
    overflow: hidden;
}

.floating-messages {
    position: relative;
    width: 100%;
    height: 100%;
}

.float-fragment {
    position: absolute;
    bottom: -80px;
    left: 10%;
    width: 80%;
    padding: 16px 20px;
    background: rgba(59, 59, 79, 0.3);
    border-bottom: 2px solid rgba(0, 71, 171, 0.5);
    border-radius: 4px;
    opacity: 0;
    animation: float-up 12s linear infinite;
    animation-delay: calc(var(--float-delay, 0) * 1s);
}

.fragment-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--emergency-blue);
    display: block;
    margin-bottom: 6px;
}

.fragment-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 15px;
    color: var(--screen-white);
    opacity: 0.85;
}

@keyframes float-up {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    80% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-600px);
        opacity: 0;
    }
}

/* --- Constitution Texture --- */
.constitution-texture {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 14px;
    line-height: 2.5;
    color: var(--screen-white);
    opacity: 0.04;
    overflow: hidden;
    word-break: break-all;
    padding: 40px;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* --- Crack SVG --- */
#crack-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    z-index: 10;
    background: var(--void-black);
}

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

#crack-path {
    stroke: url(#crack-gradient);
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

#crack-path.drawn {
    stroke-dashoffset: 0;
}

/* Fallback stroke color when gradient isn't used */
#crack-path {
    stroke: var(--emergency-blue);
}

/* --- Section 3: National Assembly --- */
#section-assembly {
    background-color: var(--void-black);
}

.assembly-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.assembly-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16px;
    color: var(--pale-blue);
    margin-bottom: 60px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.counter-container {
    margin: 40px 0;
}

.counter-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(120px, 20vw, 280px);
    color: var(--screen-white);
    line-height: 1;
    transition: color 0.3s ease;
}

.counter-number.complete {
    color: var(--signal-green);
    text-shadow: 0 0 60px rgba(46, 125, 50, 0.5);
}

.counter-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--pale-blue);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 10px;
}

.assembly-description {
    margin-top: 40px;
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--screen-white);
    opacity: 0.7;
    line-height: 1.8;
}

.korean-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--screen-white);
    margin-top: 16px;
}

.assembly-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    z-index: 0;
    pointer-events: none;
}

.assembly-building {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 150px;
    background: linear-gradient(to top, rgba(59, 59, 79, 0.3), transparent);
    clip-path: polygon(10% 100%, 15% 40%, 25% 30%, 35% 20%, 50% 10%, 65% 20%, 75% 30%, 85% 40%, 90% 100%);
}

/* --- Section 4: The Streets --- */
#section-streets {
    background: linear-gradient(to bottom, var(--void-black), var(--deep-night));
    min-height: 120vh;
}

.streets-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phone-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 50px;
    max-width: 900px;
    width: 100%;
}

.phone-screen {
    aspect-ratio: 9 / 16;
    background: rgba(10, 10, 18, 0.8);
    border: 1px solid rgba(232, 232, 240, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 14px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) rotate(calc((var(--delay, 0s) - 1.5s) * 1));
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: var(--delay, 0s);
    box-shadow: inset 0 0 40px rgba(232, 232, 240, 0.03);
    animation: phone-glow 3s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.phone-screen.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

@keyframes phone-glow {
    0%, 100% {
        box-shadow: inset 0 0 30px rgba(232, 232, 240, 0.03);
    }
    50% {
        box-shadow: inset 0 0 50px rgba(232, 232, 240, 0.08);
    }
}

.phone-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, var(--glow, #E8E8F0) 0%, transparent 70%);
    opacity: 0.04;
    pointer-events: none;
}

.phone-quote {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(13px, 1.2vw, 16px);
    color: var(--screen-white);
    text-align: center;
    line-height: 1.6;
    opacity: 0.9;
}

.phone-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--emergency-blue);
    margin-top: 12px;
    letter-spacing: 0.1em;
}

/* Staggered phone grid angles */
.phone-screen:nth-child(odd) {
    transform: translateY(30px) rotate(-1.5deg);
}

.phone-screen:nth-child(even) {
    transform: translateY(30px) rotate(1.5deg);
}

.phone-screen.visible:nth-child(odd),
.phone-screen.visible:nth-child(even) {
    transform: translateY(0) rotate(0deg);
}

.phone-screen:nth-child(2),
.phone-screen:nth-child(3) {
    margin-top: 30px;
}

.phone-screen:nth-child(6),
.phone-screen:nth-child(7) {
    margin-top: 30px;
}

/* --- Section 5: Dawn --- */
#section-dawn {
    background: linear-gradient(to bottom, var(--deep-night), var(--screen-white));
    min-height: 120vh;
}

.dawn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
    padding: 80px 40px;
}

.dawn-content .timestamp-text {
    color: var(--dawn-gold);
}

.dawn-message {
    margin: 80px 0 60px;
}

.dawn-korean {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 72px);
    color: var(--void-black);
    letter-spacing: 0.5em;
    opacity: 0;
    transition: opacity 3s ease, letter-spacing 3s ease;
    line-height: 1.4;
}

.dawn-korean.visible {
    opacity: 1;
    letter-spacing: normal;
}

.dawn-english {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(14px, 1.5vw, 18px);
    color: var(--concrete-gray);
    margin-top: 20px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.dawn-coda {
    margin-top: 60px;
}

.coda-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 2vw, 22px);
    color: var(--concrete-gray);
    line-height: 1.8;
}

.coda-english {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--concrete-gray);
    opacity: 0.7;
    margin-top: 8px;
}

.domain-stamp {
    font-family: 'Noto Serif KR', serif;
    font-weight: 400;
    font-size: clamp(14px, 1.5vw, 20px);
    color: var(--concrete-gray);
    letter-spacing: 0.3em;
    margin-top: 120px;
    opacity: 0.5;
}

/* --- Dawn Particles --- */
#dawn-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.dawn-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--dawn-gold);
    border-radius: 50%;
    opacity: 0;
    animation: particle-drift linear infinite;
}

@keyframes particle-drift {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    15% {
        opacity: 0.7;
    }
    85% {
        opacity: 0.5;
    }
    100% {
        transform: translate(calc(var(--dx) * 1px), calc(var(--dy) * 1px));
        opacity: 0;
    }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .split-screen {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .split-right {
        height: 350px;
    }

    .phone-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .section-content {
        padding: 40px 30px 40px 70px;
    }

    #timeline-spine {
        left: 20px;
    }

    #progress-indicator {
        right: 16px;
    }

    .phone-screen:nth-child(2),
    .phone-screen:nth-child(3),
    .phone-screen:nth-child(6),
    .phone-screen:nth-child(7) {
        margin-top: 0;
    }
}

@media (max-width: 600px) {
    .section-content {
        padding: 30px 20px 30px 50px;
    }

    .phone-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    #timeline-spine {
        left: 12px;
    }
}
