/* Event Gallery (auto) — custom-templates/event-gallery-auto.php
   Justified rows: every tile's width ∝ its aspect ratio (--r), so each row is one even height
   and nothing is cropped. Pure CSS, no layout library. */

.eg-bar {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 14px;
	color: #64748b;
	border-bottom: 1px solid #e2e8f0;
	padding-bottom: 12px;
}
.eg-count { font-weight: 600; color: #0f172a; letter-spacing: .02em; }

.eg-grid {
	width: 100%;
	--row-h: 280px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.eg-grid::after { content: ""; flex-grow: 999999; } /* keeps the last row from stretching */

.eg-item {
	position: relative;
	display: block;
	flex-grow: calc(var(--r) * 100);
	flex-basis: calc(var(--r) * var(--row-h));
	overflow: hidden;
	border-radius: 4px;
	background: #e9edf2;
	cursor: zoom-in;
}
.eg-item img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--r);
	object-fit: cover;
	transition: transform .5s cubic-bezier(.2, .7, .2, 1), filter .3s ease;
}
.eg-item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(15, 23, 42, .35), transparent 45%);
	opacity: 0;
	transition: opacity .3s ease;
	pointer-events: none;
}
@media (hover: hover) {
	.eg-item:hover img { transform: scale(1.035); }
	.eg-item:hover::after { opacity: 1; }
}
.eg-item:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; }

@media (max-width: 991px) { .eg-grid { --row-h: 200px; } }
@media (max-width: 767px) {
	.eg-grid { --row-h: 130px; gap: 4px; }
	.eg-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.eg-item img, .eg-item::after { transition: none; }
	.eg-item:hover img { transform: none; }
}

/* Lightbox download button */
.pswp__button--download-button { display: flex; align-items: center; justify-content: center; }
.pswp__button--download-button svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; }

/* The custom site header sits at z-index 2147483640 — the lightbox has to clear it. */
.pswp { z-index: 2147483647; }
