/**
 * Scroll anchors (Наверх / К подвалу): keep ALWAYS in the viewport —
 * fixed on the RIGHT, vertically CENTERED (mid-right).
 *
 * Culprit: bottom-anchored stack + cookie / mobile-nav bottom offsets
 * can push buttons out of the visible zone or into awkward corners.
 * Also: when layout viewport > visual (admin bar / overflow / emulator),
 * plain right:Npx parks the control past the visible edge — use dvw gap.
 *
 * Overrides custom.css bottom/right rules for .footer__scroll-anchors
 * without editing custom.css / custom.min.css / footer.php.
 * Marker: scrollmid20260814a
 */

.footer__scroll-anchors {
  position: fixed !important;
  top: 50% !important;
  bottom: auto !important;
  /* Base inset; when 100vw > 100dvw, push further left so the full button stays visible */
  right: max(
    8px,
    env(safe-area-inset-right, 0px),
    calc(100vw - 100dvw + 8px)
  ) !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 650 !important;
  display: flex !important;
  flex-direction: column-reverse !important;
  align-items: center !important;
  gap: 12px !important;
  pointer-events: none !important;
  transition: none !important;
  max-width: min(56px, calc(100dvw - 16px)) !important;
  box-sizing: border-box !important;
}

.footer__scroll-anchors .footer__up_btn,
.footer__scroll-anchors .footer__down_btn,
.footer__scroll-anchors .footer__up,
.footer__scroll-anchors .footer__down {
  pointer-events: auto !important;
}

/* Neutralize bottom-lift variants (cookie / mnav / combo) — stay mid-right */
body.cotinder-mnav-mobile .footer__scroll-anchors,
body.cotinder-cookie-banner-open .footer__scroll-anchors,
body.cotinder-mnav-mobile.cotinder-cookie-banner-open .footer__scroll-anchors,
html.cotinder-in-pwa .footer__scroll-anchors {
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  right: max(
    8px,
    env(safe-area-inset-right, 0px),
    calc(100vw - 100dvw + 8px)
  ) !important;
}

/* Same clamp on every tablet/phone width (no “one breakpoint only”) */
@media (max-width: 1199.98px) {
  .footer__scroll-anchors,
  body.cotinder-mnav-mobile .footer__scroll-anchors,
  body.cotinder-cookie-banner-open .footer__scroll-anchors,
  body.cotinder-mnav-mobile.cotinder-cookie-banner-open .footer__scroll-anchors,
  html.cotinder-in-pwa .footer__scroll-anchors {
    right: max(
      8px,
      env(safe-area-inset-right, 0px),
      calc(100vw - 100dvw + 8px)
    ) !important;
    left: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
  }
}

@media (max-width: 900px) {
  .footer__scroll-anchors {
    gap: 10px !important;
  }
}

@media (max-width: 575.98px) {
  .footer__scroll-anchors {
    gap: 8px !important;
  }

  .footer__scroll-anchors .footer__up_btn,
  .footer__scroll-anchors .footer__down_btn {
    width: 44px !important;
    height: 44px !important;
  }

  .footer__scroll-anchors .footer__up_btn svg,
  .footer__scroll-anchors .footer__down_btn svg {
    width: 44px !important;
    height: 44px !important;
  }
}
