/* === SIMIDIOTS.NET - Corrupted Terminal Broadcast === */

:root {
    --terminal-phosphor: #00FF41;
    --void-black: #0A0A0A;
    --deep-terminal: #0D1A0D;
    --error-red: #FF0040;
    --dim-system: #808080;
    --signal-noise: #1A3A1A;
    --corruption-magenta: #FF00FF;
    --burnt-amber: #CC7700;

    --corruption-level: 0;
    --static-frequency: 45000;
    --channel-separation: 3;
    --scanline-opacity: 0.04;
    --text-corrupt-rate: 80;
    --gutter-width: 40px;
    --overlap-amount: 5px;
}

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

html {
    scrollbar-width: thin;
    scrollbar-color: var(--terminal-phosphor) var(--void-black);
}

body {
    background-color: var(--void-black);
    color: var(--terminal-phosphor);
    font-family: 'Share Tech Mono', monospace;
    font-size: 15px;
    line-height: 1.7;
    cursor: none;
    overflow-x: hidden;
    min-height: 600vh;
}

/* === SCANLINE OVERLAY === */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        var(--terminal-phosphor) 2px,
        var(--terminal-phosphor) 3px
    );
    opacity: var(--scanline-opacity);
    mix-blend-mode: screen;
}

/* === STATIC BURST OVERLAY === */
#static-burst-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.6'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    transition: opacity 0.05s;
}

#static-burst-overlay.active {
    opacity: 0.6;
}

/* === CUSTOM CURSOR === */
#custom-cursor {
    position: fixed;
    width: 12px;
    height: 18px;
    background-color: var(--terminal-phosphor);
    pointer-events: none;
    z-index: 1001;
    animation: cursor-blink 1060ms step-end infinite;
    display: none;
}

#cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.trail-rect {
    position: fixed;
    width: 12px;
    height: 18px;
    background-color: var(--terminal-phosphor);
    pointer-events: none;
    transition: opacity 0.4s ease-out;
}

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

/* === ERROR BAR (Navigation) === */
#error-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 32px;
    background-color: var(--void-black);
    border-bottom: 1px solid var(--terminal-phosphor);
    z-index: 900;
    overflow: hidden;
    display: flex;
    align-items: center;
    animation: error-bar-border 2s ease-in-out infinite alternate;
}

@keyframes error-bar-border {
    0% { border-bottom-color: var(--terminal-phosphor); }
    100% { border-bottom-color: var(--error-red); }
}

#error-bar-text {
    white-space: nowrap;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--terminal-phosphor);
    animation: marquee-scroll 30s linear infinite;
    padding-left: 100%;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.nav-link {
    cursor: none;
    transition: color 0.1s;
}

.nav-link:hover {
    color: var(--error-red);
    text-shadow: 0 0 8px var(--error-red);
}

/* === PHASES === */
.phase {
    padding: 40px 20px;
    position: relative;
}

#phase-1 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
}

#phase-2 {
    min-height: 200vh;
}

#phase-3 {
    min-height: 200vh;
}

#phase-4 {
    min-height: 200vh;
}

/* === TRANSMISSION BLOCKS === */
.transmission-block {
    position: relative;
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid var(--terminal-phosphor);
    background-color: var(--void-black);
    padding: 0;
    animation: border-flicker 4s step-end infinite;
}

.transmission-block:nth-child(even) {
    background-color: var(--deep-terminal);
}

@keyframes border-flicker {
    0%, 33% { border-style: solid; }
    33.01%, 66% { border-style: dashed; }
    66.01%, 100% { border-style: dotted; }
}

.block-content {
    padding: 30px 25px;
}

/* Offset classes for broken-grid */
.offset-left {
    transform: translateX(-12px);
}

.offset-right {
    transform: translateX(16px);
}

.overlap-heavy .block-content {
    position: relative;
}

.overlap-heavy {
    margin-top: -15px;
}

.overlap-extreme {
    margin-top: -25px;
}

/* Title block */
.title-block {
    border: none;
    background: transparent;
    text-align: center;
    animation: none;
}

#main-title {
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 6vw, 5rem);
    color: var(--error-red);
    text-shadow: 2px -1px 0 var(--terminal-phosphor);
    letter-spacing: 0.15em;
    min-height: 1.2em;
    position: relative;
}

.terminal-prompt {
    margin-top: 20px;
}

.prompt-cursor {
    color: var(--terminal-phosphor);
    font-size: 24px;
    animation: cursor-blink 1060ms step-end infinite;
}

.system-msg {
    margin-top: 30px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
}

/* === TYPOGRAPHY === */
.glitch-headline {
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 6vw, 5rem);
    color: var(--error-red);
    text-shadow: 2px -1px 0 var(--terminal-phosphor);
    margin-bottom: 20px;
    position: relative;
    line-height: 1.2;
}

.body-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 15px;
    line-height: 1.7;
    color: var(--terminal-phosphor);
    margin-bottom: 15px;
}

.dim-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--dim-system);
    display: block;
    margin-top: 10px;
}

/* === ERROR GLYPHS === */
.error-glyph {
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    margin-right: 8px;
    display: inline-block;
}

.error-glyph.alert {
    color: var(--error-red);
    animation: glyph-pulse 1.5s ease-in-out infinite;
}

.error-glyph.warning {
    color: var(--burnt-amber);
    animation: cursor-blink 1060ms step-end infinite;
}

.error-glyph.failed {
    color: var(--corruption-magenta);
}

.error-glyph.active {
    color: var(--terminal-phosphor);
    animation: cursor-blink 1060ms step-end infinite;
}

@keyframes glyph-pulse {
    0%, 100% { text-shadow: 0 0 4px var(--error-red); }
    50% { text-shadow: 0 0 12px var(--error-red), 0 0 20px var(--error-red); }
}

