/*
 * Shared story-gallery treatment.
 *
 * Keep this stylesheet after page-level <style> blocks. Older stories used
 * several gallery class names and frequently left the browser's default
 * figure margin in place, which made otherwise full-size images look tiny.
 */
:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(16px, 2vw, 22px);
  margin: 28px 0;
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(11, 31, 66, 0.14);
  border-radius: 16px;
  background: #f4f7fa;
  box-shadow: 0 10px 24px rgba(11, 31, 66, 0.06);
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) > :is(img, .gallery-media, .gallery-photo) {
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #edf2f6;
  padding: 0;
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) > .gallery-photo {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) > .gallery-media {
  display: grid;
  place-items: center;
  overflow: hidden;
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) > .gallery-media > img {
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
  padding: 0;
}

:is(
  .award-gallery,
  .campaign-gallery,
  .gallery,
  .gallery-grid,
  .image-gallery,
  .image-grid,
  .inline-gallery,
  .inline-photo-grid,
  .media-gallery,
  .offer-gallery,
  .official-gallery,
  .official-photo-gallery,
  .official-photo-grid,
  .photo-grid,
  .photo-pair,
  .princess-gallery,
  .product-gallery,
  .product-grid,
  .product-photo-grid
) > :is(figure, article.product-card) > figcaption {
  height: 100%;
  margin: 0;
  border-top: 1px solid rgba(11, 31, 66, 0.11);
  background: #f4f7fa;
  color: #526173;
  padding: 12px 14px 14px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

@media (max-width: 720px) {
  :is(
    .award-gallery,
    .campaign-gallery,
    .gallery,
    .gallery-grid,
    .image-gallery,
    .image-grid,
    .inline-gallery,
    .inline-photo-grid,
    .media-gallery,
    .offer-gallery,
    .official-gallery,
    .official-photo-gallery,
    .official-photo-grid,
    .photo-grid,
    .photo-pair,
    .princess-gallery,
    .product-gallery,
    .product-grid,
    .product-photo-grid
  ) {
    grid-template-columns: minmax(0, 1fr);
  }
}
