/* ============================================================
   gabs.report — Classified Intelligence Dossier
   Cyberpunk Data-Viz Dashboard
   ============================================================ */

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

:root {
    --blacksite: #0A0A0F;
    --secure-dark: #0D0D14;
    --cipher-green: #1B3A2A;
    --phosphor: #00FF41;
    --alert-red: #FF3131;
    --terminal-silver: #C0C0C0;
    --redacted-gray: #5A5A6A;
    --declassified-white: #E0E0E0;
    --easing: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

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

body {
    background-color: var(--blacksite);
    color: var(--terminal-silver);
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.06em;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --- CRT Scan Lines Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.02) 2px,
        rgba(0, 255, 65, 0.02) 3px
    );
}

/* --- Recording Indicator --- */
.recording-indicator {
    position: fixed;
    top: 20px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
}

.rec-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--alert-red);
    animation: recPulse 1s steps(1) infinite;
}

.rec-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--alert-red);
    opacity: 0.7;
}

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

/* ============================================================
   BOOT SEQUENCE SECTION (0-100vh)
   ============================================================ */
.boot-sequence {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--blacksite);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Code Rain --- */
.code-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: rainFadeOut 0.5s var(--easing) 3s forwards;
}

.rain-char {
    position: absolute;
    top: -40px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    color: var(--phosphor);
    opacity: 0;
    white-space: nowrap;
    animation: rainFall var(--rain-duration, 1.2s) var(--easing) var(--rain-delay, 0s) forwards;
}

@keyframes rainFall {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        opacity: 0.08;
        transform: translateY(110vh);
    }
}

@keyframes rainFadeOut {
    to {
        opacity: 0;
    }
}

/* --- Blinking Cursor (boot phase) --- */
.cursor-blink {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 18px;
    background-color: var(--phosphor);
    animation: cursorBlink 0.53s steps(1) infinite, cursorFadeOut 0.3s var(--easing) 1s forwards;
    z-index: 5;
}

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

@keyframes cursorFadeOut {
    to { opacity: 0; }
}

/* --- Hero Character --- */
.hero-gabs {
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: heroAppear 1.5s var(--easing) 3.5s forwards;
}

.hero-svg {
    width: clamp(12rem, 25vw, 20rem);
    height: clamp(12rem, 25vw, 20rem);
}

.hero-gabs-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: 140px;
    fill: none;
    stroke: var(--phosphor);
    stroke-width: 2;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: heroStrokeDraw 2s var(--easing) 3.5s forwards, heroFill 1s var(--easing) 5.5s forwards;
}

@keyframes heroAppear {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes heroStrokeDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes heroFill {
    to {
        fill: var(--phosphor);
        fill-opacity: 0.15;
    }
}

/* Hero pulse */
.hero-gabs-text {
    animation: heroStrokeDraw 2s var(--easing) 3.5s forwards, heroFill 1s var(--easing) 5.5s forwards, heroPulse 3s ease-in-out 6.5s infinite;
}

@keyframes heroPulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.6; }
}

/* ============================================================
   DATA CONDUIT SVG LAYER
   ============================================================ */
.data-conduits {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 800vh;
    pointer-events: none;
    z-index: 1;
}

.conduit-line {
    fill: none;
    stroke: var(--phosphor);
    stroke-opacity: 0.15;
    stroke-width: 1;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s var(--easing);
}

.conduit-line.active {
    stroke-dashoffset: 0;
}

.conduit-node {
    fill: var(--phosphor);
    fill-opacity: 0.2;
    animation: nodePulse 3s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { fill-opacity: 0.1; r: 2; }
    50% { fill-opacity: 0.5; r: 3; }
}

/* ============================================================
   DOSSIER GRID SECTION (100vh-400vh)
   ============================================================ */
.dossier-grid {
    position: relative;
    width: 100%;
    height: 300vh;
    z-index: 2;
}

/* --- Dossier Panel --- */
.dossier-panel {
    position: absolute;
    background-color: rgba(13, 13, 20, 0.85);
    border: 1px solid var(--cipher-green);
    padding: 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s var(--easing), transform 0.3s var(--easing);
    max-width: calc(100% - 40px);
}

.dossier-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Panel Header --- */
.panel-header {
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--cipher-green);
    background-color: rgba(27, 58, 42, 0.1);
}

.panel-id {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.6rem, 0.9vw, 0.75rem);
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--phosphor);
}

.panel-status {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.55rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--redacted-gray);
}

.panel-status.status-alert {
    color: var(--alert-red);
}

.panel-status.status-recovery {
    color: var(--phosphor);
}

/* --- Panel Content --- */
.panel-content {
    padding: 16px 14px;
}

.panel-content p {
    color: var(--terminal-silver);
    margin-bottom: 12px;
}

.panel-content p:last-child {
    margin-bottom: 0;
}

.panel-meta {
    font-size: clamp(0.6rem, 0.85vw, 0.7rem);
    color: var(--redacted-gray);
    letter-spacing: 0.1em;
}

/* --- Corner Brackets --- */
.panel-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    transition: transform 0.3s var(--easing);
}

.panel-corner::before,
.panel-corner::after {
    content: '';
    position: absolute;
    background-color: var(--cipher-green);
}

/* Top-left */
.panel-corner.tl {
    top: -1px;
    left: -1px;
}
.panel-corner.tl::before {
    top: 0;
    left: 0;
    width: 12px;
    height: 1px;
}
.panel-corner.tl::after {
    top: 0;
    left: 0;
    width: 1px;
    height: 12px;
}

/* Top-right */
.panel-corner.tr {
    top: -1px;
    right: -1px;
}
.panel-corner.tr::before {
    top: 0;
    right: 0;
    width: 12px;
    height: 1px;
}
.panel-corner.tr::after {
    top: 0;
    right: 0;
    width: 1px;
    height: 12px;
}