/* === GLITCH GUTTERS === */
.glitch-gutter {
    width: 100%;
    height: 50px;
    background-color: var(--signal-noise);
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--terminal-phosphor);
    opacity: 0.15;
    display: flex;
    align-items: center;
    white-space: nowrap;
    line-height: 50px;
    position: relative;
}

/* === STATUS GRID === */
.status-grid {
    margin: 15px 0;
}

.status-row {
    padding: 6px 0;
    border-bottom: 1px solid var(--signal-noise);
    display: flex;
    align-items: center;
}

.status-row:last-child {
    border-bottom: none;
}

/* === VHS IMAGE CONTAINER === */
.vhs-image-container {
    margin: 20px 0;
    position: relative;
}

.vhs-image {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--terminal-phosphor);
    background: var(--deep-terminal);
}

.vhs-tracking-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.vhs-tracking-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    animation: vhs-drift 8s linear infinite;
}

@keyframes vhs-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(300px); }
}

.vhs-content {
    position: relative;
    z-index: 1;
    filter: contrast(1.1);
}

.ascii-art {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    line-height: 1.3;
    color: var(--terminal-phosphor);
    padding: 15px;
    white-space: pre;
    overflow-x: auto;
}

/* VHS chromatic aberration */
.vhs-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 100%;
    height: 100%;
    background: inherit;
    opacity: 0.15;
    mix-blend-mode: screen;
    z-index: 3;
    pointer-events: none;
}

/* === HEX DUMP === */
.hex-dump {
    background: var(--void-black);
    border: 1px solid var(--signal-noise);
    padding: 15px;
    margin: 15px 0;
}

.hex-line {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--terminal-phosphor);
    line-height: 1.8;
    opacity: 0.8;
}

/* === OVERWRITTEN BLOCK === */
.overwritten-block {
    position: relative;
}

.overwrite-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    font-family: 'VT323', monospace;
    font-size: 28px;
    color: var(--error-red);
    text-shadow: 0 0 10px var(--error-red);
    white-space: nowrap;
    opacity: 0;
    animation: overwrite-flash 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes overwrite-flash {
    0%, 70%, 100% { opacity: 0; }
    75%, 90% { opacity: 0.9; }
}

/* === LOG STREAM === */
.log-stream {
    margin: 15px 0;
}

.log-entry {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    line-height: 2;
    color: var(--terminal-phosphor);
    border-left: 2px solid var(--signal-noise);
    padding-left: 12px;
    margin-bottom: 4px;
}

/* === SEGFAULT === */
.segfault-block {
    background: var(--void-black);
    border: 2px solid var(--error-red);
    padding: 20px;
    margin: 15px 0;
    position: relative;
}

.segfault-block::before {
    content: '*** CRITICAL ***';
    position: absolute;
    top: -10px;
    left: 15px;
    background: var(--void-black);
    color: var(--error-red);
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 0 8px;
}

.system-error {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--error-red);
    line-height: 1.8;
    opacity: 0.9;
}

/* === FINAL TERMINAL === */
.final-terminal {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.fade-error {
    animation: fade-away 8s ease-out forwards;
    opacity: 0.7;
}

.fade-error:nth-child(1) { animation-delay: 0s; }
.fade-error:nth-child(2) { animation-delay: 0.5s; }
.fade-error:nth-child(3) { animation-delay: 1s; }
.fade-error:nth-child(4) { animation-delay: 1.5s; }
.fade-error:nth-child(5) { animation-delay: 2s; }

@keyframes fade-away {
    0% { opacity: 0.7; }
    60% { opacity: 0.7; }
    100% { opacity: 0.1; }
}

.void-space {
    margin-top: 60px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.final-cursor {
    font-size: 32px;
    color: var(--terminal-phosphor);
    animation: cursor-blink 1060ms step-end infinite;
}

.final-block {
    border: none;
    background: transparent;
    animation: none;
    max-width: 100%;
}

/* === ASCII DIVIDERS === */
.ascii-divider {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--terminal-phosphor);
    opacity: 0.2;
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
    padding: 5px 0;
    display: none;
}

/* === HEADLINE GLITCH ANIMATION === */
.glitch-active {
    animation: headline-glitch 3.5s step-end infinite;
}

@keyframes headline-glitch {
    0%, 14% { transform: translateX(0); }
    14.01%, 14.5% { transform: translateX(-2px); }
    14.51%, 15% { transform: translateX(3px); }
    15.01%, 15.5% { transform: translateX(-1px); }
    15.51%, 100% { transform: translateX(0); }
}

/* === VHS TRACKING LOSS === */
@keyframes vhs-tracking-loss {
    0%, 95% { transform: skewX(0deg); filter: none; }
    95.01%, 97% { transform: skewX(8deg); filter: contrast(1.5) brightness(1.3); }
    97.01%, 98% { transform: skewX(-5deg); filter: contrast(1.5) brightness(1.3); }
    98.01%, 100% { transform: skewX(0deg); filter: none; }
}

.vhs-tracking-active {
    animation: vhs-tracking-loss 10s ease-in-out infinite;
}

/* === MEDIA QUERY: prefers-reduced-motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #scanline-overlay {
        opacity: 0.03;
    }

    #error-bar-text {
        animation: none;
        padding-left: 10px;
    }

    .glitch-gutter {
        opacity: 0.1;
    }
}

/* === Scrollbar === */
body::-webkit-scrollbar {
    width: 6px;
}

body::-webkit-scrollbar-track {
    background: var(--void-black);
}

body::-webkit-scrollbar-thumb {
    background: var(--terminal-phosphor);
    border-radius: 0;
}
