/**
 * Variant CSS: gallery--mosaic-wide-top-pair
 *
 * A three-photo mosaic — one wide panoramic frame (16:7) on top across the full
 * width, then two frames side by side below (hover zoom). Unlike the left-led
 * triptych or the even row: this is a two-row, panoramic-on-top / even-below
 * layout. Built as a 2-column grid where the wide tile spans both columns on the
 * first row and the pair takes one column each on the second. 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 three photos. Part of the `gallery` role.
 */

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

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

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

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

/* Layout: 2-column grid. The wide tile spans both columns (top row); the pair
   takes one column each (bottom row). Each tile carries its own aspect-ratio so
   heights are intrinsic — no squish. */
body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__mosaic {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(0.7rem, 1.6vw, 1.1rem);
}

body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__item {
	margin: 0 !important;
	overflow: hidden;
	border-radius: var(--decor-radius, 14px);
}

body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__item--wide {
	grid-column: 1 / -1;
}

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

body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__item:hover img,
body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__item:focus-within img {
	transform: scale(1.04);
}

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

/* Robustness: the count-fit trims to the client's upload count. The bottom pair
   needs both tiles to fill the two columns. With one tile left below (wide + 1),
   the lone bottom frame would sit half-width with a gap beside it — let it span
   the full width too so the mosaic reads as a clean panoramic stack. Degrades
   safely where :has() is unsupported (pair simply keeps two columns). */
body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__mosaic:not(:has(.universal-gallery__item:nth-child(3))) .universal-gallery__item {
	grid-column: 1 / -1;
}

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

/* Mobile: the bottom pair gets too narrow side by side — stack everything into a
   single column. The wide tile stays panoramic on top, the pair flows below.
   Each tile keeps its aspect-ratio so nothing squishes. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__mosaic {
		grid-template-columns: 1fr;
		gap: clamp(0.6rem, 3vw, 1rem);
	}
	body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__item--wide {
		grid-column: auto;
		aspect-ratio: 16 / 9; /* a touch taller than 16:7 so it isn't a thin sliver on a phone */
	}
	body.aibt-universal .universal-gallery--mosaic-wide-top-pair .universal-gallery__kicker {
		letter-spacing: var(--tracking-wide) !important;
	}
}

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