/* Segmented thumbnail count/selection indicator, only on mobile product pages. */
.product-page-body .product-gallery__progress { display:none; }
@media (max-width:700px) {
  .product-page-body .product-gallery__progress:not([hidden]) {
    display:flex;
    direction:rtl;
    grid-column:1!important;
    grid-row:2!important;
    width:calc(100% - 1.44rem);
    max-width:calc(100% - 1.44rem);
    margin-inline:.72rem;
    gap:5px;
    align-items:center;
    box-sizing:border-box;
  }
  .product-page-body .product-gallery__progress-segment {
    flex:1 1 0;
    min-width:0;
    height:22px;
    padding:8px 0;
    margin:0;
    display:flex;
    align-items:center;
    background:transparent;
    border:0;
    border-radius:0;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  .product-page-body .product-gallery__progress-segment::before {
    content:"";
    display:block;
    width:100%;
    height:4px;
    border-radius:99px;
    background:#b9bdc3;
    transition:background-color .2s;
  }
  .product-page-body .product-gallery__progress-segment.is-active::before {
    background:#d6a529;
  }
  .product-page-body .product-gallery__progress-segment:focus-visible {
    outline:2px solid #1c64ad;
    outline-offset:-2px;
    border-radius:6px;
  }
  .product-page-body .product-gallery__progress:not([hidden]) ~ .product-gallery__thumbs {
    grid-row:3!important;
  }
  .product-page-body .product-gallery__progress:not([hidden]) ~ .product-gallery__selection-summary {
    grid-row:4!important;
  }
}


/* SHORT MOBILE GALLERIES: share the available thumbnail rail width evenly.
   The old fixed max-width (112px) left a large empty area on some phones.
   Only 1–3 visible media items enter this mode; 4+ keep their scrollable row. */
@media (max-width:700px) {
  .product-page-body .product-gallery__thumbs.is-short-gallery:not([hidden]) {
    display:grid!important;
    direction:rtl;
    grid-template-columns:repeat(var(--gallery-short-count, 3), minmax(0, 1fr))!important;
    grid-auto-flow:row!important;
    justify-content:stretch!important;
    justify-items:stretch!important;
    align-items:stretch!important;
    gap:8px!important;
    overflow-x:hidden!important;
    scroll-snap-type:none!important;
    box-sizing:border-box!important;
  }
  .product-page-body .product-gallery__thumbs.is-short-gallery:not([hidden]) > .product-thumb {
    --mobile-product-thumb-size:auto;
    display:block;
    flex:none!important;
    flex-basis:auto!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:1 / 1;
    box-sizing:border-box!important;
    margin:0!important;
    justify-self:stretch!important;
  }
  .product-page-body .product-gallery__thumbs.is-short-gallery:not([hidden]) > .product-thumb img,
  .product-page-body .product-gallery__thumbs.is-short-gallery:not([hidden]) > .product-thumb .product-thumb__video-preview {
    width:100%!important;
    height:100%!important;
    object-fit:contain;
  }
}
