/* AB House Portal — floating back-to-top control (portal + public landing) */

.ab-back-to-top {
  position: fixed;
  right: 1.35rem;
  bottom: 1.35rem;
  z-index: 860;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(249, 115, 22, 0.22), rgba(22, 25, 33, 0.92));
  color: var(--c-heading, #f0f4ff);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.65rem) scale(0.94);
  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

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

.ab-back-to-top:hover,
.ab-back-to-top:focus-visible {
  border-color: rgba(249, 115, 22, 0.85);
  background:
    linear-gradient(145deg, rgba(249, 115, 22, 0.34), rgba(22, 25, 33, 0.96));
  box-shadow:
    0 14px 34px rgba(249, 115, 22, 0.22),
    0 10px 28px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  outline: none;
}

.ab-back-to-top__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.95rem;
  line-height: 1;
}

body.ab-portal-modal-open .ab-back-to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body:has(.user-area-wrapper) .ab-back-to-top {
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
}

body:has(.ab-portal-footer--admin) .ab-back-to-top {
  bottom: calc(3.15rem + env(safe-area-inset-bottom, 0px));
}

body:has(.ab-portal-cookie-consent.is-visible) .ab-back-to-top {
  bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
}

body:has(.ab-portal-cookie-consent.is-visible):has(.ab-portal-footer--admin) .ab-back-to-top {
  bottom: calc(7.35rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 991px) {
  .ab-back-to-top {
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    width: 2.55rem;
    height: 2.55rem;
  }

  body:has(.ab-portal-footer--admin) .ab-back-to-top {
    bottom: calc(2.85rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ab-back-to-top {
    transition: opacity 120ms ease, visibility 120ms ease;
    transform: none;
  }

  .ab-back-to-top.is-visible {
    transform: none;
  }
}
