/*
 * VEJA HOME V46.94 — Full product photo visibility.
 * Scope: storefront product cards, product detail gallery and thumbnails.
 * Deliberately excludes hero banners, round categories and editorial images.
 * Source photograph proportions are preserved; no image file is modified.
 */

/* Catalog, home collections, related products: keep a clean, consistent
   portrait card while showing the COMPLETE photograph inside the frame. */
#app .product-card .product-image-wrap,
#app .vh60-product-section .vh60-card .product-image-wrap,
#app .vh60-product-section .vh60-card .product-image-container,
body.vh60-home #app .vh60-product-section .vh60-card .product-image-wrap,
body.vh60-home #app .vh60-product-section .vh60-card .product-image-container {
  aspect-ratio: 7 / 10 !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: #f8f7f5 !important;
}

/* V46.61 and V46.62 used object-fit: cover, and forced min-size 100%.
   Override both, otherwise tall and wide rugs are clipped. */
#app .product-card .product-image-wrap > img.product-image,
#app .vh60-product-section .vh60-card .product-image-container > img.product-image,
body.vh60-home #app .vh60-product-section .vh60-card img.product-image,
body.vh60-home #app .section .product-card img.product-image {
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: none !important;
}

/* Alternate hover photo/video must not crop either. The existing hover
   transition and click actions remain in the JavaScript unchanged. */
#app .product-card .product-image-wrap > .veja-card-hover-image,
#app .product-card .product-image-wrap > .veja-card-hover-video {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* Product detail: the photo element uses its intrinsic aspect ratio.
   V46.72 forced height:100% and cover, clipping the top and bottom of rugs.
   Remove that artificial stage height; do not make the gallery stretch down
   to match a long product description/custom-size form. */
#app #veja-detail-gallery .veja-detail-stage {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  align-self: start !important;
  background: #fff !important;
}

#app #veja-detail-gallery .veja-open-zoom {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  background: transparent !important;
}

#app #veja-detail-gallery .veja-open-zoom > img.main-detail-image {
  position: relative !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: min(78vh, 880px) !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  transform: none !important;
}

/* The photo inside the gallery thumbnail was also cropped. */
#app #veja-detail-gallery .veja-detail-thumb > img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  background: #faf9f7 !important;
}

/* Retain correct proportions in search previews too. */
#search-results .search-result > img {
  object-fit: contain !important;
  object-position: center center !important;
  background: #f8f7f5 !important;
}

/* Video remains fully visible when selected in the detail gallery. */
#app #veja-detail-gallery .veja-inline-product-video.veja-video-visible {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-height: min(78vh, 880px) !important;
  aspect-ratio: 16 / 9;
  object-fit: contain !important;
  background: #111 !important;
}

@media (max-width: 900px) {
  #app #veja-detail-gallery .veja-open-zoom > img.main-detail-image {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: min(70dvh, 640px) !important;
    aspect-ratio: auto !important;
  }
  #app #veja-detail-gallery .veja-inline-product-video.veja-video-visible {
    max-height: min(70dvh, 640px) !important;
  }
}

@media (max-width: 480px) {
  #app .product-card .product-image-wrap {
    aspect-ratio: 7 / 10 !important;
  }
  #app #veja-detail-gallery .veja-open-zoom > img.main-detail-image {
    max-height: min(68dvh, 560px) !important;
  }
}
