/* ==========================================================================
   Bouton « Retour en haut de page »
   Fonctionne en CSS pur (lien ancre + défilement fluide) : sans JavaScript,
   le bouton reste simplement toujours visible et fonctionnel. Un petit
   script optionnel (back-to-top.js) ajoute juste l'apparition/disparition
   au scroll ; s'il ne charge pas, rien ne casse.
   ========================================================================== */

html {
  scroll-behavior: smooth;
}

#back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #14b7e6 !important;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 4px 16px rgba(20, 24, 28, 0.28);
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background-color 0.2s ease;
}

#back-to-top:hover,
#back-to-top:focus-visible {
  background: #3ec6fc !important;
  color: #fff !important;
}

#back-to-top svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Avec JS (classe posée par back-to-top.js) : caché par défaut, puis
   révélé après quelques centaines de pixels de scroll. */
#back-to-top.bt-js {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
}

#back-to-top.bt-js.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media (max-width: 640px) {
  #back-to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #back-to-top {
    transition: opacity 0.01s linear, visibility 0.01s linear;
  }
}
