/* ========================================
   infra.day - Neon War Room
   ======================================== */

/* -- CSS Custom Properties -- */
:root {
    /* Backgrounds */
    --deep-void: #0a0a0f;
    --dark-slate: #0d1117;
    --rack-black: #12141a;

    /* Neon Accents */
    --electric-cyan: #00f0ff;
    --hot-signal: #ff0066;
    --acid-pass: #00ff88;
    --voltage-amber: #ffaa00;

    /* Text */
    --terminal-white: #e0e6ed;
    --ghost-wire: #1a2a3a;
    --dim-signal: #4a5568;

    /* Glows */
    --glow-cyan: 0 0 10px rgba(0,240,255,0.3), 0 0 40px rgba(0,240,255,0.1), 0 0 80px rgba(0,240,255,0.05);
    --glow-hot: 0 0 10px rgba(255,0,102,0.3), 0 0 40px rgba(255,0,102,0.1);
    --glow-acid: 0 0 10px rgba(0,255,136,0.3), 0 0 40px rgba(0,255,136,0.1);
    --glow-amber: 0 0 10px rgba(255,170,0,0.3), 0 0 40px rgba(255,170,0,0.1);

    --text-glow-cyan: 0 0 10px rgba(0,240,255,0.3), 0 0 40px rgba(0,240,255,0.1), 0 0 80px rgba(0,240,255,0.05);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--deep-void);
    color: var(--terminal-white);
}

body {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* -- Font Classes -- */
.font-chakra {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
}

.font-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
}

.font-orbitron {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
}

/* -- Animations -- */
@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

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

@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes packetMove {
    0% { left: -6px; }
    100% { left: 100%; }
}

@keyframes nodeAlert {
    0% { r: 4; opacity: 1; }
    100% { r: 30; opacity: 0; }
}

@keyframes topologyBreath {
    0%, 100% { transform: rotate(-0.5deg); }
    50% { transform: rotate(0.5deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes borderDraw {
    from { stroke-dashoffset: var(--border-perimeter); }
    to { stroke-dashoffset: 0; }
}

@keyframes introSplit {
    0% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 100%); }
}

/* -- Cursor Blink -- */
.cursor-blink {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background-color: var(--electric-cyan);
    animation: cursorBlink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 4px;
    box-shadow: var(--glow-cyan);
}

/* -- Intro Overlay -- */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--deep-void);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.1s;
}

#intro-overlay.splitting {
    pointer-events: none;
}

#intro-overlay.hidden {
    display: none;
}

#intro-content {
    text-align: center;
    position: relative;
}

#intro-title {
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--electric-cyan);
    text-shadow: var(--text-glow-cyan);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

#intro-subtitle {
    font-size: 1rem;
    color: var(--terminal-white);
    margin-top: 1rem;
    min-height: 1.5em;
    opacity: 0;
}

#intro-subtitle.visible {
    opacity: 1;
}

#intro-cursor {
    display: block;
    width: 8px;
    height: 20px;
    background-color: var(--electric-cyan);
    box-shadow: var(--glow-cyan);
    animation: cursorBlink 1s step-end infinite;
    margin: 0 auto 2rem;
}

#intro-cursor.hide {
    display: none;
}

/* Scanline on intro */
#intro-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,240,255,0.015) 3px,
        rgba(0,240,255,0.015) 4px
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 1;
}

#intro-overlay.scanlines-active::before {
    opacity: 1;
}

/* Split animation elements */
.intro-split-left,
.intro-split-right {
    position: fixed;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: var(--deep-void);
    z-index: 999;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.intro-split-left {
    left: 0;
}

.intro-split-right {
    right: 0;
}

.intro-split-left.split-away {
    transform: translateX(-100%);
}

.intro-split-right.split-away {
    transform: translateX(100%);
}

/* -- Main Container -- */
#main-container {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s;
}

#main-container.visible {
    opacity: 1;
}

/* -- Scanline Overlay (global) -- */
#main-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,240,255,0.015) 3px,
        rgba(0,240,255,0.015) 4px
    );
    pointer-events: none;
    z-index: 100;
}

/* -- Left Pane: The Monitor -- */
#left-pane {
    width: 50vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--deep-void);
    overflow: hidden;
}

#scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,255,170,0.03) 3px,
        rgba(0,255,170,0.03) 4px
    );
    pointer-events: none;
    z-index: 2;
}

#topology-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    animation: topologyBreath 20s ease-in-out infinite;
    z-index: 1;
}

/* Topology node styling */
.topo-node {
    fill: var(--electric-cyan);
    filter: drop-shadow(0 0 4px rgba(0,240,255,0.4));
    transition: fill 0.3s, r 0.3s;
}

.topo-node.idle {
    fill: var(--ghost-wire);
    filter: none;
}

.topo-node.alert {
    fill: var(--hot-signal);
    filter: drop-shadow(0 0 8px rgba(255,0,102,0.5));
}

.topo-line {
    stroke: var(--ghost-wire);
    stroke-width: 1;
}

.topo-packet {
    fill: var(--acid-pass);
    filter: drop-shadow(0 0 3px rgba(0,255,136,0.5));
}

.alert-ring {
    fill: none;
    stroke: var(--hot-signal);
    stroke-width: 1;
    opacity: 0;
}

/* -- Pane Divider -- */
#pane-divider {
    position: fixed;
    top: 0;
    left: 50vw;
    width: 1px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        var(--hot-signal),
        transparent 50%,
        var(--acid-pass)
    );
    z-index: 50;
}

/* -- Right Pane: The Terminal -- */
#right-pane {
    width: 50vw;
    margin-left: 50vw;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--dark-slate);
    padding-bottom: 32px;
    position: relative;
}