/* Bottom-left */
.panel-corner.bl {
    bottom: -1px;
    left: -1px;
}
.panel-corner.bl::before {
    bottom: 0;
    left: 0;
    width: 12px;
    height: 1px;
}
.panel-corner.bl::after {
    bottom: 0;
    left: 0;
    width: 1px;
    height: 12px;
}

/* Bottom-right */
.panel-corner.br {
    bottom: -1px;
    right: -1px;
}
.panel-corner.br::before {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 1px;
}
.panel-corner.br::after {
    bottom: 0;
    right: 0;
    width: 1px;
    height: 12px;
}

/* Corner bracket lock-on animation */
.dossier-panel.visible .panel-corner.tl {
    transform: translate(2px, 2px);
}
.dossier-panel.visible .panel-corner.tr {
    transform: translate(-2px, 2px);
}
.dossier-panel.visible .panel-corner.bl {
    transform: translate(2px, -2px);
}
.dossier-panel.visible .panel-corner.br {
    transform: translate(-2px, -2px);
}

/* ============================================================
   REDACTION ZONE (400vh-600vh)
   ============================================================ */
.redaction-zone {
    position: relative;
    width: 100%;
    height: 200vh;
    z-index: 2;
}

/* --- Redaction Bars --- */
.redact {
    position: relative;
    display: inline;
}

.redact::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    width: 100%;
    height: calc(100% + 8px);
    background-color: var(--blacksite);
    border: 1px solid var(--cipher-green);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--easing);
    z-index: 1;
}

.redaction-panel.visible .redact::after {
    transform: scaleX(1);
}

.redact-end {
    display: none;
}

/* Inline redaction bars for meta text */
.redact-inline {
    display: inline-block;
    width: 80px;
    height: 1em;
    background-color: var(--blacksite);
    border: 1px solid var(--cipher-green);
    vertical-align: middle;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--easing) 0.2s;
}

.redaction-panel.visible .redact-inline {
    transform: scaleX(1);
}

/* Heavy redaction - more bars, darker feel */
.heavy-redaction .panel-content {
    position: relative;
}

.heavy-redaction.visible .panel-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 3px;
    background-color: var(--cipher-green);
    opacity: 0.3;
    animation: heavyRedactSweep 2s var(--easing) forwards;
}

@keyframes heavyRedactSweep {
    from { width: 0; }
    to { width: 80%; }
}

/* Full redaction - nearly everything blacked out */
.full-redaction .panel-content {
    position: relative;
}

.full-redaction.visible .panel-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 15, 0.7);
    z-index: 2;
    animation: fullRedactFade 1.5s var(--easing) 0.5s forwards;
    opacity: 0;
}

@keyframes fullRedactFade {
    to { opacity: 1; }
}

/* ============================================================
   SIGNAL RECOVERY SECTION (600vh-800vh)
   ============================================================ */
.signal-recovery {
    position: relative;
    width: 100%;
    height: 200vh;
    z-index: 2;
}

/* --- Un-redaction bars --- */
.unredact {
    position: relative;
    display: inline;
}

.unredact::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    width: 100%;
    height: calc(100% + 8px);
    background-color: var(--blacksite);
    border: 1px solid var(--cipher-green);
    transform: scaleX(1);
    transform-origin: right;
    transition: transform 0.8s var(--easing);
    z-index: 1;
}

.recovery-panel.visible .unredact::after {
    transform: scaleX(0);
}

.unredact-end {
    display: none;
}

/* --- Final Panel --- */
.final-panel {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    padding: 40px 60px;
    border: 1px solid var(--cipher-green);
    background-color: rgba(13, 13, 20, 0.9);
    opacity: 0;
    transition: opacity 0.6s var(--easing);
}

.final-panel.visible {
    opacity: 1;
}

.final-gabs {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: 48px;
    color: var(--declassified-white);
    line-height: 1;
    margin-bottom: 40px;
}

.final-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--redacted-gray);
    text-transform: uppercase;
}

/* ============================================================
   SCROLL CURSOR
   ============================================================ */
.scroll-cursor {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 18px;
    background-color: var(--phosphor);
    z-index: 10000;
    animation: cursorBlink 0.53s steps(1) infinite;
    opacity: 0;
    transition: opacity 0.3s var(--easing);
}

.scroll-cursor.active {
    opacity: 1;
}

/* ============================================================
   GLITCH EFFECT
   ============================================================ */
.glitch-active {
    animation: glitchShift 60ms steps(1) forwards;
}

@keyframes glitchShift {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    25% {
        transform: translateX(3px);
        opacity: 0.92;
    }
    50% {
        transform: translateX(-2px);
        opacity: 0.94;
    }
    75% {
        transform: translateX(4px);
        opacity: 0.92;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .dossier-panel {
        left: 5% !important;
        right: 5% !important;
        width: auto !important;
        max-width: 90%;
    }

    .final-panel {
        padding: 30px 40px;
    }

    .final-gabs {
        font-size: 36px;
    }

    .hero-svg {
        width: 10rem;
        height: 10rem;
    }

    .recording-indicator {
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .dossier-panel {
        left: 3% !important;
        right: 3% !important;
        max-width: 94%;
    }

    .panel-content {
        padding: 12px 10px;
    }

    .hero-svg {
        width: 8rem;
        height: 8rem;
    }
}

/* ============================================================
   SELECTION STYLING
   ============================================================ */
::selection {
    background-color: var(--phosphor);
    color: var(--blacksite);
}

::-moz-selection {
    background-color: var(--phosphor);
    color: var(--blacksite);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--blacksite);
}

::-webkit-scrollbar-thumb {
    background: var(--cipher-green);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor);
}
