/* ==========================================================================
   Nettoyage Auto 02 — couche d'animations légères (v2)
   Ajouts purement décoratifs : aucune modification de mise en page.
   Uniquement transform / opacity animés (sauf lueurs ponctuelles).
   Tout est désactivé avec prefers-reduced-motion.
   ========================================================================== */

/* ---------- 1. Révélation au défilement (éléments internes) ----------
   La classe .na-rv n'est ajoutée que par animations.js : sans JS, rien n'est masqué. */
html.na-js .na-rv {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.7s var(--ease-out);
  transition-delay: calc(var(--rv-i, 0) * 70ms);
}

html.na-js .na-rv.na-in {
  opacity: 1;
  transform: none;
}

/* Avis clients (chargés dynamiquement) : apparition en cascade */
.reveal.visible .reviews-list > li {
  animation: fxFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.reveal.visible .reviews-list > li:nth-child(2) { animation-delay: 0.08s; }
.reveal.visible .reviews-list > li:nth-child(3) { animation-delay: 0.16s; }
.reveal.visible .reviews-list > li:nth-child(4) { animation-delay: 0.24s; }
.reveal.visible .reviews-list > li:nth-child(n+5) { animation-delay: 0.3s; }

/* ---------- 2. Hero : halo lumineux qui dérive doucement ---------- */
.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 45%;
  width: min(120vmax, 1400px);
  height: min(120vmax, 1400px);
  margin: calc(min(120vmax, 1400px) / -2) 0 0 calc(min(120vmax, 1400px) / -2);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(26, 161, 26, 0.16) 0%, rgba(26, 161, 26, 0.05) 32%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  animation:
    naHeroGlowIn 1.6s var(--ease-out) 0.2s forwards,
    naHeroGlowDrift 16s ease-in-out 1.8s infinite alternate;
}

.hero { overflow: hidden; }

@keyframes naHeroGlowIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes naHeroGlowDrift {
  0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  50% { opacity: 0.75; transform: translate3d(-8%, 4%, 0) scale(1.08); }
  100% { opacity: 1; transform: translate3d(7%, -3%, 0) scale(0.96); }
}

/* « 02 » : éclat de lumière à la fin de l'entrée (2 fois puis s'arrête) */
.hero .logo-text .green {
  display: inline-block;
  animation: naGreenFlash 1.4s ease-in-out 1.1s 2;
}

@keyframes naGreenFlash {
  0%, 100% { text-shadow: 0 0 20px rgba(0, 0, 0, 0.9), 0 0 24px rgba(26, 161, 26, 0.35); }
  50% { text-shadow: 0 0 20px rgba(0, 0, 0, 0.9), 0 0 34px rgba(26, 161, 26, 0.85), 0 0 60px rgba(26, 161, 26, 0.35); }
}

/* ---------- 3. Boutons : reflet qui balaie + retour à l'appui ---------- */
.btn-devis,
.contact-submit,
.reviews-submit {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-devis::after,
.contact-submit::after,
.reviews-submit::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  z-index: -1;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.16) 50%, transparent 100%);
  transform: translate3d(-130%, 0, 0) skewX(-18deg);
  pointer-events: none;
}

.btn-devis:hover::after,
.btn-devis:focus-visible::after,
.contact-submit:hover::after,
.contact-submit:focus-visible::after,
.reviews-submit:hover::after,
.reviews-submit:focus-visible::after {
  animation: naBtnShine 0.85s var(--ease-out) forwards;
}

/* Un reflet automatique sur le bouton « Appeler » du hero, après son entrée */
.hero .btn-devis::after {
  animation: naBtnShine 1.1s var(--ease-out) 1.7s 1;
}

@keyframes naBtnShine {
  from { transform: translate3d(-130%, 0, 0) skewX(-18deg); }
  to { transform: translate3d(260%, 0, 0) skewX(-18deg); }
}

.contact-submit,
.reviews-submit {
  transition:
    background var(--dur-sm) var(--ease-out),
    color var(--dur-sm) var(--ease-out),
    box-shadow var(--dur-sm) var(--ease-out),
    transform var(--dur-sm) var(--ease-spring);
}

