/**
 * Code & Programming Effects
 * Enhanced visual effects for developer-themed design
 */

/* Terminal Cursor Effect */
.typing-cursor::after {
    content: '|';
    animation: cursorBlink 1s infinite;
    color: var(--primary-color);
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Code Block Styling */
.code-snippet {
    font-family: 'Courier New', 'Consolas', monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    color: var(--accent-color);
    overflow-x: auto;
}

/* Binary Rain Background */
.binary-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    opacity: 0.03;
}

.binary-bg span {
    position: absolute;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 20px;
    animation: binaryFall linear infinite;
}

@keyframes binaryFall {
    0% {
        top: -10%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        top: 110%;
        opacity: 0;
    }
}

/* Circuit Lines */
.circuit-line {
    position: absolute;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-color), 
        transparent);
    height: 1px;
    width: 100%;
    animation: circuitFlow 3s linear infinite;
}

@keyframes circuitFlow {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Hexagon Tech Pattern */
.hex-pattern {
    position: absolute;
    width: 100px;
    height: 100px;
    background: 
        linear-gradient(60deg, transparent 35%, var(--primary-color) 36%, var(--primary-color) 64%, transparent 65%),
        linear-gradient(-60deg, transparent 35%, var(--primary-color) 36%, var(--primary-color) 64%, transparent 65%);
    background-size: 100px 60px;
    opacity: 0.05;
    animation: hexRotate 20s linear infinite;
}

@keyframes hexRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Data Flow Lines */
.data-flow {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent,
        var(--primary-color),
        transparent);
    animation: dataStream 2s ease-in-out infinite;
}

@keyframes dataStream {
    0%, 100% {
        transform: translateY(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* Tech Corner Brackets */
.tech-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--primary-color);
    opacity: 0.5;
}

.tech-corner.top-left {
    top: 10px;
    left: 10px;
    border-top: 2px solid;
    border-left: 2px solid;
}

.tech-corner.top-right {
    top: 10px;
    right: 10px;
    border-top: 2px solid;
    border-right: 2px solid;
}

.tech-corner.bottom-left {
    bottom: 10px;
    left: 10px;
    border-bottom: 2px solid;
    border-left: 2px solid;
}

.tech-corner.bottom-right {
    bottom: 10px;
    right: 10px;
    border-bottom: 2px solid;
    border-right: 2px solid;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--primary-color);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-color);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
    5% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
    10% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
    15% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
    20% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
    100% { clip: rect(random(100) + px, 9999px, random(100) + px, 0); }
}

/* Scanline Effect */
.scanlines {
    position: relative;
}

.scanlines::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    animation: scanlineMove 8s linear infinite;
}

@keyframes scanlineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(100%); }
}

/* Loading Bar Effect */
.loading-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        var(--primary-color),
        transparent);
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Matrix-style Number Rain */
.matrix-char {
    position: absolute;
    font-family: 'Courier New', monospace;
    color: var(--accent-color);
    font-size: 16px;
    opacity: 0;
    animation: matrixRain 4s linear infinite;
}

@keyframes matrixRain {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Tech Grid Overlay */
.tech-grid {
    background-image:
        linear-gradient(rgba(167, 139, 250, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(167, 139, 250, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Pulse Ring Effect */
.pulse-ring {
    position: absolute;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}
