/* =====================================================
   AVUIX Gaming Platform — animations.css
   Keyframe animations, utilities, scroll reveal,
   hover effects for the neon sci-fi aesthetic.
   ===================================================== */

/* ===== TIMING CUSTOM PROPERTIES ===== */
:root {
    --ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth:  cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring:  cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --duration-instant: 0.1s;
    --duration-fast:    0.2s;
    --duration-normal:  0.4s;
    --duration-slow:    0.8s;
    --duration-slower:  1.2s;
}

/* =====================================================
   KEYFRAME DEFINITIONS
   ===================================================== */

/* --- Slide In Up --- */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Slide In Down --- */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Slide In Left --- */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Slide In Right --- */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* --- Fade Out --- */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* --- Glow Pulse (purple) --- */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(188, 19, 254, 0.4),
                    0 0 20px rgba(188, 19, 254, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(188, 19, 254, 0.9),
                    0 0 50px rgba(188, 19, 254, 0.5),
                    0 0 80px rgba(188, 19, 254, 0.2);
    }
}

/* --- Glow Pulse Green --- */
@keyframes glowPulseGreen {
    0%, 100% {
        box-shadow: 0 0 8px rgba(0, 255, 136, 0.4),
                    0 0 20px rgba(0, 255, 136, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.9),
                    0 0 50px rgba(0, 255, 136, 0.5),
                    0 0 80px rgba(0, 255, 136, 0.2);
    }
}

/* --- Gradient Shift --- */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* --- Neon Flicker --- */
@keyframes neonFlicker {
    0%   { opacity: 1; }
    3%   { opacity: 0.7; }
    6%   { opacity: 1; }
    10%  { opacity: 0.85; }
    12%  { opacity: 1; }
    47%  { opacity: 1; }
    50%  { opacity: 0.6; }
    53%  { opacity: 1; }
    55%  { opacity: 0.9; }
    57%  { opacity: 1; }
    100% { opacity: 1; }
}

/* --- Shimmer (skeleton loaders) --- */
@keyframes shimmer {
    0% {
        background-position: -800px 0;
    }
    100% {
        background-position: 800px 0;
    }
}

/* --- Bounce In --- */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    40% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.95);
    }
    85% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Spin And Grow --- */
@keyframes spinAndGrow {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

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

/* --- Scanline --- */
@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* --- Typewriter cursor blink --- */
@keyframes typewriter {
    0%, 49% {
        border-right-color: var(--purple, #bc13fe);
        opacity: 1;
    }
    50%, 100% {
        border-right-color: transparent;
        opacity: 0.8;
    }
}

/* --- Border Glow --- */
@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(188, 19, 254, 0.3);
        box-shadow: 0 0 8px rgba(188, 19, 254, 0.2);
    }
    50% {
        border-color: rgba(188, 19, 254, 0.9);
        box-shadow: 0 0 25px rgba(188, 19, 254, 0.6),
                    inset 0 0 15px rgba(188, 19, 254, 0.1);
    }
}

/* --- Background Pan --- */
@keyframes backgroundPan {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: -200% center;
    }
}

/* --- Particle Drift --- */
@keyframes particleDrift {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-120px) translateX(40px) rotate(360deg);
        opacity: 0;
    }
}

/* --- Rotate continuous --- */
@keyframes rotateContinuous {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Text Gradient Flow --- */
@keyframes textGradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* --- Scale Pulse --- */
@keyframes scalePulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

/* --- Shake --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-8px); }
    30%       { transform: translateX(8px); }
    45%       { transform: translateX(-6px); }
    60%       { transform: translateX(6px); }
    75%       { transform: translateX(-3px); }
    90%       { transform: translateX(3px); }
}

/* =====================================================
   ANIMATION UTILITY CLASSES
   ===================================================== */

.animate-slide-in-up {
    animation: slideInUp 0.6s var(--ease-smooth) both;
}

.animate-slide-in-down {
    animation: slideInDown 0.6s var(--ease-smooth) both;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s var(--ease-smooth) both;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s var(--ease-smooth) both;
}

.animate-fade-in {
    animation: fadeIn 0.5s var(--ease-smooth) both;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.5s var(--ease-spring) both;
}

.animate-fade-out {
    animation: fadeOut 0.4s var(--ease-smooth) forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.7s var(--ease-bounce) both;
}

.animate-float {
    animation: float 3.5s ease-in-out infinite;
    will-change: transform;
}

.animate-glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
    will-change: box-shadow, text-shadow;
}

.animate-glow-pulse-green {
    animation: glowPulseGreen 2s ease-in-out infinite;
    will-change: box-shadow, text-shadow;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 40%,
        rgba(188, 19, 254, 0.08) 50%,
        rgba(255, 255, 255, 0.08) 60%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    will-change: background-position;
}

.animate-neon-flicker {
    animation: neonFlicker 4s ease-in-out infinite;
    will-change: opacity, text-shadow;
}

.animate-spin {
    animation: rotateContinuous 1s linear infinite;
    will-change: transform;
}

