/* Image scale pass. Load after site.css. Keep product and technical media complete. */

/* The gallery fits the copy column instead of growing with a wide viewport.
   Scene frames are narrower than their source ratio, so cover removes only
   peripheral room background. Technical selections keep their natural ratio. */
.fr-product-layout .fr-product-gallery {
  width: 100%;
  max-width: 580px;
  min-width: 0;
  justify-self: center;
  align-self: start;
  margin-inline: auto;
}
.fr-product-gallery > .fr-gallery-main {
  width: 100%;
  min-height: 0;
  height: auto;
  background: transparent;
}
.fr-product-gallery .fr-gallery-main [data-product-main-image] {
  display: block;
  width: 100%;
  max-width: 100%;
  height: clamp(360px, 28vw, 410px);
  max-height: 410px;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: 73% center;
}
.fr-product-gallery .fr-gallery-main[data-gallery-kind="technical"] [data-product-main-image],
.fr-product-gallery .fr-gallery-main.is-technical [data-product-main-image] {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 340px;
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
  background: transparent;
  border-radius: 0;
}
.fr-product-gallery .fr-gallery-main[data-gallery-kind="technical"] {
  padding-top: 12px;
}
.fr-product-gallery .fr-gallery-main figcaption {
  padding: 10px 0 0;
  max-width: 100%;
}
.fr-product-gallery .fr-gallery-thumbs {
  gap: 10px;
  margin-top: 14px;
}
.fr-product-gallery .fr-gallery-thumbs img {
  height: 66px;
  object-fit: contain;
}
.fr-product-gallery .fr-gallery-thumbs [data-gallery-kind="scene"] img {
  object-fit: cover;
  object-position: 73% center;
}

/* Editorial split figures have no forced tall canvas. Native-ratio images
   shrink inside their text column; technology diagrams are never cropped. */
body:not([data-page="/"]) .page-body .split > .figure,
.fr-brand-intro .split > .figure {
  width: 100%;
  max-width: 560px;
  min-height: 0;
  height: auto;
  align-self: center;
  margin-inline: auto;
}
body:not([data-page="/"]) .page-body .split > .figure > img,
.fr-brand-intro .split > .figure > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 340px;
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
}
body[data-page="/technology/"] .page-body .split > .figure > img {
  max-height: 320px;
  border-radius: 0;
}
body:not([data-page="/"]) .page-body .split > .figure > figcaption,
.fr-brand-intro .split > .figure > figcaption {
  padding-top: 10px;
  max-width: 100%;
}
.page-body .tech-graphic {
  min-height: 0;
  padding: 20px;
}
.page-body .tech-graphic > svg {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 310px;
  margin-inline: auto;
}

/* Cutaways, controls and installation details use their own natural shapes.
   Removing the large coloured canvas keeps a compact diagram from looking
   like a small object lost in a full-width card. */
.dossier-technical-row .dossier-technical-media {
  width: 100%;
  max-width: 440px;
  min-height: 0;
  height: auto;
  margin-inline: auto;
  padding: 14px 0;
  background: transparent;
}
.dossier-technical-row .dossier-technical-media > img,
.page-body .figure--technical > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 320px;
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
}
.dossier-technical-row .dossier-technical-media--scene {
  width: fit-content;
  max-width: 100%;
  padding: 0;
}
.dossier-technical-row .dossier-technical-media figcaption {
  padding-top: 10px;
  max-width: 440px;
  margin-inline: auto;
}

/* Installation photos remain two columns. The photo controls its figure
   size, so portrait/square sources do not receive wide grey letterboxes. */
.dossier-cases .dossier-case-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 880px;
  gap: 28px 24px;
  align-items: start;
  justify-items: center;
  margin-inline: auto;
}
.dossier-case-grid .dossier-case {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  justify-self: center;
  background: transparent;
}
.dossier-case-grid .dossier-case > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 320px;
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
  background: transparent;
}
.dossier-case-grid .dossier-case > figcaption {
  padding: 10px 0 12px;
  background: transparent;
  max-width: 100%;
}
.dossier-related-grid .dossier-related-item .product-card-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 220px;
  aspect-ratio: auto;
  object-fit: contain;
  margin: 0 auto 18px;
}

