/* Neural Network Background Animation */
.neural-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

.neural-node {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(0, 255, 255, 0.8);
    border-radius: 50%;
    animation: nodePulse 4s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.6);
}

.neural-connection {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.6), rgba(255, 0, 255, 0.6), transparent);
    transform-origin: left center;
    animation: connectionFlow 3s linear infinite;
}

@keyframes nodePulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.4;
        box-shadow: 0 0 6px rgba(0, 255, 255, 0.6);
    }
    50% { 
        transform: scale(1.8);
        opacity: 1;
        box-shadow: 0 0 12px rgba(255, 0, 255, 0.8);
    }
}

@keyframes connectionFlow {
    0% { opacity: 0.2; }
    50% { opacity: 0.8; }
    100% { opacity: 0.2; }
}

/* Floating mathematical symbols */
.math-symbol {
    position: fixed;
    pointer-events: none;
    opacity: 0.3;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    color: rgba(255, 255, 0, 0.6);
    animation: floatMath 15s infinite ease-in-out;
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.4);
}

@keyframes floatMath {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0.2;
    }
    25% {
        transform: translateY(-30px) translateX(15px) rotate(90deg);
        opacity: 0.5;
    }
    50% {
        transform: translateY(15px) translateX(-15px) rotate(180deg);
        opacity: 0.3;
    }
    75% {
        transform: translateY(-15px) translateX(8px) rotate(270deg);
        opacity: 0.6;
    }
}

/* Enhanced glitch effect for headers */
.glitch {
    position: relative;
    color: transparent;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 
        0 0 10px rgba(0, 255, 255, 0.8),
        0 0 20px rgba(255, 0, 255, 0.6),
        0 0 30px rgba(255, 255, 0, 0.4);
    font-family: 'Times New Roman', 'Computer Modern', serif;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00, #00ffff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #00ffff;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #ff00ff;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
    20% {
        clip-path: inset(20% 0 30% 0);
        transform: translate(-2px, 2px);
    }
    40% {
        clip-path: inset(50% 0 20% 0);
        transform: translate(2px, -2px);
    }
    60% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(-1px, 1px);
    }
    80% {
        clip-path: inset(80% 0 5% 0);
        transform: translate(1px, -1px);
    }
}

@keyframes glitch-2 {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
    20% {
        clip-path: inset(60% 0 10% 0);
        transform: translate(2px, -1px);
    }
    40% {
        clip-path: inset(20% 0 50% 0);
        transform: translate(-2px, 1px);
    }
    60% {
        clip-path: inset(30% 0 40% 0);
        transform: translate(1px, -2px);
    }
    80% {
        clip-path: inset(5% 0 80% 0);
        transform: translate(-1px, 2px);
    }
}

/* Neural network loading animation */
.neural-loader {
    display: inline-block;
    width: 40px;
    height: 40px;
    position: relative;
}

.neural-loader::before,
.neural-loader::after {
    content: '';
    position: absolute;
    border: 2px solid #00ffff;
    border-radius: 50%;
    animation: neuralRotate 2s linear infinite;
}

.neural-loader::before {
    width: 100%;
    height: 100%;
    border-color: #00ffff transparent #00ffff transparent;
}

.neural-loader::after {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-color: transparent #ff00ff transparent #ff00ff;
    animation-direction: reverse;
}

@keyframes neuralRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Research paper grid overlay */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
    animation: gridPulse 8s ease-in-out infinite alternate;
}

@keyframes gridPulse {
    0% { opacity: 0.1; }
    100% { opacity: 0.3; }
}
