/* ============================================================
   buquesdeguerra.com - Visor de galería vanilla (autoalojado)
   Cuadrícula .jg-grid + lightbox .jglb. Sin dependencias.
   ============================================================ */

/* ---------- Cuadrícula de miniaturas ---------- */
.jg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
	margin: 1rem 0;
	padding: 0;
	list-style: none;
}

.jg-grid a.jg {
	display: block;
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	background: #0d1b2a;
	aspect-ratio: 4 / 3;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	text-decoration: none;
}

.jg-grid a.jg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease, opacity .35s ease;
}

.jg-grid a.jg::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, .35), transparent 45%);
	opacity: 0;
	transition: opacity .3s ease;
}

.jg-grid a.jg:hover img,
.jg-grid a.jg:focus-visible img {
	transform: scale(1.06);
}

.jg-grid a.jg:hover::after,
.jg-grid a.jg:focus-visible::after {
	opacity: 1;
}

.jg-grid a.jg:focus-visible {
	outline: 3px solid #4aa3ff;
	outline-offset: 2px;
}

@media (max-width: 480px) {
	.jg-grid {
		grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
		gap: 6px;
	}
}

/* ---------- Lightbox ---------- */
.jglb {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(6, 12, 20, .94);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	-webkit-user-select: none;
	user-select: none;
}

.jglb.is-open {
	opacity: 1;
	visibility: visible;
}

.jglb__stage {
	position: relative;
	width: 95vw;
	max-width: 95vw;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.jglb__img {
	width: 100%;
	height: 82vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, .6);
	background: #0d1b2a;
}

.jglb__cap {
	margin-top: .6rem;
	color: #e7eef7;
	font-size: .95rem;
	text-align: center;
	max-width: 90vw;
	line-height: 1.3;
}

.jglb__cap a {
	color: #8fc4ff;
	margin-left: .5rem;
	font-size: .85rem;
	white-space: nowrap;
}

.jglb__count {
	display: block;
	color: #93a3b5;
	font-size: .8rem;
	margin-top: .2rem;
}

/* Botones */
.jglb__btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .2s ease;
}

.jglb__btn:hover {
	background: rgba(255, 255, 255, .25);
}

.jglb__btn:focus-visible {
	outline: 3px solid #4aa3ff;
	outline-offset: 2px;
}

.jglb__prev { left: 10px; }
.jglb__next { right: 10px; }

.jglb__close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 44px;
	height: 44px;
	font-size: 30px;
	transform: none;
	z-index: 2;
}

.jglb.is-single .jglb__prev,
.jglb.is-single .jglb__next {
	display: none;
}

/* Bloqueo de scroll del fondo */
body.jglb-lock {
	overflow: hidden;
}

@media (max-width: 600px) {
	.jglb__btn { width: 40px; height: 40px; font-size: 22px; }
	.jglb__img { height: 74vh; }
}

@media (prefers-reduced-motion: reduce) {
	.jg-grid a.jg img,
	.jglb,
	.jglb__btn { transition: none; }
}
