/* =============================================
   a6c.dev — Sci-Fi HUD Interface
   Phosphor screens & classified transmissions
   ============================================= */

:root {
    --void: #080c10;
    --surface: #131b24;
    --grid: #2a5a4a;
    --glow: #00e6a0;
    --signal: #00d4ff;
    --alert: #ffb800;
    --decay: #5a6a78;
    --ghost: #1a2a34;

    --font-system: 'Space Mono', monospace;
    --font-display: 'Orbitron', sans-serif;
    --font-data: 'Share Tech Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--void);
    color: var(--glow);
    font-family: var(--font-system);
    font-size: 15px;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* --- Scan Lines Overlay --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 1px,
        rgba(0, 228, 160, 0.03) 1px,
        rgba(0, 228, 160, 0.03) 2px
    );
    pointer-events: none;
    z-index: 9999;
}

/* --- Grid Lattice --- */
.grid-lattice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- Pulsing Nodes --- */
.nodes-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.node {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--glow);
    border-radius: 50%;
    animation: nodePulse 3s ease-in-out infinite;
}

.node:nth-child(2n) { animation-delay: 1s; }
.node:nth-child(3n) { animation-delay: 0.5s; }
.node:nth-child(5n) { animation-delay: 2s; }

@keyframes nodePulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; box-shadow: 0 0 8px var(--glow); }
}

/* --- Sector Navigation --- */
.sector-nav {
    position: fixed;
    top: 12px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1000;
}

.sector-label {
    font-family: var(--font-data);
    font-size: 10px;
    color: var(--decay);
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s ease, transform 0.2s ease;
    letter-spacing: 0.1em;
}

.sector-label:hover {
    color: var(--glow);
    text-shadow: 0 0 6px rgba(0, 230, 160, 0.5);
    transform: scale(1.03);
}

.sector-label.active {
    color: var(--signal);
}

/* --- Sectors (shared) --- */
.sector {
    min-height: 100vh;
    position: relative;
    z-index: 5;
}

/* --- BOOT SECTOR --- */
.boot-sector {
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 3rem;
    background: var(--void);
}

.boot-terminal {
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--glow);
    line-height: 1.5;
    max-width: 700px;
}

.boot-output {
    white-space: pre-wrap;
    word-break: break-all;
}

.boot-ready {
    margin-top: 1rem;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--glow);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.boot-ready.visible {
    opacity: 1;
}

.blink-cursor {
    animation: cursorBlink 1s step-end infinite;
}

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

/* --- HUD SECTOR --- */
.hud-sector {
    min-height: 300vh;
    padding: 2rem;
}

.hud-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "id main metrics"
        "id main metrics"
        "status status status";
    gap: 1px;
    min-height: 100vh;
    border: 0.5px solid var(--grid);
}

.panel {
    background: var(--surface);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.panel.visible {
    opacity: 1;
    transform: scale(1);
}

.panel-border {
    position: absolute;
    inset: 0;
    border: 0.5px solid var(--grid);
    pointer-events: none;
}

/* --- Panel: Identifier --- */
.panel-id {
    grid-area: id;
}

.designation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--glow);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--glow); }
    50% { opacity: 0.3; box-shadow: none; }
}

.designation-text {
    font-family: var(--font-system);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.panel-data {
    margin-bottom: 1.2rem;
}

.data-label {
    font-family: var(--font-data);
    font-size: 10px;
    color: var(--decay);
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 2px;
}

.data-value {
    font-family: var(--font-system);
    font-size: 14px;
    color: var(--glow);
    letter-spacing: 0.08em;
}

/* --- Panel: Main Display --- */
.panel-main {
    grid-area: main;
    position: relative;
}

.panel-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(0, 228, 160, 0.04) 2px,
        rgba(0, 228, 160, 0.04) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.panel-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 120px);
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--glow);
    text-shadow: 0 0 30px rgba(0, 230, 160, 0.3);
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.decoded-text {
    position: relative;
    z-index: 2;
}

