/* ============================================= */
/* OPTZIO.ORG — ANIMATIONS & KEYFRAMES          */
/* The Optimization Operating System             */
/* ============================================= */

/* ─────────── KEYFRAMES ─────────── */

/* Float (gentle up-down) */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

/* Pulse Glow */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
        box-shadow: 0 0 10px currentColor;
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 25px currentColor;
    }
}

/* Gradient Shift (background animation) */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Typing Cursor Blink */
@keyframes typing-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Slide Up (reveal) */
@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In from Left */
@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In from Right */
@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Particle Float (random-ish movement) */
@keyframes particle-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(15px, -20px) scale(1.1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-10px, -35px) scale(0.9);
        opacity: 0.4;
    }
    75% {
        transform: translate(20px, -15px) scale(1.05);
        opacity: 0.5;
    }
}

/* Shimmer (loading effect) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Rotating Border Gradient */
@keyframes rotate-border {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Fade In */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scale In */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scale In with Bounce */
@keyframes scale-in-bounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    60% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Typewriter for terminal */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Border glow pulse */
@keyframes border-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 255, 136, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    }
}

/* Glow orbit */
@keyframes glow-orbit {
    0% {
        transform: rotate(0deg) translateX(100px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(100px) rotate(-360deg);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-12px);
    }
    60% {
        transform: translateY(-6px);
    }
}

/* Wiggle (for attention) */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-3deg); }
    20% { transform: rotate(3deg); }
    30% { transform: rotate(-2deg); }
    40% { transform: rotate(2deg); }
    50% { transform: rotate(0deg); }
}

/* Ripple */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Counter roll (for stat numbers) */
@keyframes counter-roll {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Glow text */
@keyframes glow-text {
    0%, 100% {
        text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.6), 0 0 40px rgba(0, 255, 136, 0.3);
    }
}

/* Matrix rain inspired */
@keyframes matrix-fall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* ─────────── ANIMATION UTILITY CLASSES ─────────── */

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 4s ease infinite;
}

.animate-slide-up {
    animation: slide-up 0.6s ease forwards;
}

.animate-slide-left {
    animation: slide-in-left 0.6s ease forwards;
}

.animate-slide-right {
    animation: slide-in-right 0.6s ease forwards;
}

.animate-fade-in {
    animation: fade-in 0.6s ease forwards;
}

.animate-scale-in {
    animation: scale-in 0.4s ease forwards;
}

.animate-scale-bounce {
    animation: scale-in-bounce 0.5s ease forwards;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-wiggle {
    animation: wiggle 0.6s ease;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-glow-text {
    animation: glow-text 3s ease-in-out infinite;
}

.animate-border-glow {
    animation: border-glow 2s ease-in-out infinite;
}

/* ─────────── STAGGERED DELAYS ─────────── */

.delay-1 { animation-delay: 0.1s; transition-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; transition-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; transition-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; transition-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; transition-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; transition-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; transition-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; transition-delay: 0.8s; }

/* ─────────── HOVER TRANSITIONS ─────────── */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.hover-scale {
    transition: transform 0.3s ease;
}
.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow-green {
    transition: box-shadow 0.3s ease;
}
.hover-glow-green:hover {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.3);
}

.hover-glow-pink {
    transition: box-shadow 0.3s ease;
}
.hover-glow-pink:hover {
    box-shadow: 0 0 25px rgba(255, 45, 124, 0.3);
}

.hover-glow-purple {
    transition: box-shadow 0.3s ease;
}
.hover-glow-purple:hover {
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.3);
}

.hover-rotate {
    transition: transform 0.3s ease;
}
.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-bright {
    transition: filter 0.3s ease;
}
.hover-bright:hover {
    filter: brightness(1.2);
}

/* ─────────── ENTRANCE ANIMATION GROUPS ─────────── */

/* For staggering children within a revealed parent */
.reveal.revealed .stagger-child {
    opacity: 0;
    animation: slide-up 0.5s ease forwards;
}

.reveal.revealed .stagger-child:nth-child(1) { animation-delay: 0.05s; }
.reveal.revealed .stagger-child:nth-child(2) { animation-delay: 0.1s; }
.reveal.revealed .stagger-child:nth-child(3) { animation-delay: 0.15s; }
.reveal.revealed .stagger-child:nth-child(4) { animation-delay: 0.2s; }
.reveal.revealed .stagger-child:nth-child(5) { animation-delay: 0.25s; }
.reveal.revealed .stagger-child:nth-child(6) { animation-delay: 0.3s; }
.reveal.revealed .stagger-child:nth-child(7) { animation-delay: 0.35s; }
.reveal.revealed .stagger-child:nth-child(8) { animation-delay: 0.4s; }
.reveal.revealed .stagger-child:nth-child(9) { animation-delay: 0.45s; }
.reveal.revealed .stagger-child:nth-child(10) { animation-delay: 0.5s; }
.reveal.revealed .stagger-child:nth-child(11) { animation-delay: 0.55s; }
.reveal.revealed .stagger-child:nth-child(12) { animation-delay: 0.6s; }

