/**
 * Variant CSS: gallery--feature-mosaic
 *
 * A mosaic with hierarchy — one large lead image (a 2×2 tile) and five smaller
 * ones in an even square 3×3 grid, with a subtle hover zoom. A magazine rhythm
 * vs the uniform grid or random-height masonry. Robust to count: on mobile the
 * feature reverts to a 1×1 tile so the 2-column grid stays gap-free. Tiles use
 * --decor-radius; images carry --photo-filter.
 */

body.aibt-universal .universal-gallery--feature-mosaic {
	padding-block: calc(clamp(3rem, 7vw, 5.5rem) * var(--density, 1));
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__intro {
	margin-bottom: clamp(2rem, 4vw, 3rem);
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__kicker {
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 600 !important;
	letter-spacing: var(--tracking-widest) !important;
	text-transform: uppercase !important;
	color: var(--accent) !important;
	margin: 0 0 var(--space-sm) 0 !important;
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 !important;
}

/* The mosaic grid. */
body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__mosaic {
	display: grid !important;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(0.5rem, 1.2vw, 0.9rem);
	grid-auto-flow: dense;
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item {
	margin: 0 !important;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--decor-radius, 12px);
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: var(--photo-filter, none);
	transition: transform 420ms var(--ease-default, ease);
}

body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item:hover img {
	transform: scale(1.05);
}

/* The lead tile spans 2×2. */
body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item--feature {
	grid-column: span 2;
	grid-row: span 2;
}

/* Robustness: the count-fit trims the gallery to the client's photo count. The
   2×2 feature only tiles cleanly into a full 6-photo 3×3 grid — with fewer
   photos a big feature + a couple of smalls looks lopsided. So feature only
   when the 6th tile exists; otherwise fall back to a uniform grid. Degrades
   gracefully (feature stays 2×2) where :has() is unsupported. */
body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(6))) .universal-gallery__item--feature {
	grid-column: auto;
	grid-row: auto;
}

/* Tablet + mobile: even 2-column grid — feature reverts to 1×1 so the 6 tiles
   form a clean 3-row grid with no trailing gap. */
@media (max-width: 880px) {
	body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__mosaic {
		grid-template-columns: repeat(2, 1fr);
	}
	body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item--feature {
		grid-column: auto;
		grid-row: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-gallery--feature-mosaic .universal-gallery__item:hover img {
		transform: none;
	}
}
