/*
  Mobile-only scroll stability patch.
  Goal: keep the browser viewport as the one vertical scroller across Home,
  Set View, My Collection, Price Guide, For You, and other generated views.
  This prevents mobile WebKit/Chrome from pausing near the top/bottom until
  the user reverses direction, which can happen when nested sections use
  contain/content-visibility, overscroll containment, transforms, or clipped
  wrappers during fast image-heavy scrolling.
*/
@media (max-width: 780px){
  html{
    height:auto !important;
    min-height:100% !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-y:auto !important;
    scroll-behavior:auto !important;
    -webkit-text-size-adjust:100%;
  }

  body:not(.ccc-body-scroll-locked){
    height:auto !important;
    min-height:100vh !important;
    min-height:100svh !important;
    min-height:100dvh !important;
    max-width:100% !important;
    overflow-x:hidden !important;
    overflow-y:visible !important;
    overscroll-behavior-y:auto !important;
    touch-action:pan-y !important;
    position:relative !important;
  }

  /* Keep page-level wrappers from becoming accidental vertical scroll traps. */
  body:not(.ccc-body-scroll-locked) .container,
  body:not(.ccc-body-scroll-locked) #result,
  body:not(.ccc-body-scroll-locked) .result,
  body:not(.ccc-body-scroll-locked) .for-you-wrap,
  body:not(.ccc-body-scroll-locked) .for-you-grid-wrap,
  body:not(.ccc-body-scroll-locked) .comic-cuts-list,
  body:not(.ccc-body-scroll-locked) .mini-results,
  body:not(.ccc-body-scroll-locked) .mc-price-guide,
  body:not(.ccc-body-scroll-locked) .mc-price-list{
    height:auto !important;
    max-height:none !important;
    overflow-y:visible !important;
    overscroll-behavior-y:auto !important;
    content-visibility:visible !important;
    contain:none !important;
    transform:none !important;
    will-change:auto !important;
  }

  /* Keep horizontal scrollers horizontal, but allow vertical page scroll chaining. */
  body:not(.ccc-body-scroll-locked) .mc-tabs,
  body:not(.ccc-body-scroll-locked) .mc-price-chart-wrap,
  body:not(.ccc-body-scroll-locked) .mc-value-signal-applied-tags,
  body:not(.ccc-body-scroll-locked) .mc-gallery-viewport,
  body:not(.ccc-body-scroll-locked) .mc-filters-row{
    overscroll-behavior-y:auto !important;
    touch-action:pan-x pan-y !important;
    -webkit-overflow-scrolling:touch !important;
  }

  /* Modal/flyout/dropdown internals should still scroll inside themselves. */
  .flyout .content,
  .modal .modal-body,
  .protip-popup-body,
  .ac,
  .modal-dd-list,
  .uniform-dd-list,
  .mc-sort-menu,
  .mc-filters-panel,
  .mc-price-picker-panel{
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior:contain !important;
  }

  /* A little end-of-document breathing room avoids the last gesture dying at the edge. */
  #ccc-mobile-scroll-sentinel{
    display:block !important;
    height:calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    pointer-events:none !important;
  }
}
