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

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

body {
    background-color: #0b0e1a;
    color: #f4f1eb;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 400;
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === PERSISTENT RED LINE === */
#red-line {
    position: fixed;
    top: 50vh;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #c7102e;
    z-index: 1000;
    pointer-events: none;
    transition: height 0.3s ease, box-shadow 0.3s ease;
}

#red-line.pulse {
    height: 3px;
    top: calc(50vh - 1px);
    box-shadow: 0 0 8px #c7102e, 0 0 16px rgba(199, 16, 46, 0.4);
}

#red-line.glow-intense {
    box-shadow: 0 0 12px #c7102e, 0 0 24px rgba(199, 16, 46, 0.6);
}

/* === PERSISTENT CLOCK / NAVIGATION === */
#persistent-clock {
    position: fixed;
    top: 20px;
    right: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-variant: small-caps;
    letter-spacing: 0.15em;
    color: #6b6e73;
    z-index: 1001;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.6s ease, color 0.3s ease;
}

#persistent-clock:hover {
    color: #c7102e;
}

#persistent-clock.visible {
    opacity: 1;
}

/* === SCAN LINE OVERLAY === */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 3px
    );
    opacity: 1;
    transition: opacity 1s ease;
}

body.phase-daylight #scanline-overlay {
    opacity: 0;
}

/* === STATIC NOISE OVERLAY === */
#static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    opacity: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 3px 3px;
}

#static-overlay.flicker {
    animation: staticFlicker 0.15s steps(3) 1;
}

@keyframes staticFlicker {
    0% { opacity: 0.7; }
    33% { opacity: 1; }
    66% { opacity: 0.7; }
    100% { opacity: 0; }
}

/* === OPENING SECTION === */
#opening {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #0b0e1a;
    z-index: 10;
}

#clock-svg-container {
    opacity: 0;
    transition: opacity 1.2s ease;
    filter: drop-shadow(0 0 15px rgba(42, 63, 95, 0.4));
}

#clock-svg-container.visible {
    opacity: 1;
}

#clock-svg-container.shrunk {
    position: fixed;
    top: 15px;
    right: 55px;
    z-index: 1002;
    opacity: 0.3;
    transition: all 1s ease;
}

#clock-svg-container.shrunk svg {
    width: 30px;
    height: 30px;
}

#opening-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: #6b6e73;
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
    font-variant: small-caps;
}

#opening-date.visible {
    opacity: 1;
}

#opening-title {
    font-family: 'Nanum Myeongjo', serif;
    font-size: clamp(2.5rem, 5vw, 5rem);
    letter-spacing: -0.03em;
    color: #f4f1eb;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 1s ease;
    text-align: center;
    padding: 0 1rem;
}

#opening-title.visible {
    opacity: 1;
}

/* === PHASE SECTIONS === */
.phase-1 {
    background-color: #0b0e1a;
}

.phase-2 {
    background-color: #0b0e1a;
    position: relative;
}

.phase-3 {
    background-color: #f4f1eb;
    position: relative;
}

#phase1-content,
#phase2-content,
#phase3-content {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    padding: 10vh 3vw;
    min-height: 200vh;
    transition: background-color 1.5s ease;
}

#phase1-content {
    background-color: #0b0e1a;
}

#phase2-content {
    background: linear-gradient(to bottom, #0b0e1a 0%, #1a0a0f 40%, #2a1510 70%, #0b0e1a 100%);
}

#phase3-content {
    background: linear-gradient(to bottom, #ece5d5 0%, #f4f1eb 50%, #f4f1eb 100%);
    color: #0b0e1a;
}

/* === TESTIMONY PANELS === */
.testimony-panel {
    background-color: #ece5d5;
    color: #0b0e1a;
    padding: 2.5rem 2rem;
    position: relative;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.85;
    will-change: transform, opacity;
}

.testimony-panel.in-view {
    opacity: 1;
    transform: translateX(0) rotate(var(--rotation, 0deg));
}

/* Torn paper edges */
.panel-1 {
    grid-column: 1 / 7;
    grid-row: 2;
    --rotation: -0.8deg;
    clip-path: polygon(0 3%, 15% 0, 35% 2%, 55% 0, 78% 1%, 100% 3%, 100% 96%, 82% 100%, 63% 97%, 40% 100%, 18% 98%, 0 100%);
}

