/*
 * AISTAR V90 responsive media repair
 * Loaded after style.css so the rules below resolve legacy fixed-height and
 * object-fit conflicts without changing the existing page structure.
 */

/* Baseline: every unframed image keeps its intrinsic ratio and never exceeds
   its parent. More specific framed-media rules below intentionally fill their
   responsive aspect-ratio boxes. */
img {
  max-width: 100%;
  height: auto;
}

picture,
figure {
  max-width: 100%;
}

picture > img {
  width: 100%;
  height: auto;
}

/* Prevent grid and flex children from forcing media wider than the viewport. */
.product-card,
.product-simple-card,
.product-v60-related-card,
.pro-gallery,
.pro-feature-wide,
.pro-feature-visual,
.solution-card,
.case-rich-card,
.news-card,
.news-side-card,
.home-news-card,
.media-panel,
.contact-visual,
.solution-v67-media,
.solution-v69-product-visual,
.product-v62-inquiry-visual,
.tech-v62-image,
.news-insight-v86-media {
  min-width: 0;
}

/* Product listing media: product renders must stay fully visible. */
.product-card .product-img {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 10;
}

.product-card .product-img > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
  padding: clamp(12px, 1.45vw, 22px) !important;
}

.product-simple-card > img,
.product-v60-related-card > img {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 16 / 10;
  object-fit: contain !important;
  object-position: center !important;
  padding: clamp(12px, 1.45vw, 22px) !important;
}

.solution-v69-product-visual {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
}

.solution-v69-product-visual > img,
.v75-mega-thumb > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Keep the Product Center composite visible without altering the homepage carousel. */
.products-hero-v69-fixed .products-hero-v69-bg > img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: right center !important;
}

/* Scene-based hero slides still fill the stage. */
.hero-slide--stage > img,
.hero-slide--xr > img,
.hero-slide--creative > img,
.hero-slide--quality > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  padding: 0 !important;
}

/* Product-detail galleries: replace fixed pixel heights with a fluid frame. */
.pro-gallery-main {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 4 / 3;
}

.pro-gallery-slide > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-position: center !important;
}

/* Standard detail pages use the first slide for the isolated product and the
   remaining slides for application scenes. */
.pro-gallery.v63 .pro-gallery-slide:first-child > img,
.pro-gallery.v63 .pro-thumb:first-child > img {
  object-fit: contain !important;
  object-position: center !important;
  box-sizing: border-box !important;
}

.pro-gallery.v63 .pro-gallery-slide:first-child > img {
  padding: clamp(14px, 2vw, 24px) !important;
}

.pro-gallery.v63 .pro-gallery-slide:not(:first-child) > img,
.pro-gallery.v63 .pro-thumb:not(:first-child) > img {
  object-fit: cover !important;
  object-position: center !important;
  padding: 0 !important;
}

/* The Cubic page explicitly labels product renders and application scenes, so
   those labels take priority over slide order. */
.cube-gallery-v87 .pro-gallery-slide.is-product-render > img,
.cube-gallery-v87 .pro-thumb.is-product-render > img {
  object-fit: contain !important;
  object-position: center !important;
  box-sizing: border-box !important;
}

.cube-gallery-v87 .pro-gallery-slide.is-product-render > img {
  padding: clamp(14px, 2vw, 24px) !important;
}

.cube-gallery-v87 .pro-gallery-slide.is-application-scene > img,
.cube-gallery-v87 .pro-thumb.is-application-scene > img {
  object-fit: cover !important;
  object-position: center !important;
  padding: 0 !important;
}

/* Product-detail feature rows resize with their columns instead of retaining
   the old 520px desktop height after the layout becomes a single column. */
.pro-feature-wide,
.pro-feature-visual {
  min-height: 0 !important;
}

.pro-feature-visual {
  width: 100%;
  aspect-ratio: 16 / 10;
}

.pro-feature-visual > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  padding: 0 !important;
}

/* Isolated product images require contain; all other feature imagery remains
   full-bleed. */
.pro-feature-visual > img[src*="/product-"],
.pro-feature-visual > img[src$=".svg"],
.cube-product-visual-v87 > img {
  object-fit: contain !important;
  object-position: center !important;
  padding: clamp(14px, 2vw, 24px) !important;
  box-sizing: border-box !important;
}

/* Standard card photographs: a fluid aspect ratio replaces accumulated fixed
   heights from older versions. */
.solution-card > img,
.case-rich-card > img,
.news-card > img,
.home-news-card > img,
.news-main-card > img,
.news-detail-main > img,
.about-v59-card > img,
.about-v60-card > img,
.tech-image-card > img,
.tech-v60-img-card > img,
.about-v63-slide > img,
.news-insight-v86-media > img {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 16 / 10;
  object-fit: cover !important;
  object-position: center !important;
}

