/* ====================================================================
   jungchi.boo -- 정치 터미널 (v2)
   Burgundy-cream CRT terminal, parallax sections, ghost Hangul drift
   Palette: #2a1520 #f5e6d0 #e8d5c0 #8b2252 #c4956a #3d2030 #000000
   ==================================================================== */

:root {
    --bg-base:        #2a1520;
    --bg-card:        #3d2030;
    --bg-deep:        #1c0d15;
    --ink-cream:      #f5e6d0;
    --ink-parchment:  #e8d5c0;
    --ink-amber:      #c4956a;
    --ink-burgundy:   #8b2252;
    --ink-black:      #000000;
    --ghost-alpha:    0.4;

    --font-mono:      "Red Hat Mono", "JetBrains Mono", "Menlo", monospace;
    --font-kr:        "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;

    --line-height:    1.75;
    --section-pad-x:  clamp(20px, 5vw, 96px);
    --section-pad-y:  clamp(56px, 9vh, 140px);
}

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

html, body {
    background: var(--bg-base);
    color: var(--ink-parchment);
    font-family: var(--font-mono), var(--font-kr);
    font-size: clamp(15px, 1.05vw, 18px);
    line-height: var(--line-height);
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    position: relative;
    background:
        radial-gradient(ellipse at 50% -20%, #3a1e2c 0%, transparent 60%),
        radial-gradient(ellipse at 50% 120%, #1a0a12 0%, transparent 60%),
        var(--bg-base);
}

::selection { background: var(--ink-burgundy); color: var(--ink-cream); }

/* ---------- CRT Scanlines + Vignette ----------------------------- */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0, 0, 0, 0.04) 2px,
        rgba(0, 0, 0, 0.04) 4px
    );
    mix-blend-mode: multiply;
}

.scanlines::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(245, 230, 208, 0.012) 0,
        rgba(245, 230, 208, 0.012) 1px,
        transparent 1px,
        transparent 3px
    );
    animation: crt-flicker 9s linear infinite;
}

@keyframes crt-flicker {
    0%, 96%, 100% { opacity: 1; }
    97% { opacity: 0.85; }
    98% { opacity: 1.05; }
}

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8800;
    background: radial-gradient(
        ellipse at center,
        transparent 55%,
        rgba(0, 0, 0, 0.35) 100%
    );
}

/* ---------- Ghost Hangul drifting layer (parallax depth 1) ------- */
.ghost-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.ghost-glyph {
    position: absolute;
    font-family: var(--font-kr);
    font-weight: 300;
    color: var(--ink-parchment);
    opacity: 0.06;
    white-space: nowrap;
    letter-spacing: 0.1em;
    will-change: transform, opacity;
    text-shadow: 0 0 24px rgba(245, 230, 208, 0.05);
}

@keyframes ghost-drift-up {
    0%   { transform: translate3d(0, 12vh, 0); opacity: 0; }
    10%  { opacity: 0.07; }
    50%  { opacity: 0.10; }
    90%  { opacity: 0.04; }
    100% { transform: translate3d(0, -120vh, 0); opacity: 0; }
}

.g1  { left:  6%; bottom: -10vh; font-size: clamp(64px, 8vw, 132px); animation: ghost-drift-up 38s linear infinite; animation-delay:  0s; }
.g2  { left: 22%; bottom: -10vh; font-size: clamp(48px, 6vw, 96px);  animation: ghost-drift-up 52s linear infinite; animation-delay:  6s; }
.g3  { left: 36%; bottom: -10vh; font-size: clamp(72px, 9vw, 168px); animation: ghost-drift-up 44s linear infinite; animation-delay: 12s; }
.g4  { left: 52%; bottom: -10vh; font-size: clamp(40px, 5vw, 80px);  animation: ghost-drift-up 60s linear infinite; animation-delay:  3s; }
.g5  { left: 68%; bottom: -10vh; font-size: clamp(56px, 7vw, 112px); animation: ghost-drift-up 48s linear infinite; animation-delay: 18s; }
.g6  { left: 84%; bottom: -10vh; font-size: clamp(64px, 8vw, 144px); animation: ghost-drift-up 56s linear infinite; animation-delay:  9s; }
.g7  { left: 12%; bottom: -10vh; font-size: clamp(36px, 4.5vw, 72px); animation: ghost-drift-up 64s linear infinite; animation-delay: 22s; }
.g8  { left: 30%; bottom: -10vh; font-size: clamp(44px, 5.5vw, 88px); animation: ghost-drift-up 50s linear infinite; animation-delay: 28s; }
.g9  { left: 60%; bottom: -10vh; font-size: clamp(80px, 10vw, 184px); animation: ghost-drift-up 70s linear infinite; animation-delay: 14s; }
.g10 { left: 76%; bottom: -10vh; font-size: clamp(40px, 5vw, 80px);  animation: ghost-drift-up 54s linear infinite; animation-delay: 32s; }
.g11 { left: 44%; bottom: -10vh; font-size: clamp(52px, 6.5vw, 104px); animation: ghost-drift-up 42s linear infinite; animation-delay: 36s; }
.g12 { left: 92%; bottom: -10vh; font-size: clamp(36px, 4.5vw, 72px);  animation: ghost-drift-up 58s linear infinite; animation-delay: 24s; }

