/* ========================================
   jeongchi.boo - Chrome Surveillance HUD
   Compliance vocabulary: IBM Plex Mono (300 Mono" (Google Fonts Interference Zone (200-300vh (Mid-page 200-300vh Internal layout: small ("SYSTEM://권력_POWER" Intersection Observer (NOT listeners Observer. Horizontal placement uses deliberate asymmetry — left-anchored `left: 5vw` Space Grotesk (500 below Grotesk"
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --void-black: #0C0C0E;
    --chrome-silver: #C0C0C0;
    --steel-gray: #6B6B73;
    --signal-white: #E8E8EC;
    --glitch-red: #FF2B2B;
    --glitch-cyan: #2BFFEF;
    --warning-amber: #FFB800;
    --deep-gunmetal: #1A1A1F;
    --panel-bg: rgba(12, 12, 14, 0.85);
    --steel-light: #A8A8A8;
    --panel-border: rgba(168, 168, 168, 0.4);

    --font-display: 'Space Grotesk', 'Inter', 'Arial Narrow', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    --font-korean: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Inter', sans-serif;
}

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

html {
    scroll-behavior: auto;
}

body {
    background-color: var(--void-black);
    color: var(--signal-white);
    font-family: var(--font-display);
    overflow-x: hidden;
    min-height: 100vh;
    /* Grid mesh background */
    background-image:
        linear-gradient(rgba(192,192,192,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(192,192,192,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Scan-line overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(200, 200, 200, 0.03) 2px,
        rgba(200, 200, 200, 0.03) 4px
    );
    pointer-events: none;
    z-index: 10000;
}

/* --- Canvas Noise --- */
#noise-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.04;
}

/* --- Glitch Bars --- */
#glitch-bars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
}

.glitch-bar {
    position: absolute;
    left: 0;
    height: 3px;
    opacity: 0;
    animation: glitch-bar-flash 0.15s ease-out forwards;
}

@keyframes glitch-bar-flash {
    0% { opacity: 0.15; }
    100% { opacity: 0; }
}

/* --- Geometric Debris --- */
#geometric-debris {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

