/**
 *  Universal lightbox component for the ws_productreviews module.
 *  Used in both back-office and front-office. Theme-agnostic, color-neutral.
 */

body.wsr-lightbox-open {
	overflow: hidden;
}

/* Triggers — visual hint that the photo is clickable. */
[data-wsr-lightbox],
.ws_carousel__slide[data-big-img-url] {
	cursor: zoom-in;
}

/* ---------- Native <dialog> base ---------- */

.wsr-lightbox {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	overflow: hidden;
}

.wsr-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.85);
}

/* Closed native dialog should be fully hidden. */
dialog.wsr-lightbox:not([open]) {
	display: none;
}

/* ---------- Fallback: <div role="dialog"> ---------- */

div.wsr-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.85);
	display: none;
}

div.wsr-lightbox.wsr-lightbox--open {
	display: block;
}

div.wsr-lightbox[hidden] {
	display: none !important;
}

/* ---------- Layout ---------- */

.wsr-lightbox .wsr-lightbox__figure {
	position: absolute;
	inset: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: clamp(16px, 4vw, 48px);
	box-sizing: border-box;
	pointer-events: none;
}

.wsr-lightbox .wsr-lightbox__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	object-fit: contain;
	pointer-events: auto;
}

.wsr-lightbox .wsr-lightbox__counter {
	color: #fff;
	font-size: 14px;
	letter-spacing: 0.02em;
	pointer-events: auto;
}

/* ---------- Controls ---------- */

.wsr-lightbox .wsr-lightbox__close,
.wsr-lightbox .wsr-lightbox__nav {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	background: rgba(255, 255, 255, 0.15);
	border: 0;
	color: #fff;
	cursor: pointer;
	border-radius: 4px;
	padding: 0;
	font-family: inherit;
	font-weight: 400;
	line-height: 1;
	transition: background-color 0.2s ease, transform 0.1s ease;
	z-index: 1;
}

.wsr-lightbox .wsr-lightbox__close:hover,
.wsr-lightbox .wsr-lightbox__nav:hover,
.wsr-lightbox .wsr-lightbox__close:focus-visible,
.wsr-lightbox .wsr-lightbox__nav:focus-visible {
	background: rgba(255, 255, 255, 0.35);
	outline: none;
}

.wsr-lightbox .wsr-lightbox__close:active,
.wsr-lightbox .wsr-lightbox__nav:active {
	transform: scale(0.96);
}

.wsr-lightbox .wsr-lightbox__close {
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	font-size: 28px;
}

.wsr-lightbox .wsr-lightbox__nav {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 64px;
	font-size: 36px;
}

.wsr-lightbox .wsr-lightbox__nav:active {
	transform: translateY(-50%) scale(0.96);
}

.wsr-lightbox .wsr-lightbox__nav--prev {
	left: 12px;
}

.wsr-lightbox .wsr-lightbox__nav--next {
	right: 12px;
}

@media (max-width: 480px) {
	.wsr-lightbox .wsr-lightbox__close {
		top: 8px;
		right: 8px;
		width: 36px;
		height: 36px;
		font-size: 22px;
	}

	.wsr-lightbox .wsr-lightbox__nav {
		width: 36px;
		height: 56px;
		font-size: 26px;
	}

	.wsr-lightbox .wsr-lightbox__nav--prev {
		left: 6px;
	}

	.wsr-lightbox .wsr-lightbox__nav--next {
		right: 6px;
	}
}
