﻿/**
 * In-page lightbox — the visible escape hatch for in-app browsers.
 *
 * Design rules: full-bleed dark backdrop (brand navy), one unmissable white
 * pill at the start edge holding "Back to the page", counter centred, close at
 * the end edge. Everything uses logical properties so the Arabic (RTL) page
 * mirrors without a second stylesheet.
 *
 * @package SM_Directory_Pro
 */

.smd-lb {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: none;
	flex-direction: column;
	background: rgba(8, 13, 24, 0.96);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: #fff;
	padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.85rem
		calc(0.85rem + env(safe-area-inset-bottom, 0px));
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior: contain;
}

.smd-lb[data-open="1"] {
	display: flex;
}

html.smd-lb-on,
html.smd-lb-on body {
	overflow: hidden;
}

.smd-lb__bar {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	justify-content: space-between;
	flex: 0 0 auto;
}

.smd-lb__back {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #0f172a;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.75rem 1.05rem;
	cursor: pointer;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.smd-lb__back:focus-visible,
.smd-lb__close:focus-visible,
.smd-lb__nav:focus-visible {
	outline: 3px solid #fbbf24;
	outline-offset: 2px;
}

.smd-lb__arrow {
	font-size: 1.05rem;
	line-height: 1;
}

.smd-lb__counter {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	color: #e2e8f0;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	padding: 0.35rem 0.7rem;
	font-variant-numeric: tabular-nums;
}

.smd-lb__close {
	width: 2.6rem;
	height: 2.6rem;
	flex: 0 0 auto;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	font-family: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.smd-lb__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 0.6rem;
}

.smd-lb__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 12px;
	background: #0b1220;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.smd-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2.6rem;
	height: 2.6rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	font-family: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.smd-lb__nav--prev {
	inset-inline-start: 0.2rem;
}

.smd-lb__nav--next {
	inset-inline-end: 0.2rem;
}

.smd-lb__caption {
	flex: 0 0 auto;
	margin: 0.65rem 0 0;
	text-align: center;
	font-size: 0.9rem;
	line-height: 1.45;
	color: #cbd5e1;
}

.smd-lb[data-single="1"] .smd-lb__nav {
	display: none;
}

/* Swipe is the native gesture on touch; the arrows only help a mouse. */
@media (max-width: 640px) {
	.smd-lb__nav {
		display: none;
	}

	.smd-lb__back {
		font-size: 0.9rem;
		padding: 0.7rem 0.95rem;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.smd-lb[data-open="1"] .smd-lb__img {
		animation: smd-lb-in 0.18s ease-out;
	}
}

@keyframes smd-lb-in {
	from {
		opacity: 0;
		transform: scale(0.98);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

