/* Shop 14: product media only. Branding, banners and avatars retain their sizes. */
html[data-product-portraits="true"] :is(.pMedia, .cImgWrap, .galleryThumb) {
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
html[data-product-portraits="true"] :is(.pImgPic, .pImg, .cImg, .galleryThumb img) {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
html[data-product-portraits="true"] :is(.thumbRow .thumb, .orderThumb, .orderEventThumb, .srImg, .swThumbImg, .linkedProductCard img) {
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  max-height: none !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}
html[data-product-portraits="true"] #viewProduct .gWrap {
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
}
html[data-product-portraits="true"] #viewProduct .gImg {
  aspect-ratio: 3 / 4 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
}

/* Desktop product card: size the whole gallery as one stable unit. This keeps
   the hero, favorite control and thumbnail strip aligned and inside the viewport. */
@media (min-width: 1024px) {
  html[data-product-portraits="true"][data-desktop-template="tilda"] #viewProduct .desktopProductMain {
    margin-top: clamp(18px, 3vh, 30px) !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct #galleryBox {
    display: flex !important;
    justify-content: center !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct .gallery {
    width: min(100%, clamp(220px, calc(75vh - 220px), 510px)) !important;
    width: min(100%, clamp(220px, calc(75svh - 220px), 510px)) !important;
    max-width: 100% !important;
    flex: 0 1 auto !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct .gWrap {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    scroll-behavior: auto !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct :is(.gImg, .gSlide img) {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: contain !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct .galleryThumbsWrap {
    width: 100% !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct .galleryThumbs {
    width: 100% !important;
    justify-content: safe center !important;
  }

  html[data-product-portraits="true"][data-desktop-gallery-layout="horizontal"] #viewProduct #favTopBtn.galleryFavoriteBtn {
    top: 16px !important;
    right: 16px !important;
  }
}
