/*
 * GAINVO Storefront v0.10.49 — Cross-device scrolling foundation
 * Phase 1–5: root scroll ownership, horizontal rails, sheet scrolling,
 * gesture arbitration, hidden indicators and desktop input parity.
 */

:root{
  --gv-scroll-viewport-h:100svh;
  --gv-scrollbar-size:0px;
}

/* Phase 1 — One vertical document scroller.
   Keep the root native. Do not make .app-shell/.main/.screen competing vertical
   scroll containers; this avoids iOS scroll chaining, rubber-band traps and
   Android nested-scroll stalls. */
html{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  overflow-x:clip;
  overflow-y:auto;
  scroll-behavior:auto;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
body{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  overflow-x:clip;
  overflow-y:visible;
  scroll-behavior:auto;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar{width:0!important;height:0!important;display:none!important}

.app-shell,
.main,
.screen{
  min-width:0;
  max-width:100%;
  height:auto!important;
  max-height:none!important;
  overflow-y:visible!important;
}
.app-shell,.main{overflow-x:clip!important}
.screen{overflow-x:visible}
.screen.active{min-height:1px}

/* Prevent accidental page-level sideways drift while preserving deliberate rails. */
img,video,svg,canvas{max-width:100%}

/* The floating bottom navigation must never become a scroll target. */
.bottom-nav{overscroll-behavior:none;touch-action:manipulation}

/* Phase 2 — Horizontal rails.
   A vertical gesture that begins over a rail must still be able to scroll the
   document; therefore pan-x AND pan-y are allowed. Snap is proximity rather
   than mandatory so short/diagonal swipes never feel trapped. */
:where(
  .category-strip,.shop-rail,.filter-row,.category-row,.home-category-row,
  .home-category-rail,.home-category-rail-approved,.shop-discovery-rail,
  .shops-discovery-rail,.search-tabs,.search-chip-row,.search-active-chips,
  .merchant-status-row,.merchant-fulfilment-row,.merchant-commerce-summary,
  .merchant-trust-strip,.shop-filter-row,.merchant-category-tags-v8,
  .pdp-thumbnails,.pdp-related-grid,.order-summary-strip,.order-timeline,
  .ad-details-media,.gainvo-hscroll
){
  overflow-x:auto!important;
  overflow-y:hidden!important;
  max-width:100%;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  overscroll-behavior-block:auto;
  scroll-snap-type:x proximity!important;
  scroll-behavior:auto;
  touch-action:pan-x pan-y pinch-zoom;
  scrollbar-width:none!important;
  scrollbar-gutter:auto!important;
  -ms-overflow-style:none!important;
  -webkit-tap-highlight-color:transparent;
}
:where(
  .category-strip,.shop-rail,.filter-row,.category-row,.home-category-row,
  .home-category-rail,.home-category-rail-approved,.shop-discovery-rail,
  .shops-discovery-rail,.search-tabs,.search-chip-row,.search-active-chips,
  .merchant-status-row,.merchant-fulfilment-row,.merchant-commerce-summary,
  .merchant-trust-strip,.shop-filter-row,.merchant-category-tags-v8,
  .pdp-thumbnails,.pdp-related-grid,.order-summary-strip,.order-timeline,
  .ad-details-media,.gainvo-hscroll
)::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}

/* Phase 3 — Intentional internal vertical scroll owners only.
   Sheets own their content scroll while open; the underlying page stays fixed by
   the existing overlay lifecycle. Momentum scrolling remains enabled on iOS. */
:where(
  #cartItems,#checkoutBody,#productModalBody,.customer-account-sheet,
  .account-editor-sheet,.order-receipt-sheet,.ad-details-body,
  .location-dialog-card,.ios-install-sheet,.gainvo-vscroll
){
  overflow-y:auto!important;
  overflow-x:hidden!important;
  min-height:0;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  overscroll-behavior-x:none;
  touch-action:pan-y pinch-zoom;
  scroll-behavior:auto!important;
  scrollbar-width:none!important;
  scrollbar-gutter:auto!important;
  -ms-overflow-style:none!important;
}
:where(
  #cartItems,#checkoutBody,#productModalBody,.customer-account-sheet,
  .account-editor-sheet,.order-receipt-sheet,.ad-details-body,
  .location-dialog-card,.ios-install-sheet,.gainvo-vscroll
)::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}

/* Keep fixed/full-screen commerce surfaces inside a stable viewport. 100svh is
   used as the CSS fallback; JS replaces it with a stable visible-height value
   without writing layout variables on every Safari toolbar scroll event. */
@media (max-width:759px){
  .product-modal{
    max-height:calc(var(--gv-scroll-viewport-h,100svh) - var(--installed-header-height,0px))!important;
  }
  body:has(.product-modal.open) .product-modal{
    height:calc(var(--gv-scroll-viewport-h,100svh) - var(--installed-header-height,var(--gainvo-mobile-header-h,0px)))!important;
    max-height:calc(var(--gv-scroll-viewport-h,100svh) - var(--installed-header-height,var(--gainvo-mobile-header-h,0px)))!important;
  }
  .cart-sheet,.checkout-sheet,.customer-account-sheet,.account-editor-sheet,
  .order-receipt-sheet,.ios-install-sheet,.location-dialog-card{
    max-height:calc(var(--gv-scroll-viewport-h,100svh) - max(8px,env(safe-area-inset-top)))!important;
  }
}

/* Phase 4 — pull-to-refresh moves the content only while actually pulling.
   Normal up/down scrolling never receives a transform or transition. */
body:not(.gainvo-pulling):not(.gainvo-resetting){--gainvo-pull:0px!important}
body.gainvo-pulling .app-shell{will-change:transform}
body:not(.gainvo-pulling) .app-shell{will-change:auto}

/* Phase 5 — no permanent scrollbar chrome on Android, iOS or desktop.
   Scrolling remains fully functional through touch, wheel, trackpad, keyboard
   and existing rail buttons. */
.gainvo-scrollbarless{scrollbar-width:none!important;-ms-overflow-style:none!important}
.gainvo-scrollbarless::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}

/* Preserve the map's intentional direct-manipulation gesture model. */
.gainvo-pilot-map,.gpm-viewport{touch-action:none!important}

/* Keyboard focus must remain visible even though scrollbar chrome is hidden. */
.gainvo-hscroll:focus-visible,
.gainvo-vscroll:focus-visible{outline:2px solid rgba(8,139,120,.32);outline-offset:2px}

@media (pointer:fine){
  :where(.gainvo-hscroll){cursor:default}
}

@media (prefers-reduced-motion:reduce){
  html,body,.gainvo-hscroll,.gainvo-vscroll{scroll-behavior:auto!important}
}