.news-main-card > img,
.news-detail-main > img,
.news-insight-v86-media > img {
  aspect-ratio: 16 / 9;
}

/* Side-news cards remain equal-height on desktop and switch to a natural media
   frame once the card becomes a single column. */
.news-side-card > img {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Responsive desktop masonry: the original rows were hard-coded to 235px,
   245px, 260px and 290px. These values now track the available canvas width. */
.home-cases-v83-grid,
.home-company-v83-grid {
  grid-template-rows: repeat(2, auto) !important;
}

.home-case-v83-card,
.home-company-v83-photo {
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 10;
}

.home-case-v83-card.is-featured,
.home-company-v83-photo.is-main {
  aspect-ratio: auto;
}

.about-company-v83-grid {
  grid-auto-rows: clamp(190px, 18vw, 280px) !important;
}

.case-v82-grid {
  grid-auto-rows: clamp(215px, 23vw, 320px) !important;
}

.news-exhibit-v82-grid {
  grid-template-rows: repeat(2, clamp(215px, 22vw, 310px)) !important;
}

.home-case-v83-card > img,
.home-company-v83-photo > img,
.about-company-v83-card > img,
.case-v82-card > img,
.news-exhibit-v82-photo > img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Large content visuals use fluid frames while retaining intentional cover
   behavior for real-world photography. */
.media-panel,
.contact-visual,
.solution-v67-media,
.product-v62-inquiry-visual,
.tech-v62-image,
.about-v63-wide,
.news-exhibit-v82-cover {
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 10;
}

.media-panel > img,
.contact-visual > img,
.solution-v67-media > img,
.product-v62-inquiry-visual > img,
.tech-v62-image > img,
.about-v63-wide > img,
.news-exhibit-v82-cover > img {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Overlay galleries already have responsive grids; mobile receives explicit
   ratios so old minimum heights cannot create narrow, heavily cropped images. */
@media (max-width: 980px) {
  .products-hero-v69-fixed .products-hero-v69-bg > img {
    object-position: center center !important;
  }

  .home-case-v83-card.is-featured,
  .home-company-v83-photo.is-main {
    aspect-ratio: 16 / 9;
  }

  .about-company-v83-card,
  .about-company-v83-card.is-featured,
  .about-company-v83-card.is-wide,
  .case-v82-card,
  .case-v82-card.is-wide,
  .case-v82-card.is-tall,
  .news-exhibit-v82-photo,
  .news-exhibit-v82-photo.is-featured {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 10;
  }

  .pro-gallery-main {
    aspect-ratio: 16 / 11;
  }

  .pro-feature-visual,
  .media-panel,
  .contact-visual,
  .solution-v67-media,
  .product-v62-inquiry-visual,
  .tech-v62-image,
  .about-v63-wide,
  .news-exhibit-v82-cover {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 760px) {
  .product-card .product-img,
  .product-simple-card > img,
  .product-v60-related-card > img {
    aspect-ratio: 4 / 3;
  }

  .pro-gallery-main {
    aspect-ratio: 1 / 1;
  }

  .pro-feature-visual,
  .solution-card > img,
  .case-rich-card > img,
  .news-card > img,
  .home-news-card > img,
  .about-v59-card > img,
  .about-v60-card > img,
  .tech-image-card > img,
  .tech-v60-img-card > img,
  .about-v63-slide > img,
  .media-panel,
  .contact-visual,
  .solution-v67-media,
  .product-v62-inquiry-visual,
  .tech-v62-image,
  .about-v63-wide,
  .news-exhibit-v82-cover {
    aspect-ratio: 4 / 3;
  }

  .news-side-card > img {
    height: auto !important;
    aspect-ratio: 16 / 9;
  }

  .about-company-v83-grid,
  .case-v82-grid,
  .news-exhibit-v82-grid {
    grid-auto-rows: auto !important;
    grid-template-rows: none !important;
  }

  .home-case-v83-card,
  .home-case-v83-card.is-featured,
  .home-company-v83-photo,
  .home-company-v83-photo.is-main,
  .about-company-v83-card,
  .about-company-v83-card.is-featured,
  .about-company-v83-card.is-wide,
  .case-v82-card,
  .case-v82-card.is-wide,
  .case-v82-card.is-tall,
  .news-exhibit-v82-photo,
  .news-exhibit-v82-photo.is-featured {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 3;
  }

}

@media (max-width: 480px) {
  .pro-gallery-main {
    aspect-ratio: 4 / 5;
  }
}
