/*
 * Back to top - Fixed control that appears after scrolling
 */

.back-to-top {
  --back-to-top-banner-offset: 0px;
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px) + var(--back-to-top-banner-offset));
  z-index: 900;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--brand-red);
  color: var(--white);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

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

.back-to-top--with-chat {
  right: auto;
  left: max(1.25rem, env(safe-area-inset-left, 0px));
}

.back-to-top:hover {
  background: var(--brand-red-dark);
}

.back-to-top:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--brand-red), var(--shadow-soft);
}

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

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }
}
