/**
 * Lightbox.
 *
 * Loaded only on pages that actually contain a gallery.
 */

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(13, 16, 36, 0.95);
	padding: clamp(1rem, 4vw, 2.5rem);
	opacity: 0;
	visibility: hidden;
	transition: opacity 220ms ease, visibility 220ms ease;
}

/* A soft spectrum glow so the overlay is not a flat black box. */
.lightbox::before {
	content: "";
	position: absolute;
	inset-block-start: -20%;
	inset-inline-start: -10%;
	width: 60%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: linear-gradient(115deg, #2F6BFF 0%, #FF4D8F 62%, #FF8A3D 100%);
	opacity: 0.22;
	filter: blur(90px);
	pointer-events: none;
}

.lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.lightbox__figure {
	position: relative;
	margin: 0;
	max-width: min(1140px, 100%);
	max-height: 100%;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	align-items: center;
}

.lightbox__image {
	max-width: 100%;
	max-height: calc(100vh - 10rem);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 18px;
	background: #161B33;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.lightbox__caption {
	color: #F4F5FF;
	font-size: 0.9375rem;
	text-align: center;
	max-width: 60ch;
	margin: 0;
	line-height: 1.65;
}

.lightbox__counter {
	color: #FFA463;
	font-size: 0.8125rem;
	letter-spacing: 0.08em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.lightbox__button {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 2px solid rgba(244, 245, 255, 0.28);
	background: rgba(22, 27, 51, 0.85);
	color: #F4F5FF;
	cursor: pointer;
	font-size: 1.35rem;
	line-height: 1;
	padding: 0;
	transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.lightbox__button:hover {
	background: linear-gradient(115deg, #2456E0 0%, #D62E70 100%);
	border-color: transparent;
	transform: scale(1.06);
}

.lightbox__button:focus-visible {
	outline: 3px solid #7BA0FF;
	outline-offset: 3px;
}

.lightbox__close {
	inset-block-start: clamp(1rem, 4vw, 2rem);
	inset-inline-end: clamp(1rem, 4vw, 2rem);
	position: fixed;
}

.lightbox__prev,
.lightbox__next {
	position: fixed;
	inset-block-start: 50%;
	transform: translateY(-50%);
}

.lightbox__prev {
	inset-inline-start: clamp(0.5rem, 2.5vw, 2rem);
}

.lightbox__next {
	inset-inline-end: clamp(0.5rem, 2.5vw, 2rem);
}

.lightbox__prev:hover,
.lightbox__next:hover {
	transform: translateY(-50%) scale(1.06);
}

.lightbox__prev[hidden],
.lightbox__next[hidden] {
	display: none;
}

/* Keep the page behind the lightbox from scrolling. */
body.nuuu-lightbox-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.lightbox,
	.lightbox__button {
		transition: none;
	}
}