/* ---------- Section scaffolding ---------------------------------- */
.section {
    position: relative;
    z-index: 2;
    padding: var(--section-pad-y) var(--section-pad-x);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.section-heading {
    margin-bottom: clamp(36px, 6vh, 96px);
    max-width: 1100px;
}

.section-heading-center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.heading-tag {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(13px, 1.05vw, 16px);
    color: var(--ink-amber);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 1.25em;
    padding: 0.25em 0.75em;
    border: 1px solid rgba(196, 149, 106, 0.35);
}

.section-title {
    font-family: var(--font-kr);
    font-weight: 700;
    color: var(--ink-cream);
    font-size: clamp(40px, 6vw, 92px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin-bottom: 0.5em;
    text-shadow:
        0 0 32px rgba(139, 34, 82, 0.45),
        0 1px 0 rgba(0, 0, 0, 0.6);
}

.section-subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--ink-amber);
    font-size: clamp(15px, 1.3vw, 20px);
    letter-spacing: 0.06em;
}

/* ====================================================================
   SECTION 1 -- Hero terminal viewport
   ==================================================================== */

.section-hero {
    align-items: center;
    justify-content: center;
    padding-top: clamp(40px, 6vh, 100px);
    padding-bottom: clamp(40px, 6vh, 100px);
}

.terminal {
    width: min(80vw, 1080px);
    background: var(--bg-deep);
    color: var(--ink-parchment);
    border: 1px solid var(--ink-cream);
    box-shadow:
        0 0 0 1px rgba(245, 230, 208, 0.05),
        0 30px 80px -20px rgba(0, 0, 0, 0.7),
        inset 0 0 80px rgba(139, 34, 82, 0.12);
    position: relative;
    overflow: hidden;

    /* Border-draw entrance: animate insets from huge to 0 via clip-path */
    clip-path: inset(0 0 0 0);
    animation: term-fade-in 600ms ease-out 200ms backwards;
}

@keyframes term-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Border-draw lines on top, right, bottom, left */
.terminal::before,
.terminal::after {
    content: "";
    position: absolute;
    background: var(--ink-cream);
    pointer-events: none;
    z-index: 4;
}

/* Top edge */
.terminal::before {
    top: 0; left: 0;
    height: 1px; width: 100%;
    transform-origin: left;
    transform: scaleX(0);
    animation: draw-x 300ms ease-out 200ms forwards;
}

/* Bottom edge */
.terminal::after {
    bottom: 0; right: 0;
    height: 1px; width: 100%;
    transform-origin: right;
    transform: scaleX(0);
    animation: draw-x 300ms ease-out 800ms forwards;
}

@keyframes draw-x { to { transform: scaleX(1); } }

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.7em 1.1em;
    background: linear-gradient(180deg, #34182a 0%, #2a1520 100%);
    border-bottom: 1px solid rgba(245, 230, 208, 0.18);
    user-select: none;
}

.titlebar-lights {
    display: flex;
    gap: 8px;
}

.light {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.3);
}
.light-red    { background: #d25067; }
.light-yellow { background: #c4956a; }
.light-green  { background: #6a9f5a; }

.titlebar-text {
    flex: 0 1 auto;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--ink-cream);
    letter-spacing: 0.04em;
    opacity: 0.92;
}

.titlebar-spacer { flex: 1 1 auto; }

.terminal-body {
    padding: clamp(20px, 3vw, 40px);
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 3px,
            rgba(245, 230, 208, 0.025) 3px,
            rgba(245, 230, 208, 0.025) 4px
        ),
        var(--bg-deep);
    min-height: 320px;
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.15vw, 17px);
    line-height: 1.85;
    position: relative;
}

.terminal-line {
    color: var(--ink-parchment);
    margin-bottom: 0.4em;
    word-break: break-word;
}
.terminal-line.muted   { color: rgba(232, 213, 192, 0.7); }
.terminal-line.subtle  { color: rgba(232, 213, 192, 0.55); }

.prompt-glyph { color: var(--ink-burgundy); font-weight: 500; }
.prompt-colon { color: var(--ink-parchment); margin: 0 0.05em; }
.prompt-path  { color: var(--ink-amber); }
.prompt-tip   { color: var(--ink-cream); margin: 0 0.5em 0 0.25em; }

