/* ============================================
   continu.ax -- Cyberpunk HUD Interface
   ============================================ */

:root {
    --void: #0a0a0f;
    --terminal: #0d1117;
    --phosphor: #00ff41;
    --phosphor-dim: #00cc33;
    --phosphor-bright: #33ff66;
    --amber: #ffb000;
    --glitch: #ff0066;
    --cyan: #00e5ff;
    --static: #e0e0e0;
    --white: #ffffff;
}

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

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

body {
    background-color: var(--void);
    color: var(--phosphor);
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    line-height: 1.75;
    letter-spacing: 0.04em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Scanline Overlay ---- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
}

#scanline-overlay.alert-mode {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.06) 2px,
        rgba(0, 255, 65, 0.06) 4px
    );
}

/* ---- Glitch Scan Bar ---- */
#glitch-scan-bar {
    position: fixed;
    left: 0;
    width: 100%;
    height: 0;
    background: rgba(255, 0, 102, 0.4);
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
}

#glitch-scan-bar.scanning {
    opacity: 1;
    height: 4px;
    animation: scanDown 150ms linear forwards;
}

@keyframes scanDown {
    0% { top: 0; }
    100% { top: 100vh; }
}

/* ---- Boot Screen ---- */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void);
    z-index: 10000;
    padding: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: var(--phosphor);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    transition: opacity 0.6s ease;
}

#boot-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

#boot-screen.hidden {
    display: none;
}

#boot-text {
    white-space: pre-wrap;
    line-height: 2;
}

#boot-cursor {
    display: inline;
    color: var(--phosphor);
    font-weight: 400;
}

.blink {
    animation: blink 0.8s step-end infinite;
}

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

/* ---- HUD Frame ---- */
#hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#hud-frame.visible {
    opacity: 1;
}

#hud-frame.alert-mode .hud-border {
    border-color: var(--amber);
}

#hud-frame.alert-mode .hud-corner {
    border-color: var(--amber);
}

#hud-frame.alert-mode .hud-readout {
    color: var(--amber);
}

/* HUD Border Lines */
.hud-border {
    position: absolute;
    background: none;
    transition: border-color 2s ease;
}

.hud-border-top {
    top: 12px;
    left: 12px;
    right: 12px;
    height: 0;
    border-top: 1px solid var(--phosphor);
}

.hud-border-right {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 0;
    border-right: 1px solid var(--phosphor);
}

.hud-border-bottom {
    bottom: 12px;
    left: 12px;
    right: 12px;
    height: 0;
    border-bottom: 1px solid var(--phosphor);
}

.hud-border-left {
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 0;
    border-left: 1px solid var(--phosphor);
}

/* HUD Corner Brackets */
.hud-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    transition: border-color 2s ease;
    animation: cornerPulse 3s ease-in-out infinite;
}

.hud-corner-tl {
    top: 8px;
    left: 8px;
    border-top: 2px solid var(--phosphor-bright);
    border-left: 2px solid var(--phosphor-bright);
}

.hud-corner-tr {
    top: 8px;
    right: 8px;
    border-top: 2px solid var(--phosphor-bright);
    border-right: 2px solid var(--phosphor-bright);
}

.hud-corner-bl {
    bottom: 8px;
    left: 8px;
    border-bottom: 2px solid var(--phosphor-bright);
    border-left: 2px solid var(--phosphor-bright);
}

.hud-corner-br {
    bottom: 8px;
    right: 8px;
    border-bottom: 2px solid var(--phosphor-bright);
    border-right: 2px solid var(--phosphor-bright);
}

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

/* HUD Corner Readouts */
.hud-readout {
    position: absolute;
    font-family: 'Fira Code', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    color: var(--phosphor-dim);
    pointer-events: none;
    transition: color 2s ease;
    white-space: nowrap;
}

.hud-readout-tl {
    top: 18px;
    left: 20px;
}

.hud-readout-tr {
    top: 18px;
    right: 20px;
    text-align: right;
}

.hud-readout-bl {
    bottom: 18px;
    left: 20px;
}