.panel-2 {
    grid-column: 5 / 12;
    grid-row: 5;
    --rotation: 1.2deg;
    clip-path: polygon(0 2%, 20% 0, 42% 3%, 60% 0, 85% 2%, 100% 0, 100% 97%, 80% 100%, 55% 98%, 30% 100%, 10% 97%, 0 100%);
}

.panel-3 {
    grid-column: 2 / 8;
    grid-row: 3;
    --rotation: -1.5deg;
    clip-path: polygon(0 1%, 12% 0, 30% 3%, 50% 0, 70% 2%, 100% 0, 100% 98%, 85% 100%, 60% 97%, 35% 100%, 15% 98%, 0 100%);
}

.panel-4 {
    grid-column: 6 / 13;
    grid-row: 6;
    --rotation: 0.7deg;
    clip-path: polygon(0 3%, 18% 0, 40% 2%, 62% 0, 80% 3%, 100% 1%, 100% 97%, 78% 100%, 55% 98%, 32% 100%, 12% 97%, 0 100%);
}

.panel-5 {
    grid-column: 2 / 8;
    grid-row: 1;
    --rotation: -0.5deg;
    clip-path: polygon(0 2%, 22% 0, 45% 2%, 65% 0, 88% 1%, 100% 3%, 100% 98%, 75% 100%, 50% 97%, 25% 100%, 8% 98%, 0 100%);
}

.panel-6 {
    grid-column: 5 / 12;
    grid-row: 4;
    --rotation: 1deg;
    clip-path: polygon(0 1%, 15% 0, 38% 3%, 58% 0, 82% 2%, 100% 0, 100% 99%, 80% 97%, 60% 100%, 38% 98%, 15% 100%, 0 97%);
}

.panel-7 {
    grid-column: 1 / 7;
    grid-row: 6;
    --rotation: -1deg;
    clip-path: polygon(0 3%, 20% 0, 40% 2%, 60% 0, 80% 3%, 100% 1%, 100% 98%, 82% 100%, 58% 97%, 35% 100%, 12% 98%, 0 100%);
}

.testimony-source {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: #6b6e73;
    margin-top: 1.5rem;
    font-variant: small-caps;
}

/* Phase 3 testimony adjustments */
.phase-3 .testimony-panel {
    background-color: rgba(11, 14, 26, 0.05);
    color: #0b0e1a;
    border-left: 2px solid rgba(11, 14, 26, 0.1);
}

/* === BROADCAST FRAGMENTS === */
.broadcast-fragment {
    background-color: #0b0e1a;
    border: 1px solid #2a3f5f;
    border-radius: 12px;
    padding: 0;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    will-change: opacity;
}

.broadcast-fragment.in-view {
    opacity: 1;
    animation: broadcastFlicker 0.15s steps(3) 1;
}

@keyframes broadcastFlicker {
    0% { opacity: 0.7; }
    33% { opacity: 1; }
    66% { opacity: 0.8; }
    100% { opacity: 1; }
}

.broadcast-inner {
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.broadcast-fragment::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 3px
    );
    z-index: 3;
    pointer-events: none;
}

.broadcast-fragment::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #c7102e;
    box-shadow: 0 0 6px #c7102e;
    animation: recDot 2s infinite;
    z-index: 4;
}

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

.broadcast-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #d4920b;
    margin-bottom: 1rem;
    font-variant: small-caps;
}

.broadcast-fragment p {
    font-family: 'Nanum Myeongjo', serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    line-height: 1.8;
    color: #f4f1eb;
}

.broadcast-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: #6b6e73;
    margin-top: 1.5rem;
    font-variant: small-caps;
}

/* Broadcast grid placements */
.fragment-1 {
    grid-column: 6 / 12;
    grid-row: 1;
}

.fragment-2 {
    grid-column: 2 / 8;
    grid-row: 4;
}

.fragment-3 {
    grid-column: 5 / 12;
    grid-row: 2;
}

.fragment-4 {
    grid-column: 1 / 7;
    grid-row: 5;
}

.fragment-5 {
    grid-column: 5 / 11;
    grid-row: 2;
}

.fragment-6 {
    grid-column: 2 / 8;
    grid-row: 5;
}