/* Custom Scrollbar */
#right-pane::-webkit-scrollbar {
    width: 4px;
}

#right-pane::-webkit-scrollbar-track {
    background: var(--deep-void);
}

#right-pane::-webkit-scrollbar-thumb {
    background: var(--electric-cyan);
    border-radius: 2px;
}

/* -- Content Sections -- */
.content-section {
    padding: clamp(3rem, 8vh, 6rem) clamp(1.5rem, 3vw, 3rem);
}

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

/* -- Terminal Cards -- */
.terminal-card {
    background-color: var(--dark-slate);
    border: 1px solid var(--ghost-wire);
    border-radius: 2px;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    position: relative;
    box-shadow: inset 0 0 30px rgba(0,240,255,0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.terminal-card:hover {
    border-color: var(--electric-cyan);
    box-shadow: inset 0 0 30px rgba(0,240,255,0.12);
}

/* Card border SVG for draw animation */
.card-border-svg {
    position: absolute;
    top: -1px;
    left: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    pointer-events: none;
    z-index: 1;
}

.card-border-rect {
    x: 0;
    y: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--electric-cyan);
    stroke-width: 1;
    rx: 2;
    ry: 2;
    opacity: 0;
}

.card-border-rect.drawing {
    opacity: 1;
    animation: borderDraw 0.6s ease-out forwards;
}

.card-border-rect.drawn {
    opacity: 1;
    stroke: var(--ghost-wire);
    stroke-dashoffset: 0 !important;
}

/* Card content reveal */
.card-content {
    position: relative;
    z-index: 2;
}

[data-reveal] .card-content {
    opacity: 0;
}

[data-reveal].revealed .card-content {
    animation: fadeInUp 0.5s ease-out 0.3s forwards;
}

/* -- Hero Card -- */
.hero-card {
    text-align: left;
}

.hero-title {
    font-size: clamp(2.4rem, 6vw, 5rem);
    color: var(--electric-cyan);
    text-shadow: var(--text-glow-cyan);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    animation: glowPulse 3s ease-in-out infinite;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--acid-pass);
    box-shadow: var(--glow-acid);
}

.pulse-green {
    animation: glowPulse 2s ease-in-out infinite;
}

.status-label {
    color: var(--acid-pass);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-tagline {
    color: var(--terminal-white);
    font-size: 1rem;
    opacity: 0.8;
}

/* -- PID Headers -- */
.pid-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pid-label {
    color: var(--dim-signal);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 600;
}

.pid-name {
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--terminal-white);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* -- Card Body Text -- */
.card-body {
    color: var(--terminal-white);
    margin-bottom: 2rem;
    opacity: 0.85;
}

/* -- Data Grid -- */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.data-pair {
    background-color: var(--rack-black);
    padding: 1rem;
    border-radius: 2px;
}

.data-label {
    display: block;
    color: var(--dim-signal);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.data-value {
    display: block;
    color: var(--electric-cyan);
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    text-shadow: 0 0 10px rgba(0,240,255,0.2);
}

/* -- Packet Flow Lines -- */
.packet-flow-line {
    height: 1px;
    background-color: var(--ghost-wire);
    position: relative;
    margin: 0 clamp(1.5rem, 3vw, 3rem);
    overflow: hidden;
}

.packet-dot {
    position: absolute;
    top: -1px;
    left: -6px;
    width: 6px;
    height: 3px;
    background-color: var(--electric-cyan);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0,240,255,0.5);
    animation: packetMove 4s linear infinite;
}

/* -- Signal Section (Act 3) -- */
#signal-section {
    padding-top: clamp(6rem, 15vh, 12rem);
    padding-bottom: clamp(6rem, 15vh, 12rem);
}

.signal-end {
    text-align: center;
}

.signal-text {
    color: var(--dim-signal);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
}

/* -- Ticker Bar -- */
#ticker-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32px;
    background-color: var(--rack-black);
    z-index: 200;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--ghost-wire);
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 30s linear infinite;
}

.ticker-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-right: 1rem;
}

.ticker-item {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--dim-signal);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ticker-item.active {
    color: var(--electric-cyan);
    text-shadow: 0 0 8px rgba(0,240,255,0.3);
}

.ticker-separator {
    color: var(--ghost-wire);
    font-size: 0.7rem;
}

/* -- Link Styles -- */
a {
    color: var(--electric-cyan);
    text-decoration: none;
    background-image: linear-gradient(var(--electric-cyan), var(--electric-cyan));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: text-shadow 0.15s, background-size 0.3s;
}

a:hover {
    text-shadow: var(--text-glow-cyan);
    background-size: 100% 1px;
}

/* -- Noise texture overlay -- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#noiseFilter);
    pointer-events: none;
    z-index: 99;
    opacity: 0.5;
}

/* ========================================
   Responsive: Below 768px
   ======================================== */
@media (max-width: 768px) {
    #left-pane {
        width: 100vw;
        height: 40vh;
        position: fixed;
        top: 0;
        left: 0;
    }

    #pane-divider {
        position: fixed;
        top: 40vh;
        left: 0;
        width: 100vw;
        height: 1px;
        background: linear-gradient(
            to right,
            var(--hot-signal),
            transparent 50%,
            var(--acid-pass)
        );
    }

    #right-pane {
        width: 100vw;
        margin-left: 0;
        margin-top: 40vh;
        height: calc(100vh - 40vh);
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .data-grid {
        grid-template-columns: 1fr;
    }

    .pid-header {
        flex-direction: column;
        gap: 0.25rem;
    }
}
