/* All product renderers use the approved M3 gallery; native markup is the loading fallback. */
body.zpvg-product .zpp-hero > .zpp-gallery.zpvg-ready {
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
}
body.zpvg-product .zlpd-gallery.zpvg-ready,
body.zpvg-product .zac-storefront .product-layout > .gallery.zpvg-ready,
body.zpvg-product .zwn-storefront .product-layout > .gallery.zpvg-ready,
body.zpvg-product #zlp-page .zlp-gallery.zpvg-ready,
body.zpvg-product .zcpp-hero > .zcpp-visual.zpvg-ready {
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
}
body.zpvg-product .zcpp-visual.zpvg-ready::before { display: none; }
body.zpvg-product .zcpp-visual.zpvg-ready > .zcpp-route-badge,
body.zpvg-product .zcpp-visual.zpvg-ready > p {
  position: static;
  inset: auto;
  width: fit-content;
  margin: 12px 0;
}
body.zpvg-product.single-product .zpvg-native-fallback[hidden],
body.zpvg-product .zpvg-gallery[hidden],
body.zpvg-product .zpvg-gallery [hidden] { display: none !important; }

body.zpvg-product .zpvg-gallery {
  --zpvg-stage-height: clamp(450px, 39vw, 520px);
  --zpvg-line: #e2e1da;
  --zpvg-accent: #c44903;
  --zpvg-muted: #6b7068;
  display: grid;
  position: relative;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: #242720;
  font-family: Montserrat, Arial, sans-serif;
}
body.zpvg-product .zpvg-gallery *,
body.zpvg-product .zpvg-gallery *::before,
body.zpvg-product .zpvg-gallery *::after { box-sizing: border-box; }
body.zpvg-product .zpvg-gallery .zpvg-main { min-width: 0; width: 100%; }
body.zpvg-product .zpvg-gallery .zpvg-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--zpvg-stage-height);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #eeeee8;
  border-radius: 12px;
  background: #f5f5f1;
  touch-action: pan-y pinch-zoom;
  cursor: default;
}
body.zpvg-product .zpvg-gallery img.zpvg-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  object-fit: contain !important;
  object-position: center;
  mix-blend-mode: normal;
  transform: none !important;
  transition: none;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
}
body.zpvg-product .zpvg-gallery .zpvg-thumbnails {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  height: var(--zpvg-stage-height);
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 2px 6px 2px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8c9c1 transparent;
}
body.zpvg-product .zpvg-gallery button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font: inherit;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  color: #242720;
  cursor: pointer;
  touch-action: manipulation;
  transform: none;
  transition: border-color .15s ease, background-color .15s ease;
}
body.zpvg-product .zpvg-gallery button.zpvg-thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  width: 66px;
  height: 76px;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  border: 1px solid var(--zpvg-line);
  border-radius: 9px;
  background: #fff;
}
body.zpvg-product .zpvg-gallery button.zpvg-thumb:is(:hover, :focus, :active) {
  background: #fff;
  color: #242720;
  border-color: #a9aea1;
  box-shadow: none;
}
body.zpvg-product .zpvg-gallery button.zpvg-thumb[aria-pressed="true"],
body.zpvg-product .zpvg-gallery button.zpvg-thumb[aria-pressed="true"]:is(:hover, :focus, :active) {
  padding: 4px;
  border: 2px solid var(--zpvg-accent);
  background: #fff;
}
body.zpvg-product .zpvg-gallery .zpvg-thumb img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain !important;
  object-position: center;
  mix-blend-mode: normal;
  transform: none !important;
  pointer-events: none;
}
body.zpvg-product .zpvg-gallery .zpvg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 66px;
  padding: 10px 0 0;
}
body.zpvg-product .zpvg-gallery .zpvg-caption,
body.zpvg-product .zpvg-gallery .zpvg-counter {
  color: var(--zpvg-muted);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0;
  font-weight: 400;
}
body.zpvg-product .zpvg-gallery .zpvg-counter {
  min-width: 41px;
  margin-right: 6px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.zpvg-product .zpvg-gallery .zpvg-navigation {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
body.zpvg-product .zpvg-gallery button.zpvg-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--zpvg-line);
  border-radius: 50%;
  background: #fff;
  color: #242720;
}
body.zpvg-product .zpvg-gallery button.zpvg-arrow:is(:hover, :focus, :active) {
  border-color: #c3c7b9;
  background: #f1f2ec;
  color: #242720;
  box-shadow: none;
}
body.zpvg-product .zpvg-gallery button.zpvg-arrow:disabled {
  opacity: .35;
  cursor: default;
  background: #fff;
  border-color: var(--zpvg-line);
}
body.zpvg-product .zpvg-gallery button:focus-visible {
  outline: 2px solid var(--zpvg-accent);
  outline-offset: 2px;
}
body.zpvg-product .zpvg-gallery .zpvg-arrow svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.zpvg-product .zpvg-gallery .zpvg-error {
  max-width: 270px;
  margin: 0;
  padding: 24px;
  color: var(--zpvg-muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}
body.zpvg-product .zpvg-gallery .zpvg-thumb-number { font-size: 12px; color: var(--zpvg-muted); }
body.zpvg-product .zpvg-gallery .zpvg-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body.zpvg-product .zpvg-gallery.zpvg-single { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1100px) and (min-width: 701px) {
  body.zpvg-product .zpvg-gallery { --zpvg-stage-height: 500px; }
}
@media (max-width: 700px) {
  body.zpvg-product .zpvg-gallery {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  body.zpvg-product .zpvg-gallery .zpvg-main { order: 0; }
  body.zpvg-product .zpvg-gallery .zpvg-stage {
    height: auto;
    max-height: 440px;
    aspect-ratio: 1;
    border-radius: 12px;
  }
  body.zpvg-product .zpvg-gallery img.zpvg-image { padding: 10px; }
  body.zpvg-product .zpvg-gallery .zpvg-thumbnails {
    order: 1;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    height: 80px;
    padding: 3px 2px 7px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  body.zpvg-product .zpvg-gallery button.zpvg-thumb {
    flex: 0 0 58px;
    width: 58px;
    height: 66px;
  }
  body.zpvg-product .zpvg-gallery .zpvg-footer { min-height: 62px; padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  body.zpvg-product .zpvg-gallery button { transition: none; }
}

/* Preserve the existing WooCommerce product column and legacy Elementor sizing. */
body.zpvg-product.woocommerce div.product .zpvg-woocommerce-column {
  float: left;
  width: 48%;
  clear: none;
  margin-bottom: 2em;
}
body.zpvg-product.single-product .zpvg-gallery .zpvg-product-labels {
  grid-column: 1 / -1;
  order: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 14px;
}
body.zpvg-product.single-product .zpvg-product-labels .product_labels {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: auto !important;
  gap: 12px !important;
  margin: 0;
}
body.zpvg-product.single-product .zpvg-product-labels .product_label {
  position: static !important;
  width: 80px !important;
  max-width: 80px !important;
  height: auto;
  flex: 0 0 auto;
}
body.zpvg-product.single-product .zpvg-product-labels .product_label img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
body.zpvg-product.single-product .zpvg-product-labels :is(.product_label_outofstock, .product_label_instock, .onsale, .sale-badge, .zlpd-image-tag) {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0;
}
body.zpvg-product.single-product .elementor-widget-shortcode:has(> .elementor-shortcode > .zpvg-gallery[data-renderer="legacy"]),
body.zpvg-product.single-product .e-con:has(> .elementor-widget-shortcode > .elementor-shortcode > .zpvg-gallery[data-renderer="legacy"]) {
  --container-widget-height: auto;
  --height: auto;
  height: auto !important;
  min-height: min-content !important;
  flex-shrink: 0 !important;
}
@media (max-width: 768px) {
  body.zpvg-product.woocommerce div.product .zpvg-woocommerce-column { float: none; width: 100%; }
}
