/* Bouton flottant « retour en haut » (suite MyPing) */
.back-to-top {
  position: fixed;
  z-index: 90;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--back-to-top-bg, var(--brand, #1fe06a));
  color: var(--back-to-top-fg, var(--on-brand, #04210f));
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.92);
  transition:
    opacity 0.25s var(--ease, ease),
    transform 0.25s var(--ease, ease),
    visibility 0.25s,
    background-color 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.back-to-top:hover {
  background: var(--back-to-top-bg-hover, var(--brand-bright, var(--brand, #5dff9b)));
}

.back-to-top:focus-visible {
  outline: 2px solid var(--back-to-top-bg-hover, var(--brand-bright, #5dff9b));
  outline-offset: 3px;
}

.back-to-top:active {
  transform: scale(0.96);
}

.back-to-top svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

/* Remonter au-dessus des bandeaux bas d'écran */
body:has(.cookie-banner.is-visible) .back-to-top,
html.privacy-banner-open .back-to-top,
body.has-sticky-mobile-cta .back-to-top,
body.has-cookie-notice .back-to-top {
  bottom: max(5.75rem, calc(env(safe-area-inset-bottom, 0px) + 5rem));
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.15s ease, visibility 0.15s;
    transform: none;
  }

  .back-to-top:active {
    transform: none;
  }
}
