/* ============================================
   계엄령.com — Brutalist Emergency Broadcast
   ============================================ */

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

:root {
    --void-black: #0A0A0A;
    --charcoal-static: #1A1A1A;
    --interference-gray: #2D2D2D;
    --alert-red: #FF2D2D;
    --curfew-amber: #FFB800;
    --concrete-white: #E0E0E0;
    --signal-fade: #8A8A8A;
    --constitutional-blue: #3D5AFE;
}

html {
    scroll-behavior: auto;
    background-color: var(--void-black);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--concrete-white);
    background-color: var(--void-black);
    overflow-x: hidden;
    position: relative;
}

/* --- Scan-line overlay (CRT effect) --- */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* --- Persistent Hour Counter --- */
.hour-counter {
    position: fixed;
    bottom: 24px;
    left: 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--alert-red);
    text-shadow: 0 0 8px rgba(255, 45, 45, 0.4);
    z-index: 9998;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- Scattered Jamo Decorations --- */
.jamo-decoration {
    position: fixed;
    font-family: 'Black Han Sans', sans-serif;
    font-size: 8rem;
    color: var(--interference-gray);
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.jamo-1 { top: 12%; left: 3%; transform: rotate(-15deg); }
.jamo-2 { top: 28%; right: 5%; transform: rotate(22deg); }
.jamo-3 { top: 50%; left: 8%; transform: rotate(-8deg); }
.jamo-4 { top: 65%; right: 10%; transform: rotate(35deg); }
.jamo-5 { top: 80%; left: 15%; transform: rotate(-25deg); }
.jamo-6 { top: 92%; right: 3%; transform: rotate(12deg); }

/* --- HERO SECTION --- */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--void-black);
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(4rem, 12vw, 14rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    line-height: 0.95;
    color: var(--concrete-white);
    position: relative;
    text-align: center;
}

.jamo-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: none;
}

.jamo-char.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hero-ticker {
    margin-top: 3rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: 600;
    color: var(--alert-red);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    animation: ticker-pulse 3s ease-in-out infinite;
}

@keyframes ticker-pulse {
    0% { opacity: 1; }
    23% { opacity: 0.4; }
    47% { opacity: 1; }
    68% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* --- Glitch Effect --- */
.glitch-target {
    position: relative;
}

.glitch-target::before,
.glitch-target::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.glitch-target.glitching::before {
    color: var(--alert-red);
    mix-blend-mode: screen;
    opacity: 0.8;
    animation: glitch-shift 0.8s steps(1) forwards;
}

.glitch-target.glitching::after {
    color: var(--constitutional-blue);
    mix-blend-mode: screen;
    opacity: 0.8;
    animation: glitch-shift 1.1s steps(1) reverse forwards;
}

@keyframes glitch-shift {
    0% { clip-path: inset(0 0 85% 0); transform: translateX(-3px); }
    15% { clip-path: inset(15% 0 65% 0); transform: translateX(4px); }
    30% { clip-path: inset(40% 0 30% 0); transform: translateX(-2px); }
    50% { clip-path: inset(60% 0 10% 0); transform: translateX(5px); }
    70% { clip-path: inset(25% 0 50% 0); transform: translateX(-4px); }
    100% { clip-path: inset(0 0 95% 0); transform: translateX(1px); }
}

/* Residual 1px displacement after glitch settles */
.glitch-target.glitch-settled::before {
    opacity: 0.3;
    clip-path: inset(30% 0 60% 0);
    transform: translateX(1px);
    animation: none;
}

.glitch-target.glitch-settled::after {
    opacity: 0.3;
    clip-path: inset(60% 0 30% 0);
    transform: translateX(-1px);
    animation: none;
}

/* --- Scan Line Dividers --- */
.scan-line-divider {
    width: 100vw;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--alert-red) 0px,
        var(--alert-red) 6px,
        var(--void-black) 6px,
        var(--void-black) 12px
    );
    animation: scan-drift 120s linear infinite;
    position: relative;
    left: 0;
    margin: 0;
}

@keyframes scan-drift {
    0% { transform: translateX(0); }
    100% { transform: translateX(-120px); }
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    padding: 6rem 2rem 4rem;
    opacity: 0;
    transition: opacity 0ms;
    min-height: 60vh;
}

