/* ============================================================
   23-backtotop — fixed bottom-right "Back to top" button, every page
   (markup lives at the end of sections/14-footer.html). Appears after
   the visitor scrolls past the first screen (js/sections/23-backtotop.js
   sets .is-visible). Sits above the sticky mobile bar on phones and
   below the nav overlay. Scoped under .sec-23-totop.
   ============================================================ */

.sec-23-totop {
  position: fixed;
  right: clamp(1rem, 2.5vw, 1.75rem);
  bottom: clamp(1rem, 2.5vw, 1.75rem);
  z-index: 185;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  border: 1px solid hsl(0 0% 100% / 0.18);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out),
    visibility 300ms, background-color 200ms var(--ease-out);
}

.sec-23-totop.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sec-23-totop:hover,
.sec-23-totop:focus-visible {
  background: var(--accent-strong);
}

.sec-23-totop:focus-visible {
  outline: 3px solid var(--accent-on);
  outline-offset: 2px;
}

/* No JS: nothing toggles .is-visible, so keep the plain #main anchor
   reachable instead of permanently hidden. */
html:not(.js) .sec-23-totop {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* Phones: clear the sticky Call | Book bar (56px + safe area, <=820px) */
@media (max-width: 820px) {
  .sec-23-totop {
    right: 1rem;
    bottom: calc(56px + env(safe-area-inset-bottom) + 0.9rem);
    width: 44px;
    height: 44px;
  }
}

/* Out of the way while the full-screen mobile menu is open */
body.sec-01-nav-lock .sec-23-totop {
  opacity: 0;
  visibility: hidden;
}

html.reduced-motion .sec-23-totop { transition: none; }
