/* ===== ENGINEERING ANIMATIONS ===== */

/* Preloader Animations */
@keyframes gearRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes voltagePulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        box-shadow: 0 0 20px var(--accent-success);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.7;
        box-shadow: 0 0 40px var(--accent-success);
    }
}

/* Floating Elements */
@keyframes floatElement {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    33% {
        transform: translateY(-20px) rotate(120deg);
        opacity: 1;
    }
    66% {
        transform: translateY(10px) rotate(240deg);
        opacity: 0.8;
    }
}

/* Circuit Animations */
@keyframes circuitFlow {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 30px 30px;
    }
}

@keyframes circuitGlow {
    0%, 100% {
        stroke: var(--accent-primary);
        stroke-width: 1;
        filter: drop-shadow(0 0 2px var(--accent-primary));
    }
    50% {
        stroke: var(--accent-secondary);
        stroke-width: 2;
        filter: drop-shadow(0 0 8px var(--accent-secondary));
    }
}

/* Orbital Animations */
@keyframes orbitRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes satelliteOrbit {
    0% {
        transform: translateX(-50%) rotate(0deg) translateY(-200px) rotate(0deg);
    }
    100% {
        transform: translateX(-50%) rotate(360deg) translateY(-200px) rotate(-360deg);
    }
}

/* Scroll Indicator */
@keyframes scrollBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Core Animation */
@keyframes corePulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 
            0 0 20px var(--accent-primary),
            0 0 40px rgba(0, 212, 255, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 
            0 0 40px var(--accent-primary),
            0 0 80px rgba(0, 212, 255, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

@keyframes raysRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        opacity: 0.7;
    }
}

/* Particle System */
@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    50% {
        transform: translate(100px, -100px) rotate(180deg);
        opacity: 0.5;
    }
}

/* Electrical Spark */
@keyframes electricalSpark {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Data Stream */
@keyframes dataStream {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* Wave Propagation */
@keyframes wavePropagate {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* Component Activation */
@keyframes componentActivate {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
    }
}

/* Text Glow Effects */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 
            0 0 5px var(--accent-primary),
            0 0 10px var(--accent-primary),
            0 0 15px var(--accent-primary);
    }
    50% {
        text-shadow: 
            0 0 10px var(--accent-primary),
            0 0 20px var(--accent-primary),
            0 0 30px var(--accent-primary),
            0 0 40px var(--accent-secondary);
    }
}

/* Border Flow */
@keyframes borderFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Magnetic Field */
@keyframes magneticField {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
        opacity: 0.6;
    }
}

/* Digital Rain */
@keyframes digitalRain {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateY(1000%);
        opacity: 0;
    }
}

/* Signal Strength */
@keyframes signalPulse {
    0%, 100% {
        transform: scaleY(0.3);
        opacity: 0.7;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Advanced Engineering Animations */

/* PCB Trace Animation */
.pcb-trace {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: pcbTrace 3s ease-in-out infinite;
}

@keyframes pcbTrace {
    0% {
        stroke-dashoffset: 1000;
        stroke: var(--accent-primary);
    }
    50% {
        stroke: var(--accent-success);
    }
    100% {
        stroke-dashoffset: 0;
        stroke: var(--accent-primary);
    }
}

/* Voltage Surge */
@keyframes voltageSurge {
    0% {
        transform: scale(0.8);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.2);
        filter: brightness(2);
    }
    50% {
        transform: scale(1);
        filter: brightness(1.5);
    }
    75% {
        transform: scale(1.1);
        filter: brightness(1.8);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Neural Network Pulse */
@keyframes neuralPulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

/* Quantum State */
@keyframes quantumState {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    25% {
        transform: translate(20px, -20px) scale(1.2);
        opacity: 0.7;
    }
    50% {
        transform: translate(-15px, 15px) scale(0.8);
        opacity: 0.9;
    }
    75% {
        transform: translate(10px, 10px) scale(1.1);
        opacity: 0.6;
    }
}

/* Holographic Display */
@keyframes hologramFlicker {
    0%, 100% {
        opacity: 0.8;
        filter: hue-rotate(0deg) blur(0px);
    }
    25% {
        opacity: 0.9;
        filter: hue-rotate(90deg) blur(1px);
    }
    50% {
        opacity: 0.7;
        filter: hue-rotate(180deg) blur(0.5px);
    }
    75% {
        opacity: 0.95;
        filter: hue-rotate(270deg) blur(1.5px);
    }
}

/* Magnetic Levitation */
@keyframes magneticLevitate {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Energy Transfer */
@keyframes energyTransfer {
    0% {
        stroke-dashoffset: 100;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0;
    }
}

/* Binary Code Stream */
.binary-stream {
    animation: binaryFlow 2s linear infinite;
}

@keyframes binaryFlow {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* Radar Sweep */
@keyframes radarSweep {
    0% {
        transform: rotate(0deg);
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        transform: rotate(360deg);
        opacity: 1;
    }
}

/* Thermal Imaging */
@keyframes thermalGradient {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(180deg);
    }
}

/* Interactive Animations */

/* Button Magnetic Effect */
.btn-magnetic {
    position: relative;
    overflow: hidden;
}

.btn-magnetic::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-magnetic:hover::before {
    left: 100%;
}

/* Card Depth Effect */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d:hover {
    transform: rotateY(5deg) rotateX(5deg) translateZ(10px);
}

/* Parallax Scrolling */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Loading Bar Animation */
@keyframes loadingProgress {
    0% {
        transform: scaleX(0);
        opacity: 1;
    }
    100% {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* Connection Node Animation */
.connection-node {
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
    }
}

/* Data Visualization */
.data-bar {
    animation: dataGrow 1.5s ease-out forwards;
}

@keyframes dataGrow {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* Circuit Board Activation */
.circuit-active path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: circuitDraw 3s ease-in-out forwards;
}

@keyframes circuitDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Advanced Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Performance Optimized Animations */
@media (max-width: 768px) {
    .engineering-showcase {
        animation-duration: 2s !important;
    }
    
    .floating-elements > div {
        animation-duration: 8s !important;
    }
}

/* High-contrast mode support */
@media (prefers-contrast: high) {
    .circuit-animation {
        opacity: 0.8;
    }
    
    .glass-effect {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .engineering-showcase {
        filter: brightness(1.1);
    }
}

/* Print styles */
@media print {
    .engineering-showcase,
    .background-elements,
    .floating-elements {
        display: none;
    }
    
    .glass-effect {
        background: transparent;
        border: 1px solid #000;
    }
}