.r5-home-other-media img[data-packaging-photo] {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px 12px;
  box-sizing: border-box;
}

.box-card img[data-packaging-photo] {
  object-fit: contain;
  padding: 10px 12px;
  box-sizing: border-box;
}

.packaging-gallery { clear: both; margin: 15px 0 20px; }
.packaging-gallery[hidden], img[data-packaging-stock][hidden] { display: none !important; }
.packaging-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.packaging-photo { display: flex; flex-direction: column; min-width: 0; margin: 0; }

.packaging-photo-enlarge {
  display: grid;
  place-items: center;
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid #e3e7e3;
  border-radius: 3px;
  background: #f2f4f0;
  color: #334842;
  cursor: zoom-in;
}

.packaging-photo-paper .packaging-photo-enlarge { background: #fff; }

.packaging-photo-enlarge:is(:focus-visible), .packaging-photo-thumbs button:focus-visible, .packaging-photo-close:focus-visible {
  outline: 3px solid #286c61;
  outline-offset: 2px;
}

.packaging-photo-enlarge::after {
  content: '+';
  position: absolute;
  bottom: 7px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #d5ded7;
  border-radius: 50%;
  background: #fff;
  color: #334842;
  font: 18px/1 Arial, sans-serif;
}

.packaging-photo .packaging-photo-enlarge img,
.box-detail-support .packaging-photo .packaging-photo-enlarge img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  float: none;
  margin: 0;
  box-sizing: border-box;
  padding: 8px 12px;
}

.packaging-photo-paper .packaging-photo-enlarge img { padding: 0; }
.packaging-photo figcaption { color: #394642; font-size: 13px; line-height: 1.4; font-weight: 500; margin: 7px 0 0; }
.packaging-photo-thumbs { display: none; }

.custom-box-callout[data-packaging-callout] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 32%);
  align-items: center;
  gap: 14px 28px;
}

[data-packaging-callout] > div { grid-column: 1; grid-row: 1; align-self: end; }
[data-packaging-callout] > a { grid-column: 1; grid-row: 2; justify-self: start; align-self: start; }
[data-packaging-callout] > figure { grid-column: 2; grid-row: 1 / 3; }
[data-packaging-callout] .packaging-photo-enlarge { aspect-ratio: 1.65; background: #f4f8f1; border-color: #dce7db; }
[data-packaging-callout] .packaging-photo-enlarge img { aspect-ratio: 1.65; }

#packaging-photo-dialog {
  position: fixed;
  inset: 0;
  width: min(90vw, 900px);
  height: auto;
  max-height: 92vh;
  margin: auto;
  padding: 40px 15px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #17211d;
  box-sizing: border-box;
}

#packaging-photo-dialog:not([open]) { display: none; }
#packaging-photo-dialog::backdrop { background: rgb(17 23 21 / 70%); }
#packaging-photo-dialog img { display: block; width: 100%; height: min(62vh, 620px); object-fit: contain; }
#packaging-photo-dialog p { text-align: center; margin: 10px 0 0; }

.packaging-photo-close {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  background: #fff;
  color: #111;
  font: 28px/1 Arial, sans-serif;
  cursor: pointer;
}

@media (max-width: 660px) {
  .packaging-photo-grid { display: block; }
  .packaging-gallery:not([data-interactive]) .packaging-photo + .packaging-photo { margin-top: 12px; }
  .packaging-gallery[data-interactive] .packaging-photo:not(.is-active) { display: none; }
  .packaging-gallery[data-interactive] .packaging-photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
  .packaging-photo-thumbs button {
    display: flex;
    align-items: center;
    min-height: 42px;
    max-width: 100%;
    gap: 5px;
    padding: 3px 6px 3px 3px;
    border: 1px solid #d4dcd7;
    border-radius: 3px;
    background: #fff;
    color: #35463f;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  .packaging-photo-thumbs button[aria-pressed="true"] { border-color: #397364; outline: 1px solid #397364; }
  .box-detail-support .packaging-photo-thumbs img { width: 36px; height: 32px; object-fit: contain; margin: 0; float: none; }
  .custom-box-callout[data-packaging-callout] { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  [data-packaging-callout] > :is(div, a, figure) { grid-column: 1; }
  [data-packaging-callout] > figure { grid-row: 2; }
  [data-packaging-callout] > a { grid-row: 3; }
}


/* The counter display carton uses one photo; other boxes keep their current media. */
.box-detail-image[data-display-photo] > img {
  object-fit: contain;
}

.box-detail-image [data-box-detail-view][hidden] {
  display: none !important;
}

.packaging-gallery[data-packaging-gallery="display"] .packaging-photo-grid {
  grid-template-columns: minmax(0, 420px);
}

.original-showroom-stage[data-display-showroom] {
  display: block;
  height: auto;
  min-height: 0;
  padding: clamp(16px, 3vw, 32px);
}

[data-display-showroom] .packaging-photo {
  width: min(100%, 640px);
  margin: auto;
}