.terminal-cmd { color: var(--ink-cream); }
.terminal-meta { color: var(--ink-amber); margin-right: 0.5em; }
.trans-text { color: rgba(232, 213, 192, 0.55); font-style: italic; }

.caret {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    background: var(--ink-cream);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: caret-blink 1s steps(2, start) infinite;
}

@keyframes caret-blink {
    50% { opacity: 0; }
}

.terminal-statusbar {
    display: flex;
    align-items: center;
    gap: 1.5em;
    padding: 0.5em 1.1em;
    background: var(--bg-base);
    border-top: 1px solid rgba(245, 230, 208, 0.12);
    font-family: var(--font-mono);
    font-size: 0.78em;
    color: var(--ink-amber);
    letter-spacing: 0.05em;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #6a9f5a;
    box-shadow: 0 0 8px rgba(106, 159, 90, 0.7);
    animation: status-pulse 2.4s ease-in-out infinite;
}

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

.status-clock { margin-left: auto; color: var(--ink-cream); }

/* Hero scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: clamp(20px, 4vh, 60px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4em;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--ink-amber);
    letter-spacing: 0.18em;
    opacity: 0.9;
    animation: hint-bob 2.4s ease-in-out infinite;
}

.hero-scroll-hint .hint-ko {
    font-family: var(--font-kr);
    font-size: 0.78em;
    color: rgba(232, 213, 192, 0.7);
    letter-spacing: 0.12em;
}

@keyframes hint-bob {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, 6px); }
}

/* ====================================================================
   SECTION 2 -- Dispatches
   ==================================================================== */

.section-dispatch {
    background: linear-gradient(180deg, var(--bg-base) 0%, #25121d 100%);
    padding-top: clamp(80px, 12vh, 180px);
}

.dispatch-stream {
    display: grid;
    gap: clamp(28px, 3.5vh, 48px);
    grid-template-columns: 1fr;
    max-width: 1100px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.dispatch-card {
    position: relative;
    background: var(--bg-card);
    border-left: 3px solid var(--ink-burgundy);
    padding: clamp(20px, 2.6vw, 36px) clamp(24px, 3vw, 44px);
    color: var(--ink-parchment);
    transition: transform 360ms ease, border-color 360ms ease, box-shadow 360ms ease;
    opacity: 0;
    transform: translateY(28px);
}

.dispatch-card.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.dispatch-card::before {
    content: "";
    position: absolute;
    top: 0; left: -3px;
    width: 3px; height: 0;
    background: var(--ink-cream);
    transition: height 600ms ease;
}

.dispatch-card.is-revealed::before { height: 100%; }

.dispatch-card:hover {
    transform: translateY(0) translateX(2px);
    box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.5),
                inset 0 0 0 1px rgba(245, 230, 208, 0.06);
    border-color: var(--ink-cream);
}

.dispatch-head {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    align-items: baseline;
    margin-bottom: 0.6em;
    font-family: var(--font-mono);
    font-size: clamp(12px, 1vw, 14px);
    color: var(--ink-amber);
    letter-spacing: 0.06em;
}

.dispatch-time { color: var(--ink-amber); }

.dispatch-id {
    color: var(--ink-cream);
    font-weight: 500;
}

.dispatch-tag {
    margin-left: auto;
    color: var(--ink-burgundy);
    background: rgba(139, 34, 82, 0.18);
    padding: 0.18em 0.7em;
    border: 1px solid rgba(139, 34, 82, 0.35);
    font-size: 0.85em;
}

.dispatch-headline {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(22px, 2.4vw, 32px);
    color: var(--ink-cream);
    line-height: 1.25;
    margin-bottom: 0.5em;
}

.dispatch-body {
    font-family: var(--font-kr);
    font-weight: 400;
    font-size: clamp(15px, 1.15vw, 18px);
    color: var(--ink-parchment);
    line-height: 1.8;
    margin-bottom: 1em;
}

.dispatch-foot {
    font-family: var(--font-mono);
    font-size: 0.8em;
    color: rgba(196, 149, 106, 0.7);
    letter-spacing: 0.06em;
}

/* ====================================================================
   SECTION 3 -- Ghost Archive
   ==================================================================== */

.section-archive {
    align-items: center;
    background:
        radial-gradient(ellipse at 50% 50%, #2e1626 0%, #1c0d15 100%);
    padding-top: clamp(80px, 12vh, 180px);
    padding-bottom: clamp(80px, 12vh, 180px);
}

.crt-frame {
    position: relative;
    width: min(96%, 1280px);
    height: clamp(540px, 78vh, 820px);
    margin: 0 auto;
    background:
        radial-gradient(ellipse at center, #2a1520 0%, #170a11 100%);
    border: 1px solid rgba(245, 230, 208, 0.22);
    border-radius: 36px / 28px; /* subtle CRT barrel */
    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.7),
        inset 0 0 200px rgba(139, 34, 82, 0.18),
        0 30px 80px -20px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    cursor: crosshair;
}

.crt-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0, transparent 2px,
        rgba(0, 0, 0, 0.10) 2px, rgba(0, 0, 0, 0.10) 4px
    );
    mix-blend-mode: multiply;
    z-index: 2;
}

