/**
 * SpeakerCraft Lightbox v1.0.2
 * Overlay + trigger styles. Inter is already loaded site-wide by the
 * header plugin; brand red #da291c matches the product templates.
 */

/* ---- trigger affordance ---- */
.sc-lb-trigger {
	cursor: zoom-in;
}

.sc-lb-trigger:focus-visible {
	outline: 2px solid #da291c;
	outline-offset: 2px;
}

/* ---- scroll lock while open ---- */
body.sc-lb-open {
	overflow: hidden;
}

/* ---- overlay (native <dialog>, top layer) ---- */
dialog.sc-lb {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(10, 10, 12, 0.94);
	color: #fff;
	font-family: 'Inter', sans-serif;
}

/* Flex column layout ONLY when open — the base selector must keep the UA's
   display:none for closed dialogs, or the overlay paints on every page. */
dialog.sc-lb[open] {
	display: flex;
	flex-direction: column;
	animation: sc-lb-fade 160ms ease-out;
}

dialog.sc-lb::backdrop {
	background: rgba(10, 10, 12, 0.94);
}

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

dialog.sc-lb:focus-visible {
	outline: none;
}

/* ---- stage (flex item above the static footer bar — never overlapped) ---- */
.sc-lb__figure {
	margin: 0;
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 56px 64px 24px;
}

.sc-lb__img {
	display: block;
	max-width: min(92vw, 1400px);
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
	user-select: none;
}

.sc-lb__caption {
	font-size: 14px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.75);
	text-align: center;
	max-width: 80vw;
}

/* ---- footer bar: counter + download (static row, below the stage) ---- */
.sc-lb__bar {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}

.sc-lb__count {
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	color: rgba(255, 255, 255, 0.8);
}

.sc-lb__download {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 8px;
	background: #da291c;
	color: #fff;
	text-decoration: none;
	font-size: 15px;
	font-weight: 600;
	transition: background-color 120ms ease-out;
}

.sc-lb__download:hover,
.sc-lb__download:focus-visible {
	background: #b71f14;
}

/* ---- controls (min 44px touch targets) ---- */
button.sc-lb__close,
button.sc-lb__nav {
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
	transition: background-color 120ms ease-out;
}

button.sc-lb__close:hover,
button.sc-lb__nav:hover,
button.sc-lb__close:focus-visible,
button.sc-lb__nav:focus-visible {
	background: rgba(255, 255, 255, 0.28);
}

button.sc-lb__close:focus-visible,
button.sc-lb__nav:focus-visible,
.sc-lb__download:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

button.sc-lb__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
}

button.sc-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.sc-lb__nav--prev { left: 12px; }
.sc-lb__nav--next { right: 12px; }

/* ---- small screens ---- */
@media (max-width: 640px) {
	.sc-lb__figure {
		padding: 56px 12px 16px;
	}

	.sc-lb__nav {
		top: auto;
		bottom: 84px; /* clears the static footer bar */
		transform: none;
	}
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	dialog.sc-lb[open],
	dialog.sc-lb,
	dialog.sc-lb *,
	.sc-lb-trigger {
		animation: none !important;
		transition: none !important;
	}
}
