/* =============================================
   20241204.com — Cinematic Documentary Noir
   A living memorial and timeline archive
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0a0c;
    --bg-secondary: #1a1a24;
    --text-primary: #e8e4dc;
    --text-secondary: #8a8a94;
    --accent-red: #c41e3a;
    --accent-gold: #d4a934;
    --accent-blue: #2a3a5c;
    --flash-white: #ffffff;
    --paper-base: #f4edd8;
    --paper-vignette: #e8dcc4;

    --font-heading: 'Noto Serif KR', serif;
    --font-body: 'IBM Plex Sans KR', sans-serif;
    --font-typewriter: 'Special Elite', cursive;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* --- Film Grain Overlay --- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 100px 100px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 9999;
    animation: grain 0.5s steps(4) infinite;
}

@keyframes grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5%, -10%); }
    50% { transform: translate(10%, 5%); }
    75% { transform: translate(-10%, 15%); }
    100% { transform: translate(5%, -5%); }
}

/* --- Scroll Container --- */
.scroll-container {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    height: 100vh;
    -webkit-overflow-scrolling: touch;
}

/* --- Fixed Timestamp Indicator --- */
.timestamp-indicator {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.6s ease;
    letter-spacing: 0.05em;
}

.timestamp-indicator.visible {
    opacity: 1;
}

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

/* --- OPENING FRAME --- */
.section-opening {
    background: var(--bg-primary);
    flex-direction: column;
}

.section-opening .section-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
}

.opening-timestamp {
    font-family: var(--font-heading);
    font-weight: 900;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.opening-timestamp .year-line {
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.opening-timestamp .time-line {
    font-size: clamp(2.5rem, 8vw, 6rem);
    letter-spacing: 0.1em;
    color: var(--flash-white);
}

.declaration-text {
    max-width: 700px;
    font-family: var(--font-typewriter);
    font-size: clamp(0.9rem, 1.8vw, 1.15rem);
    color: var(--flash-white);
    line-height: 1.9;
    letter-spacing: 0.02em;
    min-height: 4em;
    position: relative;
    text-align: left;
}

.typewriter {
    display: inline;
}

.cursor {
    display: inline-block;
    font-family: var(--font-mono);
    color: var(--flash-white);
    animation: blink 1s step-end infinite;
    font-weight: 300;
}

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

.scroll-chevron {
    margin-top: 3rem;
    opacity: 0;
    animation: breathe 3s ease-in-out infinite;
    animation-delay: 6s;
    animation-fill-mode: forwards;
}

@keyframes breathe {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(6px); }
}

/* --- TIMELINE SECTIONS --- */
.section-timeline {
    background: var(--bg-primary);
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--accent-red);
    transform: translateX(-50%);
    opacity: 0.7;
}

.timeline-node {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    align-items: center;
}

.node-left {
    justify-content: flex-start;
    padding-right: 55%;
}

.node-right {
    justify-content: flex-end;
    padding-left: 55%;
}

.node-center {
    justify-content: center;
    text-align: center;
}

.node-center .node-content {
    max-width: 600px;
}

.node-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.node-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-dot 2s ease-in-out infinite;
    opacity: 0;
}

.node-dot.active::after {
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0% { width: 8px; height: 8px; opacity: 0.8; }
    100% { width: 32px; height: 32px; opacity: 0; }
}

.node-dot-large {
    width: 14px;
    height: 14px;
    box-shadow: 0 0 20px var(--accent-red), 0 0 40px rgba(196, 30, 58, 0.3);
}

.node-content {
    max-width: 480px;
}

.node-timestamp {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-red);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}

.node-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.node-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    letter-spacing: 0.03em;
}

.node-text {
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    color: var(--text-primary);
    line-height: 1.8;
    opacity: 0.85;
}

/* --- VOTE COUNT --- */
.vote-count {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.vote-number {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 500;
    color: var(--flash-white);
    letter-spacing: -0.02em;
}

.vote-against {
    color: var(--text-secondary);
}

.vote-label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* --- TESTIMONY SECTIONS --- */
.section-testimony {
    background: var(--bg-secondary);
}

.testimony-content {
    max-width: 800px;
    padding: 2rem;
    text-align: center;
}

.testimony-quote {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    quotes: none;
}

.testimony-translation {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.testimony-cite {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    font-style: normal;
}

/* --- DOCUMENT FACSIMILE SECTION --- */
.section-documents {
    flex-direction: column;
    background: var(--bg-primary);
    gap: 2rem;
    padding: 4rem 0;
}

.documents-label {
    text-align: center;
    padding: 0 2rem;
}

.documents-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.documents-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--text-secondary);
}

