/* SERG LightBox — overlay & modal */

.serg-lb-backdrop {
	position: fixed;
	inset: 0;
	z-index: 999990;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.serg-lb-backdrop.is-open .serg-lb-content {
	opacity: 1;
	transform: scale(1);
}

.serg-lb-content {
	position: relative;
	max-width: 100vw;
	max-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 15px;
	padding: 2rem;
	box-sizing: border-box;
	cursor: default;
	opacity: 0;
	transform: scale(0.95);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.serg-lb-content:where(:focus-within) {
	outline: none;
}

.serg-lb-image-wrap {
	flex: 1 1 0;
	min-width: 0;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.serg-lb-image-wrap img,
.serg-lb-content img {
	max-width: 100%;
	max-height: calc(100vh - 4rem);
	width: auto;
	height: auto;
	object-fit: contain;
	vertical-align: middle;
}

/* Кнопки навигации карусели — вне области изображения, отступ 30px */

.serg-lb-btn {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	padding: 0;
	border: none;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, color 0.2s ease;
	z-index: 2;
	-webkit-tap-highlight-color: transparent;
}

.serg-lb-btn:hover,
.serg-lb-btn:focus {
	background: rgba(255, 255, 255, 0.35);
	color: #fff;
}

.serg-lb-btn:focus {
	outline: 2px solid rgba(255, 255, 255, 0.6);
	outline-offset: 2px;
}

.serg-lb-single .serg-lb-btn {
	display: none;
}

/* Закрытие по клику на backdrop (не на контенте) */

.serg-lb-backdrop[role="button"] .serg-lb-content {
	pointer-events: auto;
}

.serg-lb-backdrop .serg-lb-content {
	pointer-events: auto;
}

@media (max-width: 768px) {
	.serg-lb-content {
		gap: 5px;
		padding: 5px;
	}
	.serg-lb-btn {
		width: 24px;
		height: 24px;
		font-size: 12px;
	}
}