.crt-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.55) 100%
    );
    z-index: 3;
}

.archive-field {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.trigger {
    position: absolute;
    width: clamp(80px, 12%, 200px);
    height: clamp(80px, 12%, 200px);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.phantom-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.phantom {
    position: absolute;
    transform: translate(-50%, -50%);
    max-width: clamp(220px, 28vw, 420px);
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(14px, 1.1vw, 17px);
    color: var(--ink-cream);
    line-height: 1.6;
    letter-spacing: 0.02em;
    text-align: center;
    text-shadow:
        0 0 12px rgba(245, 230, 208, 0.55),
        0 0 28px rgba(139, 34, 82, 0.35);
    opacity: 0;
    animation: phantom-life 3900ms ease-out forwards;
    will-change: opacity, transform, filter;
    filter: blur(0.4px);
    padding: 1em 1.2em;
    background: linear-gradient(
        180deg,
        rgba(42, 21, 32, 0.0) 0%,
        rgba(42, 21, 32, 0.4) 50%,
        rgba(42, 21, 32, 0.0) 100%
    );
}

.phantom .phantom-bar {
    display: block;
    width: 1.4em;
    height: 1px;
    background: var(--ink-burgundy);
    margin: 0.5em auto 0;
    opacity: 0.7;
}

@keyframes phantom-life {
    0%   { opacity: 0; transform: translate(-50%, -45%); filter: blur(4px); }
    20%  { opacity: 0.95; transform: translate(-50%, -50%); filter: blur(0.4px); }
    65%  { opacity: 0.85; }
    100% { opacity: 0; transform: translate(-50%, -55%); filter: blur(3px); }
}

.ripple-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.ripple {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--ink-cream);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.7;
    animation: ripple-out 1100ms ease-out forwards;
    will-change: transform, opacity;
}

@keyframes ripple-out {
    from { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
    to   { transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

.archive-hint {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 1.6em;
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: rgba(245, 230, 208, 0.55);
    letter-spacing: 0.08em;
    text-align: center;
    pointer-events: none;
    transition: opacity 600ms ease;
}

.archive-hint .hint-ko {
    font-family: var(--font-kr);
    font-weight: 400;
}

.archive-hint.is-faded { opacity: 0.18; }

/* ====================================================================
   SECTION 4 -- Closing cursor
   ==================================================================== */

.section-cursor {
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    min-height: 100vh;
    text-align: center;
    padding-top: clamp(80px, 14vh, 200px);
    padding-bottom: clamp(80px, 12vh, 160px);
}

.closing { max-width: 720px; }

.closing-prompt {
    font-family: var(--font-mono);
    font-size: clamp(16px, 1.5vw, 22px);
    color: var(--ink-parchment);
    margin-bottom: 1.5em;
    display: inline-flex;
    align-items: center;
    gap: 0.05em;
}

.caret-final {
    width: 0.75em;
    height: 1.1em;
    margin-left: 0.4em;
}

.closing-line {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(48px, 8vw, 128px);
    color: var(--ink-cream);
    letter-spacing: -0.01em;
    line-height: 1;
    margin-bottom: 0.3em;
    text-shadow:
        0 0 36px rgba(139, 34, 82, 0.5),
        0 1px 0 rgba(0, 0, 0, 0.6);
}

.closing-dots {
    color: var(--ink-burgundy);
    animation: dots-pulse 2.2s ease-in-out infinite;
}

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

.closing-en {
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.2vw, 18px);
    color: var(--ink-amber);
    letter-spacing: 0.18em;
    text-transform: lowercase;
    margin-bottom: 4em;
}

.closing-sig {
    font-family: var(--font-mono);
    font-size: 0.78em;
    color: rgba(196, 149, 106, 0.55);
    letter-spacing: 0.18em;
}

/* ====================================================================
   Responsive
   ==================================================================== */

@media (max-width: 720px) {
    .terminal { width: 94vw; }
    .terminal-body { padding: 18px 16px; min-height: 260px; }

    .dispatch-head { gap: 0.8em; }
    .dispatch-tag { margin-left: 0; }

    .crt-frame { height: clamp(440px, 70vh, 620px); border-radius: 24px / 18px; }

    .archive-hint { flex-direction: column; gap: 0.3em; bottom: 14px; }

    .titlebar-text { font-size: 0.72em; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
