/**
 * Variant CSS: gallery--quad-asym-mosaic
 *
 * An asymmetric, interlocked mosaic of exactly four photos: one tall frame on the
 * left spanning two rows, a wide frame across the top-right, and two near-square
 * frames side by side beneath it (hover zoom). Unlike the even 2×2, the "1 hero + 3
 * strip" (hero-plus-three-strip) or the panorama-over-pair (mosaic-wide-top-pair):
 * the tall left block interlocks with a 1+2 stack on the right for an off-balance
 * rhythm with no single hero. Built as a 3-column / 2-row grid with explicit area
 * placement; the tall tile is the grid's height reference so the right stack matches
 * it. Text stays --ink (polarity aware); kicker + the em take --accent; tiles use
 * --decor-radius and images carry --photo-filter. Image src are swapped by the photo
 * system. Dedicated to exactly four photos. Part of the `gallery` role.
 */

body.aibt-universal .universal-gallery--quad-asym-mosaic {
	padding-block: calc(clamp(3rem, 7vw, 5.5rem) * var(--density, 1));
	background: var(--background);
	color: var(--text-primary);
}

/* Intro. */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__intro {
	margin-bottom: clamp(2rem, 4vw, 3rem);
}

body.aibt-universal .universal-gallery--quad-asym-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--quad-asym-mosaic .universal-gallery__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 !important;
}

body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__headline em {
	color: var(--accent) !important;
	font-style: italic;
}

/* Mosaic: 3 columns, 2 rows. Tall tile = col 1 across both rows; wide tile = cols
   2-3 on row 1; the two square tiles split cols 2 and 3 on row 2. Row height is
   driven by the wide-plus-square right stack; the tall tile stretches to match. */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic {
	display: grid;
	grid-template-columns: 1.05fr 1fr 1fr;
	grid-template-rows: auto auto;
	gap: clamp(0.7rem, 1.6vw, 1.15rem);
}

body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item {
	margin: 0 !important;
	overflow: hidden;
	border-radius: var(--decor-radius, 14px);
	min-height: 0; /* allow grid items to shrink inside fixed tracks (no overflow) */
}

/* Tall left tile spans both rows. */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--tall {
	grid-column: 1 / 2;
	grid-row: 1 / 3;
}

/* Wide tile across the top-right two columns. */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--wide {
	grid-column: 2 / 4;
	grid-row: 1 / 2;
}

/* The two square tiles fall into row 2, cols 2 and 3 automatically (source order). */

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

/* The tall + wide tiles are stretched by the grid, so their img must fill the cell
   height (the intrinsic aspect-ratio is only a hint for the square tiles' own row). */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--tall,
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--wide {
	display: block;
}

body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item:hover img,
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item:focus-within img {
	transform: scale(1.05);
}

/* Keyboard focus parity with hover (image becomes focusable when a client links it). */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item a:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 3px;
	border-radius: var(--decor-radius, 14px);
}

/* Robustness: the count-fit trimmer keeps the first N uploads. If fewer than 4
   survive the right stack can leave a hole. Collapse to a 2-column flow grid when
   the 4th (or 3rd) tile is missing so the mosaic stays gap-free. Degrades safely
   where :has() is unsupported (full 4-up mosaic is the authored default). */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(4))) {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: none;
}
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(4))) .universal-gallery__item--tall,
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(4))) .universal-gallery__item--wide {
	grid-column: auto;
	grid-row: auto;
}
/* Two-or-one survivors: a single full-width tile reads cleaner than a lone half. */
body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(2))) .universal-gallery__item {
	grid-column: 1 / -1;
}

/* Tablet: keep the interlocked mosaic; just trim the gap. */
@media (min-width: 641px) and (max-width: 959px) {
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic {
		gap: clamp(0.6rem, 1.8vw, 0.95rem);
	}
}

/* Mobile: the interlocking can't hold in a narrow column — flatten to a single
   column in source order (tall, wide, square, square). Each tile takes its own
   intrinsic aspect-ratio; the tall/wide get an explicit ratio so they aren't
   stretched without a grid to size them. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__mosaic {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		gap: clamp(0.7rem, 3vw, 1rem);
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--tall {
		grid-column: auto;
		grid-row: auto;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--wide {
		grid-column: auto;
		grid-row: auto;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--tall img {
		aspect-ratio: 4 / 3;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item--wide img {
		aspect-ratio: 16 / 9;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item:not(.universal-gallery__item--tall):not(.universal-gallery__item--wide) img {
		aspect-ratio: 1 / 1;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__kicker {
		letter-spacing: var(--tracking-wide) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item img {
		transition: none;
	}
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item:hover img,
	body.aibt-universal .universal-gallery--quad-asym-mosaic .universal-gallery__item:focus-within img {
		transform: none;
	}
}