.content-section.visible {
    opacity: 1;
}

.content-section .section-body,
.content-section .chapter-meta,
.content-section .section-heading {
    transform: translateX(-30px);
    opacity: 0;
    transition: transform 200ms ease-out, opacity 200ms ease-out;
}

.content-section.visible .section-body,
.content-section.visible .chapter-meta,
.content-section.visible .section-heading {
    transform: translateX(0);
    opacity: 1;
}

.content-section.visible .chapter-meta {
    transition-delay: 50ms;
}

.content-section.visible .section-heading {
    transition-delay: 100ms;
}

.content-section.visible .section-body {
    transition-delay: 200ms;
}

/* Odd sections */
.section-odd {
    margin-left: 7vw;
    max-width: 80vw;
    background-color: var(--charcoal-static);
}

/* Even sections */
.section-even {
    margin-left: 2vw;
    max-width: 85vw;
    background-color: var(--void-black);
}

/* Every third section */
.section-third {
    margin-left: 15vw;
    max-width: 55vw;
    background-color: var(--interference-gray);
}

/* --- Timestamp Watermarks --- */
.timestamp-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(6rem, 15vw, 20rem);
    font-weight: 600;
    color: var(--alert-red);
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    white-space: nowrap;
}

/* --- Chapter Meta --- */
.chapter-meta {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.chapter-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--signal-fade);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(2rem, 5vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    line-height: 0.95;
    color: var(--concrete-white);
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

/* --- Section Body --- */
.section-body {
    position: relative;
    z-index: 1;
    max-width: 680px;
}

.section-body p {
    margin-bottom: 1.5rem;
}

.section-body strong {
    font-weight: 700;
    color: var(--curfew-amber);
}

/* --- Redaction Bars --- */
.redacted {
    position: relative;
    cursor: pointer;
    transition: none;
}

.redacted::after {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    background-color: var(--void-black);
    transition: background-color 300ms ease;
    pointer-events: none;
}

.redacted[data-revealed="true"]::after {
    background-color: transparent;
}

.redacted:hover::after,
.redacted:active::after {
    background-color: transparent;
}

/* --- Constitutional Detail (details/summary) --- */
.constitutional-detail {
    margin-top: 2rem;
    border-left: 2px solid var(--alert-red);
    padding-left: 1.5rem;
}

.constitutional-detail summary {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--signal-fade);
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: 0.5rem 0;
    text-transform: uppercase;
    list-style: none;
}

.constitutional-detail summary::-webkit-details-marker {
    display: none;
}

.constitutional-detail summary::before {
    content: '▸ ';
    color: var(--alert-red);
}

.constitutional-detail[open] summary::before {
    content: '▾ ';
}

.constitutional-text {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 400;
    line-height: 2.0;
    color: var(--concrete-white);
    margin-top: 1rem;
    padding: 1.5rem 0;
    border: none;
}

/* --- Links --- */
a {
    color: var(--constitutional-blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms;
}

a:hover {
    border-bottom-color: var(--constitutional-blue);
}

/* --- Selection --- */
::selection {
    background-color: var(--alert-red);
    color: var(--void-black);
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .section-odd {
        margin-left: 0;
        max-width: 100%;
        padding-left: 8vw;
        padding-right: 4vw;
    }

    .section-even {
        margin-left: 0;
        max-width: 100%;
        padding-left: 3vw;
        padding-right: 4vw;
    }

    .section-third {
        margin-left: 0;
        max-width: 100%;
        padding-left: 8vw;
        padding-right: 4vw;
    }

    .hero-title {
        font-size: clamp(3rem, 15vw, 8rem);
    }

    .section-heading {
        font-size: clamp(1.5rem, 8vw, 3rem);
    }

    .timestamp-watermark {
        font-size: clamp(4rem, 20vw, 10rem);
    }

    .hour-counter {
        bottom: 12px;
        left: 12px;
        font-size: 0.65rem;
    }

    .jamo-decoration {
        font-size: 5rem;
    }

    .section-body {
        max-width: 100%;
    }
}

/* --- Hero initial animation (start dark) --- */
.hero {
    opacity: 0;
    transition: opacity 800ms ease;
}

.hero.active {
    opacity: 1;
}
