/* Return-to-top control. Do not edit site.css, members.css, or app.css for this. */

.rl-to-top {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 43, 61, 0.55);
  background: rgba(8, 10, 16, 0.94);
  color: #f4f7fb;
  box-shadow: 0 0 18px rgba(255, 43, 61, 0.22);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.rl-to-top.has-lift {
  /* Lift already includes tab-bar / dashboard-fab height (and their safe-area). */
  bottom: calc(12px + var(--rl-to-top-lift, 0px));
}

.rl-to-top.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.rl-to-top:hover,
.rl-to-top:focus-visible {
  color: #fff;
  border-color: #ff2b3d;
  outline: 2px solid #ff2b3d;
  outline-offset: 2px;
}

.rl-to-top svg {
  display: block;
}

/* Leave a right-hand slot so the save toast does not cover this button. */
html.has-back-to-top .rl-toast-host {
  left: 12px;
  transform: none;
  width: min(calc(100% - 24px - 56px), 420px);
}

body.theme-spiritual .rl-to-top,
body:has(.sp-page) .rl-to-top,
body.tn-blue .rl-to-top,
body.m-body .rl-to-top {
  background: #111;
  color: #F3F1EF;
  border-color: color-mix(in srgb, #B83A36 50%, #111111);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
}

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