/* V18: turn stacked WooCommerce product images into a controlled gallery slider. */
body.single-product div.product div.images {
  overflow: hidden !important;
}

body.single-product div.product div.images .woocommerce-product-gallery {
  position: relative !important;
  width: 100% !important;
  display: block !important;
}

body.single-product div.product div.images .woocommerce-product-gallery__wrapper {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.single-product div.product div.images .woocommerce-product-gallery__image {
  display: none !important;
  width: 100% !important;
  margin: 0 !important;
  float: none !important;
}

body.single-product div.product div.images .woocommerce-product-gallery__image.eps-gallery-active {
  display: block !important;
}

body.single-product div.product div.images .woocommerce-product-gallery__image.eps-gallery-active a,
body.single-product div.product div.images .woocommerce-product-gallery__image.eps-gallery-active img {
  display: block !important;
  width: 100% !important;
}

body.single-product div.product div.images .woocommerce-product-gallery__image.eps-gallery-active img {
  height: min(540px, 58vw) !important;
  max-height: 540px !important;
  min-height: 360px !important;
  object-fit: contain !important;
  padding: 14px !important;
  border-radius: 12px !important;
  background: #f7fafc !important;
}

.eps-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(13, 43, 92, .92);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  box-shadow: 0 10px 26px rgba(13,43,92,.18);
}

.eps-gallery-prev {
  right: 12px;
}

.eps-gallery-next {
  left: 12px;
}

.eps-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.eps-gallery-thumb {
  height: 78px;
  padding: 0;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}

.eps-gallery-thumb img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  padding: 5px !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: #fff !important;
}

.eps-gallery-thumb.is-active {
  border-color: var(--eps-primary);
  box-shadow: 0 0 0 2px rgba(13,43,92,.12);
}

body.single-product div.product div.images .flex-control-thumbs {
  display: none !important;
}

@media (max-width: 760px) {
  body.single-product div.product div.images .woocommerce-product-gallery__image.eps-gallery-active img {
    height: 330px !important;
    min-height: 260px !important;
  }

  .eps-gallery-thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .eps-gallery-thumb {
    height: 66px;
  }
}
