/**
 * ANIMATIONS SCROLL - UPPERFORMA
 * Animations subtiles et professionnelles au scroll
 * Respect prefers-reduced-motion
 */

/* ===== ÉTAT INITIAL (avant animation) ===== */

/* Ne cacher les éléments QUE si JavaScript a ajouté la classe 'scroll-animate' */
/* Cela évite que le contenu soit invisible si JavaScript ne se charge pas */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Fallback: Si JavaScript ne fonctionne pas, afficher quand même le contenu après 1s */
@keyframes fallback-show {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scroll-animate {
    animation: fallback-show 0.3s ease 1s forwards;
}

/* ===== ÉTAT ANIMÉ (après scroll) ===== */

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

/* ===== ANIMATIONS SPÉCIFIQUES PAR TYPE ===== */

/* Cards - Fade in + Slide up */
.value-card.scroll-animate,
.formation-card.scroll-animate,
.thematique-card.scroll-animate,
.testimonial-card.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.value-card.animated,
.formation-card.animated,
.thematique-card.animated,
.testimonial-card.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Section headers - Fade in simple */
.section-header.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.section-header.animated {
    opacity: 1;
    transform: translateY(0);
}

/* CTA sections - Scale + Fade */
.cta-section.scroll-animate {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.cta-section.animated {
    opacity: 1;
    transform: scale(1);
}

/* Team members - Fade + Slight rotation */
.team-member.scroll-animate {
    opacity: 0;
    transform: translateY(30px) rotate(-2deg);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.team-member.animated {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Process steps - Slide from left alternating */
.process-step.scroll-animate:nth-child(odd) {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.process-step.scroll-animate:nth-child(even) {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.process-step.animated {
    opacity: 1;
    transform: translateX(0);
}

/* FAQ items - Fade in progressive */
.faq-item.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.faq-item.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Stats cards - Scale up */
.stat-card.scroll-animate {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stat-card.animated {
    opacity: 1;
    transform: scale(1);
}

/* ===== RESPECTER PRÉFÉRENCES UTILISATEUR ===== */

/* Si l'utilisateur préfère réduire les animations */
@media (prefers-reduced-motion: reduce) {
    .scroll-animate {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    
    .scroll-animate.animated {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ===== ANIMATIONS SUBTILES HOVER (bonus) ===== */

.animated:hover {
    transition: transform 0.3s ease;
}

.formation-card.animated:hover,
.value-card.animated:hover,
.thematique-card.animated:hover {
    transform: translateY(-5px);
}

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

@media (max-width: 768px) {
    /* Réduire l'intensité des animations sur mobile */
    .scroll-animate {
        transform: translateY(20px);
    }
    
    .process-step.scroll-animate:nth-child(odd),
    .process-step.scroll-animate:nth-child(even) {
        transform: translateY(20px);
    }
}

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

/* Utiliser will-change pour optimiser les performances */
.scroll-animate {
    will-change: opacity, transform;
}

.scroll-animate.animated {
    will-change: auto; /* Libérer les ressources après animation */
}
