/* Across borders photo wall: a core Gallery block with the class "py-wall", laid out as fixed
   tiles. FRONT END ONLY (enqueued in inc/enqueue.php, not an editor style), so the editor keeps
   the normal Gallery look (see editor.css for its notes).

   12-column grid with 190 px rows: photo 1 is large (6 x 2), photos 2-5 small (3 x 1),
   photos 6-7 wide (6 x 1). Each photo is cropped to its tile, so no image size, resize or
   crop setting can stretch the grid. Auto-placement (dense) keeps the mosaic closed when photos
   are removed or added. Spans come from custom properties so the phone layout can remap them.
   The selectors are long on purpose: they must beat core's gallery rules, which use
   :not(#individual-image) for extra weight. */

.wp-block-gallery.has-nested-images.py-wall {
	display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 190px; grid-auto-flow: dense; gap: 10px;
	margin: 0; counter-reset: none;
}

/* Tile sizes: defaults (small), then per position. */
.py-wall > figure { --py-c: 3; --py-r: 1; --py-mc: 1; --py-mr: 1; }
.py-wall > figure:nth-of-type(1) { --py-c: 6; --py-r: 2; --py-mc: 2; --py-mr: 2; }
.py-wall > figure:nth-of-type(6), .py-wall > figure:nth-of-type(7) { --py-c: 6; --py-mc: 2; }
.py-wall > figure:nth-of-type(4):last-of-type { --py-c: 6; }
.py-wall > figure:nth-of-type(6):last-of-type { --py-c: 12; }

.py-wall.wp-block-gallery.has-nested-images > figure.wp-block-image:not(#py-wall) {
	grid-column: span var(--py-c); grid-row: span var(--py-r);
	position: relative; display: block; flex: none; width: auto; max-width: none; min-width: 0; margin: 0; overflow: hidden; background: #2A2A2E;
}
.py-wall.wp-block-gallery.has-nested-images > figure.wp-block-image:not(#py-wall) img {
	position: absolute; inset: 0; display: block; width: 100% !important; height: 100% !important; max-width: none; object-fit: cover;
}
.py-wall.wp-block-gallery.has-nested-images > figure.wp-block-image:not(#py-wall) figcaption {
	position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; width: auto; max-height: none; margin: 0; padding: 0; overflow: visible;
	background: none; font-size: 11px; line-height: 1.3; color: #D2D2D8; text-align: left; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.py-wall.wp-block-gallery.has-nested-images > figure.wp-block-image:not(#py-wall)::before { display: none; }

/* A caption for the whole gallery takes a full row under the photos. */
.py-wall.wp-block-gallery > .blocks-gallery-caption { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--py-muted); text-align: left; }

@media (max-width: 700px) {
	.wp-block-gallery.has-nested-images.py-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 150px; gap: 8px; }
	.py-wall.wp-block-gallery.has-nested-images > figure.wp-block-image:not(#py-wall) { grid-column: span var(--py-mc); grid-row: span var(--py-mr); }
}
