/**
 * 7 Chakras Gallery Studio — masonry PHONE ONLY.
 * The theme switches to its single-column mobile layout at 520px.
 * Tile height limits intended for a multi-column desktop gallery can produce
 * very wide, ~90px-tall strips once each item occupies the full phone width.
 *
 * Do not alter non-masonry gallery layouts, desktop or tablet styles.
 * Images are displayed in their intrinsic proportions: no stretching/cropping.
 */
@media screen and (max-width: 520px) {
  /* Only Gallery Studio masonry containers — never layouts 1/2/3/4. */
  html body .chakras-managed-gallery.chakras-gallery-layout-masonry > .chakras-gallery-tile,
  html body .chakras-media-page .media-page-tiles.chakras-gallery-layout-masonry > .chakras-gallery-tile,
  html body .chakras-managed-gallery.chakras-gallery-layout-masonry > .chakras-gallery-tile.is-video.has-video-thumb-height {
    display: block !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    overflow: hidden;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }

  /* Let each picture determine its own tile height, without distortion. */
  html body .chakras-managed-gallery.chakras-gallery-layout-masonry > .chakras-gallery-tile > .chakras-gallery-thumb,
  html body .chakras-media-page .media-page-tiles.chakras-gallery-layout-masonry > .chakras-gallery-tile > .chakras-gallery-thumb,
  html body .chakras-managed-gallery.chakras-gallery-layout-masonry > .chakras-gallery-tile.is-video.has-video-thumb-height > .chakras-gallery-thumb {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }

  /* A video without a poster still needs a useful, non-collapsed tile. */
  html body .chakras-managed-gallery.chakras-gallery-layout-masonry > .chakras-gallery-tile > .chakras-gallery-empty,
  html body .chakras-media-page .media-page-tiles.chakras-gallery-layout-masonry > .chakras-gallery-tile > .chakras-gallery-empty {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }
}
