/**
 * Simple lightbox. An extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2026, Fred Rimbert, https://forums.caforum.fr
 * @license GNU General Public License, version 2 (GPL-2.0)
 */

/* Images that open in the lightbox
---------------------------------------- */
.cslb-trigger {
	cursor: zoom-in;
}

/* Scroll lock while the lightbox is open */
html.cslb-locked,
html.cslb-locked body {
	overflow: hidden;
}

/* Overlay
---------------------------------------- */
.cslb {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000;
	overflow: hidden;
	background-color: rgba(10, 10, 12, 0.82);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: #fff;
	font-family: inherit;
	opacity: 0;
	outline: none;
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
	transition: opacity 0.25s ease;
}

.cslb.cslb-open {
	opacity: 1;
}

/* Dynamic blurred background: a blurred copy of the current image */
.cslb-backdrop {
	position: absolute;
	top: -60px;
	right: -60px;
	bottom: -60px;
	left: -60px;
	background-position: center;
	background-size: cover;
	filter: blur(40px) saturate(1.3) brightness(0.45);
	opacity: 0;
	pointer-events: none;
	transform: translateZ(0);
	transition: opacity 0.4s ease;
}

.cslb-backdrop.cslb-visible {
	opacity: 1;
}

/* Slides
---------------------------------------- */
.cslb-stage {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
}

.cslb-slide {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 56px 72px;
	transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.35s ease;
	will-change: transform, opacity;
}

.cslb-slide.cslb-dragging {
	transition: none;
}

.cslb-slide img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	margin: auto;
	border: 0;
	border-radius: 2px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	object-fit: contain;
	opacity: 1;
	transition: opacity 0.25s ease;
	-webkit-user-drag: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}

.cslb-slide.cslb-loading img {
	opacity: 0;
}

/* Loading spinner */
.cslb-slide.cslb-loading::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cslb-spin 0.8s linear infinite;
}

@keyframes cslb-spin {
	to { transform: rotate(360deg); }
}

.cslb-error {
	max-width: 320px;
	padding: 16px 20px;
	border-radius: 6px;
	background-color: rgba(0, 0, 0, 0.5);
	font-size: 14px;
	text-align: center;
}

/* Toolbar, caption and buttons
---------------------------------------- */
.cslb-toolbar {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	padding: 8px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
}

.cslb-counter {
	margin-right: auto;
	padding: 0 8px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	opacity: 0.85;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.cslb-caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	padding: 12px 16px 14px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
	font-size: 13px;
	text-align: center;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	word-wrap: break-word;
}

.cslb-caption:empty {
	display: none;
}

.cslb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: transparent;
	color: #fff;
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.cslb-btn:hover,
.cslb-btn:focus {
	color: #fff;
	background-color: rgba(255, 255, 255, 0.15);
	opacity: 1;
	text-decoration: none;
}

.cslb-btn:focus {
	outline: none;
}

.cslb-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.cslb-btn svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}

.cslb-arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 56px;
	height: 56px;
	margin-top: -28px;
	background-color: rgba(0, 0, 0, 0.25);
}

.cslb-arrow svg {
	width: 30px;
	height: 30px;
}

.cslb-prev {
	left: 12px;
}

.cslb-next {
	right: 12px;
}

/* Right-to-left languages */
.cslb[dir="rtl"] .cslb-prev {
	right: 12px;
	left: auto;
}

.cslb[dir="rtl"] .cslb-next {
	right: auto;
	left: 12px;
}

.cslb[dir="rtl"] .cslb-arrow svg {
	transform: scaleX(-1);
}

.cslb[dir="rtl"] .cslb-counter {
	margin-right: 0;
	margin-left: auto;
}

/* Mobile
---------------------------------------- */
@media (max-width: 700px) {
	.cslb-slide {
		padding: 52px 8px;
	}

	.cslb-arrow {
		width: 44px;
		height: 44px;
		margin-top: -22px;
		background-color: rgba(0, 0, 0, 0.35);
	}

	.cslb-arrow svg {
		width: 24px;
		height: 24px;
	}

	.cslb-prev {
		left: 6px;
	}

	.cslb-next {
		right: 6px;
	}

	.cslb[dir="rtl"] .cslb-prev {
		right: 6px;
	}

	.cslb[dir="rtl"] .cslb-next {
		left: 6px;
	}
}

/* Accessibility: less motion
---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.cslb,
	.cslb-slide,
	.cslb-slide img,
	.cslb-backdrop {
		transition: none;
	}

	.cslb-slide.cslb-loading::before {
		animation-duration: 2s;
	}
}

/* Fallback when backdrop-filter is not supported */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	.cslb {
		background-color: rgba(10, 10, 12, 0.94);
	}
}
