/* Sahtain PDP — gallery matched to sahtainwater.com (web + mobile) */

.sahtain-pdp-gallery {
  --spg-brand: #013e87;
  --spg-bg: #f9fafb;
  --spg-radius: 11px;
  --spg-thumb-w: 141px;
  --spg-thumb-h: 80px;
  --spg-thumb-radius: 11px;
  --spg-gap: 10px;
  /* Reference desktop stage ~767×640 */
  --spg-stage-ratio: 767 / 640;
}

@media (min-width: 992px) {
  .sahtain-pdp .sahtain-pdp__row {
    align-items: flex-start;
  }

  .sahtain-pdp-gallery.col-lg-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
  }

  .sahtain-pdp .col-product-info.col-lg-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
  }
}

.sahtain-pdp-gallery__stage {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.sahtain-pdp-gallery__wrap > .row {
  margin-left: 0;
  margin-right: 0;
}

/* Hide extras not in merchant reference (desktop). Mobile shows arrows. */
.sahtain-pdp-gallery .carousel-fullscreen-icon,
.sahtain-pdp-gallery .carousel-fullscreen-control,
.sahtain-pdp-gallery .carousel-pause-icon,
.sahtain-pdp-gallery .carousel-pause,
.sahtain-pdp-gallery .carousel-fullscreen,
.sahtain-pdp-gallery .slick-dots {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

/* Desktop: no gallery arrows */
@media (min-width: 992px) {
  .sahtain-pdp-gallery .slick-arrow,
  .sahtain-pdp-gallery .slick-prev,
  .sahtain-pdp-gallery .slick-next {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
  }
}

/* ——— Main image stage ——— */
.sahtain-pdp-gallery .sahtain-pdp-gallery__main.box-1-1:before,
.sahtain-pdp-gallery .product-images-carousel.box-1-1:before,
.sahtain-pdp-gallery .product-images-empty.box-1-1:before {
  display: none !important;
  content: none !important;
  padding-top: 0 !important;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__main.box-1-1,
.sahtain-pdp-gallery .product-images-carousel.box-1-1,
.sahtain-pdp-gallery .product-images-empty.box-1-1 {
  position: relative;
  width: 100%;
  aspect-ratio: var(--spg-stage-ratio);
  height: auto;
  max-height: 640px;
  background: var(--spg-bg);
  border-radius: var(--spg-radius);
  overflow: hidden;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__main.box-1-1 > .content,
.sahtain-pdp-gallery .product-images-carousel.box-1-1 > .content,
.sahtain-pdp-gallery .product-images-empty.box-1-1 > .content {
  position: absolute;
  inset: 0;
}

.sahtain-pdp-gallery #product-images,
.sahtain-pdp-gallery #product-images-slick,
.sahtain-pdp-gallery #product-images-slick .slick-list,
.sahtain-pdp-gallery #product-images-slick .slick-track,
.sahtain-pdp-gallery #product-images-slick .slick-slide {
  height: 100% !important;
}

.sahtain-pdp-gallery #product-images-slick .slick-slide > div {
  height: 100%;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__slide.box-1-1:before,
.sahtain-pdp-gallery #product-images-slick .box-1-1:before {
  display: none !important;
  content: none !important;
  padding-top: 0 !important;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__slide.box-1-1,
.sahtain-pdp-gallery #product-images-slick .box-1-1 {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--spg-bg);
  border-radius: var(--spg-radius);
  overflow: hidden;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__slide.box-1-1 > .content,
.sahtain-pdp-gallery #product-images-slick .box-1-1 > .content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sahtain-pdp-gallery #product-images-slick .image-link {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
}

/* Reference: object-contain — full product visible, no crop */
.sahtain-pdp-gallery #product-images-slick img.carousel-img,
.sahtain-pdp-gallery .product-images-empty img {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center;
  display: block;
  margin: 0;
  background: transparent;
  border-radius: 0;
}

/* ——— Thumbnails under main image ——— */
.sahtain-pdp-gallery .sahtain-pdp-gallery__thumbs,
.sahtain-pdp-gallery .lg-thumbs.sahtain-pdp-gallery__thumbs {
  display: flex !important;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--spg-gap);
  margin: 12px 0 0 !important;
  padding: 0 !important;
  width: 100%;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item {
  flex: 0 0 var(--spg-thumb-w);
  width: var(--spg-thumb-w);
  max-width: var(--spg-thumb-w);
  height: var(--spg-thumb-h);
  margin: 0 !important;
  padding: 0 !important;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item .thumb-image-a {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--spg-thumb-radius);
  overflow: hidden;
  background: var(--spg-bg);
  border: 2px solid #e5e7eb;
  box-sizing: border-box;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item .thumb-image-a img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  display: block;
  border: 0 !important;
  opacity: 1 !important;
  border-radius: 6px;
}

.sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item.is-active .thumb-image-a,
.sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item .thumb-image-a.selected {
  border-color: var(--spg-brand);
}

/* Mobile/tablet — match sahtainwater.com thumbs (132×64 phone, 132×80 ≥768) */
@media (max-width: 991.98px) {
  .sahtain-pdp-gallery {
    --spg-thumb-w: 132px;
    --spg-thumb-h: 64px;
    --spg-thumb-radius: 11px;
    --spg-gap: 10px;
    --spg-stage-ratio: 345 / 380;
    margin-bottom: 0.75rem;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__main.box-1-1,
  .sahtain-pdp-gallery .product-images-carousel.box-1-1,
  .sahtain-pdp-gallery .product-images-empty.box-1-1 {
    max-height: min(380px, 52vh);
    overflow: visible;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__slide.box-1-1,
  .sahtain-pdp-gallery #product-images-slick .box-1-1 {
    overflow: hidden;
  }

  .products-details-page .sahtain-pdp-gallery .lg-thumbs,
  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumbs {
    display: flex !important;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: var(--spg-gap);
    margin: 12px 0 0 !important;
    padding: 0 !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumbs::-webkit-scrollbar {
    display: none;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item {
    flex: 0 0 var(--spg-thumb-w);
    width: var(--spg-thumb-w);
    max-width: var(--spg-thumb-w);
    height: var(--spg-thumb-h);
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item .thumb-image-a {
    border-width: 1px;
    border-color: #e5e7eb;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item.is-active .thumb-image-a,
  .sahtain-pdp-gallery .sahtain-pdp-gallery__thumb-item .thumb-image-a.selected {
    border-width: 2px;
    border-color: var(--spg-brand);
  }

  /* Mobile gallery arrows — both white circles (reference) */
  .sahtain-pdp-gallery .product-images-carousel,
  .sahtain-pdp-gallery .sahtain-pdp-gallery__main {
    position: relative;
  }

  .sahtain-pdp-gallery .slick-arrow,
  .sahtain-pdp-gallery .slick-prev,
  .sahtain-pdp-gallery .slick-next {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    min-height: 40px;
    margin-top: -20px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff !important;
    color: var(--spg-brand) !important;
    box-shadow: none;
    cursor: pointer;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    font-size: 0;
    line-height: 1;
    transform: none;
  }

  .sahtain-pdp-gallery .slick-prev {
    inset-inline-start: 10px;
    left: auto;
    right: auto;
  }

  .sahtain-pdp-gallery .slick-next {
    inset-inline-end: 10px;
    left: auto;
    right: auto;
    background: #fff !important;
    color: var(--spg-brand) !important;
  }

  .sahtain-pdp-gallery .slick-arrow.slick-disabled,
  .sahtain-pdp-gallery .slick-arrow[aria-disabled="true"] {
    opacity: 0.45 !important;
    cursor: default;
  }

  .sahtain-pdp-gallery .slick-arrow span,
  .sahtain-pdp-gallery .slick-arrow [class^="icon-"],
  .sahtain-pdp-gallery .slick-arrow [class*=" icon-"] {
    display: block;
    font-size: 22px !important;
    line-height: 1 !important;
    color: inherit !important;
  }

  .sahtain-pdp-gallery .slick-next span,
  .sahtain-pdp-gallery .slick-next [class^="icon-"],
  .sahtain-pdp-gallery .slick-next [class*=" icon-"] {
    color: inherit !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .sahtain-pdp-gallery {
    --spg-thumb-h: 80px;
    --spg-stage-ratio: 723 / 480;
  }

  .sahtain-pdp-gallery .sahtain-pdp-gallery__main.box-1-1,
  .sahtain-pdp-gallery .product-images-carousel.box-1-1,
  .sahtain-pdp-gallery .product-images-empty.box-1-1 {
    max-height: min(480px, 58vh);
  }
}
