/* Advanced Animations and Effects */

/* Scroll-triggered animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation classes */
.animate-fade-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Stagger animation delays */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }

/* Initially hidden for scroll animations */
.scroll-hidden {
    opacity: 0;
}

/* Particle effect for hero section */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 153, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 255, 136, 0.05) 0%, transparent 50%);
    animation: particleFloat 20s ease-in-out infinite;
    z-index: -2;
}

@keyframes particleFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.5;
    }
    33% { 
        transform: translateY(-20px) rotate(120deg);
        opacity: 0.8;
    }
    66% { 
        transform: translateY(-10px) rotate(240deg);
        opacity: 0.6;
    }
}

/* Glitch effect for hero title */
.hero-title {
    position: relative;
}

.hero-title::before,
.hero-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--tech-green);
    opacity: 0;
    z-index: -1;
}

.hero-title::before {
    animation: glitch1 6s infinite;
    color: var(--tech-blue);
    z-index: -1;
}

.hero-title::after {
    animation: glitch2 6s infinite;
    color: var(--tech-green);
    z-index: -2;
}

@keyframes glitch1 {
    0%, 98% { 
        transform: translateX(0);
        opacity: 0;
    }
    99% { 
        transform: translateX(1px);
        opacity: 0.3;
    }
    100% { 
        transform: translateX(0);
        opacity: 0;
    }
}

@keyframes glitch2 {
    0%, 97% { 
        transform: translateX(0);
        opacity: 0;
    }
    98% { 
        transform: translateX(-1px);
        opacity: 0.2;
    }
    100% { 
        transform: translateX(0);
        opacity: 0;
    }
}

/* Holographic border effect */
.holographic-border {
    position: relative;
    overflow: hidden;
}

.holographic-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(
        from 0deg,
        var(--tech-green),
        var(--tech-blue),
        var(--tech-green),
        var(--tech-blue),
        var(--tech-green)
    );
    border-radius: inherit;
    z-index: -1;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Matrix-style text reveal */
.matrix-reveal {
    position: relative;
    overflow: hidden;
}

.matrix-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        var(--tech-green),
        transparent
    );
    transform: translateX(-100%);
    animation: matrixScan 2s ease-in-out;
}

@keyframes matrixScan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Floating elements */
.floating {
    animation: float 6s ease-in-out infinite;
}

.floating:nth-child(even) {
    animation-delay: -3s;
    animation-direction: reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--tech-green);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--tech-green); }
}

/* Neon glow hover effect */
.neon-hover {
    transition: all 0.3s ease;
}

.neon-hover:hover {
    text-shadow: 
        0 0 5px var(--tech-green),
        0 0 10px var(--tech-green),
        0 0 15px var(--tech-green),
        0 0 20px var(--tech-green);
}

/* Circuit board pattern overlay */
.circuit-pattern {
    position: relative;
}

.circuit-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px),
        linear-gradient(180deg, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.1;
    z-index: -1;
}

/* Loading animation */
.loading-bar {
    width: 100%;
    height: 2px;
    background: var(--border-color);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: var(--gradient-primary);
    animation: loading 2s ease-in-out infinite;
    transform: translateX(-100%);
}

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

/* Energy pulse effect */
.energy-pulse {
    position: relative;
}

.energy-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tech-green), transparent);
    animation: energyPulse 2s ease-out infinite;
}

@keyframes energyPulse {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        transform: translate(-50%, -50%);
    }
}

/* Text scramble effect */
.text-scramble {
    position: relative;
}

.text-scramble::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--tech-green);
    animation: scramble 0.8s ease-in-out;
}

@keyframes scramble {
    0%, 20%, 40%, 60%, 80% {
        content: "▓▓▓▓▓▓▓▓";
        opacity: 1;
    }
    10%, 30%, 50%, 70% {
        content: "░░░░░░░░";
        opacity: 0.7;
    }
    90%, 100% {
        content: attr(data-text);
        opacity: 0;
    }
}

/* Hover animations for interactive elements */
.interactive-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-hover:hover {
    transform: translateY(-4px) scale(1.02);
}

/* Gradient border animation */
.gradient-border {
    position: relative;
    background: var(--surface-bg);
    border-radius: 12px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
}

/* Parallax scroll effect helper */
.parallax {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

/* Smooth reveal on scroll */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}