/* Scroll to Top — global floating button, scoped to .scroll-to-top. */

/* Accent follows the footer: brand purple by default, green on green-accent pages
   (<body data-page-accent> resolved in _Layout). */
body[data-page-accent="green"] {
  --scroll-to-top-accent: var(--eve-color-green, #2cd2c5);
}

.scroll-to-top {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--scroll-to-top-accent, var(--eve-color-purple, #7855d7));
  color: var(--eve-color-white, #ffffff);
  box-shadow: 0 4px 16px rgba(72, 79, 81, 0.2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s, background-color 0.2s ease;
}

.scroll-to-top[hidden] {
  display: none;
}

.scroll-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s, background-color 0.2s ease;
}

.scroll-to-top:hover {
  background-color: var(--eve-color-text, #484f51);
}

.scroll-to-top:focus {
  outline: none;
}

.scroll-to-top:focus-visible {
  outline: 2px solid var(--scroll-to-top-accent, var(--eve-color-purple, #7855d7));
  outline-offset: 3px;
}

/* Programmatic focus target after scrolling to top — no visible ring on <main>. */
main[tabindex="-1"]:focus {
  outline: none;
}

.scroll-to-top__icon {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Keep out of the way while the mobile off-canvas menu is open. */
body.is-header-offcanvas-open .scroll-to-top {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 639px) {
  .scroll-to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-to-top,
  .scroll-to-top.is-visible {
    transform: none;
    transition: none;
  }
}