/* ─────────── SPECIAL EFFECTS ─────────── */

/* Gradient text animation */
.animated-gradient-text {
    background: linear-gradient(
        270deg,
        #00ffaa,
        #00e5ff,
        #6366f1,
        #b45eff,
        #ff3d8f,
        #ff7849,
        #ffe047,
        #00ffaa
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s ease infinite;
}

/* Rotating border effect for cards */
.rotating-border {
    position: relative;
}

.rotating-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(
        var(--angle, 0deg),
        #00ff88,
        #00d2ff,
        #a855f7,
        #ff2d7c,
        #00ff88
    );
    z-index: -1;
    animation: rotate-border 4s linear infinite;
    background-size: 200% 200%;
}

/* Dot grid background pattern */
.dot-grid-bg {
    background-image: radial-gradient(
        circle at 1px 1px,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 0
    );
    background-size: 40px 40px;
}

/* Scan line effect */
.scan-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--green);
    opacity: 0.3;
    animation: scan 3s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Noise texture overlay */
.noise-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ─────────── REDUCED MOTION ─────────── */
@media (prefers-reduced-motion: reduce) {
    .animate-float,
    .animate-pulse,
    .animate-gradient,
    .animate-bounce,
    .animate-shimmer,
    .animate-glow-text,
    .animate-border-glow,
    .animated-gradient-text {
        animation: none !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none !important;
    }
    
    .reveal.revealed .stagger-child {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* ─────────── NEURAL SYNTHESIS EFFECTS ─────────── */

/* Neural node pulse (for feature backgrounds) */
@keyframes neural-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 rgba(0, 255, 170, 0.1),
            0 0 0 0 rgba(180, 94, 255, 0.05);
    }
    50% {
        box-shadow:
            0 0 40px 10px rgba(0, 255, 170, 0.08),
            0 0 80px 20px rgba(180, 94, 255, 0.04);
    }
}

/* Flowing aurora glow */
@keyframes aurora-flow {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg) brightness(1);
    }
    33% {
        background-position: 50% 100%;
        filter: hue-rotate(30deg) brightness(1.1);
    }
    66% {
        background-position: 100% 50%;
        filter: hue-rotate(-15deg) brightness(1.05);
    }
    100% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg) brightness(1);
    }
}

/* Synaptic connection line animation */
@keyframes synaptic-fire {
    0% { opacity: 0; transform: scaleX(0); }
    50% { opacity: 1; transform: scaleX(1); }
    100% { opacity: 0; transform: scaleX(0); }
}

/* Neural morph (organic shape shifting) */
@keyframes neural-morph {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25% { border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%; }
    50% { border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%; }
    75% { border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

/* Data stream flowing effect */
@keyframes data-stream {
    0% { transform: translateY(-100%) translateX(-50%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh) translateX(50%); opacity: 0; }
}

/* Neural Classes */
.neural-pulse { animation: neural-pulse 4s ease-in-out infinite; }
.neural-morph { animation: neural-morph 8s ease-in-out infinite; }

.aurora-bg {
    background: linear-gradient(
        270deg,
        rgba(0, 255, 170, 0.08),
        rgba(0, 229, 255, 0.06),
        rgba(99, 102, 241, 0.08),
        rgba(180, 94, 255, 0.06),
        rgba(0, 255, 170, 0.08)
    );
    background-size: 400% 400%;
    animation: aurora-flow 15s ease infinite;
}

/* Neural node decoration for cards */
.neural-card {
    position: relative;
    overflow: hidden;
}

.neural-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(0, 255, 170, 0.04) 60deg,
        transparent 120deg,
        rgba(180, 94, 255, 0.04) 180deg,
        transparent 240deg,
        rgba(0, 229, 255, 0.04) 300deg,
        transparent 360deg
    );
    animation: rotate-border 8s linear infinite;
    background-size: 200% 200%;
    z-index: 0;
}

.neural-card > * { position: relative; z-index: 1; }

/* Interactive glow that follows section */
.section-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.4;
    z-index: 0;
}

.section-glow-green { background: rgba(0, 255, 170, 0.15); }
.section-glow-purple { background: rgba(180, 94, 255, 0.15); }
.section-glow-pink { background: rgba(255, 61, 143, 0.15); }
.section-glow-cyan { background: rgba(0, 229, 255, 0.15); }

/* Neural line connector between elements */
.neural-connector {
    position: relative;
}

.neural-connector::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 1px;
    height: 20px;
    background: linear-gradient(to bottom, rgba(0, 255, 170, 0.3), transparent);
}

/* Futuristic scan line on hover */
.scan-hover:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--green), transparent);
    animation: scan 1s linear;
}

/* Data flow dots animation for backgrounds */
.data-dots {
    background-image:
        radial-gradient(circle at 2px 2px, rgba(0, 255, 170, 0.08) 1px, transparent 0),
        radial-gradient(circle at 2px 2px, rgba(180, 94, 255, 0.06) 1px, transparent 0);
    background-size: 50px 50px, 70px 70px;
    background-position: 0 0, 25px 25px;
}
