/*
 * PureCSS.com
 * https://purecss.com/lightbox/
 * Full-size image overlay using the :target pseudo-class, with no JavaScript.
 */

.demo-lightbox .lb-gallery {
		width: 100%;
		max-width: 480px;
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: .75rem;
	}

.demo-lightbox .lb-thumb {
		display: block;
		aspect-ratio: 1;
		border-radius: var(--radius);
		overflow: hidden;
		position: relative;
		cursor: zoom-in;
		border: 2px solid transparent;
		transition: border-color .2s, transform .2s;
	}

:is(.demo-lightbox .lb-thumb):hover {
			border-color: var(--accent);
			transform: scale(1.02);
		}

.demo-lightbox .lb-thumb-img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
		background-size: cover;
		background-position: center;
	}

.demo-lightbox .lb-overlay {
		display: none;
		position: fixed;
		inset: 0;
		/* a lighter tint with a blur, so the page shows through soft and out of focus */
		background: rgba(0,0,0,.6);
		-webkit-backdrop-filter: blur(4px);
		backdrop-filter: blur(4px);
		z-index: 999;
		align-items: center;
		justify-content: center;
		padding: 2rem;
	}

:is(.demo-lightbox .lb-overlay):target {
			display: flex;
		}

.demo-lightbox .lb-overlay-img {
		position: relative;
		max-width: 90vw;
		max-height: 80vh;
		border-radius: var(--radius-lg);
		object-fit: contain;
		background-size: cover;
		background-position: center;
	}

.demo-lightbox .lb-close {
		position: fixed;
		top: 1.5rem;
		right: 1.5rem;
		width: 40px;
		height: 40px;
		background: var(--surface);
		border: 1px solid var(--border);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: var(--text);
		text-decoration: none;
		font-size: 1.2rem;
		line-height: 1;
		cursor: zoom-out;
		transition: background .15s;
	}

:is(.demo-lightbox .lb-close):hover {
			background: var(--surface-2);
		}

/* the tinted area around the image is a link too, so a click outside the
   image closes it; the image and the nav row sit above it */
.demo-lightbox .lb-backdrop {
		position: absolute;
		inset: 0;
		cursor: zoom-out;
	}

/* Fake colored image placeholders */

.demo-lightbox .lb-img-1 { background: linear-gradient(135deg, var(--violet), var(--sky)); }

.demo-lightbox .lb-img-2 { background: linear-gradient(135deg, var(--coral), var(--orange)); }

.demo-lightbox .lb-img-3 { background: linear-gradient(135deg, var(--accent-in-palette), var(--teal)); }

.demo-lightbox .lb-img-4 { background: linear-gradient(135deg, var(--rose), var(--violet)); }

.demo-lightbox .lb-img-5 { background: linear-gradient(135deg, var(--orange), var(--yellow)); }

.demo-lightbox .lb-img-6 { background: linear-gradient(135deg, var(--sky), var(--teal)); }

/* ── Variant: previous and next inside the overlay ── */

/* column layout, so the nav row sits under the image rather than beside it */
.demo-lightbox .lb-overlay-nav {
		flex-direction: column;
		gap: 1rem;
	}

.demo-lightbox .lb-nav {
		position: relative;
		display: flex;
		gap: .75rem;
		align-items: center;
	}

.demo-lightbox .lb-nav-btn {
		padding: .5rem 1rem;
		border-radius: 6px;
		background: var(--surface);
		border: 1px solid var(--border);
		color: var(--text);
		text-decoration: none;
		font-size: .85rem;
		transition: background .15s;
	}

:is(.demo-lightbox .lb-nav-btn):hover {
			background: var(--surface-2);
		}

.demo-lightbox .lb-nav-spacer {
		padding: .5rem 1rem;
		font-size: .85rem;
		color: var(--text-muted);
	}

/* ── Variant: locking the page behind the overlay ── */

/* :has() lets a rule on <body> react to an overlay deep inside the page
   being targeted, so the gallery stops scrolling for exactly as long as
   the lightbox is open. Where :has() is missing the rule is skipped and
   the lightbox behaves as it always did. */
body:has(.demo-lightbox .lb-overlay-lock:target) {
	overflow: hidden;
}

/* ── Variant: a popover, which closes on Escape and on a click outside ── */

/* a button resets to look like the link thumbnails */
.demo-lightbox button.lb-thumb {
	width: 100%;
	padding: 0;
	background: none;
	cursor: zoom-in;
}

.demo-lightbox .lb-thumb-img {
	display: block;
}

/* the popover is the image card in the top layer, above everything on the
   page; inset and margin center it, set here because a margin reset
   (* { margin: 0 }) would otherwise pin it to the top left corner */
.demo-lightbox .lb-pop {
	inset: 0;
	margin: auto;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: visible;
}

/* ::backdrop is the layer between the popover and the page */
.demo-lightbox .lb-pop::backdrop {
	background: rgba(0,0,0,.6);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.demo-lightbox .lb-pop-img {
	width: min(360px, 80vw);
	aspect-ratio: 36 / 25;
	border-radius: var(--radius-lg);
}

/* a browser without popover would show every image inline */
@supports not selector(:popover-open) {
	.demo-lightbox .lb-pop {
		display: none;
	}
}
