/* Shared Wardrobes/Vanity photo framing; loaded only by these collection pages. */
#mainContent :is(#featured-wardrobes, #featured-vanity, #wardrobe-details, #vanity-details, #kitchen-gallery) .kitchen-gallery-media {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
#mainContent :is(#featured-wardrobes, #featured-vanity, #wardrobe-details, #vanity-details, #kitchen-gallery) .kitchen-gallery-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}
#mainContent .collection-featured-grid { align-items: start; }

/* Portrait gallery/detail images must establish their own natural height.
   A percentage-height image in an auto-sized grid can overflow its short frame. */
#mainContent :is(#wardrobe-details, #vanity-details, #kitchen-gallery) .kitchen-gallery-media {
  display: block;
  aspect-ratio: auto;
  overflow: visible;
}
#mainContent :is(#wardrobe-details, #vanity-details, #kitchen-gallery) .kitchen-gallery-media img {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  transform: none;
}
/* Featured landscape frames get definite bounds without relying on grid sizing. */
#mainContent :is(#featured-wardrobes, #featured-vanity) .kitchen-gallery-media { position: relative; }
#mainContent :is(#featured-wardrobes, #featured-vanity) .kitchen-gallery-media img { position: absolute; inset: 0; min-height: 0; }

/* Detail previews outside the complete catalogue. */
.vanity-page #mainContent #vanity-details .kitchen-gallery-media img {
  max-height: min(64svh, 620px);
  object-fit: contain;
}
