/* ═══════════════════════════════════════════════════════════════════
   Floating "back to top" button - shared across pages that include
   templates/core/_back_to_top.html. Plain href="#" scroll (works with
   zero JS); static/js/back-to-top.js only toggles visibility by scroll
   position. Respects `prefers-reduced-motion: reduce`.
   ═══════════════════════════════════════════════════════════════════ */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 35;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 10px 24px -8px rgba(242, 106, 16, 0.55);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.back-to-top svg { width: 22px; height: 22px; }
.back-to-top:hover { background: var(--primary-hover); transform: translateY(-3px); }
.back-to-top:active { transform: translateY(0); }
.back-to-top:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.back-to-top[data-hidden] {
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  pointer-events: none;
}
/* No-JS fallback: nothing toggles [data-hidden] off, so stay visible and
   let the plain href="#" jump (+ scroll-behavior: smooth below) work. */
.no-js .back-to-top { opacity: 1; transform: none; pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: opacity 0.15s linear; }
  .back-to-top[data-hidden] { transform: none; }
}

@media (max-width: 560px) {
  .back-to-top {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
  }
}

/* Clear the league public shell's fixed bottom tab bar (static/css/base.css
   .hl-league-nav, only fixed below the 900px sidebar breakpoint) so the
   button doesn't sit on top of it. Higher specificity than the 560px rule
   above, so it wins there too. */
@media (max-width: 899px) {
  body:has(.hl-league-shell) .back-to-top {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* ─── Smooth in-page scrolling for the href="#" jump ─────────────── */
@media (prefers-reduced-motion: no-preference) {
  html:has(.back-to-top) { scroll-behavior: smooth; }
}
