/* ============================================================
   MATRIX EFFECTS — CRT Scanlines, Glitch, Terminal Cursor
   ============================================================ */

/* -- CRT Scanline Overlay -- */
.scanline-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(to bottom,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    opacity: 0.4;
}

/* -- Glitch Text -- */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.glitch::before {
    color: var(--color-secondary);
    animation: glitch-shift 3s infinite linear alternate;
    clip-path: inset(0 0 60% 0);
}

.glitch::after {
    color: var(--color-accent);
    animation: glitch-shift 2s infinite linear alternate-reverse;
    clip-path: inset(60% 0 0 0);
}

@keyframes glitch-shift {

    0%,
    90%,
    100% {
        transform: translate(0);
    }

    92% {
        transform: translate(-2px, 1px);
    }

    94% {
        transform: translate(2px, -1px);
    }

    96% {
        transform: translate(-1px, 2px);
    }

    98% {
        transform: translate(1px, -2px);
    }
}

/* -- Terminal Cursor Blink -- */
.cursor-blink::after {
    content: '▌';
    color: var(--color-primary);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* -- Matrix Glow Border -- */
.matrix-border {
    position: relative;
}

.matrix-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
            var(--color-primary) 0%,
            transparent 40%,
            transparent 60%,
            var(--color-primary) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    transition: opacity var(--transition-base);
}

.matrix-border:hover::before {
    opacity: 1;
}

/* -- Data Stream Background -- */
.data-stream {
    position: relative;
    overflow: hidden;
}

.data-stream::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    right: 0;
    height: 200%;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(0, 255, 65, 0.02) 50%,
            transparent 100%);
    animation: dataStreamFlow 4s linear infinite;
    pointer-events: none;
}

@keyframes dataStreamFlow {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(50%);
    }
}