/* ---------------------------------------------------------------
   Image lightbox - click a .sample thumbnail to view it large.
   Standalone: not part of styles.scss, so a Sass rebuild won't
   overwrite it.

   Control rules are scoped with #mstr-theme because the theme sets
   "#mstr-theme button, #mstr-theme [type=button] { position: relative }".
   Unscoped, .lb-btn loses that cascade, the buttons stay in flow as
   flex items, and they shove the image off-centre.
   --------------------------------------------------------------- */

/* --- Thumbnails ------------------------------------------------- */
#mstr-theme .sample img.lb-thumb {
	cursor: zoom-in;
	transition: opacity 0.2s ease;
}

#mstr-theme .sample img.lb-thumb:hover {
	opacity: 0.82;
}

#mstr-theme .sample img.lb-thumb:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* --- Overlay ---------------------------------------------------- */
.lb-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(12, 12, 12, 0.94);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

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

.lb-figure {
	margin: 0;
	max-width: 92vw;
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	transform: scale(0.98);
	transition: transform 0.25s ease;
}

.lb-overlay.is-open .lb-figure {
	transform: scale(1);
}

.lb-img {
	display: block;
	max-width: 92vw;
	max-height: 84vh;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
	background: #1a1a1a;
}

.lb-caption {
	margin: 14px 0 0;
	font-size: 13px;
	line-height: 1.4;
	letter-spacing: 0.02em;
	color: rgba(255, 255, 255, 0.66);
	text-align: center;
	max-width: 60ch;
}

/* --- Controls --------------------------------------------------- */
#mstr-theme .lb-overlay .lb-btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.09);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

#mstr-theme .lb-overlay .lb-btn:hover {
	background: rgba(255, 255, 255, 0.2);
}

#mstr-theme .lb-overlay .lb-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* The theme decorates every button with an ::after; not wanted here. */
#mstr-theme .lb-overlay .lb-btn::after,
#mstr-theme .lb-overlay .lb-btn::before {
	content: none;
	display: none;
}

#mstr-theme .lb-overlay .lb-close {
	top: 22px;
	right: 22px;
	font-size: 26px;
}

#mstr-theme .lb-overlay .lb-prev {
	left: 22px;
	top: 50%;
	transform: translateY(-50%);
}

#mstr-theme .lb-overlay .lb-next {
	right: 22px;
	top: 50%;
	transform: translateY(-50%);
}

.lb-counter {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 12px;
	letter-spacing: 0.14em;
	color: rgba(255, 255, 255, 0.5);
}

/* Single-image groups have nothing to page through. */
#mstr-theme .lb-overlay.is-single .lb-prev,
#mstr-theme .lb-overlay.is-single .lb-next,
.lb-overlay.is-single .lb-counter {
	display: none;
}

@media (max-width: 47em) {
	#mstr-theme .lb-overlay .lb-btn { width: 40px; height: 40px; font-size: 17px; }
	#mstr-theme .lb-overlay .lb-close { top: 12px; right: 12px; }
	#mstr-theme .lb-overlay .lb-prev { left: 8px; }
	#mstr-theme .lb-overlay .lb-next { right: 8px; }
	.lb-img { max-width: 96vw; max-height: 78vh; }
}

@media (prefers-reduced-motion: reduce) {
	.lb-overlay,
	.lb-figure,
	#mstr-theme .sample img.lb-thumb {
		transition: none;
	}
}