@media (max-width: 1070px) and (min-width: 801px) {
  .fr-product-gallery .fr-gallery-main [data-product-main-image] {
    height: 360px;
    max-height: 360px;
  }
  .fr-product-gallery .fr-gallery-main[data-gallery-kind="technical"] [data-product-main-image],
  .fr-product-gallery .fr-gallery-main.is-technical [data-product-main-image] {
    height: auto;
    max-height: 320px;
  }
}

@media (max-width: 800px) {
  .fr-product-layout .fr-product-gallery {
    max-width: 580px;
  }
  .fr-product-gallery .fr-gallery-main [data-product-main-image] {
    height: auto;
    max-height: 390px;
    aspect-ratio: 3 / 2;
  }
  .fr-product-gallery .fr-gallery-main[data-gallery-kind="technical"] [data-product-main-image],
  .fr-product-gallery .fr-gallery-main.is-technical [data-product-main-image] {
    height: auto;
    max-height: 320px;
    aspect-ratio: auto;
  }
  body:not([data-page="/"]) .page-body .split > .figure,
  .fr-brand-intro .split > .figure {
    max-width: 540px;
  }
  body:not([data-page="/"]) .page-body .split > .figure > img,
  .fr-brand-intro .split > .figure > img {
    max-height: 320px;
  }
  .dossier-technical-row .dossier-technical-media > img,
  .page-body .figure--technical > img {
    max-height: 300px;
  }
  .dossier-case-grid .dossier-case > img {
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .fr-product-layout .fr-product-gallery {
    max-width: 100%;
  }
  .fr-product-gallery .fr-gallery-main [data-product-main-image] {
    width: 100%;
    height: auto;
    max-height: 320px;
    aspect-ratio: 3 / 2;
  }
  .fr-product-gallery .fr-gallery-main[data-gallery-kind="technical"] [data-product-main-image],
  .fr-product-gallery .fr-gallery-main.is-technical [data-product-main-image] {
    width: auto;
    height: auto;
    max-height: 285px;
    aspect-ratio: auto;
  }
  .fr-product-gallery .fr-gallery-thumbs {
    margin-top: 10px;
    gap: 8px;
  }
  .fr-product-gallery .fr-gallery-thumbs img {
    height: 60px;
  }
  body:not([data-page="/"]) .page-body .split > .figure > img,
  .fr-brand-intro .split > .figure > img {
    max-height: 280px;
  }
  body[data-page="/technology/"] .page-body .split > .figure > img {
    max-height: 280px;
  }
  .dossier-technical-row .dossier-technical-media {
    max-width: 100%;
    padding: 8px 0;
  }
  .dossier-technical-row .dossier-technical-media > img,
  .page-body .figure--technical > img {
    max-height: 285px;
  }
  .page-body .tech-graphic {
    padding: 16px;
  }
  .page-body .tech-graphic > svg {
    max-height: 270px;
  }
  .dossier-cases .dossier-case-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 420px;
    gap: 25px;
  }
  .dossier-case-grid .dossier-case > img {
    max-height: 360px;
  }
  .dossier-case-grid .dossier-case > figcaption {
    padding-top: 10px;
  }
  .dossier-related-grid .dossier-related-item .product-card-image {
    max-height: 210px;
  }
}

/* These two original operation photos are near 1.4:1, rather than the new
   room renders' 3:2 / 16:9. Retain every edge when selected in the gallery. */
.fr-product-gallery .fr-gallery-main [data-product-main-image][src*="steatite-cube-lifestyle"],
.fr-product-gallery .fr-gallery-main [data-product-main-image][src*="calypso-installation"] {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 340px;
  aspect-ratio: auto;
  object-fit: contain;
  margin-inline: auto;
}
.fr-product-gallery .fr-gallery-thumbs [data-gallery-src*="steatite-cube-lifestyle"] img,
.fr-product-gallery .fr-gallery-thumbs [data-gallery-src*="calypso-installation"] img {
  object-fit: contain;
}
@media (max-width: 600px) {
  .fr-product-gallery .fr-gallery-main [data-product-main-image][src*="steatite-cube-lifestyle"],
  .fr-product-gallery .fr-gallery-main [data-product-main-image][src*="calypso-installation"] {
    max-height: 285px;
  }
}
