/* Natural image flow avoids a square flex container and percentage-height cycle. */
@media (max-width: 600px) {
  .msc-photo-grid {
    /* A portrait stack has no grid tracks to retain a landscape row height. */
    display: block;
  }
  .msc-photo-grid > figure {
    height: auto;
    min-height: 0;
  }
  .msc-photo-grid > figure + figure {
    margin-block-start: 1.5rem;
  }
  .msc-photo-grid > figure > .msc-lightbox-link {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
  }
  .msc-photo-grid > figure > .msc-lightbox-link > img,
  .msc-photo-grid > figure > .msc-lightbox-link > img.msc-constrained-image {
    display: block;
    width: 100%;
    max-width: min(100%, var(--msc-image-width, var(--msc-source-width, 100%)));
    height: auto;
    max-height: none;
    /* WordPress sizes="auto" reserves 3000 x 1500px; use the real image ratio. */
    contain-intrinsic-size: none;
    aspect-ratio: var(--msc-source-ratio, auto);
    object-fit: contain;
    margin: 0 auto;
  }
}
