/*
 * Image Group Gallery
 * Wide screens: justified rows (every row fills the full width, any screen size).
 * Phones: single column, scroll down.
 */

.igg {
	--row: 260px;   /* target row height on wide screens */
	--gap: 4px;
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap);
	width: 100%;
	margin: 0 auto 24px;
}

.igg-item {
	/* width follows the photo's aspect ratio, rows stretch to full width */
	flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row));
	display: block;
	line-height: 0;
	overflow: hidden;
	background: #eee;
	cursor: zoom-in;
}

.igg-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* keeps the last row from stretching */
.igg::after {
	content: "";
	flex-grow: 1000000;
}

@media (min-width: 1200px) { .igg { --row: 300px; } }
@media (min-width: 1700px) { .igg { --row: 360px; } }

/* Phones: one big photo after another */
@media (max-width: 699px) {
	.igg { display: block; }
	.igg::after { display: none; }
	.igg-item {
		margin: 0 0 var(--gap);
		cursor: default;
		aspect-ratio: var(--ar);
	}
}

/* Lightbox (wide screens only) */
.igg-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .92);
}
.igg-lb img {
	max-width: 94vw;
	max-height: 94vh;
	object-fit: contain;
}
.igg-lb button {
	position: absolute;
	border: 0;
	background: none;
	color: #fff;
	font: 40px/1 sans-serif;
	padding: 16px 22px;
	cursor: pointer;
	opacity: .7;
}
.igg-lb button:hover { opacity: 1; }
.igg-lb .igg-close { top: 0; right: 0; }
.igg-lb .igg-prev  { left: 0; top: 50%; transform: translateY(-50%); }
.igg-lb .igg-next  { right: 0; top: 50%; transform: translateY(-50%); }
