/**
 * Animation Styles for OutputLag Theme
 * 
 * @package OutputLag
 * @since 1.0.0
 */

/* ===================================================================
   Core Animation Utilities
   =================================================================== */

/* Fade-in Animation Base */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Animation Delays */
.fade-in:nth-child(1) { transition-delay: 0ms; }
.fade-in:nth-child(2) { transition-delay: 100ms; }
.fade-in:nth-child(3) { transition-delay: 200ms; }
.fade-in:nth-child(4) { transition-delay: 300ms; }
.fade-in:nth-child(5) { transition-delay: 400ms; }
.fade-in:nth-child(6) { transition-delay: 500ms; }

/* ===================================================================
   Loading States
   =================================================================== */

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading-shimmer {
    background: linear-gradient(
        90deg,
        rgba(var(--rgb-white), 0.05) 0px,
        rgba(var(--rgb-primary-accent), 0.2) 40px,
        rgba(var(--rgb-white), 0.05) 80px
    );
    background-size: 200px 100%;
    animation: shimmer 2s infinite linear;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(var(--rgb-white), 0.05) 25%,
        rgba(var(--rgb-white), 0.1) 50%,
        rgba(var(--rgb-white), 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 60%;
}

/* ===================================================================
   RGB and Glow Animations
   =================================================================== */

/* RGB Glow Animation */
@keyframes rgbGlow {
    0% {
        box-shadow: 
            0 0 5px rgba(var(--rgb-primary-accent), 0.5),
            0 0 10px rgba(var(--rgb-primary-accent), 0.3),
            0 0 15px rgba(var(--rgb-primary-accent), 0.1);
    }
    33% {
        box-shadow: 
            0 0 5px rgba(var(--rgb-secondary-accent), 0.5),
            0 0 10px rgba(var(--rgb-secondary-accent), 0.3),
            0 0 15px rgba(var(--rgb-secondary-accent), 0.1);
    }
    66% {
        box-shadow: 
            0 0 5px rgba(var(--rgb-tertiary-accent), 0.5),
            0 0 10px rgba(var(--rgb-tertiary-accent), 0.3),
            0 0 15px rgba(var(--rgb-tertiary-accent), 0.1);
    }
    100% {
        box-shadow: 
            0 0 5px rgba(var(--rgb-primary-accent), 0.5),
            0 0 10px rgba(var(--rgb-primary-accent), 0.3),
            0 0 15px rgba(var(--rgb-primary-accent), 0.1);
    }
}

.rgb-glow {
    animation: rgbGlow 3s ease-in-out infinite;
}

/* Pulsing Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ===================================================================
   Interactive Hover Animations
   =================================================================== */

/* Scale on Hover */
.hover-scale {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Lift on Hover */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(var(--rgb-primary-accent), 0.2);
}

/* Glow on Hover */
.hover-glow {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    opacity: 0;
    filter: blur(8px);
    z-index: -1;
    transition: opacity 0.3s ease;
}

.hover-glow:hover::before {
    opacity: 0.6;
}

/* ===================================================================
   Particle System Animations
   =================================================================== */

/* Floating Particles */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(120deg);
    }
    66% {
        transform: translateY(5px) rotate(240deg);
    }
}

.particle {
    animation: float 6s ease-in-out infinite;
}

/* Different speeds for variety */
.particle:nth-child(odd) {
    animation-duration: 4s;
    animation-delay: -1s;
}

.particle:nth-child(even) {
    animation-duration: 8s;
    animation-delay: -2s;
}

/* ===================================================================
   Background Animations
   =================================================================== */

/* Gradient Shift Animation */
@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

/* Noise Animation */
@keyframes noiseMove {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-5px, -5px);
    }
    50% {
        transform: translate(5px, -5px);
    }
    75% {
        transform: translate(-5px, 5px);
    }
}

.noise-overlay {
    background-image: url('../images/noise-texture.svg');
    opacity: 0.03;
    mix-blend-mode: overlay;
    animation: noiseMove 20s linear infinite;
}

/* ===================================================================
   Scroll-based Animations
   =================================================================== */

/* Parallax Base */
.parallax {
    will-change: transform;
}

/* Scale on Scroll */
.scale-on-scroll {
    transition: transform 0.1s ease-out;
}

/* ===================================================================
   Loading States for Images
   =================================================================== */

img {
    transition: opacity 0.3s ease;
}

img:not(.loaded) {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

/* Image Zoom on Load */
@keyframes imageZoom {
    0% {
        transform: scale(1.1);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.image-zoom img.loaded {
    animation: imageZoom 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================================
   Special Effects
   =================================================================== */

/* Text Glow */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 
            0 0 5px rgba(var(--rgb-primary-accent), 0.5),
            0 0 10px rgba(var(--rgb-primary-accent), 0.3);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(var(--rgb-primary-accent), 0.8),
            0 0 20px rgba(var(--rgb-primary-accent), 0.5),
            0 0 30px rgba(var(--rgb-primary-accent), 0.3);
    }
}

.text-glow {
    animation: textGlow 2s ease-in-out infinite alternate;
}

/* Neon Border Animation */
@keyframes neonBorder {
    0%, 100% {
        border-color: rgba(var(--rgb-primary-accent), 0.3);
        box-shadow: 
            0 0 5px rgba(var(--rgb-primary-accent), 0.2),
            inset 0 0 5px rgba(var(--rgb-primary-accent), 0.1);
    }
    50% {
        border-color: rgba(var(--rgb-primary-accent), 0.8);
        box-shadow: 
            0 0 20px rgba(var(--rgb-primary-accent), 0.6),
            inset 0 0 20px rgba(var(--rgb-primary-accent), 0.3);
    }
}

.neon-border-animated {
    animation: neonBorder 2s ease-in-out infinite alternate;
}

/* ===================================================================
   Performance Optimizations
   =================================================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .hover-scale,
    .hover-lift,
    .pulse,
    .rgb-glow,
    .particle,
    .animated-gradient,
    .noise-overlay {
        animation: none !important;
        transition: none !important;
    }
    
    .hover-scale:hover,
    .hover-lift:hover {
        transform: none !important;
    }
}

/* GPU Acceleration Hints */
.fade-in,
.hover-scale,
.hover-lift,
.particle,
.parallax,
.scale-on-scroll {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}