/* ============================================================
   Animation pass — Boulangerie Foggéa — lot 10
   AnimationDesigner · WEB-1229
   Périmètre : CSS-first, IntersectionObserver vanilla,
   0 lib externe, 0 SVG, 0 image ajoutée.
   ============================================================ */

/* Default (prefers-reduced-motion ou JS désactivé) :
   les éléments .fade-in restent visibles sans animation. */
.fade-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {

  /* ── 1. Hero entrance ─────────────────────────────────────
     Fade-in + translateY au chargement, décalé sur la visuel */
  .hero-content {
    animation: foggea-enter 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hero-visual {
    animation: foggea-enter 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both;
  }
  @keyframes foggea-enter {
    from { opacity: 0; transform: translateY(22px); }
  }

  /* ── 2. Scroll reveal (IntersectionObserver → .visible) ───
     Stagger sur grilles de cartes pour un effet en cascade */
  .fade-in {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
  }
  .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
  }
  .features-grid .fade-in:nth-child(2),
  .reviews-grid  .fade-in:nth-child(2) { transition-delay: 0.09s; }
  .features-grid .fade-in:nth-child(3),
  .reviews-grid  .fade-in:nth-child(3) { transition-delay: 0.18s; }

  /* ── 3. CTA pulse — héro uniquement ──────────────────────
     Halo artisanal qui s'estompe : attire l'œil sans clignoter */
  .hero .btn-primary {
    animation: foggea-pulse 3.2s ease-in-out 1.6s infinite;
  }
  @keyframes foggea-pulse {
    0%, 100% {
      box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 36%, transparent);
    }
    55% {
      box-shadow: 0 0 0 8px color-mix(in srgb, var(--color-primary) 0%, transparent);
    }
  }

  /* ── 4. Hover lift — cartes produits & avis ──────────────
     transform GPU-only, pas de repaint layout */
  .feature-card,
  .review-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  }
  .feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-primary) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-primary) 52%, var(--color-bg));
  }
  .review-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--color-secondary) 40%, transparent);
  }

  /* Visual placeholder — léger lift au survol sans toucher à aspect-ratio */
  .visual-placeholder {
    transition: transform 0.32s ease;
    will-change: transform;
  }
  .visual-placeholder:hover {
    transform: scale(1.012);
  }

  /* ── 5. Nav sticky — ombre au scroll (JS ajoute .scrolled) */
  .site-header {
    transition: box-shadow 0.3s ease;
  }
  .site-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
  }

  /* Soulignement animé sur les liens de nav (desktop) */
  @media (min-width: 768px) {
    .main-nav a {
      position: relative;
    }
    .main-nav a::after {
      content: '';
      position: absolute;
      bottom: 0.2rem;
      left: 0.75rem;
      right: 0.75rem;
      height: 2px;
      background: var(--color-primary);
      transform: scaleX(0);
      transform-origin: left center;
      transition: transform 0.22s ease;
      border-radius: 1px;
    }
    .main-nav a:hover::after {
      transform: scaleX(1);
    }
    /* Le lien actif a l'underline toujours visible */
    .main-nav a[aria-current="page"]::after {
      transform: scaleX(1);
      opacity: 0.5;
    }
  }

  /* Focus ring élégant sur tous les éléments interactifs animés */
  .btn:focus-visible,
  .site-logo:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 4px;
  }
  .main-nav a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
  }

}

/* ── Hard-off reduced-motion (renforce la règle dans style.css) ──
   Désactive toutes animations/transitions pour les utilisateurs
   qui ont configuré ce préférence dans leur OS. */
@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;
  }
}
