.punnet-gallery {
  display: grid;
  width: 100%;
  gap: 10px;
}

.punnet-gallery .pdp-photo-frame {
  position: relative;
  display: grid;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: #fff;
}

.pdp .stage:has(.punnet-gallery) {
  align-self: start;
  padding: clamp(18px, 2.4vw, 32px);
}

main > .wrap:nth-of-type(2):has(> .pdp) {
  padding-top: clamp(24px, 3vw, 40px) !important;
  padding-bottom: 0;
}

main > .wrap:nth-of-type(2):has(> .pdp) > .pdp {
  padding-top: 0;
}

.punnet-gallery .pdp-product-photo,
.pdp .stage .punnet-gallery .pdp-photo-frame[data-media-kind] .pdp-product-photo[src] {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: clamp(8px, 1.5vw, 18px);
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.punnet-gallery > .caption {
  margin: 0;
  line-height: 1.3;
}

.punnet-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.punnet-gallery__thumb {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dfe4f2;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.punnet-gallery__thumb:hover,
.punnet-gallery__thumb:focus-visible {
  border-color: #334aa0;
  box-shadow: 0 8px 24px rgba(27, 48, 120, 0.13);
  outline: none;
  transform: translateY(-2px);
}

.punnet-gallery__thumb[aria-current="true"] {
  border-color: #334aa0;
  box-shadow: inset 0 0 0 1px #334aa0;
}

.punnet-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.punnet-gallery [data-punnet-main] {
  transition: opacity 150ms ease, transform 260ms ease;
}

.punnet-gallery.is-changing [data-punnet-main] {
  opacity: 0.35;
  transform: scale(0.985);
}

.media-spec .spec-thumb img {
  object-fit: contain;
  background: #fff;
}

/* Related products on fruit-punnet detail pages */
.pdp .hairbox {
  margin-top: clamp(28px, 4vw, 42px) !important;
  padding: clamp(18px, 2vw, 24px) 0 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid #dfe4f2;
}

.pdp .hairbox > .label {
  display: block;
  margin-bottom: 8px;
}

.pdp .hairbox table.spec {
  width: 100%;
  min-width: 0;
  margin-top: 0 !important;
  table-layout: fixed;
}

.pdp .hairbox table.spec th,
.pdp .hairbox table.spec td {
  box-sizing: border-box;
  padding-right: clamp(8px, 1.4vw, 16px);
  vertical-align: middle;
}

.pdp .hairbox table.spec th:nth-child(1),
.pdp .hairbox table.spec td:nth-child(1) {
  width: 48%;
}

.pdp .hairbox table.spec th:nth-child(2),
.pdp .hairbox table.spec td:nth-child(2) {
  width: 18%;
}

.pdp .hairbox table.spec th:nth-child(3),
.pdp .hairbox table.spec td:nth-child(3) {
  width: 34%;
  padding-right: 0;
  text-align: right;
}

.pdp .hairbox table.spec td {
  padding-top: 14px;
  padding-bottom: 14px;
  line-height: 1.35;
}

.pdp .hairbox table.spec td:first-child a {
  display: inline;
  line-height: 1.35;
  text-wrap: pretty;
}

@media (max-width: 720px) {
  .pdp .hairbox {
    padding-top: 18px;
  }

  .pdp .hairbox table.spec tr:first-child {
    display: none;
  }

  .pdp .hairbox table.spec tr:not(:first-child) {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
    column-gap: 18px;
    padding: 16px 0;
    border-bottom: 1px solid #dfe4f2;
  }

  .pdp .hairbox table.spec td,
  .pdp .hairbox table.spec td:nth-child(n) {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .pdp .hairbox table.spec td:first-child {
    grid-column: 1 / -1;
    padding-right: 28px;
    padding-bottom: 12px;
    font-size: 16px;
  }

  .pdp .hairbox table.spec td:first-child::after {
    position: absolute;
    top: 15px;
    right: 1px;
    content: "↗";
    color: #334aa0;
    font-size: 15px;
  }

  .pdp .hairbox table.spec td:nth-child(2),
  .pdp .hairbox table.spec td:nth-child(3) {
    color: #5b6478;
    font-size: 13px;
  }

  .pdp .hairbox table.spec td:nth-child(2)::before,
  .pdp .hairbox table.spec td:nth-child(3)::before {
    display: block;
    margin-bottom: 4px;
    color: #7c8497;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .pdp .hairbox table.spec td:nth-child(2)::before {
    content: "Size";
  }

  .pdp .hairbox table.spec td:nth-child(3)::before {
    content: "Packing";
  }
}

@media (max-width: 680px) {
  .pdp .stage:has(.punnet-gallery) {
    padding: 14px;
  }

  .punnet-gallery .pdp-photo-frame {
    aspect-ratio: 4 / 3;
  }

  .punnet-gallery .pdp-product-photo,
  .pdp .stage .punnet-gallery .pdp-photo-frame[data-media-kind] .pdp-product-photo[src] {
    padding: 6px;
  }

  .punnet-gallery__thumbs {
    gap: 7px;
  }

  .punnet-gallery__thumb {
    border-radius: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .punnet-gallery__thumb,
  .punnet-gallery [data-punnet-main] {
    transition: none;
  }
}
