/*
 * AEC-4158: site-wide floating "back to top" control. Fixed position so
 * it stays reachable throughout a scrolled page, not just at the footer
 * (that narrower footer-only version is Hero E's own, kept separate and
 * unchanged -- this file and its button are never loaded on a hero
 * preview page). Icon is 27x27 here vs Hero E's 18x18 (1.5x).
 */
#site-back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  border: 1px solid var(--color-ink-200);
  background-color: var(--color-paper-raised);
  color: var(--color-ink-700);
  box-shadow: 0 2px 10px rgba(8, 11, 20, 0.14);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, border-color 150ms ease, color 150ms ease;
}

#site-back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#site-back-to-top:hover {
  border-color: var(--color-ink-400);
  color: var(--color-ink-950);
}

#site-back-to-top:focus-visible {
  outline: 2px solid var(--color-accent-600);
  outline-offset: 2px;
}

/* Mobile-safe placement: smaller target clear of the thumb-reach edge,
 * and clear of the mobile nav toggle in the header (fixed control, not
 * near it, but kept modest at narrow widths regardless). */
@media (max-width: 640px) {
  #site-back-to-top {
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    width: 3rem;
    height: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #site-back-to-top {
    transition: opacity 1ms, color 1ms, border-color 1ms;
  }
}
