/* ═══════════════════════════════════════════════════════════════
   30OHM ADVANCED ANIMATIONS - Terminal-Punk Effects
   ═══════════════════════════════════════════════════════════════ */

/* Scroll-triggered animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered animations for lists */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }
.stagger-item:nth-child(7) { transition-delay: 0.7s; }

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--dark-surface);
    border-top: 4px solid var(--color-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Hover lift effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   GLITCH EFFECT - Text distortion animation
   ═══════════════════════════════════════════════════════════════ */
.glitch {
    position: relative;
    animation: glitchSkew 3s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00de;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    animation: glitchTop 2.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    animation: glitchBottom 1.5s infinite linear alternate-reverse;
}

@keyframes glitchSkew {
    0% { transform: skew(0deg); }
    10% { transform: skew(-0.5deg); }
    20% { transform: skew(0.5deg); }
    30% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

@keyframes glitchTop {
    0% { clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%); transform: translate(0); }
    10% { clip-path: polygon(0 10%, 100% 10%, 100% 45%, 0 45%); transform: translate(-2px); }
    20% { clip-path: polygon(0 25%, 100% 25%, 100% 55%, 0 55%); transform: translate(2px); }
    30% { clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%); transform: translate(0); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%); transform: translate(0); }
}

@keyframes glitchBottom {
    0% { clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%); transform: translate(0); }
    15% { clip-path: polygon(0 55%, 100% 55%, 100% 85%, 0 85%); transform: translate(2px); }
    25% { clip-path: polygon(0 70%, 100% 70%, 100% 95%, 0 95%); transform: translate(-2px); }
    35% { clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%); transform: translate(0); }
    100% { clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%); transform: translate(0); }
}

/* ═══════════════════════════════════════════════════════════════
   CRT SCAN LINES - Retro monitor effect
   ═══════════════════════════════════════════════════════════════ */
.crt-scanlines {
    position: relative;
}

.crt-scanlines::after {
    content: '';
    position: absolute;
    inset: 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(4px); }
}

/* CRT flicker effect - subtle */
.crt-flicker {
    animation: crtFlicker 0.15s infinite;
}

@keyframes crtFlicker {
    0% { opacity: 1; }
    50% { opacity: 0.98; }
    100% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════
   NEON GLOW EFFECTS - Pulsing and breathing
   ═══════════════════════════════════════════════════════════════ */
.neon-pulse {
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        text-shadow:
            0 0 5px var(--color-orange),
            0 0 10px var(--color-orange),
            0 0 20px var(--color-orange),
            0 0 40px var(--color-orange-glow);
    }
    50% {
        text-shadow:
            0 0 2px var(--color-orange),
            0 0 5px var(--color-orange),
            0 0 10px var(--color-orange),
            0 0 20px var(--color-orange-glow);
    }
}

.neon-glow-green {
    animation: neonGlowGreen 2s ease-in-out infinite;
}

@keyframes neonGlowGreen {
    0%, 100% {
        text-shadow:
            0 0 5px var(--terminal-green),
            0 0 10px var(--terminal-green),
            0 0 20px rgba(0, 255, 65, 0.5);
        box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
    }
    50% {
        text-shadow:
            0 0 2px var(--terminal-green),
            0 0 5px var(--terminal-green),
            0 0 10px rgba(0, 255, 65, 0.3);
        box-shadow: 0 0 5px rgba(0, 255, 65, 0.2);
    }
}

/* ═══════════════════════════════════════════════════════════════
   TERMINAL CURSOR - Blinking effect
   ═══════════════════════════════════════════════════════════════ */
.cursor-blink {
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Terminal typing cursor */
.typing-cursor::after {
    content: '█';
    animation: cursorBlink 1s step-end infinite;
    color: var(--terminal-green);
}

/* ═══════════════════════════════════════════════════════════════
   FLOATING ELEMENTS - Ambient motion
   ═══════════════════════════════════════════════════════════════ */
.float-gentle {
    animation: floatGentle 6s ease-in-out infinite;
}

@keyframes floatGentle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(1deg); }
    50% { transform: translateY(-5px) rotate(0deg); }
    75% { transform: translateY(-15px) rotate(-1deg); }
}

.float-slow {
    animation: floatSlow 8s ease-in-out infinite;
}

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

/* ═══════════════════════════════════════════════════════════════
   DATA STREAM EFFECT - Matrix-inspired
   ═══════════════════════════════════════════════════════════════ */
.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.03) 50%,
        transparent 100%
    );
    animation: dataStream 3s linear infinite;
    pointer-events: none;
}

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

/* ═══════════════════════════════════════════════════════════════
   ELECTRICAL SURGE - Power-up effect
   ═══════════════════════════════════════════════════════════════ */
.electric-surge {
    position: relative;
}

.electric-surge::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 107, 53, 0.3),
        transparent
    );
    opacity: 0;
    animation: electricSurge 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes electricSurge {
    0%, 90%, 100% {
        opacity: 0;
        transform: translateX(-100%);
    }
    95% {
        opacity: 1;
        transform: translateX(100%);
    }
}