.animate-spin-slow {
    animation: rotateContinuous 3s linear infinite;
    will-change: transform;
}

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

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

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

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-typewriter {
    border-right: 2px solid var(--purple, #bc13fe);
    animation: typewriter 0.75s step-end infinite;
    overflow: hidden;
    white-space: nowrap;
}

/* ===== DELAY UTILITIES ===== */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }
.animate-delay-7 { animation-delay: 0.7s; }
.animate-delay-8 { animation-delay: 0.8s; }

/* ===== DURATION UTILITIES ===== */
.animate-duration-fast   { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.6s; }
.animate-duration-slow   { animation-duration: 1.2s; }

/* ===== FILL / ITERATION UTILITIES ===== */
.animate-fill-both     { animation-fill-mode: both; }
.animate-fill-forwards { animation-fill-mode: forwards; }
.animate-infinite      { animation-iteration-count: infinite; }
.animate-paused        { animation-play-state: paused; }
.animate-running       { animation-play-state: running; }

/* =====================================================
   SCROLL REVEAL CLASSES
   ===================================================== */

/* Base reveal — hidden state */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s var(--ease-smooth),
                transform 0.6s var(--ease-smooth);
    will-change: opacity, transform;
}

/* Visible state (JS adds this class) */
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    will-change: auto;
}

/* Slide from left */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s var(--ease-smooth),
                transform 0.6s var(--ease-smooth);
    will-change: opacity, transform;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
    will-change: auto;
}

/* Slide from right */
.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s var(--ease-smooth),
                transform 0.6s var(--ease-smooth);
    will-change: opacity, transform;
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
    will-change: auto;
}

/* Scale up */
.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.6s var(--ease-spring),
                transform 0.6s var(--ease-spring);
    will-change: opacity, transform;
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
    will-change: auto;
}

/* Staggered children reveal */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s var(--ease-smooth),
                transform 0.5s var(--ease-smooth);
}

.reveal-stagger.visible > *:nth-child(1)  { opacity: 1; transform: translateY(0); transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2)  { opacity: 1; transform: translateY(0); transition-delay: 0.15s; }
.reveal-stagger.visible > *:nth-child(3)  { opacity: 1; transform: translateY(0); transition-delay: 0.25s; }
.reveal-stagger.visible > *:nth-child(4)  { opacity: 1; transform: translateY(0); transition-delay: 0.35s; }
.reveal-stagger.visible > *:nth-child(5)  { opacity: 1; transform: translateY(0); transition-delay: 0.45s; }
.reveal-stagger.visible > *:nth-child(6)  { opacity: 1; transform: translateY(0); transition-delay: 0.55s; }

/* =====================================================
   HOVER EFFECT UTILITIES
   ===================================================== */

/* Lift with shadow */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-smooth),
                box-shadow var(--duration-normal) var(--ease-smooth);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(188, 19, 254, 0.25),
                0 8px 16px rgba(0, 0, 0, 0.4);
}

/* Purple glow */
.hover-glow {
    transition: box-shadow var(--duration-normal) var(--ease-smooth),
                border-color var(--duration-normal) var(--ease-smooth);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.6),
                0 0 50px rgba(188, 19, 254, 0.3);
    border-color: rgba(188, 19, 254, 0.7);
}

/* Green glow */
.hover-glow-green {
    transition: box-shadow var(--duration-normal) var(--ease-smooth),
                border-color var(--duration-normal) var(--ease-smooth);
}

.hover-glow-green:hover {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6),
                0 0 50px rgba(0, 255, 136, 0.3);
    border-color: rgba(0, 255, 136, 0.7);
}

/* Scale */
.hover-scale {
    transition: transform var(--duration-normal) var(--ease-spring);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Brightness boost */
.hover-bright {
    transition: filter var(--duration-normal) var(--ease-smooth);
}

.hover-bright:hover {
    filter: brightness(1.25) saturate(1.15);
}

/* Combined lift + glow */
.hover-lift-glow {
    transition: transform var(--duration-normal) var(--ease-smooth),
                box-shadow var(--duration-normal) var(--ease-smooth);
}

.hover-lift-glow:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(188, 19, 254, 0.35),
                0 0 25px rgba(188, 19, 254, 0.2);
}

/* Underline grow (for links/text) */
.hover-underline {
    position: relative;
    text-decoration: none;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--purple, #bc13fe), var(--green, #00ff88));
    transition: width var(--duration-normal) var(--ease-smooth);
}

.hover-underline:hover::after {
    width: 100%;
}

/* Rotate on hover */
.hover-rotate {
    transition: transform var(--duration-normal) var(--ease-bounce);
}

.hover-rotate:hover {
    transform: rotate(8deg) scale(1.05);
}

/* =====================================================
   PARTICLE & DECORATIVE ANIMATION HELPERS
   ===================================================== */

/* Pseudo-element scanline sweep */
.scanline-sweep::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(188, 19, 254, 0.4),
        rgba(0, 255, 136, 0.3),
        transparent
    );
    animation: scanline 4s linear infinite;
    pointer-events: none;
}

/* Animated gradient text */
.gradient-text-animated {
    background: linear-gradient(
        270deg,
        var(--purple, #bc13fe),
        var(--green, #00ff88),
        #00ccff,
        var(--purple, #bc13fe)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGradientFlow 5s ease infinite;
}

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

    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .reveal-stagger > * {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