.hud-readout-br {
    bottom: 18px;
    right: 20px;
    text-align: right;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.08em;
}

/* ---- Data Stream Background ---- */
#data-stream-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.04;
}

/* ---- Grid Lines Background ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
}

/* ---- Main Content ---- */
#main-content {
    position: relative;
    z-index: 10;
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

/* ---- Hero Section ---- */
#hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 80px;
}

#hero-section h1 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 8vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    position: relative;
    display: inline-block;
}

#hero-subtitle {
    margin-top: 24px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    color: var(--phosphor-dim);
    letter-spacing: 0.06em;
}

.subtitle-segment {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.subtitle-segment.visible {
    opacity: 1;
}

/* ---- Glitch Text Effect ---- */
.glitch-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    position: relative;
    display: inline-block;
}

#hero-section .glitch-text {
    font-size: clamp(2.8rem, 8vw, 6rem);
    font-weight: 900;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.glitch-text::before {
    color: var(--glitch);
    z-index: -1;
    animation: glitchBefore 3s steps(1) infinite;
}

.glitch-text::after {
    color: var(--cyan);
    z-index: -1;
    animation: glitchAfter 2.5s steps(1) infinite;
}

@keyframes glitchBefore {
    0% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    5% { clip-path: inset(40% 0 20% 0); transform: translateX(-3px); }
    10% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    30% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    35% { clip-path: inset(60% 0 10% 0); transform: translateX(2px); }
    36% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    50% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    55% { clip-path: inset(10% 0 70% 0); transform: translateX(-4px); }
    56% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    75% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    80% { clip-path: inset(80% 0 5% 0); transform: translateX(3px); }
    81% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    100% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
}

@keyframes glitchAfter {
    0% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    7% { clip-path: inset(20% 0 50% 0); transform: translateX(3px); }
    8% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    25% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    28% { clip-path: inset(70% 0 5% 0); transform: translateX(-2px); }
    29% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    45% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    48% { clip-path: inset(30% 0 40% 0); transform: translateX(4px); }
    49% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    70% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    73% { clip-path: inset(5% 0 80% 0); transform: translateX(-3px); }
    74% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    100% { clip-path: inset(0 0 100% 0); transform: translateX(0); }
}

/* Hero glitch entry animation */
.glitch-text.glitch-entry::before {
    animation: glitchEntryBefore 200ms steps(1) forwards;
}

.glitch-text.glitch-entry::after {
    animation: glitchEntryAfter 200ms steps(1) forwards;
}

@keyframes glitchEntryBefore {
    0% { transform: translateX(-8px); clip-path: inset(0 0 0 0); }
    25% { transform: translateX(4px); clip-path: inset(20% 0 30% 0); }
    50% { transform: translateX(-2px); clip-path: inset(50% 0 10% 0); }
    75% { transform: translateX(1px); clip-path: inset(10% 0 60% 0); }
    100% { transform: translateX(0); clip-path: inset(0 0 100% 0); }
}

@keyframes glitchEntryAfter {
    0% { transform: translateX(8px); clip-path: inset(0 0 0 0); }
    25% { transform: translateX(-4px); clip-path: inset(30% 0 20% 0); }
    50% { transform: translateX(2px); clip-path: inset(10% 0 50% 0); }
    75% { transform: translateX(-1px); clip-path: inset(60% 0 10% 0); }
    100% { transform: translateX(0); clip-path: inset(0 0 100% 0); }
}

/* ---- Data Blocks ---- */
.data-block {
    position: relative;
    margin-bottom: 64px;
    padding-top: 32px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.data-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.block-border {
    position: absolute;
    top: 0;
    left: 0;
    height: 1px;
    width: 0;
    background: var(--phosphor);
    transition: width 0.4s ease-out;
}

.data-block.revealed .block-border {
    width: 100%;
}

.block-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: var(--phosphor-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
    opacity: 0;
    transition: opacity 0.3s ease 0.4s;
}

.data-block.revealed .block-label {
    opacity: 1;
}

/* Targeting Reticle */
.block-reticle {
    position: absolute;
    top: 24px;
    right: 0;
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

.data-block.revealed .block-reticle {
    opacity: 0.6;
}

.block-reticle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--phosphor);
}

