/**
 * Variant CSS: gallery--triptych-lead-pair
 *
 * A deliberate three-photo composition — one large lead frame on the left and
 * two smaller frames stacked on the right (hover zoom). A triptych with
 * hierarchy vs three equal tiles: one image leads, two support 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.
 * Part of the `gallery` role.
 */

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

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

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

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

/* The triptych: lead column (left) + a stacked pair (right). Two equal rows so
   the two right tiles together match the lead's height. */
body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__triptych {
	display: grid;
	grid-template-columns: 1.55fr 1fr;
	grid-template-rows: repeat(2, 1fr);
	gap: clamp(0.6rem, 1.4vw, 1rem);
	aspect-ratio: 3 / 2;
}

body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item {
	margin: 0 !important;
	overflow: hidden;
	border-radius: var(--decor-radius, 14px);
	min-height: 0; /* let grid tracks size the tile; no intrinsic-height overflow */
}

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

body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item:hover img {
	transform: scale(1.05);
}

/* Lead spans the left column across both rows. */
body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item--lead {
	grid-row: span 2;
}

/* Robustness: the count-fit trims the gallery to the client's upload count. The
   lead's 2-row span only resolves cleanly with the full pair present — with
   fewer photos a tall lead beside one (or zero) small tiles looks lopsided. So
   the lead spans 2 rows only when the 3rd tile exists; otherwise everything
   falls back to a single, even row. Degrades gracefully where :has() is
   unsupported (lead simply stays 2-row). */
body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__triptych:not(:has(.universal-gallery__item:nth-child(3))) {
	grid-template-rows: 1fr;
	aspect-ratio: 16 / 9;
}
body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__triptych:not(:has(.universal-gallery__item:nth-child(3))) .universal-gallery__item--lead {
	grid-row: auto;
}

/* Tablet: keep the composition but a touch shorter. */
@media (max-width: 959px) {
	body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__triptych {
		aspect-ratio: 16 / 10;
	}
}

/* Mobile: a side-by-side triptych gets too cramped — stack into a single
   column where the lead leads and the pair follows. Heights become intrinsic
   (fixed aspect per tile) so nothing squishes. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__triptych {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		aspect-ratio: auto;
		gap: clamp(0.6rem, 3vw, 1rem);
	}
	body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item--lead {
		grid-row: auto;
	}
	body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item {
		aspect-ratio: 4 / 3;
	}
	body.aibt-universal .universal-gallery--triptych-lead-pair .universal-gallery__item--lead {
		aspect-ratio: 16 / 10;
	}
}

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

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