/* V43 local candidate: media layout refinements only.
   Source images remain unchanged; the rules below control their presentation. */

/* Product galleries: keep the complete asset visible while giving narrow bodies
   enough area to remain legible at both desktop and phone widths. */
body.v43-media .gallery,
body.v43-media .gallery-stage,
body.v43-media .gallery-thumbs {
  min-width: 0;
}

body.v43-media .gallery-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(320px, 58vw, 500px);
  min-height: 320px;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
}

body.v43-media .gallery-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 8px;
  object-fit: contain;
  object-position: center;
  transform: none;
}

/* The supplied MSV/SVR assets are long-format products in square source
   canvases. Reducing the presentation padding makes the body easier to read
   without scaling beyond the source canvas or cutting terminals. */
body.v43-media.v43-long-format .gallery-stage {
  height: clamp(340px, 60vw, 510px);
}

body.v43-media.v43-long-format .gallery-stage img {
  padding: 4px;
}

body.v43-media.v43-linear-format .gallery-stage img {
  padding: 6px;
}

body.v43-media .gallery-stage:focus-visible {
  outline: 3px solid #238bc2;
  outline-offset: 3px;
}

body.v43-media .gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
  margin-top: 14px;
}

body.v43-media .gallery-thumbs button {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  padding: 5px;
  border: 1px solid #c3d9e6;
  border-radius: 4px;
  background: #fff;
}

body.v43-media .gallery-thumbs button[aria-pressed="true"] {
  border: 2px solid var(--brand, #0067ad);
  box-shadow: 0 0 0 2px #0067ad1c;
}

body.v43-media .gallery-thumbs button:focus-visible {
  outline: 3px solid #238bc2;
  outline-offset: 2px;
}

body.v43-media .gallery-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 16:9 cover frames. The script marks square and unusually wide source
   images so drawings and product images are letterboxed rather than cropped. */
body.v43-blog-index .v13-page-media,
body.v43-blog-article .v13-page-media,
body.v43-insights .v13-page-media {
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

/* V21/V27 provide higher-specificity 3:2 and fixed-height hero rules. Keep
   the V43 cover contract authoritative for the three page types in scope. */
body.v43-blog-index.v16-site .v16-banner .v13-page-media,
body.v43-blog-article.v16-site .v16-banner .v13-page-media,
body.v43-insights.v16-site .v16-banner .v13-page-media {
  height: auto !important;
  min-height: 0;
  aspect-ratio: 16 / 9 !important;
}

body.v43-blog-index .v13-page-media > img,
body.v43-blog-article .v13-page-media > img,
body.v43-insights .v13-page-media > img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: cover;
  object-position: center;
}

body.v43-blog-index .v16-story-card > img,
body.v43-insights .v13-guide-card > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  padding: 0;
  object-fit: cover;
  object-position: center;
  background: #f4f9fc;
}

body.v43-blog-index .v43-cover-square,
body.v43-blog-article .v43-cover-square,
body.v43-insights .v43-cover-square {
  object-fit: contain !important;
  padding: 14px !important;
  background: #fff;
}

body.v43-blog-index .v43-cover-wide,
body.v43-blog-article .v43-cover-wide,
body.v43-insights .v43-cover-wide {
  object-fit: contain !important;
  padding: 12px !important;
  background: #fff;
}

@media (max-width: 760px) {
  body.v43-media .product-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  /* V27 turns these wrappers into grid contents for compact cards. Product
     galleries need their wrapper restored so the complete gallery is one
     mobile column instead of becoming a narrow grid item. */
  body.v43-media .product-layout > .gallery,
  body.v43-media .product-layout > .product-intro {
    display: block;
  }

  body.v43-media .gallery-stage {
    height: 320px;
    min-height: 320px;
  }

  body.v43-media.v43-long-format .gallery-stage {
    height: 340px;
  }

  body.v43-media .gallery-thumbs button {
    flex-basis: 65px;
    width: 65px;
    height: 65px;
  }

  body.v43-blog-index .v16-story-card > img,
  body.v43-insights .v13-guide-card > img {
    aspect-ratio: 16 / 9;
  }

  body.v43-blog-index .v43-cover-square,
  body.v43-blog-article .v43-cover-square,
  body.v43-insights .v43-cover-square {
    padding: 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.v43-media .gallery-stage img {
    transition: none !important;
  }
}
