/*
 * Animations Improved - King Size Game
 * Version: 1.0.0
 * Description: Subtle and performant cyberpunk animations that don't interfere with readability
 */

/* ========================================
   FADE IN ANIMATIONS
   ======================================== */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@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);
    }
}

/* Utility classes for fade animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ========================================
   SUBTLE GLOW PULSE (Non-intrusive)
   ======================================== */

@keyframes glowPulseSubtle {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.1);
    }
}

.glow-pulse-subtle {
    animation: glowPulseSubtle 3s ease-in-out infinite;
}

/* ========================================
   BORDER ANIMATIONS
   ======================================== */

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

.border-flow {
    background-size: 200% 200%;
    animation: borderFlow 3s ease infinite;
}

@keyframes borderGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 229, 255, 0.3),
                    0 0 20px rgba(0, 229, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 229, 255, 0.5),
                    0 0 40px rgba(0, 229, 255, 0.2);
    }
}

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

/* ========================================
   SCANLINE EFFECT (Subtle)
   ======================================== */

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

.scanline-effect {
    position: relative;
    overflow: hidden;
}

.scanline-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 229, 255, 0.03) 50%,
        transparent 100%
    );
    pointer-events: none;
    animation: scanline 8s linear infinite;
    opacity: 0.5;
}

/* ========================================
   GLITCH EFFECT (Only on hover, very subtle)
   ======================================== */

@keyframes glitchSubtle {
    0%, 100% {
        transform: translate(0);
        clip-path: inset(0 0 0 0);
    }
    10% {
        transform: translate(-1px, 1px);
        clip-path: inset(0 0 80% 0);
    }
    20% {
        transform: translate(1px, -1px);
        clip-path: inset(80% 0 0 0);
    }
    30% {
        transform: translate(0);
        clip-path: inset(0 0 0 0);
    }
}

.glitch-hover:hover {
    animation: glitchSubtle 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   FLOAT ANIMATION (Subtle)
   ======================================== */

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

.float-subtle {
    animation: float 3s ease-in-out infinite;
}

/* ========================================
   ROTATE ANIMATION (For icons)
   ======================================== */

@keyframes rotateSubtle {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate-slow {
    animation: rotateSubtle 20s linear infinite;
}

/* ========================================
   HOVER EFFECTS (Interactive)
   ======================================== */

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

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 229, 255, 0.2);
}

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

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

.hover-glow {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.hover-glow:hover {
    border-color: var(--cyan-primary);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3),
                0 0 40px rgba(0, 229, 255, 0.1);
}

/* ========================================
   TEXT EFFECTS (Very subtle)
   ======================================== */

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    }
}

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

/* ========================================
   PARTICLE BACKGROUND (Optimized)
   ======================================== */

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translate(100px, -100px);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--cyan-primary);
    border-radius: 50%;
    animation: particleFloat 10s linear infinite;
    pointer-events: none;
}

.particle:nth-child(2) { animation-delay: 2s; }
.particle:nth-child(3) { animation-delay: 4s; }
.particle:nth-child(4) { animation-delay: 6s; }
.particle:nth-child(5) { animation-delay: 8s; }

/* ========================================
   GRID OVERLAY (Subtle)
   ======================================== */

.grid-overlay {
    position: relative;
}

.grid-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   PROGRESS/LOADING ANIMATIONS
   ======================================== */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 229, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

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

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

/* ========================================
   SCROLL INDICATOR
   ======================================== */

@keyframes scrollBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

.scroll-indicator {
    animation: scrollBounce 2s ease-in-out infinite;
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Use will-change for animated elements */
.fade-in,
.fade-in-up,
.fade-in-left,
.fade-in-right,
.hover-lift,
.hover-scale,
.float-subtle {
    will-change: transform, opacity;
}

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

/* ========================================
   RESPONSIVE ANIMATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .glow-pulse-subtle,
    .border-glow-animate,
    .text-glow-animate {
        animation: none;
    }

    /* Faster animations on mobile */
    .fade-in,
    .fade-in-up,
    .fade-in-left,
    .fade-in-right {
        animation-duration: 0.5s;
    }

    /* Disable heavy effects on mobile */
    .scanline-effect::after,
    .grid-overlay::before {
        display: none;
    }
}

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

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.no-animation {
    animation: none !important;
    transition: none !important;
}

.animation-paused {
    animation-play-state: paused !important;
}

/* ========================================
   CYBERPUNK SPECIFIC EFFECTS
   ======================================== */

/* Corner accents */
.corner-accent {
    position: relative;
}

.corner-accent::before,
.corner-accent::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--cyan-primary);
}

.corner-accent::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner-accent::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

/* Neon line */
@keyframes neonLine {
    0%, 100% {
        transform: scaleX(0);
        opacity: 0;
    }
    50% {
        transform: scaleX(1);
        opacity: 1;
    }
}

.neon-line {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan-primary), transparent);
    animation: neonLine 2s ease-in-out infinite;
    transform-origin: center;
}

/* Data stream effect */
@keyframes dataStream {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(100%);
        opacity: 0;
    }
}

.data-stream {
    position: absolute;
    width: 1px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--cyan-primary),
        transparent
    );
    animation: dataStream 3s linear infinite;
}
