/* Photographs keep their original content. Light corrections follow the image into the viewer. */
img[data-photo-tone="natural"] {
  filter: brightness(1.025) contrast(1.025) !important;
}
img[data-photo-tone="soft"] {
  filter: brightness(1.08) contrast(.98) !important;
}

/* Preserve the legibility of source-limited images in large product frames. */
main img[data-photo-size="native"] {
  object-fit: scale-down !important;
}
[data-family-layout="hardware-product"] .product-detail-lead > .original-v160:has(img[data-photo-size="native"]) {
  width: min(100%, 470px);
  justify-self: center;
}
[data-family-layout="hardware-product"] .product-detail-lead > .original-v160:has(img[src$="/handbook-1930.png"]) {
  width: min(100%, 390px);
}
[data-family-layout="hardware-product"] .product-detail-lead > .original-v160:has(img[src$="/handbook-1937.png"]) {
  width: min(100%, 320px);
}
[data-family-layout="hardware-product"] .product-detail-lead > .original-v160 img[data-photo-size="native"] {
  height: 230px;
}
[data-family-layout="hardware-product"] .product-detail-lead > .original-v160 img[src$="/handbook-1937.png"] {
  height: 310px;
}

/* Lighten the photographic side of the hero while keeping the text side shaded. */
@media (min-width: 901px) {
  body .hero.editorial-hero::before {
    background: linear-gradient(90deg, #022532d6 0%, #0225325e 45%, transparent 77%),
                linear-gradient(0deg, #03243160, transparent 63%);
  }
}

#home-fasteners-cover { scroll-margin-top: 180px; }
#home-fasteners-cover .source-cover-v154 > img {
  object-fit: cover;
  object-position: center;
  object-view-box: inset(9.5% 0 13.5% 35%);
  filter: contrast(.96) brightness(1.11) saturate(.98);
}

/* Display copies already include the tonal corrections. */
img[data-photo-retouched="true"] { filter: none !important; }

/* Art direction for the electronic catalogue covers. Keep the original assets intact. */
body[data-layout-v112="materials"] .material-category-grid > .page-card > .category-visual:is([src*="catalog-covers-v173/"], [src*="-clean-"]) {
  object-fit: cover;
  object-position: var(--catalog-position, 50% 50%) !important;
  object-view-box: inset(var(--catalog-inset, 0)) !important;
}
.category-visual[src$="/light-steel-joint.jpg"] {
  --catalog-position: 50% 57%;
  --catalog-inset: 12% 0 10%;
}
.category-visual[src$="/kmew-facade.jpg"] { --catalog-inset: 0 0 0 31%; }
.category-visual[src*="/osb-composite-clean-"] {
  --catalog-position: 50% 72%;
}
.category-visual[src$="/breather-membrane.png"] { --catalog-position: 50% 26%; }
.category-visual[src$="/bathroom-interior.jpg"] {
  --catalog-position: 50% 81%;
  --catalog-inset: 4% 3% 7% 0;
}
.selection-item > .source-cover-v154:has(> img:is([src*="catalog-covers-v173/"], [src*="-clean-"])) { position: relative; }
.selection-item > .source-cover-v154 > img:is([src*="catalog-covers-v173/"], [src*="-clean-"]) { object-fit: cover; }
#home-fasteners-cover .source-cover-v154 > img[src$="/steel-truss-joints.jpg"] {
  object-view-box: none;
  object-position: 50% 21%;
}
.selection-item .source-cover-v154 > img[src*="/nichiha-wall-texture-clean-"] {
  object-position: 50% 100%;
}
.selection-item .source-cover-v154 > img[src*="/earthen-tile-roof-clean-"] {
  object-position: 50% 100%;
}

/* Replace the old catalogue corner mark with the same owl artwork used in the header. */
.material-category-grid > .page-card:has(> img[src*="/osb-composite-clean-"])::before,
.selection-item > .source-cover-v154:has(> img:is([src*="/nichiha-wall-texture-clean-"], [src*="/earthen-tile-roof-clean-"]))::before {
  content: "";
  position: absolute;
  inset: 9px auto auto 9px;
  z-index: 1;
  width: 37px;
  height: 40px;
  background: #fbfaf5 url("gbb-logo.png") center 20% / 167% auto no-repeat;
  border: 1px solid #153d4826;
  border-radius: 4px;
  pointer-events: none;
}

/* The tools list uses one image stage, including the tall aviation snips.
   Contain preserves every original tool; no product is stretched or cropped. */
body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-product-link-v61 {
  align-items: center;
  gap: 22px;
}
body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-spec-photo-v61 {
  display: grid;
  place-items: center;
  flex: 0 0 160px;
  width: 160px;
  height: 160px;
  aspect-ratio: 1;
  padding: 10px;
  background: #fff;
  border: 1px solid #bdcbb7;
  border-radius: 3px;
  overflow: hidden;
}
body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-spec-photo-v61 > img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  aspect-ratio: auto;
  object-fit: contain !important;
  object-position: center;
  object-view-box: none;
  background: #fff;
}
@media (max-width: 1250px) {
  body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-spec-photo-v61 {
    flex-basis: 136px;
    width: 136px;
    height: 136px;
    padding: 9px;
  }
}
@media (max-width: 600px) {
  body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-product-link-v61 { gap: 16px; }
  body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-spec-photo-v61 {
    flex-basis: 108px;
    width: 108px;
    height: 108px;
    padding: 8px;
  }
}
@media (max-width: 380px) {
  body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-product-link-v61 { gap: 12px; }
  body[data-layout-v112="table"] #product-specifications:has([data-product-id="tool-grommet"]) .catalog-spec-photo-v61 {
    flex-basis: 88px;
    width: 88px;
    height: 88px;
    padding: 6px;
  }
}
