/**
 * Zenth Toolkit — Gallery Lightbox
 *
 * Overlay full-screen para mostrar imágenes a tamaño completo.
 * Fade in/out simple. No incluye transiciones de imagen — el browser
 * hace el fade del overlay y eso es suficiente.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * ÍNDICE
 *   §1  Overlay        → .zenth-lightbox (+ is-open, box-sizing reset)
 *   §2  Botón close    → .zenth-lightbox__close
 *   §3  Stage + imagen → .zenth-lightbox__stage / __image
 *   §4  Caption        → .zenth-lightbox__caption (+ __title / __subtitle)
 *   §5  Responsive     → @media de tamaño + reduced-motion
 * ─────────────────────────────────────────────────────────────────────────
 * BREAKPOINTS (desktop es la base, sin media query)
 *   Mobile  → max-width: 767px   (padding / close / image / tipografía)
 *
 *   + 1 media de accesibilidad (prefers-reduced-motion) en subsección propia
 *   al final de §5. El único @media de tamaño vive también en §5.
 * ─────────────────────────────────────────────────────────────────────────
 */


/* ═══════════════════════════════════════════════════════════════════════
   §1 · OVERLAY
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(5, 5, 5, 0.92);
	opacity: 0;
	transition: opacity 220ms cubic-bezier(0.4, 0, 0.2, 1);
	-webkit-tap-highlight-color: transparent;
}

.zenth-lightbox.is-open {
	display: flex;
	opacity: 1;
}

.zenth-lightbox *,
.zenth-lightbox *::before,
.zenth-lightbox *::after {
	box-sizing: border-box;
}


/* ═══════════════════════════════════════════════════════════════════════
   §2 · BOTÓN CLOSE
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	transition: background 160ms ease, transform 160ms ease;
}

.zenth-lightbox__close:hover,
.zenth-lightbox__close:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	outline: none;
	transform: scale(1.06);
}

.zenth-lightbox__close:focus-visible {
	box-shadow: 0 0 0 2px #fff;
}


/* ═══════════════════════════════════════════════════════════════════════
   §3 · STAGE + IMAGEN
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-lightbox__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-width: min(1200px, 100%);
	max-height: 100%;
	min-height: 0; /* permite que la imagen se reduzca */
}

.zenth-lightbox__image {
	display: block;
	max-width: 100%;
	/* Reservamos ~60px abajo para el caption en pantallas con caption,
	   y dejamos margen arriba para el botón close. */
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	background: #1a1a1a;
}


/* ═══════════════════════════════════════════════════════════════════════
   §4 · CAPTION
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-lightbox__caption {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	max-width: 100%;
	color: #fff;
	text-align: center;
}

.zenth-lightbox__caption[hidden] {
	display: none;
}

.zenth-lightbox__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.01em;
}

.zenth-lightbox__subtitle {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.7);
}

.zenth-lightbox__title[hidden],
.zenth-lightbox__subtitle[hidden] {
	display: none;
}


/* ═══════════════════════════════════════════════════════════════════════
   §5 · RESPONSIVE — @media de tamaño + accesibilidad
   ───────────────────────────────────────────────────────────────────────
   Un solo tier de tamaño (Mobile ≤767). Al final, accesibilidad
   (prefers-reduced-motion), que NO es un breakpoint de tamaño y no se
   consolida con el de arriba.
   ═══════════════════════════════════════════════════════════════════════ */

/* ───────────────────────── MOBILE · max-width: 767px ──────────────────── */
@media (max-width: 767px) {
	/* §1 · Overlay: padding reducido */
	.zenth-lightbox {
		padding: 12px;
	}

	/* §2 · Close más chico y pegado a la esquina */
	.zenth-lightbox__close {
		top: 8px;
		right: 8px;
		width: 40px;
		height: 40px;
	}

	/* §3 · Imagen: más alto disponible al achicar el chrome */
	.zenth-lightbox__image {
		max-height: calc(100vh - 100px);
	}

	/* §4 · Caption: tipografía más compacta */
	.zenth-lightbox__title {
		font-size: 14px;
	}

	.zenth-lightbox__subtitle {
		font-size: 12px;
	}
}


/* ─────────────────── ACCESIBILIDAD · prefers-reduced-motion ───────────── */
@media (prefers-reduced-motion: reduce) {
	.zenth-lightbox,
	.zenth-lightbox__close {
		transition: none !important;
	}

	.zenth-lightbox__close:hover {
		transform: none;
	}
}