/* Phase 3 broadcast adjustments */
.phase-3 .broadcast-fragment {
    background-color: #f4f1eb;
    border-color: #6b6e73;
}

.phase-3 .broadcast-fragment p {
    color: #0b0e1a;
}

.phase-3 .broadcast-fragment::before {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.02) 2px,
        rgba(0, 0, 0, 0.02) 3px
    );
}

/* === TIMELINE SHARDS === */
.timeline-shard {
    writing-mode: vertical-rl;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: #6b6e73;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem 0.3rem;
    border-right: 1px solid rgba(107, 110, 115, 0.3);
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    transition: opacity 0.8s ease, transform 0.8s ease;
    font-variant: small-caps;
    will-change: transform, opacity;
}

.timeline-shard.in-view {
    opacity: 1;
    transform: scaleY(1);
}

.shard-1 {
    grid-column: 1;
    grid-row: 1;
    height: 300px;
}

.shard-2 {
    grid-column: 12;
    grid-row: 3;
    height: 250px;
}

.shard-3 {
    grid-column: 1;
    grid-row: 1;
    height: 280px;
}

.shard-4 {
    grid-column: 12;
    grid-row: 7;
    height: 260px;
}

.shard-5 {
    grid-column: 1;
    grid-row: 1;
    height: 240px;
}

.shard-6 {
    grid-column: 12;
    grid-row: 5;
    height: 220px;
}

/* Phase 3 shard adjustments */
.phase-3 .timeline-shard {
    color: #6b6e73;
    border-right-color: rgba(107, 110, 115, 0.2);
}

/* === PHOTOGRAPHIC WINDOWS === */
.photo-window {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease;
    will-change: opacity;
}

.photo-window.in-view {
    opacity: 1;
}

.window-1 {
    grid-column: 3 / 10;
    grid-row: 4;
    clip-path: polygon(5% 0, 95% 3%, 100% 95%, 2% 100%);
}

.window-2 {
    grid-column: 2 / 9;
    grid-row: 3;
    clip-path: polygon(0 5%, 100% 0, 97% 100%, 3% 95%);
}

.window-3 {
    grid-column: 6 / 12;
    grid-row: 7;
    clip-path: polygon(3% 0, 98% 2%, 100% 97%, 0 100%);
}

.photo-abstract {
    width: 100%;
    height: 250px;
    position: relative;
    overflow: hidden;
}

.photo-caption {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: #6b6e73;
    padding: 0.5rem 0;
    text-align: center;
    font-variant: small-caps;
}

/* National Assembly abstract */
.assembly-abstract {
    background: linear-gradient(to bottom, #2a3f5f 0%, #0b0e1a 100%);
}

.assembly-dome {
    position: absolute;
    bottom: 60%;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 60px;
    border-radius: 60px 60px 0 0;
    background: #1a5c3a;
    opacity: 0.7;
}

.assembly-steps {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 80px;
    background: linear-gradient(to bottom,
        rgba(244, 241, 235, 0.15) 0%,
        rgba(244, 241, 235, 0.1) 33%,
        rgba(244, 241, 235, 0.05) 66%,
        transparent 100%
    );
}

.assembly-figures {
    position: absolute;
    bottom: 40%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.assembly-figures .figure {
    width: 4px;
    height: 20px;
    background: #f4f1eb;
    opacity: 0.5;
    border-radius: 2px;
}

/* Gwanghwamun abstract */
.gwanghwamun-abstract {
    background: linear-gradient(to bottom, #f4f1eb 0%, #ece5d5 100%);
}

.gwanghwamun-gate {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 80px;
    border: 2px solid rgba(11, 14, 26, 0.3);
    border-bottom: none;
}

.gwanghwamun-gate::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -10px;
    width: 180px;
    height: 20px;
    background: rgba(11, 14, 26, 0.2);
}

.gwanghwamun-crowd {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 120px;
    justify-content: center;
}

.crowd-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c7102e;
    opacity: 0.6;
}

.crowd-dot:nth-child(even) {
    background: #d4920b;
    opacity: 0.5;
}

/* Retreat abstract */
.retreat-abstract {
    background: linear-gradient(to bottom, #ece5d5 0%, #f4f1eb 100%);
}

.vehicle-shape {
    position: absolute;
    width: 80px;
    height: 35px;
    background: #6b6e73;
    opacity: 0.4;
    border-radius: 3px;
}

.vehicle-shape:first-child {
    top: 35%;
    left: 30%;
}

.vehicle-shape:nth-child(2) {
    top: 35%;
    left: 55%;
    opacity: 0.25;
}

.road-line {
    position: absolute;
    bottom: 30%;
    left: 10%;
    width: 80%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #6b6e73 0px,
        #6b6e73 20px,
        transparent 20px,
        transparent 30px
    );
    opacity: 0.3;
}

/* === REDACTION BARS === */
.redaction {
    position: relative;
    display: inline;
    cursor: pointer;
}

.redacted-text {
    position: relative;
    z-index: 1;
}

.redaction-bar {
    position: absolute;
    top: 0;
    left: -4px;
    right: -4px;
    bottom: 0;
    background-color: #0b0e1a;
    z-index: 2;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.phase-3 .redaction-bar {
    background-color: #0b0e1a;
}

.redaction[data-revealed="true"] .redaction-bar {
    transform: translateX(105%);
    opacity: 0;
}

/* === CRISIS DISPLAY === */
#crisis-display {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    opacity: 0;
    transition: opacity 1s ease;
}

#crisis-display.in-view {
    opacity: 1;
}

