/* Landscape & Portrait Gallery — front end */

.lpg-wrap {
	container-type: inline-size;
	display: flow-root;
	position: relative;
	z-index: 0;
	isolation: isolate;
	overflow: hidden;
	clear: both;
	width: 100%;
	max-width: 100%;
	margin: 1.5em 0;
	background: transparent;
}

@supports not (width: 1cqw) {
	.lpg-mosaic {
		--unit: calc((100vw - 32px - (var(--cols) - 1) * var(--lpg-gap)) / var(--cols));
	}
}

.lpg {
	--lpg-h: 280px;
	--lpg-hm: 170px;
	--lpg-gap: 10px;
	--lpg-radius: 6px;
	--lpg-bg: #e9e7e3;
	box-sizing: border-box;
	width: 100%;
}

.lpg *,
.lpg *::before,
.lpg *::after {
	box-sizing: border-box;
}

.lpg .lpg-item {
	position: relative;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.lpg .lpg-frame {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--lpg-bg);
	border-radius: var(--lpg-radius);
	line-height: 0;
	text-decoration: none;
	box-shadow: none;
}

.lpg a.lpg-frame {
	cursor: zoom-in;
}

.lpg .lpg-frame img.lpg-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	object-position: center;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lpg a.lpg-frame:hover img.lpg-img,
.lpg a.lpg-frame:focus-visible img.lpg-img {
	transform: scale(1.04);
}

.lpg a.lpg-frame:focus-visible {
	outline: 3px solid #1d4ed8;
	outline-offset: 2px;
}

/* ---------- Layout: justified rows ---------- */

.lpg-rows {
	display: flex;
	flex-wrap: wrap;
	gap: var(--lpg-gap);
}

.lpg-rows .lpg-item {
	flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--lpg-h));
}

.lpg-rows .lpg-frame {
	aspect-ratio: var(--r);
}

/* Keeps the last row from stretching across the full width. */
.lpg-rows::after {
	content: "";
	flex-grow: 1000000;
}

@media (max-width: 600px) {
	.lpg-rows .lpg-item {
		flex-basis: calc(var(--r) * var(--lpg-hm));
	}
}

/* Phones: landscapes/wide go full width, portraits & squares pair up. */
@media (max-width: 480px) {
	.lpg-rows .lpg-landscape,
	.lpg-rows .lpg-wide {
		flex: 1 1 100%;
	}
	.lpg-rows .lpg-portrait,
	.lpg-rows .lpg-square {
		flex: 1 1 calc(50% - var(--lpg-gap));
		max-width: 100%;
	}
	.lpg-rows::after {
		display: none;
	}
}

/* ---------- Layout: mosaic tiles ---------- */

.lpg-mosaic {
	--cols: 6;
	--unit: calc((100cqw - (var(--cols) - 1) * var(--lpg-gap)) / var(--cols));
	display: grid;
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	grid-auto-rows: var(--unit);
	grid-auto-flow: dense;
	gap: var(--lpg-gap);
}

.lpg-mosaic .lpg-item {
	height: 100%;
}

.lpg-mosaic .lpg-frame {
	height: 100%;
}

.lpg-mosaic .lpg-landscape { grid-column: span 3; grid-row: span 2; }
.lpg-mosaic .lpg-portrait  { grid-column: span 2; grid-row: span 3; }
.lpg-mosaic .lpg-square    { grid-column: span 2; grid-row: span 2; }
.lpg-mosaic .lpg-wide      { grid-column: span 6; grid-row: span 3; }

@container (max-width: 640px) {
	.lpg-mosaic {
		--cols: 4;
	}
	.lpg-mosaic .lpg-landscape { grid-column: span 4; grid-row: span 3; }
	.lpg-mosaic .lpg-portrait  { grid-column: span 2; grid-row: span 3; }
	.lpg-mosaic .lpg-square    { grid-column: span 2; grid-row: span 2; }
	.lpg-mosaic .lpg-wide      { grid-column: span 4; grid-row: span 2; }
}

@container (max-width: 480px) {
	.lpg-mosaic .lpg-square { grid-column: span 2; grid-row: span 3; }
}

/* ---------- Captions ---------- */

.lpg .lpg-caption {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.4;
}

.lpg-cap-hover .lpg-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 2.5rem 0.9rem 0.8rem;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
	border-radius: 0 0 var(--lpg-radius) var(--lpg-radius);
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.lpg-cap-hover .lpg-item:hover .lpg-caption,
.lpg-cap-hover .lpg-item:focus-within .lpg-caption {
	opacity: 1;
	transform: none;
}

@media (hover: none) {
	.lpg-cap-hover .lpg-caption {
		opacity: 1;
		transform: none;
	}
}

.lpg-cap-below .lpg-caption {
	padding: 0.5rem 0.15rem 0;
	color: inherit;
	opacity: 0.75;
}

/* ---------- Lightbox ---------- */

.lpg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(12, 12, 14, 0.94);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0s linear 0.25s;
	touch-action: pan-y;
}

.lpg-lb.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.25s ease;
}

.lpg-lb-stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	padding: 56px 72px 64px;
	margin: 0;
}

.lpg-lb-stage img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 140px);
	max-height: calc(100dvh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 3px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	opacity: 1;
	transition: opacity 0.2s ease;
}

.lpg-lb-stage img.is-loading {
	opacity: 0;
}

.lpg-lb-caption {
	min-height: 1.4em;
	margin-top: 14px;
	max-width: 70ch;
	color: #e8e6e1;
	font-size: 0.95rem;
	line-height: 1.45;
	text-align: center;
}

.lpg-lb button {
	position: absolute;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s ease;
}

.lpg-lb button:hover {
	background: rgba(255, 255, 255, 0.2);
}

.lpg-lb button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.lpg-lb button svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.lpg-lb-close { top: 14px; right: 14px; }
.lpg-lb-prev  { left: 14px; top: 50%; margin-top: -22px; }
.lpg-lb-next  { right: 14px; top: 50%; margin-top: -22px; }

.lpg-lb-count {
	position: absolute;
	top: 24px;
	left: 20px;
	color: #bdb9b0;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
}

body.lpg-lb-lock {
	overflow: hidden;
}

@media (max-width: 600px) {
	.lpg-lb { overscroll-behavior: contain; }
	.lpg-lb-stage {
		width: 100%;
		padding: 56px 12px calc(76px + env(safe-area-inset-bottom, 0px));
	}
	.lpg-lb-stage img { max-height: calc(100dvh - 190px); }
	.lpg-lb-caption {
		max-height: 4.5em;
		overflow-y: auto;
		font-size: 0.88rem;
	}
	.lpg-lb-close { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; }
	.lpg-lb-count { top: calc(22px + env(safe-area-inset-top, 0px)); left: 14px; }
	.lpg-lb-prev, .lpg-lb-next {
		top: auto;
		bottom: calc(14px + env(safe-area-inset-bottom, 0px));
		margin-top: 0;
	}
	.lpg-lb-prev { left: 14px; }
	.lpg-lb-next { right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.lpg .lpg-frame img.lpg-img,
	.lpg-cap-hover .lpg-caption,
	.lpg-lb,
	.lpg-lb-stage img {
		transition: none;
	}
	.lpg a.lpg-frame:hover img.lpg-img {
		transform: none;
	}
}
