/* ==========================================================================
   animations.css — système de mouvement
   Tokens adaptés du skill Motion (motion-foundations) en CSS natif :
   durées, easings, distances, échelles. Seuls transform & opacity animent.
   Principe : le contenu est TOUJOURS visible par défaut (sans JS = sans masque).
   ========================================================================== */

:root {
  --dur-instant: 80ms;
  --dur-fast: 180ms;
  --dur-normal: 350ms;
  --dur-slow: 600ms;
  --dur-crawl: 1000ms;
  --ease-smooth: cubic-bezier(.22, 1, .36, 1);
  --ease-sharp: cubic-bezier(.4, 0, .2, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --dist-sm: 8px;
  --dist-md: 16px;
  --dist-lg: 24px;
  --dist-xl: 48px;
}

/* ---------- Hero : entrée cinématique (CSS pur, aucun JS requis) ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(var(--dist-lg)); } to { opacity: 1; transform: none; } }
@keyframes word-in { from { opacity: 0; transform: translateY(.45em) rotate(2deg); } to { opacity: 1; transform: none; } }
@keyframes mockup-in { from { opacity: 0; transform: translateY(var(--dist-xl)) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes halo-pulse { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(var(--dist-md)) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes screen-scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(260%); } }
@keyframes bar-grow { from { transform: scaleX(.15); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: no-preference) {
  .anim-rise { animation: rise-in var(--dur-slow) var(--ease-smooth) both; }
  .anim-d1 { animation-delay: 80ms; }
  .anim-d2 { animation-delay: 420ms; }
  .anim-d3 { animation-delay: 520ms; }
  .anim-d4 { animation-delay: 620ms; }

  /* Mots du H1 en cascade */
  .hero-copy h1 .w { animation: word-in 520ms var(--ease-smooth) both; }
  .hero-copy h1 .w:nth-child(1) { animation-delay: 60ms; }
  .hero-copy h1 .w:nth-child(2) { animation-delay: 110ms; }
  .hero-copy h1 .w:nth-child(3) { animation-delay: 160ms; }
  .hero-copy h1 .w:nth-child(4) { animation-delay: 210ms; }
  .hero-copy h1 .w:nth-child(5) { animation-delay: 260ms; }
  .hero-copy h1 .w:nth-child(6) { animation-delay: 310ms; }
  .hero-copy h1 .w:nth-child(7) { animation-delay: 360ms; }
  .hero-copy h1 .w:nth-child(8) { animation-delay: 410ms; }

  .mockup { animation: mockup-in 900ms var(--ease-smooth) 200ms both; }
  .float-card--price { animation: pop-in var(--dur-slow) var(--ease-bounce) 750ms both; }
  .float-card--guide { animation: pop-in var(--dur-slow) var(--ease-bounce) 900ms both; }
  .float-card--pay { animation: pop-in var(--dur-slow) var(--ease-bounce) 1050ms both; }
  .float-card > .fc-float { animation: float-y 6s ease-in-out 1.6s infinite; }
  .hero .halo--1 { animation: halo-pulse 9s ease-in-out infinite; }
  .mk-scan { animation: screen-scan 5.5s linear 1.5s infinite; }
  .mk-bar { transform-box: fill-box; transform-origin: 0 50%; animation: bar-grow 1.6s var(--ease-smooth) 1.1s both; }

  /* Pages internes */
  .page-hero-inner > * { animation: rise-in var(--dur-slow) var(--ease-smooth) both; }
  .page-hero-inner > :nth-child(2) { animation-delay: 60ms; }
  .page-hero-inner > :nth-child(3) { animation-delay: 120ms; }
  .page-hero-inner > :nth-child(4) { animation-delay: 180ms; }
  .page-hero-inner > :nth-child(5) { animation-delay: 240ms; }

  /* Bouton Commander : reflet lumineux au survol */
  .btn--primary::after {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; z-index: -1;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    transform: translateX(-120%) skewX(-20deg);
  }
  .btn--primary:hover::after { animation: shine 800ms var(--ease-sharp); }

  /* ---------- Révélations au scroll (activées par animations.js uniquement
     pour les éléments encore hors écran → aucun flash, aucun masquage sans JS) ---------- */
  .reveal-pending { opacity: 0; transform: translateY(var(--dist-lg)); }
  .reveal-pending.reveal-left { transform: translateX(calc(var(--dist-xl) * -1)); }
  .reveal-pending.reveal-scale { transform: scale(.94); }
  .reveal-in { transition: opacity 700ms var(--ease-smooth), transform 700ms var(--ease-smooth); transition-delay: var(--reveal-delay, 0ms); }

  /* Titres : révélation progressive */
  .reveal-pending .accent, .reveal-pending .accent-grad { display: inline-block; transform: translateY(.3em); opacity: .2; }
  .reveal-in .accent, .reveal-in .accent-grad { display: inline-block; transition: transform 800ms var(--ease-smooth) 150ms, opacity 800ms var(--ease-smooth) 150ms; }

  /* Carte tarifaire */
  .price-card.reveal-in { transition-duration: 900ms; }
  .price-ribbon { transition: transform var(--dur-normal) var(--ease-bounce); }
  .price-card:hover .price-ribbon { transform: translateX(-50%) translateY(-3px); }

  /* Menu mobile */
  .nav-open .site-nav { animation: menu-in var(--dur-normal) var(--ease-smooth) both; }
  .nav-open .nav-list > li { animation: rise-in var(--dur-normal) var(--ease-smooth) both; }
  .nav-open .nav-list > li:nth-child(2) { animation-delay: 30ms; }
  .nav-open .nav-list > li:nth-child(3) { animation-delay: 60ms; }
  .nav-open .nav-list > li:nth-child(4) { animation-delay: 90ms; }
  .nav-open .nav-list > li:nth-child(5) { animation-delay: 120ms; }
  .nav-open .nav-list > li:nth-child(6) { animation-delay: 150ms; }
  .nav-open .nav-list > li:nth-child(7) { animation-delay: 180ms; }
  .nav-open .nav-list > li:nth-child(8) { animation-delay: 210ms; }

  /* WhatsApp flottant : apparition différée */
  .wa-float { animation: pop-in var(--dur-slow) var(--ease-bounce) 1.2s both; }

  /* Cartes paiement (checkout) */
  .pay-option { transition: transform var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast); }
  .pay-option:hover { transform: translateY(-2px); }
}

