/* Publication sample images: rows of up to 3 (grouped in page/publication.php).
   Each item grows in proportion to its aspect ratio (--ratio = width / height, set inline),
   so every image in a row ends up the same height and the row fills the full width. */

.pub-gallery {
	--gap: 8px;
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	width: 100%;
}

.pub-gallery__row {
	display: flex;
	gap: var(--gap);
}

.pub-gallery__item {
	flex: var(--ratio) 1 0%;
	min-width: 0;
	aspect-ratio: var(--ratio);
	margin: 0;
	overflow: hidden;
	border-radius: 3px;
}

.pub-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;   /* only trims sub-pixel rounding; the box already matches the image's ratio */
}

/* Takes the place of the missing images in a short last row (plus the gaps they would have had) */
.pub-gallery__spacer {
	flex: var(--ratio) 1 0%;
	margin-left: calc(var(--missing-gaps) * var(--gap));
}

@media (max-width: 576px) {
	.pub-gallery {
		--gap: 6px;
	}
}
