/**
 * Variant CSS: gallery--stacked-offset-pair
 *
 * Two wide frames stacked one above the other, the second shifted sideways from
 * the first (hover zoom) — a stepped layout with captions on the open margin.
 * Unlike two photos side by side: a vertical stack with an offset walks the eye
 * down in a zigzag, like a magazine spread. The lead row hugs the left; the second
 * row is indented from the right, each image capped below full width so the caption
 * sits in the freed margin. Text stays --ink (polarity aware); kicker + the em +
 * the caption tick take --accent; images carry --photo-filter. Image src are
 * swapped by the photo system. Dedicated to exactly two photos. Part of the
 * `gallery` role.
 */

body.aibt-universal .universal-gallery--stacked-offset-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--stacked-offset-pair .universal-gallery__intro {
	margin-bottom: clamp(1.8rem, 4vw, 3rem);
}

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

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

/* The vertical stack; rows overlap-pull slightly to feel like a spread. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__stack {
	display: flex;
	flex-direction: column;
	gap: clamp(1.6rem, 4vw, 3rem);
}

/* A row = a capped-width photo + a caption on the open side. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row {
	margin: 0 !important;
	display: flex;
	align-items: flex-end;
	gap: clamp(1rem, 2.5vw, 1.8rem);
	max-width: 80%;
}

/* Lead row hugs the left; caption sits to the right of the image. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row--lead {
	margin-right: auto !important;
}

/* Offset row is pushed to the right edge; caption sits to its left. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row--offset {
	margin-left: auto !important;
	flex-direction: row-reverse;
}

/* Photo. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__img {
	margin: 0 !important;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	border-radius: var(--decor-radius, 16px);
	box-shadow: var(--decor-shadow, none);
}

body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__img img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	filter: var(--photo-filter, none);
	transition: transform var(--duration-slow, 500ms) var(--ease-default, ease);
}

body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row:hover .universal-gallery__img img,
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row:focus-within .universal-gallery__img img {
	transform: scale(1.05);
}

/* Caption: a slim vertical label on the margin side. */
body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__caption {
	flex: 0 0 auto;
	width: clamp(7rem, 14vw, 11rem);
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	color: var(--ink) !important;
	opacity: 0.84;
	margin: 0 0 0.4rem 0 !important;
	padding-top: var(--space-sm);
	border-top: 2px solid var(--accent);
}

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

/* Tablet: keep the stepped stack but widen the rows so photos stay generous. */
@media (min-width: 641px) and (max-width: 959px) {
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row {
		max-width: 92%;
	}
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__caption {
		width: clamp(6rem, 16vw, 9rem);
	}
}

/* Mobile: drop the offset; full-width rows, caption beneath each photo. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row,
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row--lead,
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row--offset {
		flex-direction: column;
		align-items: stretch;
		max-width: 100%;
		margin-inline: 0 !important;
		gap: var(--space-sm);
	}
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__caption {
		width: auto;
		padding-top: var(--space-xs);
	}
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__kicker {
		letter-spacing: var(--tracking-wide) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__img img {
		transition: none;
	}
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row:hover .universal-gallery__img img,
	body.aibt-universal .universal-gallery--stacked-offset-pair .universal-gallery__row:focus-within .universal-gallery__img img {
		transform: none;
	}
}