.decode-line {
    margin-bottom: 1rem;
    font-size: 15px;
    line-height: 1.65;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.decode-line.visible {
    opacity: 1;
    transform: scale(1);
}

.line-prefix {
    color: var(--signal);
    font-weight: 700;
}

/* --- Crosshairs --- */
.crosshair {
    position: absolute;
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--grid);
    opacity: 0.5;
    pointer-events: none;
}

.ch-1 { top: 10px; right: 10px; }
.ch-2 { bottom: 10px; left: 10px; }
.ch-corner { top: 8px; right: 8px; }

/* --- Panel: Metrics --- */
.panel-metrics {
    grid-area: metrics;
}

.metrics-title {
    font-family: var(--font-system);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--decay);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.hex-cascade {
    height: 120px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
}

.hex-column {
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--glow);
    opacity: 0.4;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.8;
    animation: hexScroll 8s linear infinite;
}

@keyframes hexScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.signal-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 1.5rem;
}

.signal-bar {
    height: 2px;
    background: var(--glow);
    opacity: 0.6;
    transition: width 1s ease;
}

.metric-readout {
    margin-bottom: 0.8rem;
}

.cycling {
    animation: pulseAttention 4s ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* --- Panel: Status Bar --- */
.panel-status {
    grid-area: status;
    padding: 0.5rem 1rem;
    height: 40px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.status-ticker {
    font-family: var(--font-data);
    font-size: 10px;
    color: var(--decay);
    letter-spacing: 0.08em;
    white-space: nowrap;
    animation: tickerScroll 30s linear infinite;
}

@keyframes tickerScroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* --- CORRIDOR SECTOR --- */
.corridor-sector {
    min-height: 300vh;
    padding: 10vh 5vw;
}

.corridor {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8vh;
}

.corridor-block {
    padding: 3rem;
    position: relative;
    background: transparent;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.corridor-block.visible {
    opacity: 1;
    transform: translateX(0);
}

.block-left {
    transform: translateX(-60px);
}

.block-right {
    transform: translateX(60px);
    text-align: right;
}

/* Incomplete frames */
.incomplete-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.frame-tl {
    border-top: 0.5px solid var(--grid);
    border-left: 0.5px solid var(--grid);
}

.frame-br {
    border-bottom: 0.5px solid var(--grid);
    border-right: 0.5px solid var(--grid);
}

.corridor-title {
    font-family: var(--font-system);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--glow);
    margin-bottom: 1.5rem;
}

.corridor-text {
    font-family: var(--font-system);
    font-size: 15px;
    line-height: 1.65;
    color: var(--glow);
    opacity: 0.85;
}

/* --- SIGNAL LOSS SECTOR --- */
.signal-loss-sector {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.degradation-zone {
    text-align: center;
    position: relative;
    z-index: 10;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border: 1px solid var(--glow);
    border-radius: 50%;
    opacity: 0;
    animation: pulseExpand 2s ease-out infinite;
}

@keyframes pulseExpand {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.end-transmission {
    font-family: var(--font-system);
    font-size: 16px;
    color: var(--decay);
    letter-spacing: 0.2em;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 1s ease;
}

.end-transmission.visible {
    opacity: 1;
}

.final-designation {
    font-family: var(--font-display);
    font-size: clamp(48px, 12vw, 140px);
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--glow);
    text-shadow: 0 0 40px rgba(0, 230, 160, 0.4);
    opacity: 0;
    transition: opacity 1.5s ease;
}

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

.fade-overlay {
    position: fixed;
    inset: 0;
    background: var(--void);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 3s ease;
}

.fade-overlay.active {
    opacity: 0.8;
    pointer-events: all;
}

/* --- Glitch effect --- */
.glitch-active {
    animation: glitchJitter 0.1s step-end infinite;
}

@keyframes glitchJitter {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, 2px); }
    100% { transform: translate(0, 0); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hud-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "id"
            "main"
            "metrics"
            "status";
    }

    .sector-nav {
        flex-direction: row;
        top: auto;
        bottom: 8px;
        right: 50%;
        transform: translateX(50%);
    }

    .corridor-block {
        padding: 2rem;
    }

    .block-left, .block-right {
        text-align: left;
    }

    .panel-title {
        font-size: clamp(32px, 10vw, 60px);
    }
}
