/* Gallery template: Justified. Rows fill the width; every Photo in a row shares one height and keeps
   its own shape. Each figure carries --ar (width / height); the row height is --leimer-gallery-row.
   --leimer-gallery-fit (default 1) scales the width a Photo asks for before a row wraps; a theme sets
   it below 1 on phones so two Photos fit across, and the row then grows to fill the width. */
.leimer-gallery--justified {
	display: flex;
	flex-wrap: wrap;
	gap: var(--leimer-gallery-gap);
}

.leimer-gallery--justified .leimer-gallery__item {
	flex-grow: calc(var(--ar) * 100);
	flex-basis: calc(var(--ar) * var(--leimer-gallery-row) * var(--leimer-gallery-fit, 1));
	min-width: 0;
}

.leimer-gallery--justified .leimer-gallery__img {
	aspect-ratio: var(--ar);
	object-fit: cover;
}

/* The last row keeps its natural height instead of stretching a lone Photo across the page. */
.leimer-gallery--justified::after {
	content: "";
	flex-grow: 1000000;
}