/* ═══════════════════════════════════════════════════════════════
   CARD HOVER EFFECTS - Boot sequence feel
   ═══════════════════════════════════════════════════════════════ */
.card-boot-hover {
    position: relative;
    overflow: hidden;
}

.card-boot-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-orange),
        var(--terminal-green),
        transparent
    );
    transition: left 0.5s ease;
}

.card-boot-hover:hover::before {
    left: 100%;
}

/* Border trace animation */
.border-trace {
    position: relative;
}

.border-trace::before,
.border-trace::after {
    content: '';
    position: absolute;
    background: var(--color-orange);
    transition: all 0.3s ease;
}

.border-trace::before {
    width: 0;
    height: 2px;
    top: 0;
    left: 0;
}

.border-trace::after {
    width: 2px;
    height: 0;
    bottom: 0;
    right: 0;
}

.border-trace:hover::before {
    width: 100%;
}

.border-trace:hover::after {
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   RESISTOR BAND GLOW - Brand element animation
   ═══════════════════════════════════════════════════════════════ */
.resistor-glow {
    animation: resistorGlow 3s ease-in-out infinite;
}

@keyframes resistorGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px var(--color-orange-glow));
    }
    50% {
        filter: drop-shadow(0 0 15px var(--color-orange-glow))
                drop-shadow(0 0 30px var(--color-orange-glow));
    }
}

/* ═══════════════════════════════════════════════════════════════
   TEXT REVEAL - Typewriter effect
   ═══════════════════════════════════════════════════════════════ */
.text-reveal {
    overflow: hidden;
    border-right: 2px solid var(--terminal-green);
    white-space: nowrap;
    animation:
        typing 3.5s steps(40, end),
        blinkCaret 0.75s step-end infinite;
}

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

@keyframes blinkCaret {
    from, to { border-color: transparent; }
    50% { border-color: var(--terminal-green); }
}

/* ═══════════════════════════════════════════════════════════════
   SHAKE EFFECT - Error/attention animation
   ═══════════════════════════════════════════════════════════════ */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════════════════════════
   CIRCUIT PULSE - Connection visualization
   ═══════════════════════════════════════════════════════════════ */
.circuit-pulse {
    position: relative;
}

.circuit-pulse::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--terminal-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--terminal-green);
    animation: circuitPulse 2s ease-in-out infinite;
}

@keyframes circuitPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

/* ═══════════════════════════════════════════════════════════════
   GRADIENT SHIFT - Subtle color animation
   ═══════════════════════════════════════════════════════════════ */
.gradient-shift {
    background: linear-gradient(
        -45deg,
        var(--color-orange),
        var(--color-gold),
        var(--terminal-green),
        var(--terminal-cyan)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ═══════════════════════════════════════════════════════════════
   HERO SCHEMATIC ANIMATIONS - Slow ambient drift
   ═══════════════════════════════════════════════════════════════ */

/* Drift patterns for schematic elements */
@keyframes driftTopLeft {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, 8px); }
    50% { transform: translate(8px, 18px); }
    75% { transform: translate(-5px, 10px); }
}

@keyframes driftTopRight {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-12px, 10px); }
    50% { transform: translate(-18px, 5px); }
    75% { transform: translate(-8px, 15px); }
}

@keyframes driftBottomLeft {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10px, -8px); }
    50% { transform: translate(18px, -15px); }
    75% { transform: translate(5px, -5px); }
}

@keyframes driftBottomRight {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-8px, -12px); }
    50% { transform: translate(-15px, -8px); }
    75% { transform: translate(-10px, -18px); }
}

@keyframes driftLeft {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(12px, -10px); }
    66% { transform: translate(8px, 12px); }
}

@keyframes driftRight {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-10px, 8px); }
    66% { transform: translate(-15px, -6px); }
}

/* Subtle pulse for connection lines */
@keyframes linePulse {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 0.18; }
}

/* Data flow along lines */
@keyframes dataFlow {
    0% { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

/* Glow pulse for elements */
@keyframes glowPulse {
    0%, 100% { filter: url(#glow) brightness(1); }
    50% { filter: url(#glow) brightness(1.2); }
}

/* Apply animations to schematic elements */
.schematic-element {
    transform-origin: center center;
}

.drift-tl {
    animation: driftTopLeft 35s ease-in-out infinite;
}

.drift-tr {
    animation: driftTopRight 40s ease-in-out infinite;
}

.drift-bl {
    animation: driftBottomLeft 38s ease-in-out infinite;
}

.drift-br {
    animation: driftBottomRight 42s ease-in-out infinite;
}

.drift-l {
    animation: driftLeft 45s ease-in-out infinite;
}

.drift-r {
    animation: driftRight 43s ease-in-out infinite;
}

/* Animate connection lines */
.hero-schematic .pipeline-lines {
    animation: linePulse 8s ease-in-out infinite;
}

.hero-schematic .flow-line {
    animation: dataFlow 3s linear infinite;
}

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

    .glitch::before,
    .glitch::after {
        display: none;
    }

    .crt-scanlines::after {
        display: none;
    }
}
