/* .lb base must be display:none so the dialog actually hides when closed.
   Author rules beat UA rules in the cascade regardless of specificity, so
   we can't rely on the UA `dialog:not([open]) { display: none }` to do it
   for us — we have to assert the closed state ourselves. */
.lb {
	display: none;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
}

.lb[open] {
	display: flex;
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	animation: lb-in 0.15s ease-out;
}

.lb:focus {
	outline: none;
}

.lb::backdrop {
	background: rgba(0, 0, 0, 0.9);
	animation: lb-in 0.15s ease-out;
}

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

.lb-img {
	max-width: 92vw;
	max-height: 86vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
	user-select: none;
	-webkit-user-select: none;
}

.lb-btn {
	position: fixed;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	transition: background 0.15s, transform 0.1s;
	-webkit-tap-highlight-color: transparent;
}

.lb-btn:hover,
.lb-btn:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	outline: none;
}

.lb-btn:active {
	transform: scale(0.94);
}

.lb-btn:disabled {
	opacity: 0.2;
	cursor: default;
	pointer-events: none;
}

.lb-icon {
	width: 50%;
	height: 50%;
	display: block;
}

.lb-close {
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
}

.lb-prev,
.lb-next {
	top: 50%;
	transform: translateY(-50%);
	width: 56px;
	height: 56px;
	border-radius: 50%;
}

.lb-prev:active,
.lb-next:active {
	transform: translateY(-50%) scale(0.94);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-meta {
	position: fixed;
	bottom: 24px;
	left: 0;
	right: 0;
	text-align: center;
	color: #fff;
	pointer-events: none;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.lb-counter {
	display: block;
	color: rgba(255, 255, 255, 0.65);
	font-size: 14px;
	margin-bottom: 6px;
	letter-spacing: 0.05em;
}

.lb-caption {
	display: block;
	max-width: 80vw;
	margin: 0 auto;
	font-size: 18px;
	line-height: 1.4;
}

@media (max-width: 600px) {
	.lb-prev, .lb-next {
		width: 48px;
		height: 48px;
	}
	.lb-prev { left: 8px; }
	.lb-next { right: 8px; }
	.lb-close { top: 8px; right: 8px; }
}