.contact-submit:hover:not(:disabled),
.contact-submit:focus-visible:not(:disabled),
.reviews-submit:hover,
.reviews-submit:focus-visible {
  box-shadow: 0 0 18px rgba(26, 161, 26, 0.3);
}

.contact-submit:active:not(:disabled),
.reviews-submit:active,
.nav-auth:active,
.lightbox-close:active {
  transform: scale(0.97);
}

.gallery-btn:active {
  transform: translateY(-50%) scale(0.94);
}

/* ---------- Liens de navigation : soulignement animé ---------- */
.nav-tabs a {
  position: relative;
}

.nav-tabs a::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(26, 161, 26, 0.6);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.32s var(--ease-out);
  pointer-events: none;
}

.nav-tabs a:hover::after,
.nav-tabs a:focus-visible::after {
  transform: scaleX(1);
}

/* L'onglet actif garde son soulignement existant */
.nav-tabs a.is-active::after { transform: scaleX(0); }

/* ---------- Cartes formules : halo qui suit la souris + focus clavier ---------- */
.card > :not(.na-spot):not(.card-badge):not(.card-pack-link) {
  position: relative;
  z-index: 2;
}

.card .card-badge { z-index: 3; }

.na-spot {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(26, 161, 26, 0.16), transparent 70%);
}

.card--pack-gold .na-spot {
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 215, 100, 0.14), transparent 70%);
}

@media (hover: hover) {
  .card:hover .na-spot { opacity: 1; }
}

.card:focus-within {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 28px rgba(26, 161, 26, 0.35);
}

.card--pack-gold:focus-within { border-color: #ffe066; }

@media (min-width: 900px) {
  .card.featured:focus-within { transform: scale(1.02) translateY(-8px); }
}

/* ---------- Galerie : zoom plus doux sur les photos ---------- */
.compare-thumb img,
.contact-map-thumb img {
  transition: transform 0.6s var(--ease-out), filter 0.6s var(--ease-out);
}

.compare-thumb:hover img,
.compare-thumb:focus-visible img {
  transform: scale(1.07);
  filter: brightness(1.06) saturate(1.05);
}

.contact-map-thumb { overflow: hidden; }
.contact-map-thumb:hover img,
.contact-map-thumb:focus-visible img {
  transform: scale(1.04);
}

/* Libellés AVANT / APRÈS : légère pulsation quand la galerie apparaît */
.reveal.visible .compare-label {
  animation: fxFadeUp 0.5s var(--ease-out) 0.25s backwards;
}

/* ---------- Lightbox : fondu d'ouverture ---------- */
.lightbox.is-open {
  animation: naFadeIn 0.28s ease-out;
}

@keyframes naFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 4. En-tête : se resserre au défilement + barre de progression ---------- */
.site-nav.nav-is-scrolled {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  background: rgba(20, 21, 20, 0.96);
}

.na-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, rgba(26, 161, 26, 0.4), var(--accent), #7dff7d);
  box-shadow: 0 0 8px rgba(26, 161, 26, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
  will-change: transform;
}

/* ---------- 5. Prix : léger rebond quand la carte apparaît ---------- */
.card-price.na-counted {
  animation: naPricePop 0.45s var(--ease-spring);
}

@keyframes naPricePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ---------- Mouvement réduit : on coupe tout ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  html.na-js .na-rv,
  html.na-js .na-rv.na-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero::before {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .hero .logo-text .green,
  .reveal.visible .reviews-list > li,
  .reveal.visible .compare-label,
  .lightbox.is-open,
  .card-price.na-counted,
  .btn-devis::after,
  .hero .btn-devis::after,
  .contact-submit::after,
  .reviews-submit::after {
    animation: none !important;
  }

  .btn-devis::after,
  .contact-submit::after,
  .reviews-submit::after { display: none; }

  .na-spot { display: none; }
  .na-progress { display: none; }

  .nav-tabs a::after { transition: none; }

  .compare-thumb img,
  .contact-map-thumb img { transition: none; }
  .compare-thumb:hover img,
  .compare-thumb:focus-visible img,
  .contact-map-thumb:hover img,
  .contact-map-thumb:focus-visible img { transform: none; }

  .card:focus-within,
  .card.featured:focus-within { transform: none; }
}
