/* mysterious.boo -- haunted digital artifact */

:root {
    --void: #000000;
    --blood: #0a0000;
    --static-white: #e0e0e0;
    --glitch-red: #ff0033;
    --terminal-green: #00ff41;
    --shadow-gray: #333333;
    --deep-crimson: #1a0005;
    --bg: var(--void);
    --scroll-tint: 0;
}

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

html {
    background: var(--void);
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--static-white);
    font-family: "Source Code Pro", "Courier New", monospace;
    font-size: 1rem;
    line-height: 1.9;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 1.2s ease-out;
    animation: flicker 10s infinite linear;
}

/* ---------- Cover (3-second blackout) ---------- */
.cover {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    pointer-events: auto;
    opacity: 1;
    animation: revealCover 4s ease-out forwards;
}

.cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 0, 51, 0.04) 0%, rgba(0, 0, 0, 0) 60%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes revealCover {
    0%, 70% {
        opacity: 1;
        pointer-events: auto;
    }
    100% {
        opacity: 0;
        pointer-events: none;
    }
}

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

/* ---------- Scan Lines Overlay ---------- */
.scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.15) 1px,
        rgba(0, 0, 0, 0.15) 2px
    );
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: multiply;
}

.scanlines::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 0, 51, 0.0) 0%,
        rgba(255, 0, 51, 0.04) 50%,
        rgba(255, 0, 51, 0.0) 100%
    );
    height: 200%;
    animation: trackingError 6s linear infinite;
}

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

/* ---------- Vignette ---------- */
.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

/* ---------- Body Flicker ---------- */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.3; }
    94% { opacity: 1; }
    96% { opacity: 0.2; }
    97% { opacity: 1; }
}

/* ---------- Glitch Overlay (occasional sweeps) ---------- */
.glitch-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 0, 51, 0.06) 48%,
        rgba(0, 255, 65, 0.05) 50%,
        rgba(255, 0, 51, 0.06) 52%,
        transparent 100%
    );
    transition: opacity 0.08s linear;
}

.glitch-overlay.active {
    opacity: 1;
}

/* ---------- Main Column ---------- */
.artifact {
    max-width: 520px;
    margin: 0 auto;
    padding: 22vh 28px 30vh 28px;
    position: relative;
    z-index: 1;
}

/* ---------- Masthead ---------- */
.masthead {
    margin-bottom: 80px;
}

.terminal-line {
    font-family: "VT323", "Source Code Pro", monospace;
    font-size: 0.95rem;
    color: var(--terminal-green);
    line-height: 1.6;
    letter-spacing: 0.02em;
    opacity: 0.85;
    margin-bottom: 6px;
}

.terminal-line.dim {
    color: var(--shadow-gray);
    opacity: 0.6;
}

.cursor {
    display: inline-block;
    color: var(--terminal-green);
    animation: blink 1s steps(2) infinite;
    margin-left: 2px;
}

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

.domain-title {
    font-family: "Creepster", "Source Code Pro", monospace;
    font-weight: 400;
    font-size: clamp(2rem, 6vw, 4rem);
    color: var(--glitch-red);
    margin-top: 28px;
    margin-bottom: 14px;
    letter-spacing: 0.05em;
    line-height: 1.05;
    position: relative;
    text-shadow:
        0 0 8px rgba(255, 0, 51, 0.5),
        0 0 22px rgba(255, 0, 51, 0.25);
    animation: titleGlitch 4s infinite steps(1);
}

.domain-title::before,
.domain-title::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.domain-title::before {
    color: var(--terminal-green);
    transform: translate(-2px, 0);
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: shiftLeft 2.6s infinite steps(1);
    text-shadow: none;
}

.domain-title::after {
    color: var(--static-white);
    transform: translate(2px, 0);
    mix-blend-mode: screen;
    opacity: 0.35;
    animation: shiftRight 3.1s infinite steps(1);
    text-shadow: none;
}

@keyframes titleGlitch {
    0%, 95%, 100% { transform: translate(0, 0); }
    96% { transform: translate(-1px, 1px); }
    97% { transform: translate(2px, -1px); }
    98% { transform: translate(-2px, 0); }
}

@keyframes shiftLeft {
    0%, 90%, 100% { transform: translate(-2px, 0); opacity: 0.45; }
    93% { transform: translate(-5px, 1px); opacity: 0.7; }
    96% { transform: translate(-3px, -1px); opacity: 0.55; }
}