.debris-shape {
    position: absolute;
    animation: debris-drift 40s linear infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes debris-drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(15px, -10px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

.reticle {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    animation: reticle-spin 60s linear infinite;
}

@keyframes reticle-spin {
    to { transform: rotate(360deg); }
}

/* --- Data Ticker --- */
#data-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 24px;
    overflow: hidden;
    z-index: 100;
    border-top: 1px solid rgba(107, 107, 115, 0.2);
    background: rgba(12, 12, 14, 0.9);
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 300;
    color: var(--steel-gray);
    line-height: 24px;
    animation: ticker-scroll 60s linear infinite;
}

@keyframes ticker-scroll {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* ===== ACT 1: Signal Acquisition ===== */
#signal-acquisition {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* HUD Frame */
#hud-frame {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 1px solid rgba(192, 192, 192, 0.1);
    opacity: 0;
    animation: hud-fade-in 1.5s ease-out 3s forwards;
    pointer-events: none;
}

@keyframes hud-fade-in {
    to { opacity: 1; }
}

.hud-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--chrome-silver);
    border-style: solid;
    opacity: 0.4;
}
.hud-corner.top-left { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.hud-corner.top-right { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.hud-corner.bottom-left { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.hud-corner.bottom-right { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.hud-coords {
    position: absolute;
    bottom: 8px;
    left: 12px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 300;
    color: var(--chrome-silver);
    opacity: 0.08;
    letter-spacing: 0.05em;
}

/* Hero Character */
#hero-char {
    font-family: var(--font-korean);
    font-weight: 500;
    font-size: clamp(5rem, 20vw, 18rem);
    background: linear-gradient(135deg, #6B6B73 0%, #C0C0C0 35%, #E8E8EC 50%, #C0C0C0 65%, #6B6B73 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: chrome-shimmer 20s linear infinite;
    position: relative;
    z-index: 5;
    will-change: transform;
}

@keyframes chrome-shimmer {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* --- Glitch System --- */
.glitch {
    text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan);
    animation: glitch-shift 4s infinite steps(1);
    will-change: transform;
}

@keyframes glitch-shift {
    0% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    2% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    2.5% { text-shadow: -5px 0 var(--glitch-red), 5px 0 var(--glitch-cyan); }
    3% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    18% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    18.5% { text-shadow: 8px 2px var(--glitch-red), -3px -1px var(--glitch-cyan); }
    19% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    53% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    53.5% { text-shadow: -4px 1px var(--glitch-red), 6px -1px var(--glitch-cyan); }
    54% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    75% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    75.5% { text-shadow: 3px -2px var(--glitch-red), -7px 1px var(--glitch-cyan); }
    76% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
    100% { text-shadow: 2px 0 var(--glitch-red), -2px 0 var(--glitch-cyan); }
}

.glitch-clip {
    will-change: clip-path;
    animation: glitch-clip-anim 3s infinite steps(1);
}

@keyframes glitch-clip-anim {
    0% { clip-path: inset(0 0 0 0); }
    10% { clip-path: inset(20% 0 30% 0); }
    10.5% { clip-path: inset(0 0 0 0); }
    30% { clip-path: inset(50% 0 10% 0); }
    30.5% { clip-path: inset(0 0 0 0); }
    55% { clip-path: inset(10% 0 60% 0); }
    55.5% { clip-path: inset(0 0 0 0); }
    80% { clip-path: inset(40% 0 20% 0); }
    80.5% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

.glitch-skew {
    animation: glitch-shift 4s infinite steps(1), glitch-skew-anim 6s infinite steps(1);
}

@keyframes glitch-skew-anim {
    0% { transform: skewX(0deg); }
    15% { transform: skewX(-2deg); }
    15.5% { transform: skewX(0deg); }
    45% { transform: skewX(3deg); }
    45.5% { transform: skewX(0deg); }
    70% { transform: skewX(-1.5deg); }
    70.5% { transform: skewX(0deg); }
    100% { transform: skewX(0deg); }
}

.glitch-flicker {
    animation: glitch-flicker-anim 5s infinite;
}

@keyframes glitch-flicker-anim {
    0%, 100% { opacity: 1; }
    90% { opacity: 1; }
    91% { opacity: 0.7; }
    92% { opacity: 1; }
    93% { opacity: 0.7; }
    94% { opacity: 1; }
}

/* ===== ACT 2: Data Stream ===== */
#data-stream {
    position: relative;
    height: 200vh;
}

/* --- HUD Panel --- */
.hud-panel {
    position: absolute;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px 24px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.hud-panel.panel-left {
    transform: translateX(-100px);
}
.hud-panel.panel-right {
    transform: translateX(100px);
}
.hud-panel.panel-left.visible {
    transform: translateX(0);
    opacity: 1;
}
.hud-panel.panel-right.visible {
    transform: translateX(0);
    opacity: 1;
}

/* Panel corner brackets */
.panel-corner {
    position: absolute;
    width: 8px;
    height: 8px;
}
.panel-corner.tl {
    top: -1px;
    left: -1px;
    border-top: 1px solid var(--chrome-silver);
    border-left: 1px solid var(--chrome-silver);
}
.panel-corner.br {
    bottom: -1px;
    right: -1px;
    border-bottom: 1px solid var(--chrome-silver);
    border-right: 1px solid var(--chrome-silver);
}

/* Status dots */
.status-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--warning-amber);
    animation: status-pulse 2s infinite ease-in-out;
}

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

.panel-label {
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1.2vw, 0.85rem);
    font-weight: 300;
    color: var(--glitch-cyan);
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    line-height: 1.4;
}

.panel-value {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 700;
    color: var(--signal-white);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.hud-panel hr {
    border: none;
    height: 1px;
    background: var(--steel-gray);
    opacity: 0.3;
    margin-bottom: 12px;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(107, 107, 115, 0.2);
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--warning-amber);
    transition: width 1.5s ease-out;
}

.panel-meta {
    font-family: var(--font-mono);
    font-size: clamp(0.55rem, 1vw, 0.7rem);
    font-weight: 300;
    color: var(--steel-gray);
    opacity: 0.7;
    line-height: 1.4;
    letter-spacing: 0.03em;
}

/* --- Damaged panels --- */
.hud-panel.damaged {
    animation: damaged-border 3s infinite steps(1);
}

@keyframes damaged-border {
    0% { border-color: var(--panel-border); }
    20% { border-color: var(--panel-border); }
    20.5% { border-color: transparent; }
    21% { border-color: var(--panel-border); }
    60% { border-color: var(--panel-border); }
    60.5% { border-color: rgba(255, 43, 43, 0.3); }
    61% { border-color: var(--panel-border); }
    100% { border-color: var(--panel-border); }
}

/* ===== ACT 3: Interference Zone ===== */
#interference-zone {
    position: relative;
    height: 150vh;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            0deg,
            #0C0C0E 0px,
            #0C0C0E 1px,
            #111114 1px,
            #111114 2px
        );
}

.interference-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 0;
    padding: 5vh 5vw;
}

.interference-grid span {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--signal-white);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 3px 0 var(--glitch-red), -3px 0 var(--glitch-cyan);
    opacity: 0.6;
}

.interference-grid.overlay {
    opacity: 0;
    animation: interference-flicker 0.5s steps(1) infinite;
}

@keyframes interference-flicker {
    0% { opacity: 0; }
    45% { opacity: 0; }
    50% { opacity: 0.8; }
    55% { opacity: 0; }
    90% { opacity: 0; }
    95% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* ===== ACT 4: Dossier Fragments ===== */
#dossier-fragments {
    position: relative;
    height: 150vh;
}

/* ===== ACT 5: Signal Loss ===== */
#signal-loss {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void-black);
}

#final-domain {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 300;
    color: var(--signal-white);
    opacity: 0;
    letter-spacing: 0.1em;
    transition: opacity 2s ease-out;
}

#final-domain.visible {
    opacity: 0.05;
}

/* --- Angular bracket decorations --- */
.bracket-deco {
    position: fixed;
    font-family: var(--font-display);
    font-size: 80px;
    font-weight: 500;
    color: var(--chrome-silver);
    opacity: 0.06;
    pointer-events: none;
    z-index: 3;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hud-panel {
        width: 80vw !important;
        left: 10vw !important;
        right: auto !important;
    }

    .interference-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .interference-grid span {
        font-size: clamp(1rem, 3vw, 2rem);
    }
}
