/* ============================================
   GLHF Gaming — Animations
   ============================================ */

/* --- Glitch Effect --- */
@keyframes glitch {
    0%   { transform: translate(0); }
    20%  { transform: translate(-3px, 3px); }
    40%  { transform: translate(-3px, -3px); }
    60%  { transform: translate(3px, 3px); }
    80%  { transform: translate(3px, -3px); }
    100% { transform: translate(0); }
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Glow Pulse --- */
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--glhf-accent-rgb), 0.2); }
    50%      { box-shadow: 0 0 40px rgba(var(--glhf-accent-rgb), 0.4); }
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(var(--glhf-accent-rgb), 0.3); }
    50%      { text-shadow: 0 0 25px rgba(var(--glhf-accent-rgb), 0.6); }
}

/* --- Counter Roll --- */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Line Expand --- */
@keyframes lineExpand {
    from { width: 0; }
    to   { width: 60px; }
}

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

/* --- Spin --- */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Scroll-triggered Animations --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.delay-1 { transition-delay: 0.2s; }
.animate-on-scroll.delay-2 { transition-delay: 0.4s; }
.animate-on-scroll.delay-3 { transition-delay: 0.6s; }
.animate-on-scroll.delay-4 { transition-delay: 0.8s; }
.animate-on-scroll.delay-5 { transition-delay: 1.0s; }
.animate-on-scroll.delay-6 { transition-delay: 1.2s; }

/* Once the entrance animation is done, remove the delay so hover is instant */
.animate-on-scroll.visible.delay-1,
.animate-on-scroll.visible.delay-2,
.animate-on-scroll.visible.delay-3,
.animate-on-scroll.visible.delay-4,
.animate-on-scroll.visible.delay-5,
.animate-on-scroll.visible.delay-6 {
    transition-delay: 0s;
}

/* --- Scan Line (gaming decoration) --- */
@keyframes scanline {
    0%   { top: -5%; }
    100% { top: 105%; }
}

.scanline-effect::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(var(--glhf-accent-rgb), 0.15), transparent);
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 2;
}

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

.shimmer {
    background: linear-gradient(
        90deg,
        var(--glhf-bg-tertiary) 25%,
        var(--glhf-bg-secondary) 50%,
        var(--glhf-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
}

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

    .grid-overlay {
        animation: none;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}
