/**
 * JC Coaching Homepage - Hero Animé
 * Version OPTIMISÉE pour Core Web Vitals (LCP, CLS, FID)
 */

/* ============================================
   HERO CONTAINER - Performance Optimized
   ============================================ */
.hero-anime {
    position: relative;
    height: calc(100vh - var(--header-height));
    min-height: 600px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* content-visibility: auto;  ← Chrome 85+ pour perf off-screen */
    /* will-change: auto;  ← À utiliser uniquement si nécessaire */
}

/* ============================================
   KEN BURNS EFFECT - GPU Accelerated Only
   ============================================ */
.hero-bg-anime {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* Image R2 - Jacques Chauvin Coach Sportif */
    background-image: url('https://pub-5a46b495cb634417b84eb765d949f0f5.r2.dev/jacques-chauvin-coach-sportif.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    /* IMPORTANT : transform only (GPU), pas de width/height/top/left */
    will-change: transform;  /* Optimisation: préparer GPU */
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.08) translate(-2%, -1%);
    }
}

.hero-bg-anime {
    animation: kenBurns 12s ease-out infinite alternate;
}

/* ============================================
   HERO OVERLAY - Gradient subtil
   ============================================ */
.hero-overlay-anime {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(10, 10, 10, 0.85) 0%,
        rgba(10, 10, 10, 0.6) 50%,
        rgba(10, 10, 10, 0.85) 100%
    );
    /* GPU accelerated */
    transform: translateZ(0);
}

/* ============================================
   HERO CONTENT - Pas de layout shift
   ============================================ */
.hero-content-anime {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 900px;
    padding: 2rem;
    /* Stabilité layout : pas de changements de taille */
    contain: layout style paint;
}

.hero-badge-anime {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    /* Animation d'entrée */
    animation: fadeUp 0.8s ease-out;
}

.hero-title-anime {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    /* Animation d'entrée avec délai */
    animation: fadeUp 0.8s ease-out 0.2s backwards;
}

.hero-subtitle-anime {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    /* Animation d'entrée avec délai */
    animation: fadeUp 0.8s ease-out 0.4s backwards;
}

.hero-cta-anime {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    /* Animation d'entrée avec délai */
    animation: fadeUp 0.8s ease-out 0.6s backwards;
}

/* ============================================
   ANIMATIONS FADE UP - GPU Only
   ============================================ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px) translateZ(0); /* GPU */
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);     /* GPU */
    }
}

/* ============================================
   SCROLL REVEAL - Performance Optimized
   ============================================ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px) translateZ(0); /* GPU */
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform; /* Optimiser GPU */
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0) translateZ(0);
    will-change: auto; /* Libérer GPU après animation */
}

/* ============================================
   SCROLL INDICATOR - Subtil
   ============================================ */
.scroll-indicator-anime {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: bounceSubtil 2s ease-in-out infinite;
    /* Pas d'impact sur CLS (position absolute) */
}

@keyframes bounceSubtil {
    0%, 100% {
        transform: translateX(-50%) translateY(0) translateZ(0);
    }
    50% {
        transform: translateX(-50%) translateY(8px) translateZ(0);
    }
}

/* ============================================
   IMAGES - Performance Optimized
   ============================================ */
img {
    max-width: 100%;
    height: auto;
    /* Éviter CLS : déclarer aspect ratio quand possible */
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    background: #111;
    min-height: 200px;
}

/* Image chargée */
img.is-loaded {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   RESPONSIVE - Mobile First
   ============================================ */
@media (max-width: 768px) {
    .hero-anime {
        min-height: 500px;
    }

    .hero-bg-anime {
        /* Sur mobile: montrer la partie droite de l'image (où est le coach) */
        background-position: 60% center;
    }

    @keyframes kenBurnsMobile {
        0% {
            transform: scale(1) translate(0, 0);
        }
        100% {
            transform: scale(1.08) translate(-1%, -1%);
        }
    }

    .hero-bg-anime {
        animation: kenBurnsMobile 12s ease-out infinite alternate;
    }

    .hero-cta-anime {
        flex-direction: column;
    }

    .hero-cta-anime .btn {
        width: 100%;
    }
}

/* ============================================
   PREFERS-REDUCED-MOTION - Accessibilité
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PRINT - Optimisé pour impression
   ============================================ */
@media print {
    .hero-anime {
        height: auto;
        min-height: 400px;
    }

    .hero-bg-anime {
        display: none;
    }

    .scroll-indicator-anime {
        display: none;
    }
}
