/* Candidate only: preserve the source photo proportions in ad listings and galleries. */
.ads .ad-image,
.store-page-wrap .store-product-image {
  box-sizing: border-box;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ads .ad-image > img,
.store-page-wrap .store-product-image > img {
  display: block;
  width: 100%;
  height: auto !important;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  transform: none !important;
}

.ads .ad-image > .no-image,
.store-page-wrap .store-product-image > span {
  display: grid;
  width: 100%;
  min-height: clamp(130px, 32vw, 205px);
  place-items: center;
  box-sizing: border-box;
}

/* The detail stage follows the selected image instead of reserving a square crop box. */
#galleryStage {
  box-sizing: border-box;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  display: block;
}

#galleryStage .main-image-open {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  padding: 0;
  border: 0;
  background: transparent;
}

#galleryStage #mainImage {
  display: block;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 100%;
  max-height: min(78vh, 760px);
  object-fit: contain;
  object-position: center;
}

#thumbnails .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#galleryStage > .no-image {
  display: flex;
  width: 100%;
  min-height: clamp(220px, 55vw, 430px);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