.documents-strip {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
}

.documents-strip::-webkit-scrollbar {
    display: none;
}

.document-card {
    flex: 0 0 auto;
    min-width: 80vw;
    max-width: 500px;
    scroll-snap-align: center;
}

.card-rotate-left {
    transform: rotate(-1.5deg);
}

.card-rotate-right {
    transform: rotate(1.2deg);
}

.card-inner {
    background: var(--paper-base);
    background-image:
        radial-gradient(ellipse at 20% 20%, var(--paper-base) 0%, transparent 70%),
        radial-gradient(ellipse at 80% 80%, var(--paper-vignette) 0%, transparent 70%),
        radial-gradient(ellipse at 50% 50%, var(--paper-base) 0%, var(--paper-vignette) 100%);
    color: var(--bg-secondary);
    padding: 2.5rem 2rem;
    box-shadow: 2px 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.trigram-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-red);
    opacity: 0.4;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--bg-secondary);
    margin-bottom: 0.15rem;
    margin-top: 0.5rem;
}

.card-title-en {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.card-text {
    font-family: var(--font-typewriter);
    font-size: 0.85rem;
    line-height: 1.8;
    color: #2a2a34;
    margin-bottom: 1.5rem;
}

.card-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

/* --- BROKEN GLASS DIVIDER --- */
.glass-divider {
    width: 100%;
    padding: 1rem 0;
    display: flex;
    justify-content: center;
    background: var(--bg-primary);
}

.glass-svg {
    width: 100%;
    max-width: 800px;
    height: 60px;
}

/* --- MEMORIAL SECTION --- */
.section-memorial {
    background: #000000;
    flex-direction: column;
}

.memorial-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    padding: 2rem;
    text-align: center;
}

.candle-container {
    position: relative;
    display: flex;
    justify-content: center;
}

.candle-svg {
    z-index: 2;
}

.flame-outer {
    fill: url(#flameGrad);
    fill: #d4a934;
    opacity: 0.9;
    animation: flicker-outer 2s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

.flame-inner {
    fill: #e8752a;
    opacity: 0.7;
    animation: flicker-inner 1.5s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

@keyframes flicker-outer {
    0% { transform: scaleX(1) scaleY(1); opacity: 0.9; }
    25% { transform: scaleX(0.92) scaleY(1.04); opacity: 0.85; }
    50% { transform: scaleX(1.05) scaleY(0.96); opacity: 0.9; }
    75% { transform: scaleX(0.95) scaleY(1.02); opacity: 0.88; }
    100% { transform: scaleX(1.02) scaleY(0.98); opacity: 0.9; }
}

@keyframes flicker-inner {
    0% { transform: scaleX(1) scaleY(1); }
    33% { transform: scaleX(1.1) scaleY(0.92); }
    66% { transform: scaleX(0.9) scaleY(1.08); }
    100% { transform: scaleX(1.05) scaleY(0.95); }
}

.candle-glow {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(212, 169, 52, 0.08) 0%, transparent 70%);
    pointer-events: none;
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.memorial-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--accent-gold);
    margin-bottom: 0.25rem;
}

.memorial-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--accent-gold);
    opacity: 0.7;
    margin-bottom: 1.5rem;
}

.memorial-body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--text-primary);
    line-height: 2;
    max-width: 500px;
    opacity: 0.8;
}

.memorial-date {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-primary);
    margin-top: 2rem;
    opacity: 0.6;
}

.memorial-date-en {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* --- REVEAL ANIMATION --- */
.reveal-element {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- RESPONSIVE --- */
@media (min-width: 768px) {
    .document-card {
        min-width: 40vw;
    }
}

@media (max-width: 768px) {
    .node-left,
    .node-right {
        padding-left: 2rem;
        padding-right: 2rem;
        justify-content: center;
    }

    .timeline-spine {
        left: 2rem;
    }

    .node-dot {
        left: 2rem;
    }

    .node-left .node-content,
    .node-right .node-content {
        margin-left: 2rem;
    }

    .timestamp-indicator {
        top: 12px;
        right: 12px;
        font-size: 0.65rem;
    }
}