.block-reticle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--phosphor);
}

.block-content {
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

.data-block.revealed .block-content {
    opacity: 1;
}

.block-content h2 {
    margin-bottom: 20px;
}

.block-content p {
    color: var(--phosphor-dim);
    margin-bottom: 16px;
}

/* Data Readout Blocks inside content */
.data-readout-block {
    margin-top: 16px;
    padding: 8px 12px;
    background: var(--terminal);
    border-left: 2px solid var(--phosphor);
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    font-weight: 300;
}

.readout-label {
    display: block;
    color: var(--phosphor-dim);
    font-size: 9px;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.readout-bar {
    color: var(--phosphor);
    letter-spacing: 0;
}

.readout-bar.threat-elevated {
    color: var(--amber);
}

.readout-value {
    color: var(--cyan);
}

/* ---- Network Grid ---- */
.network-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 20px;
}

.node-status {
    padding: 8px 12px;
    background: var(--terminal);
    border: 1px solid rgba(0, 255, 65, 0.15);
    font-family: 'Fira Code', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
}

.node-id {
    display: block;
    color: var(--phosphor-dim);
    font-size: 9px;
    margin-bottom: 4px;
}

.node-state {
    font-size: 10px;
    letter-spacing: 0.06em;
}

.node-state.active {
    color: var(--phosphor);
}

.node-state.warning {
    color: var(--amber);
}

.node-state.error {
    color: var(--glitch);
}

/* ---- Log Entries ---- */
.log-entries {
    margin-top: 16px;
}

.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 255, 65, 0.06);
    font-family: 'Fira Code', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.log-time {
    color: var(--phosphor-dim);
    flex-shrink: 0;
}

.log-type {
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.log-type.type-info {
    color: var(--cyan);
}

.log-type.type-warn {
    color: var(--amber);
}

.log-type.type-error {
    color: var(--glitch);
}

.log-msg {
    color: var(--phosphor-dim);
}

/* ---- End of Stream ---- */
.data-block-final {
    text-align: center;
    padding-top: 64px;
    padding-bottom: 64px;
}

.end-stream-title {
    color: var(--amber);
}

.end-cursor {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.4rem;
    color: var(--amber);
    margin-top: 12px;
}

/* ---- Scroll Indicator ---- */
#scroll-indicator {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--amber);
    opacity: 0;
    z-index: 200;
    pointer-events: none;
    letter-spacing: 0.08em;
    animation: flickerAmber 2s ease-in-out infinite;
    transition: opacity 0.5s ease;
}

#scroll-indicator.visible {
    opacity: 0.7;
}

@keyframes flickerAmber {
    0%, 100% { opacity: 0.7; }
    25% { opacity: 0.5; }
    50% { opacity: 0.7; }
    75% { opacity: 0.4; }
}

/* ---- Hover Shake-Error on Data Blocks ---- */
.data-block.shake {
    animation: shakeError 150ms linear;
}

.data-block.shake .block-border {
    background: var(--white);
}

@keyframes shakeError {
    0% { transform: translateX(0); }
    16% { transform: translateX(-1px); }
    33% { transform: translateX(1px); }
    50% { transform: translateX(-1px); }
    66% { transform: translateX(1px); }
    83% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

/* ---- Screen Shake ---- */
body.screen-shake {
    animation: screenShake 100ms linear;
}

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

/* ---- Content Shift Glitch ---- */
body.content-shift {
    transform: translateX(1px);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .hud-readout-tl,
    .hud-readout-tr,
    .hud-readout-bl {
        font-size: 8px;
    }

    .hud-readout-br {
        font-size: 9px;
    }

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

    .log-entry {
        flex-direction: column;
        gap: 2px;
    }

    #hero-section h1,
    #hero-section .glitch-text {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }
}
