/*
 * Strikers theme: Gallery page. Split out of style.css (STR-185, speed) so other pages
 * don't download it. Loaded after style.css only where it is used:
 *   /gallery/ (page-gallery.html)
 * (functions.php strikers_enqueue_page_styles).
 * Same rules as style.css: theme.json tokens only, no colors or sizes here.
 */

/* ---- Gallery page (STR-172): the Gallery blocks staff manage in the page content become a
   bento grid on black. Fixed row height (theme.json custom gallery-row), tiles span rows and
   columns in a repeating rhythm, dense packing fills the holes, every photo is cropped to its
   tile (object-fit cover), so any upload, portrait or landscape, fits without layout shift.
     phones  2 columns: every 6th from the 1st is 2 x 2 (the lead), every 6th from the 4th is tall
     782px+  4 columns: 7n+1 is 2 x 2, 7n+4 tall (1 x 2), 7n+6 wide (2 x 1)
   Soft corners (radius md), generous gaps (8px phones, 16px from 782px). Hover (mouse only,
   motion allowed): the photo eases to 1.04 inside its tile; that is the page's one motion.
   Click opens WordPress's own lightbox (core "Expand on click", Interactivity API).
   Core's gallery rules use :not(#individual-image) (id specificity), so these match it. ---- */
.strikers-gallery-content > .strikers-gallery-heading {
	margin: var(--wp--preset--spacing--16) 0 var(--wp--preset--spacing--6);
}

.strikers-gallery-content > .strikers-gallery-heading:first-child {
	margin-top: 0;
}

.strikers-gallery-content .wp-block-gallery.has-nested-images {
	display: grid;
	gap: var(--wp--preset--spacing--2);
	grid-auto-flow: row dense;
	grid-auto-rows: var(--wp--custom--gallery-row);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
}

.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) {
	border-radius: var(--wp--custom--radius--md);
	height: 100%;
	margin: 0;
	overflow: hidden;
	width: auto;
}

.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(6n + 1) {
	grid-column: span 2;
	grid-row: span 2;
}

.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(6n + 4) {
	grid-row: span 2;
}

@media (min-width: 782px) {
	.strikers-gallery-content .wp-block-gallery.has-nested-images {
		gap: var(--wp--preset--spacing--4);
		grid-auto-rows: var(--wp--custom--gallery-row-wide);
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(n) {
		grid-column: auto;
		grid-row: auto;
	}

	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(7n + 1) {
		grid-column: span 2;
		grid-row: span 2;
	}

	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(7n + 4) {
		grid-row: span 2;
	}

	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):nth-child(7n + 6) {
		grid-column: span 2;
	}
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) img {
		transition: transform 0.5s ease;
	}

	.strikers-gallery-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image):hover img {
		transform: scale(1.04);
	}
}

/* Keyboard: core's lightbox button (and any link) gets the blue ring inside the tile, since the
   tile clips overflow. 6B7BFF 5.90:1 on black. */
.strikers-gallery-content .wp-block-gallery figure.wp-block-image :is(a, button):focus-visible {
	box-shadow: none;
	outline-offset: calc(-2 * var(--wp--custom--border--width));
}

/* Lightbox "Enlarge" (STR-172, QA: core's button is 20x20px): the button now covers the whole
   tile, so the tap target is the photo itself (rows are at least 8.5rem tall). Core's small chip stays
   as the cue, drawn on the icon in the top-right corner: shown on hover and keyboard focus,
   always shown on touch screens. Core sets top/right inline from its script, hence
   !important. The keyboard ring (rule above) now outlines the whole tile.
   STR-191: core gives the button a frosted backdrop (blur 16px); stretched over the tile it
   blurred every photo, so it is switched off. */
.strikers-gallery-content .wp-block-gallery figure.wp-block-image .lightbox-trigger {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	align-items: flex-start;
	background: none;
	border-radius: 0;
	bottom: 0;
	height: 100%;
	justify-content: flex-end;
	left: 0;
	opacity: 1;
	padding: var(--wp--preset--spacing--4);
	right: 0 !important;
	top: 0 !important;
	width: 100%;
}

.strikers-gallery-content .wp-block-gallery figure.wp-block-image .lightbox-trigger svg {
	background-color: color-mix(in srgb, var(--wp--custom--look--night--surface) 45%, transparent);
	border-radius: var(--wp--custom--radius--sm);
	box-sizing: content-box;
	opacity: 0;
	padding: var(--wp--preset--spacing--1);
}

.strikers-gallery-content .wp-block-gallery figure.wp-block-image .lightbox-trigger:is(:hover, :focus-visible) svg {
	opacity: 1;
}

@media (hover: none) {
	.strikers-gallery-content .wp-block-gallery figure.wp-block-image .lightbox-trigger svg {
		opacity: 1;
	}
}

/* Gallery "what's here" list: one area per row on a hairline, the bold name leads. */
.strikers-area-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.strikers-area-list > li {
	border-top: var(--wp--custom--border--hairline) solid var(--wp--preset--color--hairline-dark);
	margin: 0;
	padding: var(--wp--preset--spacing--4) 0;
}
