/**
 * Variant CSS: gallery--justified-rows
 * Layer 2 (Path B gallery role, 2026-06-06).
 * Flickr-style justified gallery: flex rows where each image grows to fill the row
 * width. Each item carries a flex-basis seeded from its aspect ratio (is-ratio-*),
 * and flex-grow proportional to that ratio so wider crops claim more horizontal room.
 * A fixed row height keeps every image visually aligned along the row baseline.
 */

body.aibt-universal .universal-gallery--justified-rows {
	background: var(--background);
	color: var(--ink);
	text-align: center;
}

/* A8 left-pin: centered text that also carries margins must auto both sides. */
body.aibt-universal .universal-gallery.universal-gallery--justified-rows .has-text-align-center {
	margin-inline: auto !important;
}

body.aibt-universal .universal-gallery--justified-rows .universal-gallery__intro {
	margin: 0 auto var(--space-xl) auto;
}
body.aibt-universal .universal-gallery--justified-rows .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 auto var(--space-sm) auto !important;
}
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 auto !important;
}
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__headline em {
	font-style: italic;
	color: var(--accent);
}

/* Justified rows: flex wrap, each image stretches via flex-grow to fill the row. */
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__rows {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	--row-h: 280px;
}

/* Reset core figure margins so the flex math is clean. */
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img,
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img figure {
	margin: 0;
}

/* Each item: height locks the row baseline; flex-basis seeds width from ratio;
   flex-grow lets the row justify to full width. */
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img {
	height: var(--row-h);
	overflow: hidden;
	border-radius: var(--decor-radius);
	flex: 1 1 auto;
}
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--decor-radius);
	filter: var(--photo-filter, none);
	transition: transform var(--duration-medium, var(--duration-fast)) var(--ease-default);
}
body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img:hover img {
	transform: scale(1.04);
}

/* Aspect-ratio seeds: width ≈ ratio × row-height, grow weight ≈ ratio. */
body.aibt-universal .universal-gallery--justified-rows .is-ratio-32 {
	flex-grow: 3;
	flex-basis: calc(var(--row-h) * 1.5);
}
body.aibt-universal .universal-gallery--justified-rows .is-ratio-43 {
	flex-grow: 2.6;
	flex-basis: calc(var(--row-h) * 1.333);
}
body.aibt-universal .universal-gallery--justified-rows .is-ratio-11 {
	flex-grow: 2;
	flex-basis: var(--row-h);
}

/* Tablet: shorter rows so 2–3 images sit per row comfortably. */
@media (max-width: 781px) {
	body.aibt-universal .universal-gallery--justified-rows .universal-gallery__rows {
		--row-h: 220px;
	}
}

/* Mobile: collapse to a single uniform column — justification offers nothing at 375px
   and uneven heights would feel arbitrary. box-sizing keeps zero overflow. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--justified-rows .universal-gallery__rows {
		--row-h: auto;
	}
	body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img {
		flex: 1 1 100%;
		height: auto;
		box-sizing: border-box;
	}
	body.aibt-universal .universal-gallery--justified-rows .universal-gallery__img img {
		aspect-ratio: 3 / 2;
	}
	body.aibt-universal .universal-gallery--justified-rows .universal-gallery__kicker {
		letter-spacing: 0 !important;
	}
}
