/* NC Home Market 2.6.22 — product gallery only.
   Preserves WooCommerce FlexSlider, native zoom and PhotoSwipe lightbox. */
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery {
  --ncg-image-height: 485px;
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  padding: 12px !important;
  border: 1px solid #e4e9ed !important;
  border-radius: 17px !important;
  background: #fff !important;
  overflow: hidden !important;
}
/* Only use a two-column gallery when WooCommerce actually renders thumbnails. */
@media (min-width: 992px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery:has(> .flex-control-thumbs) {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 13px;
    align-items: start;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery:has(> .flex-control-thumbs) > .flex-viewport,
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery:has(> .flex-control-thumbs) > .woocommerce-product-gallery__wrapper {
    grid-column: 2;
    grid-row: 1;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs {
    grid-column: 1;
    grid-row: 1;
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap !important;
    width: 72px !important;
    max-height: var(--ncg-image-height);
    overflow-x: hidden;
    overflow-y: auto;
    gap: 9px;
    margin: 0 !important;
    padding: 0 2px 2px 0 !important;
    scrollbar-width: thin;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs li {
    width: 68px !important;
    flex: 0 0 68px !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
  }
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > .flex-viewport {
  width: 100% !important;
  min-width: 0;
  height: var(--ncg-image-height) !important;
  border: 1px solid #eef1f4;
  border-radius: 12px;
  background: #fff;
  overflow: hidden !important;
}
/* Handle products that have only a single image (no FlexSlider viewport). */
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
  width: 100%;
  min-width: 0;
  height: var(--ncg-image-height);
  border: 1px solid #eef1f4;
  border-radius: 12px;
  overflow: hidden;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__image {
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: var(--ncg-image-height) !important;
  background: #fff;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__image > a {
  display: flex !important;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center;
  padding: 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-sizing: border-box;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs li img {
  display: block !important;
  width: 100% !important;
  height: 68px !important;
  max-height: 68px !important;
  object-fit: contain !important;
  padding: 4px !important;
  border: 1px solid #e5eaf0 !important;
  border-radius: 9px !important;
  box-sizing: border-box;
  background: #fff !important;
  opacity: 1 !important;
  cursor: pointer;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs li img.flex-active {
  border-color: #c1121f !important;
  box-shadow: inset 0 0 0 1px #c1121f;
}
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
  z-index: 8;
  top: 22px !important;
  right: 22px !important;
  left: auto !important;
  margin: 0 !important;
}
@media (min-width: 992px) and (max-width: 1199px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 405px; }
}
@media (max-width: 991px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery {
    --ncg-image-height: 370px;
    display: block !important;
    padding: 9px !important;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    width: 100% !important;
    margin: 10px 0 0 !important;
    padding: 0 0 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs li {
    flex: 0 0 62px !important;
    width: 62px !important;
    float: none !important;
    margin: 0 !important;
  }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery > ol.flex-control-thumbs li img {
    height: 62px !important;
    max-height: 62px !important;
  }
}
@media (max-width: 600px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 300px; }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__image img { padding: 8px !important; }
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger { top: 16px !important; right: 16px !important; }
}
@media (max-width: 370px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 255px; }
}

/* 2.6.25 — actual desktop product shell: 55% gallery / 45% details.
   Only affects the two primary columns; mobile and tablet remain unchanged. */
@media (min-width: 1101px) {
  body.ncsm-theme.single-product .ncsm-single-product-shell > div.product {
    grid-template-columns: minmax(0, 11fr) minmax(0, 9fr) !important;
  }
}

/* 2.6.52 Fashion: taller gallery for portrait clothing photos.
   WooCommerce gallery, thumbnails, zoom and image containment stay native. */
body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery {
  --ncg-image-height: 650px;
}
@media (min-width: 992px) and (max-width: 1199px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 540px; }
}
@media (max-width: 991px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 485px; }
}
@media (max-width: 600px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: clamp(350px, 110vw, 510px); }
}
@media (max-width: 370px) {
  body.single-product .ncsm-single-product-shell div.product .woocommerce-product-gallery { --ncg-image-height: 360px; }
}