@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Barre de progression de lecture : pilotée par JS via transform: scaleX() */

/* ---------- Mouvement réduit : aucune transformation, fondus courts ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; scroll-behavior: auto !important; }
  .reveal-pending { opacity: 1 !important; transform: none !important; }
  .card:hover, .btn:hover, .device-chip:hover, .bento-card:hover .bento-art { transform: none !important; }
}

/* Hero maquette : entrée, flottement des appareils et de la carte prix, halos */
@keyframes dev-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes card-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes spark-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.92); } }
@media (prefers-reduced-motion: no-preference) {
  .hero-devices { animation: mockup-in 900ms var(--ease-smooth) 150ms both, dev-float 7s ease-in-out 1.4s infinite; }
  .price-float { animation: pop-in var(--dur-slow) var(--ease-bounce) 700ms both; }
  .price-float__card { animation: card-float 5s ease-in-out 1.6s infinite; }
  .price-sparks { transform-origin: 20% 80%; animation: pop-in var(--dur-slow) var(--ease-bounce) 950ms both, spark-pulse 2.8s ease-in-out 1.8s infinite; }
  .hb-glow--1 { animation: halo-pulse 9s ease-in-out infinite; }
  .hb-glow--2 { animation: halo-pulse 11s ease-in-out 2s infinite; }
  .hero-feats li { transition: transform var(--dur-fast) var(--ease-smooth); }
  .hero-feats li:hover { transform: translateY(-2px); }
}

/* Illustrations 3D : entrée douce puis flottement léger (transform/opacity uniquement) */
@media (prefers-reduced-motion: no-preference) {
  .page-hero-visual { animation: mockup-in 900ms var(--ease-smooth) 200ms both; }
  .page-hero-visual__img { animation: dev-float 7s ease-in-out 1.4s infinite; }
  .page-hero-visual::before { animation: halo-pulse 9s ease-in-out infinite; }
  .bento-card .bento-art { transition: transform 900ms var(--ease-smooth), filter var(--dur-normal) var(--ease-smooth); }
  .bento-card:hover .bento-art { transform: scale(1.05); filter: saturate(1.12) brightness(1.04); }
}