@keyframes shiftRight {
    0%, 90%, 100% { transform: translate(2px, 0); opacity: 0.35; }
    91% { transform: translate(5px, -1px); opacity: 0.6; }
    94% { transform: translate(3px, 1px); opacity: 0.5; }
}

.subtitle {
    font-family: "VT323", monospace;
    font-size: 1.05rem;
    color: var(--shadow-gray);
    letter-spacing: 0.08em;
    margin-top: 8px;
}

/* ---------- Static Bars (Section Dividers) ---------- */
.static-bar {
    height: 60px;
    margin: 70px 0;
    position: relative;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 0, 51, 0.04) 2px,
            rgba(255, 0, 51, 0.04) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(26, 0, 5, 0.5) 3px,
            rgba(26, 0, 5, 0.5) 4px
        );
    opacity: 0.7;
    overflow: hidden;
    border-top: 1px solid rgba(26, 0, 5, 0.7);
    border-bottom: 1px solid rgba(26, 0, 5, 0.7);
}

.static-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 6px,
        rgba(255, 0, 51, 0.07) 6px,
        rgba(255, 0, 51, 0.07) 7px
    );
    animation: barScroll 0.4s steps(8) infinite;
}

.static-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 0, 51, 0.18) 30%,
        rgba(0, 255, 65, 0.15) 50%,
        rgba(255, 0, 51, 0.18) 70%,
        transparent 100%
    );
    height: 2px;
    top: 50%;
    animation: trackingLine 2.4s linear infinite;
}

.static-bar.dense {
    height: 90px;
    opacity: 0.85;
}

@keyframes barScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-7px); }
}

@keyframes trackingLine {
    0%, 100% { top: 8%; }
    50% { top: 92%; }
}

/* ---------- Sections ---------- */
.entry {
    margin-bottom: 0;
    position: relative;
}

.section-heading {
    font-family: "Creepster", "Source Code Pro", monospace;
    font-weight: 400;
    font-size: clamp(1.4rem, 3.6vw, 2.1rem);
    color: var(--static-white);
    letter-spacing: 0.06em;
    margin-bottom: 26px;
    line-height: 1.2;
    position: relative;
    display: inline-block;
}

.section-heading::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    color: var(--glitch-red);
    transform: translate(2px, 1px);
    mix-blend-mode: screen;
    opacity: 0.55;
    pointer-events: none;
}

.entry.in-view .section-heading {
    color: var(--static-white);
    text-shadow: 0 0 6px rgba(224, 224, 224, 0.2);
}

.decrypt-text {
    font-family: "VT323", "Source Code Pro", monospace;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--terminal-green);
    letter-spacing: 0.01em;
    word-break: break-word;
    min-height: 5em;
    transition: color 1.4s ease-out, font-family 0s, letter-spacing 1s ease-out;
}

.entry.decrypted .decrypt-text {
    font-family: "Source Code Pro", monospace;
    font-size: 1rem;
    color: var(--static-white);
    letter-spacing: normal;
    line-height: 1.9;
}

.entry.decrypted .decrypt-text::first-letter {
    color: var(--glitch-red);
    font-size: 1.4em;
    font-family: "Creepster", monospace;
}

/* highlighted "keyword" runs while still encrypting */
.entry .decrypt-text .glitch-on {
    color: var(--glitch-red);
    text-shadow: 0 0 4px rgba(255, 0, 51, 0.5);
}

.entry.final .decrypt-text {
    color: var(--glitch-red);
}

.entry.final.decrypted .decrypt-text {
    color: var(--static-white);
    text-shadow: 0 0 8px rgba(255, 0, 51, 0.18);
}

/* ---------- Sign-off ---------- */
.signoff {
    margin-top: 100px;
    padding-top: 40px;
    border-top: 1px dashed rgba(51, 51, 51, 0.5);
}

.signature {
    font-family: "Creepster", monospace;
    font-size: 1.5rem;
    color: var(--glitch-red);
    margin-top: 28px;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.4);
}

/* ---------- Selection ---------- */
::selection {
    background: var(--glitch-red);
    color: var(--void);
}

::-moz-selection {
    background: var(--glitch-red);
    color: var(--void);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--deep-crimson);
    border: 1px solid rgba(255, 0, 51, 0.2);
}

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

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .artifact {
        padding: 18vh 20px 22vh 20px;
        max-width: 100%;
    }

    .static-bar {
        margin: 50px 0;
        height: 50px;
    }

    .masthead {
        margin-bottom: 60px;
    }
}
