/*
 * GAINVO Storefront v0.10.50 — Scrolling Phase 6
 * Navigation restoration, keyboard-safe anchors and overlay edge hardening.
 */

/* Keep programmatic focus/anchor movement clear of the installed header and
   floating bottom navigation. This does not create a second scroll owner. */
html{
  scroll-padding-top:calc(var(--installed-header-height,0px) + 12px);
  scroll-padding-bottom:calc(var(--gv-bottom-nav-height,70px) + env(safe-area-inset-bottom,0px) + 16px);
}

/* Common destinations used by search, shop and account actions should never
   land underneath fixed/sticky chrome. */
:where(
  #merchantCatalogueStart,.account-saved-shops,.page-title-row,.search-workspace,
  .order-history-card,.checkout-section,.pdp-choice-section,[data-scroll-anchor]
){
  scroll-margin-top:calc(var(--installed-header-height,0px) + 14px);
  scroll-margin-bottom:calc(var(--gv-bottom-nav-height,70px) + env(safe-area-inset-bottom,0px) + 14px);
}

/* Form controls need extra breathing room when the software keyboard asks the
   browser to reveal the focused element. */
:where(
  #checkoutBody input,#checkoutBody textarea,#checkoutBody select,
  .customer-account-sheet input,.customer-account-sheet textarea,.customer-account-sheet select,
  .account-editor-sheet input,.account-editor-sheet textarea,.account-editor-sheet select,
  .location-dialog-card input
){
  scroll-margin-block:18px 42px;
}

/* Deliberate internal scroll surfaces get safe reveal padding but no visible
   scrollbar chrome. */
:where(.gainvo-vscroll,#cartItems,#checkoutBody,#productModalBody,.customer-account-sheet,.account-editor-sheet,.order-receipt-sheet,.ad-details-body,.location-dialog-card,.ios-install-sheet){
  scroll-padding-block:12px calc(24px + env(safe-area-inset-bottom,0px));
  overflow-anchor:auto;
}

:where(.gainvo-hscroll){
  scroll-padding-inline:10px;
  overflow-anchor:none;
}

/* The backdrop must never become an accidental background scroll gesture. */
.overlay:not([hidden]){
  touch-action:none!important;
  overscroll-behavior:none!important;
}

/* Avoid iOS text selection/drag side effects on decorative sheet handles. */
.sheet-handle{
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}

/* Desktop browser chrome is not fixed like the mobile installed header, so a
   smaller anchor clearance feels natural there. */
@media (min-width:900px){
  html{scroll-padding-top:20px;scroll-padding-bottom:24px}
  :where(#merchantCatalogueStart,.account-saved-shops,.page-title-row,.search-workspace,.order-history-card,[data-scroll-anchor]){
    scroll-margin-top:20px;
    scroll-margin-bottom:24px;
  }
}