.crisis-text {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(5rem, 15vw, 15rem);
    color: #c7102e;
    mix-blend-mode: difference;
    letter-spacing: -0.02em;
    text-align: center;
    line-height: 1;
}

/* === VERTICAL KOREAN TEXT STRIPS === */
#vertical-strips {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.v-strip {
    position: absolute;
    writing-mode: vertical-rl;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    color: #6b6e73;
    opacity: 0.3;
    will-change: transform;
    line-height: 1;
}

.strip-1 {
    left: 3%;
    top: 20vh;
}

.strip-2 {
    right: 5%;
    top: 40vh;
}

.strip-3 {
    left: 50%;
    top: 10vh;
    opacity: 0.15;
}

/* Phase 3 adjustments for strips */
body.phase-daylight .v-strip {
    color: #6b6e73;
    opacity: 0.15;
}

/* === CLOSING SECTION === */
#closing {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f4f1eb;
    position: relative;
}

#closing-content {
    text-align: center;
}

#closing-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: #6b6e73;
    margin-bottom: 2rem;
    font-variant: small-caps;
}

#closing-text {
    font-family: 'Nanum Myeongjo', serif;
    font-size: clamp(1.2rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
    color: #0b0e1a;
    max-width: 600px;
    line-height: 1.6;
    padding: 0 2rem;
}

/* === SHADOW DIRECTION TRANSITION (Phase 3) === */
.phase-3 .testimony-panel {
    box-shadow: -4px -4px 15px rgba(0, 0, 0, 0.05);
}

.phase-3 .photo-window {
    box-shadow: -3px -3px 10px rgba(0, 0, 0, 0.05);
}

.phase-1 .testimony-panel,
.phase-2 .testimony-panel {
    box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.3);
}

/* === MAGNETIC DRIFT (testimony panels) === */
.testimony-panel {
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #phase1-content,
    #phase2-content,
    #phase3-content {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.5rem;
        padding: 5vh 4vw;
    }

    .panel-1, .panel-2, .panel-3, .panel-4,
    .panel-5, .panel-6, .panel-7 {
        grid-column: 1 / -1 !important;
    }

    .fragment-1, .fragment-2, .fragment-3,
    .fragment-4, .fragment-5, .fragment-6 {
        grid-column: 1 / -1 !important;
    }

    .window-1, .window-2, .window-3 {
        grid-column: 1 / -1 !important;
    }

    .shard-1, .shard-2, .shard-3,
    .shard-4, .shard-5, .shard-6 {
        display: none;
    }

    .v-strip {
        display: none;
    }

    .crisis-text {
        font-size: clamp(3rem, 12vw, 8rem);
    }

    #opening-title {
        font-size: clamp(1.8rem, 6vw, 3rem);
    }
}

@media (max-width: 480px) {
    .broadcast-inner {
        padding: 1.5rem;
    }

    .testimony-panel {
        padding: 2rem 1.5rem;
    }
}
