/* Supplemental gallery behavior.
   Desktop standard keeps the thumbnail overlay from catalog-card-fixes.css.
   Desktop compact/list stays primary-only.
   Mobile has no compact mode; its standard view becomes a full-width swipe carousel. */

body.catalog-view-compact .catalog-product-thumbnails {
  display: none !important;
}

body.catalog-view-compact .catalog-product-main-image {
  display: block !important;
}

.catalog-mobile-gallery-counter {
  display: none;
}

@media (max-width: 768px) {
  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery {
    overflow: hidden !important;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery > .catalog-product-main-image {
    display: none !important;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery > .catalog-product-thumbnails {
    position: relative !important;
    inset: auto !important;
    z-index: auto !important;
    display: flex !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery > .catalog-product-thumbnails::-webkit-scrollbar {
    display: none;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb,
  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb:hover,
  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb.is-active {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: none !important;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb img,
  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb:hover img,
  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery .catalog-product-thumb.is-active img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain !important;
    opacity: 1 !important;
    border-radius: 4px !important;
  }

  body:not(.catalog-view-compact) .catalog-product-media.is-mobile-swipe-gallery > .catalog-mobile-gallery-counter {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 24px;
    padding: 3px 7px;
    box-sizing: border-box;
    border-radius: 999px;
    background: rgba(0, 42, 65, 0.76);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    pointer-events: none;
  }
}
