/* p9r.xyz - Digital Entropy / Glitch Transmission */

:root {
    --void: #0A0A0F;
    --scan-dark: #12121A;
    --purple-shift: #0F0A0F;
    --recovery-dark: #10101A;
    --cyan: #00FFDD;
    --magenta: #FF00AA;
    --text-white: #F0F0F0;
    --text-dim: #6A6A7A;
    --signal-green: #33FF88;
    --grid-line: #1A1A2A;
    --highlight: #FFAA33;
}

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.6vw, 1.05rem);
    line-height: 1.7;
    color: var(--text-white);
    background: var(--void);
    overflow-x: hidden;
}

/* Scan lines overlay */
body.scan-active::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        transparent,
        transparent 3px,
        rgba(10, 10, 15, 0.3) 3px,
        rgba(10, 10, 15, 0.3) 4px
    );
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.scan-visible::after {
    opacity: 1;
}

/* Signal Lock Overlay */
#signal-overlay {
    position: fixed;
    inset: 0;
    background: var(--void);
    z-index: 10000;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

#signal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#signal-overlay.gone {
    display: none;
}

#scan-line {
    position: absolute;
    top: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--signal-green);
    box-shadow: 0 0 10px var(--signal-green), 0 0 30px rgba(51, 255, 136, 0.3);
    animation: scan-sweep 1.5s linear forwards;
}

@keyframes scan-sweep {
    0% { top: 0; }
    100% { top: 100vh; }
}

/* Sections */
section {
    min-height: 100vh;
    padding: 6rem 6vw;
    position: relative;
}

/* Glitch Title - RGB Channel Separation */
.glitch-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--text-white);
    position: relative;
    display: inline-block;
}

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

.glitch-title::before {
    color: var(--cyan);
    left: 2px;
    top: -1px;
    opacity: 0.6;
    mix-blend-mode: screen;
}

.glitch-title::after {
    color: var(--magenta);
    left: -2px;
    top: 1px;
    opacity: 0.6;
    mix-blend-mode: screen;
}

.glitch-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--text-white);
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

.glitch-heading::before,
.glitch-heading::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
}

.glitch-heading::before {
    color: var(--cyan);
    left: 2px;
    top: -1px;
    opacity: 0.5;
    mix-blend-mode: screen;
}

.glitch-heading::after {
    color: var(--magenta);
    left: -2px;
    top: 1px;
    opacity: 0.5;
    mix-blend-mode: screen;
}

/* Signal Lock Section */
#signal-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.signal-status {
    font-family: 'Fira Mono', monospace;
    font-size: 0.8rem;
    color: var(--signal-green);
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.1em;
}

.signal-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal-green);
    animation: dot-pulse 2s ease-in-out infinite;
}

.signal-dot.green {
    background: var(--signal-green);
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Split Screen */
.split-screen {
    display: flex;
    gap: 5vw;
}

.split-left {
    flex: 0 0 55%;
}

.split-right {
    flex: 0 0 40%;
}

/* Content Blocks */
.content-block {
    margin-bottom: 2em;
    padding: 1rem 0;
}

.content-block p {
    color: var(--text-white);
}

.dim-text {
    color: var(--text-dim) !important;
    font-family: 'Fira Mono', monospace;
    font-size: 0.8rem;
}

.centered {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2em;
}

.recovery-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--highlight);
}

/* Random Displacement Glitch */
.glitch-shift-a {
    animation: glitch-a 10s linear infinite;
}

.glitch-shift-b {
    animation: glitch-b 12s linear infinite;
}

.glitch-shift-c {
    animation: glitch-c 14s linear infinite;
}

@keyframes glitch-a {
    0%, 95%, 97%, 100% { transform: translateX(0); }
    96% { transform: translateX(4px); }
}

@keyframes glitch-b {
    0%, 93%, 95%, 100% { transform: translateX(0); }
    94% { transform: translateX(-5px); }
}

@keyframes glitch-c {
    0%, 96%, 98%, 100% { transform: translateX(0); }
    97% { transform: translateX(3px); }
}

/* Generative Canvas */
.gen-canvas {
    width: 100%;
    height: 300px;
    background:
        conic-gradient(from 45deg, rgba(0, 255, 221, 0.13), rgba(255, 0, 170, 0.13), rgba(0, 255, 221, 0.13)),
        repeating-linear-gradient(45deg, #1A1A2A 0px, transparent 2px, transparent 10px),
        radial-gradient(ellipse at 30% 70%, rgba(51, 255, 136, 0.07), transparent 60%);
    background-blend-mode: difference, normal, screen;
    background-size: 200% 200%, 10px 10px, 100% 100%;
    animation: gen-drift 60s linear infinite;
    border: 1px solid var(--grid-line);
}

.recovery-canvas {
    max-width: 600px;
    margin: 3rem auto;
    height: 200px;
    background:
        conic-gradient(from 135deg, rgba(255, 170, 51, 0.1), rgba(0, 255, 221, 0.1), rgba(255, 170, 51, 0.1)),
        repeating-linear-gradient(-45deg, #1A1A2A 0px, transparent 2px, transparent 10px),
        radial-gradient(ellipse at 70% 30%, rgba(51, 255, 136, 0.07), transparent 60%);
    background-blend-mode: difference, normal, screen;
    background-size: 200% 200%, 10px 10px, 100% 100%;
    animation: gen-drift 60s linear infinite reverse;
}

@keyframes gen-drift {
    0% { background-position: 0% 0%, 0 0, 0% 0%; }
    100% { background-position: 200% 200%, 0 0, 100% 100%; }
}

/* Degradation Section */
#degradation {
    background: var(--void);
}

.tear-block {
    margin-bottom: 3em;
}

.tear-top {
    clip-path: inset(0 0 50% 0);
    padding: 1.5rem;
    border-left: 2px solid var(--cyan);
}

.tear-bottom {
    clip-path: inset(50% 0 0 0);
    padding: 1.5rem;
    transform: translateX(20px);
    border-left: 2px solid var(--magenta);
    margin-top: -2em;
}

.narrow {
    max-width: 60%;
}

.offset {
    margin-left: 15vw;
}

/* Corruption Section */
#corruption {
    background: var(--purple-shift);
}

.corruption-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.fragment {
    width: 30vw;
    max-width: 300px;
    padding: 1rem;
    border: 1px solid var(--grid-line);
}

.corrupted-data {
    font-family: 'Fira Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    opacity: 0.2;
    overflow: hidden;
    white-space: nowrap;
    width: 60vw;
    margin: 2rem auto;
    animation: data-scroll 30s linear infinite;
}

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

/* Recovery Section */
#recovery {
    background: var(--recovery-dark);
}

.final-status {
    font-family: 'Fira Mono', monospace;
    font-size: 0.8rem;
    color: var(--signal-green);
    text-align: center;
    margin-top: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.1em;
}

/* Responsive */
@media (max-width: 768px) {
    .split-screen {
        flex-direction: column;
    }

    .split-left,
    .split-right {
        flex: 1 1 auto;
    }

    .narrow {
        max-width: 100%;
    }

    .offset {
        margin-left: 0;
    }

    .fragment {
        width: 100%;
        max-width: 100%;
    }

    .corrupted-data {
        width: 90vw;
    }
}
