/**
 * Animations CSS
 *
 * All @keyframes definitions, scroll animations, and transitions.
 *
 * @package Groupetto_2026
 */

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

/* Pulse animation for badges and indicators */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Bounce animation for scroll indicator */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Scroll indicator inner dot */
@keyframes scroll-indicator {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

/* News banner ticker */
@keyframes ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade in up animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in down animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in left animation */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in right animation */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale in animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Blob floating animation */
@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10px, -10px);
    }
    50% {
        transform: translate(20px, 0);
    }
    75% {
        transform: translate(10px, 10px);
    }
}

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

/* Shimmer effect for loading states */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Counter number animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Animation Classes
   ========================================================================== */

/* Fade animations */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

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

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

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

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

.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

/* Float animation for background elements */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float 8s ease-in-out infinite;
    animation-delay: -2s;
}

.animate-float-slow {
    animation: float 10s ease-in-out infinite;
    animation-delay: -4s;
}

/* Pulse animation */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Rotate animation */
.animate-rotate {
    animation: rotate 20s linear infinite;
}

/* ==========================================================================
   Scroll-triggered Animations
   ========================================================================== */

/* Initial state for scroll-triggered elements */
[data-animate] {
    opacity: 0;
}

[data-animate="fade-up"] {
    transform: translateY(40px);
}

[data-animate="fade-down"] {
    transform: translateY(-40px);
}

[data-animate="fade-left"] {
    transform: translateX(-40px);
}

[data-animate="fade-right"] {
    transform: translateX(40px);
}

[data-animate="scale"] {
    transform: scale(0.9);
}

/* Visible state */
[data-animate].is-visible {
    opacity: 1;
    transform: translate(0) scale(1);
    transition: opacity 0.6s ease-out,
                transform 0.6s ease-out;
}

/* Staggered delays */
[data-animate-delay="100"] {
    transition-delay: 100ms;
}

[data-animate-delay="200"] {
    transition-delay: 200ms;
}

[data-animate-delay="300"] {
    transition-delay: 300ms;
}

[data-animate-delay="400"] {
    transition-delay: 400ms;
}

[data-animate-delay="500"] {
    transition-delay: 500ms;
}

/* ==========================================================================
   Hero Section Animations
   ========================================================================== */

.hero__blob--1 {
    animation: float 8s ease-in-out infinite;
}

.hero__blob--2 {
    animation: float 10s ease-in-out infinite;
    animation-delay: -3s;
}

.hero__blob--3 {
    animation: float 12s ease-in-out infinite;
    animation-delay: -5s;
}

.hero__badge {
    animation: fadeInDown 0.6s ease-out 0.2s both;
}

.hero__title {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero__description {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.hero__cta {
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

.hero__scroll {
    animation: fadeIn 1s ease-out 1.2s both,
               bounce 2s ease-in-out 2s infinite;
}

/* ==========================================================================
   Counter Animation
   ========================================================================== */

/* Default: visible (fallback if JS doesn't load) */
.stat-card {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out,
                transform 0.6s ease-out;
}

/* When JS adds this class to body, hide cards initially for animation */
.js-enabled .stat-card {
    opacity: 0;
    transform: translateY(30px);
}

/* Animated visible state */
.js-enabled .stat-card.is-visible,
.stat-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stat-card:nth-child(1) {
    transition-delay: 0ms;
}

.stat-card:nth-child(2) {
    transition-delay: 150ms;
}

.stat-card:nth-child(3) {
    transition-delay: 300ms;
}

.stat-card:nth-child(4) {
    transition-delay: 450ms;
}

/* Counter number animation */
.counter {
    display: inline-block;
    min-width: 1em;
}

.counter.is-counting {
    animation: countUp 0.4s ease-out;
}

/* ==========================================================================
   App Demo Animations
   ========================================================================== */

.app-demo__content {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out,
                transform 0.8s ease-out;
}

.app-demo__content.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.app-demo__mockup {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease-out 0.2s,
                transform 0.8s ease-out 0.2s;
}

.app-demo__mockup.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Phone screen animations */
.phone-mockup {
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s ease-out;
}

.phone-mockup:hover {
    transform: perspective(1000px) rotateY(0deg);
}

/* Progress bar animation */
.stats-card__progress-bar.is-animating {
    animation: progressFill 1.5s ease-out forwards;
}

@keyframes progressFill {
    from {
        width: 0;
    }
}

/* Workout items stagger animation */
.workout-item:nth-child(1) {
    transition-delay: 0.3s;
}

.workout-item:nth-child(2) {
    transition-delay: 0.5s;
}

.workout-item:nth-child(3) {
    transition-delay: 0.7s;
}

.workout-item:nth-child(4) {
    transition-delay: 0.9s;
}

/* ==========================================================================
   Download Section Animations
   ========================================================================== */

.download__content {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out,
                transform 0.8s ease-out;
}

.download__content.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.store-button {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out,
                transform 0.3s ease-out,
                box-shadow 0.3s ease-out;
}

.store-button.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.store-button:nth-child(1) {
    transition-delay: 0.2s;
}

.store-button:nth-child(2) {
    transition-delay: 0.4s;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-alt) 25%,
        var(--color-accent) 50%,
        var(--color-bg-alt) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==========================================================================
   Hover Animations
   ========================================================================== */

/* Button hover lift */
.btn {
    transition: transform 0.3s ease,
                box-shadow 0.3s ease,
                background-color 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* Card hover effect */
.stat-card,
.store-button {
    transition: transform 0.3s ease,
                box-shadow 0.3s ease;
}

/* Link hover underline animation */
.link-animated {
    position: relative;
    display: inline-block;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.link-animated:hover::after {
    width: 100%;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

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

    [data-animate] {
        opacity: 1;
        transform: none;
    }

    .hero__blob {
        animation: none;
    }

    .news-banner__track {
        animation: none;
    }
}
