/* DinhoS Reef Shop Brand v0.2.99 — Marketplace Premium product gallery.
 * Visual-only. Woo/FlexSlider retains slide navigation, image zoom, lightbox,
 * and the ReefClips module retains playback, sound, fullscreen and deep links.
 * No rules target checkout, wallet, prices or other pages.
 */

/* Let the product page breathe on large desktops; preserve the page margins. */
@media (min-width: 1101px) {
  body.drsf-shop-site.drsb-shop-brand.single-product :is(#container, main.dr-page-content) {
    width: min(1440px, calc(100% - 44px)) !important;
    max-width: 1440px !important;
  }
}

/* The former 390px fixed gallery width is the bottleneck. Increase only the
 * media column, never the product summary or any detached checkout panel. */
@media (min-width: 901px) {
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product {
    grid-template-columns: minmax(0, 45%) minmax(0, 1fr) !important;
    column-gap: clamp(18px, 2vw, 28px) !important;
    align-items: start !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > :is(.images,.woocommerce-product-gallery) {
    max-width: none !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: clamp(12px, 1.1vw, 18px) !important;
    overflow: hidden !important;
    border: 1px solid #dce9f4 !important;
    border-radius: 20px !important;
    box-shadow: 0 12px 36px rgba(17, 58, 91, .09) !important;
    box-sizing: border-box !important;
    background: #fff !important;
  }
  /* Preserve Woo's JS-created viewport; do not move or clone media items. */
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) {
    display: grid !important;
    grid-template-columns: 70px minmax(0, 1fr) !important;
    column-gap: clamp(10px, 1.1vw, 16px) !important;
    align-items: start !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) > :is(.flex-viewport,.woocommerce-product-gallery__wrapper) {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border-radius: 15px !important;
    overflow: hidden !important;
    background: #fff !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) > .flex-control-thumbs {
    grid-column: 1 !important;
    grid-row: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    align-self: start !important;
    gap: 9px !important;
    width: 70px !important;
    max-width: 70px !important;
    max-height: min(620px, 75vh);
    margin: 0 !important;
    padding: 2px 3px 8px !important;
    overflow: auto hidden;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    scrollbar-width: thin;
    scrollbar-color: #c9d9e7 transparent;
    list-style: none !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery .flex-control-thumbs > li {
    float: none !important;
    flex: 0 0 64px !important;
    display: block !important;
    width: 64px !important;
    max-width: none !important;
    height: 64px !important;
    min-height: 64px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #d8e5ef !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(18, 45, 72, .04) !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery .flex-control-thumbs > li:has(img.flex-active) {
    border: 2px solid #258ded !important;
    box-shadow: 0 0 0 2px rgba(37, 141, 237, .12) !important;
  }
}

/* Square photo stage without cropping animals, product packaging or accessories.
 * Avoid targeting Woo's injected .zoomImg or the portrait ReefClips cover. */
body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > :is(.images,.woocommerce-product-gallery) :is(.woocommerce-product-gallery__image > a > img,.woocommerce-product-gallery__image > img,.wp-post-image):not(.zoomImg) {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center center !important;
  padding: clamp(4px, .7vw, 10px) !important;
  border-radius: 13px !important;
  background: #fff !important;
}
body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery .flex-control-thumbs > li img {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  padding: 3px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: #fff !important;
}

/* Vertical clips grow with the visual stage, but keep their natural 9:16 ratio.
 * Never apply the photo aspect-ratio to the portrait player or its poster. */
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip {
  justify-content: flex-start !important;
  gap: 12px !important;
  padding: 7px 4px 14px !important;
}
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__frame {
  box-sizing: border-box !important;
  width: min(100%, 306px) !important;
  height: auto !important;
  aspect-ratio: 9 / 16 !important;
  max-height: min(560px, 76dvh) !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 36px rgba(6, 22, 37, .20) !important;
}
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__play img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: 9 / 16 !important;
  object-fit: cover !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__detail {
  width: min(100%, 340px) !important;
  max-width: 340px !important;
  padding: 12px 11px 13px !important;
  border-radius: 15px !important;
}
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__eyebrow {
  font-size: 11px !important;
  letter-spacing: .065em !important;
}
body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__community {
  font-size: 13px !important;
}

/* Tablets and phones: keep the full-width photo first; thumbnails become a
 * horizontal scroll rail, rather than squeezing the image into two columns. */
@media (max-width: 900px) {
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > :is(.images,.woocommerce-product-gallery) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 12px !important;
    border: 1px solid #dce9f4 !important;
    border-radius: 17px !important;
    background: #fff !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    row-gap: 12px !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) > :is(.flex-viewport,.woocommerce-product-gallery__wrapper) {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: 580px !important;
    min-width: 0 !important;
    margin-inline: auto !important;
    overflow: hidden !important;
    border-radius: 13px !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery:has(> .flex-control-thumbs) > .flex-control-thumbs {
    grid-column: 1 !important;
    grid-row: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 9px !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 2px 3px 7px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    box-sizing: border-box !important;
    scrollbar-width: thin;
    list-style: none !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery .flex-control-thumbs > li {
    float: none !important;
    flex: 0 0 62px !important;
    width: 62px !important;
    max-width: none !important;
    height: 62px !important;
    min-height: 62px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #d8e5ef !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #fff !important;
  }
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > .woocommerce-product-gallery .flex-control-thumbs > li:has(img.flex-active) {
    border: 2px solid #258ded !important;
  }
}
@media (max-width: 520px) {
  body.drsf-shop-site.drsb-shop-brand.single-product .woocommerce div.product > :is(.images,.woocommerce-product-gallery) {
    padding: 9px !important;
  }
  body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__frame {
    width: min(100%, 246px) !important;
    max-height: min(445px, 71dvh) !important;
  }
  body.drsb-shop-brand.single-product .drsb-pclip-slide .drsb-pclip__detail {
    width: min(100%, 300px) !important;
    padding: 10px 9px 11px !important;
  }
}
