/*
 * Animations Stylesheet
 * Theme: Roblox APK Theme
 */

/* ===== Keyframe Definitions ===== */

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

@keyframes float-rotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-12px) rotate(2deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

@keyframes pulse-shadow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 162, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(0, 162, 255, 0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-32px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(32px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(0, 162, 255, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(0, 162, 255, 0.7));
    }
}

/* ===== Apply Animations ===== */

/* Hero entrance */
.hero-content > * {
    animation: fade-in-up 0.6s ease-out backwards;
}

.hero-badge { animation-delay: 0.05s; }
.hero-title { animation-delay: 0.15s; }
.hero-subtitle { animation-delay: 0.25s; }
.hero-actions { animation-delay: 0.35s; }
.hero-stats { animation-delay: 0.45s; }

.hero-visual {
    animation: fade-in 0.8s ease-out 0.4s backwards;
}

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

/* Floating cards */
.card-1 {
    animation: float-rotate 4s ease-in-out infinite;
}
.card-2 {
    animation: float-rotate 4s ease-in-out infinite;
    animation-delay: -2s;
}

/* Background shapes */
.bg-shape {
    animation: float 8s ease-in-out infinite;
}

.bg-shape:nth-child(2) {
    animation-delay: -3s;
    animation-duration: 10s;
}

.bg-shape:nth-child(3) {
    animation-delay: -5s;
    animation-duration: 12s;
}

/* Primary CTA pulse */
.btn-primary.btn-xl {
    animation: pulse-shadow 2.5s ease-in-out infinite;
}

/* Featured APK card entrance */
.featured-apk-card {
    animation: scale-in 0.5s ease-out;
}

/* Game cards staggered entrance */
.game-card {
    animation: fade-in-up 0.4s ease-out backwards;
}

.game-grid .game-card:nth-child(1) { animation-delay: 0.05s; }
.game-grid .game-card:nth-child(2) { animation-delay: 0.10s; }
.game-grid .game-card:nth-child(3) { animation-delay: 0.15s; }
.game-grid .game-card:nth-child(4) { animation-delay: 0.20s; }
.game-grid .game-card:nth-child(5) { animation-delay: 0.25s; }
.game-grid .game-card:nth-child(6) { animation-delay: 0.30s; }
.game-grid .game-card:nth-child(7) { animation-delay: 0.35s; }
.game-grid .game-card:nth-child(8) { animation-delay: 0.40s; }

/* Step cards */
.step-card {
    animation: fade-in-up 0.5s ease-out backwards;
}

.steps-grid .step-card:nth-child(1) { animation-delay: 0.1s; }
.steps-grid .step-card:nth-child(2) { animation-delay: 0.2s; }
.steps-grid .step-card:nth-child(3) { animation-delay: 0.3s; }

/* FAQ items expand */
.faq-item[open] .faq-answer {
    animation: fade-in-down 0.3s ease-out;
}

/* Modal */
.modal-overlay.is-open {
    animation: fade-in 0.25s ease-out;
}

.modal-overlay.is-open .modal-content {
    animation: bounce-in 0.4s ease-out;
}

/* Floating CTA */
.floating-cta {
    animation: fade-in 0.4s ease-out;
}

.floating-cta:hover {
    animation: pulse 1s ease-in-out infinite;
}

/* Toast / copy feedback */
.copy-feedback {
    animation: fade-in-up 0.3s ease-out;
}

/* Skeleton shimmer (for lazy loading placeholders) */
.skeleton,
.lazy:not(.loaded) {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.04) 25%,
        rgba(0, 0, 0, 0.08) 37%,
        rgba(0, 0, 0, 0.04) 63%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.lazy.loaded {
    animation: fade-in 0.4s ease-out;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 162, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Sticky download slide-up */
.sticky-download-mobile {
    animation: fade-in-up 0.4s ease-out;
}

/* Smooth scroll is set in main.css */

/* Hover transitions (already in main.css but reinforced) */
.btn,
.game-card,
.step-card,
.category-tile,
.news-card,
a {
    transition: all 0.25s ease;
}

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

    .phone-mockup,
    .floating-card,
    .bg-shape,
    .btn-primary.btn-xl {
        animation: none !important;
    }
}
