/* Grid thumbnails: layout / hover / aspect-ratio — see mue-grid-fix.css */

/* Modal: centered preview, not edge-to-edge fullscreen.
   When "closed", must use display:none — visibility:hidden + opacity:0 still leaves a full-screen
   flex layer (z-index 10050) that eats all clicks in WebKit/Chromium. */
#mue-lightbox-root {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: none;
	box-sizing: border-box;
	background: rgba(12, 12, 12, 0.88);
}

#mue-lightbox-root.mue-lb-open {
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 2.5rem 1.25rem;
	padding-top: max(1rem, env(safe-area-inset-top, 0px));
	padding-right: max(1rem, env(safe-area-inset-right, 0px));
	padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
	padding-left: max(1rem, env(safe-area-inset-left, 0px));
	animation: mue-lb-fade-in 0.2s ease;
}

@keyframes mue-lb-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

#mue-lightbox-root .mue-lb-backdrop {
	position: absolute;
	inset: 0;
	cursor: zoom-out;
}

#mue-lightbox-root .mue-lb-panel {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1320px);
	max-height: min(88vh, 88dvh);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

#mue-lightbox-root .mue-lb-panel img {
	display: block;
	max-width: min(92vw, 1320px);
	max-height: min(calc(88vh - 3rem), calc(88dvh - 3rem));
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

#mue-lightbox-root .mue-lb-caption {
	color: #ddd;
	font-size: 0.85rem;
	text-align: center;
	max-width: 100%;
	word-break: break-word;
}

#mue-lightbox-root .mue-lb-close,
#mue-lightbox-root .mue-lb-prev,
#mue-lightbox-root .mue-lb-next {
	position: absolute;
	z-index: 2;
	border: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	line-height: 1;
	font-size: 1.75rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

#mue-lightbox-root .mue-lb-close:hover,
#mue-lightbox-root .mue-lb-prev:hover,
#mue-lightbox-root .mue-lb-next:hover {
	background: rgba(255, 255, 255, 0.22);
}

#mue-lightbox-root .mue-lb-close {
	top: 0.75rem;
	right: 0.75rem;
	font-size: 1.5rem;
}

#mue-lightbox-root .mue-lb-prev {
	left: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
}

#mue-lightbox-root .mue-lb-next {
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
}

body.mue-lb-noscroll {
	overflow: hidden;
}

@media (max-width: 767px) {
	#mue-lightbox-root.mue-lb-open {
		padding: max(0.5rem, env(safe-area-inset-top, 0px))
			max(0.5rem, env(safe-area-inset-right, 0px))
			max(0.5rem, env(safe-area-inset-bottom, 0px))
			max(0.5rem, env(safe-area-inset-left, 0px));
	}

	#mue-lightbox-root .mue-lb-panel {
		max-height: 90vh;
		max-height: 90dvh;
	}

	#mue-lightbox-root .mue-lb-panel img {
		max-width: 100%;
		max-height: calc(90vh - 5.5rem);
		max-height: calc(90dvh - 5.5rem);
	}

	#mue-lightbox-root .mue-lb-close,
	#mue-lightbox-root .mue-lb-prev,
	#mue-lightbox-root .mue-lb-next {
		min-width: 44px;
		min-height: 44px;
		width: 44px;
		height: 44px;
		font-size: 1.5rem;
	}

	#mue-lightbox-root .mue-lb-close {
		top: max(0.35rem, env(safe-area-inset-top, 0px));
		right: max(0.35rem, env(safe-area-inset-right, 0px));
	}

	#mue-lightbox-root .mue-lb-prev {
		left: max(0.25rem, env(safe-area-inset-left, 0px));
	}

	#mue-lightbox-root .mue-lb-next {
		right: max(0.25rem, env(safe-area-inset-right, 0px));
	}
}

/* Direct /lightbox/ URL: same idea — image bounded, not full-bleed */
.mue-lb-standalone {
	max-width: min(92vw, 1100px);
	margin: 0 auto;
	text-align: center;
}

.mue-lb-standalone-nav {
	margin-bottom: 1rem;
}

.mue-lb-standalone-sep {
	opacity: 0.5;
}

.mue-lb-muted {
	opacity: 0.35;
}

.mue-lb-standalone-figure {
	margin: 0 auto 1rem;
}

.mue-lb-standalone-figure img {
	display: block;
	max-width: 100%;
	max-height: min(78vh, 78dvh);
	width: auto;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
}

.mue-lb-standalone-figure figcaption {
	margin-top: 0.6rem;
	font-size: 0.9rem;
	color: #888;
}
