/* ==========================================================================
   Bitsaturno Galería Destacada
   ========================================================================== */

.bsg {
	--bsg-h: 560px;
	--bsg-gap: 30px;
	--bsg-big: 50%;
	--bsg-btn-offset: 20px;
	--bsg-lb-bg: rgba(10, 12, 10, 0.94);
	--bsg-lb-fg: #f1f0ec;
	position: relative;
	width: 100%;
}

.bsg__grid {
	display: grid;
	gap: var(--bsg-gap);
	height: var(--bsg-h);
	grid-template-rows: 1fr 1fr;
	grid-template-columns: var(--bsg-big) minmax(0, 1fr);
	/* Compensa el gap para que el % sea del ancho real */
	grid-template-columns: calc(var(--bsg-big) - var(--bsg-gap) / 2) minmax(0, 1fr);
}

.bsg__item {
	position: relative;
	margin: 0;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	background-color: #e8e6e1;
}

.bsg__item--big {
	grid-row: 1 / 3;
	grid-column: 1;
}

.bsg__item--small {
	grid-column: 2;
}

/* Imagen grande a la derecha */
.bsg-big-right .bsg__grid {
	grid-template-columns: minmax(0, 1fr) calc(var(--bsg-big) - var(--bsg-gap) / 2);
}
.bsg-big-right .bsg__item--big { grid-column: 2; }
.bsg-big-right .bsg__item--small { grid-column: 1; }

/* Con 2 fotos: la pequeña ocupa toda la columna */
.bsg__grid[data-count="2"] .bsg__item--small { grid-row: 1 / 3; }

/* Con 1 foto: ocupa todo */
.bsg__grid[data-count="1"] { grid-template-columns: 1fr; }
.bsg__grid[data-count="1"] .bsg__item--big { grid-column: 1; }

.bsg__link {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}

.bsg__link:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -6px;
}

.bsg__item img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	object-position: center;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bsg-zoom-yes .bsg__link:hover img {
	transform: scale(1.04);
}

/* ---------- Botón flotante ---------- */

.bsg__btn {
	position: absolute;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	margin: 0;
	padding: 0.7em 1.15em;
	border: 0;
	border-radius: 999px;
	background-color: rgba(255, 255, 255, 0.92);
	color: #1c211b;
	fill: currentColor;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.bsg__btn:hover,
.bsg__btn:focus-visible {
	background-color: #fff;
	color: #000;
	transform: translateY(-1px);
}

.bsg__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.bsg-btn-br .bsg__btn { right: var(--bsg-btn-offset); bottom: var(--bsg-btn-offset); }
.bsg-btn-bl .bsg__btn { left: var(--bsg-btn-offset);  bottom: var(--bsg-btn-offset); }
.bsg-btn-tr .bsg__btn { right: var(--bsg-btn-offset); top: var(--bsg-btn-offset); }
.bsg-btn-tl .bsg__btn { left: var(--bsg-btn-offset);  top: var(--bsg-btn-offset); }

.bsg__btn-icon {
	display: inline-flex;
	font-size: 1.1em;
	line-height: 1;
}
.bsg__btn-icon svg {
	width: 1.1em;
	height: 1.1em;
}
.bsg__btn-count {
	opacity: 0.65;
	font-weight: 500;
}

.bsg-empty {
	padding: 40px;
	text-align: center;
	border: 2px dashed #c9c6bd;
	color: #6b6a64;
}

/* ---------- Móvil ---------- */

@media (max-width: 767px) {
	.bsg-stack-yes .bsg__grid {
		height: auto;
		grid-template-columns: 1fr 1fr !important;
		grid-template-rows: auto;
	}
	.bsg-stack-yes .bsg__item--big {
		grid-column: 1 / -1 !important;
		grid-row: auto;
		aspect-ratio: 4 / 3;
	}
	.bsg-stack-yes .bsg__item--small {
		grid-column: auto !important;
		grid-row: auto !important;
		aspect-ratio: 1 / 1;
	}
	.bsg-stack-yes .bsg__grid[data-count="2"] .bsg__item--small {
		grid-column: 1 / -1 !important;
		aspect-ratio: 4 / 3;
	}
	.bsg__btn { font-size: 13px; }
}

/* ==========================================================================
   Lightbox (se inserta en <body>)
   ========================================================================== */

.bsg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: var(--bsg-lb-bg, rgba(10, 12, 10, 0.94));
	color: var(--bsg-lb-fg, #f1f0ec);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0s linear 0.25s;
	-webkit-user-select: none;
	user-select: none;
}

.bsg-lb.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.25s ease;
}

.bsg-lb__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.bsg-lb__stage {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 72px;
	touch-action: pan-y;
}

.bsg-lb__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.bsg-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 190px);
	width: auto;
	height: auto;
	object-fit: contain;
	transition: opacity 0.2s ease;
}

.bsg-lb--no-thumbs .bsg-lb__img { max-height: calc(100vh - 110px); }

.bsg-lb__img.is-loading { opacity: 0.25; }

.bsg-lb__caption {
	max-width: 70ch;
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	opacity: 0.85;
}
.bsg-lb__caption:empty { display: none; }

.bsg-lb button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	box-shadow: none;
}

.bsg-lb__close,
.bsg-lb__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: 50%;
	transition: background-color 0.2s;
}

.bsg-lb__close:hover,
.bsg-lb__nav:hover,
.bsg-lb__close:focus-visible,
.bsg-lb__nav:focus-visible {
	background: rgba(255, 255, 255, 0.12);
}

.bsg-lb button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bsg-lb svg {
	width: 26px;
	height: 26px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bsg-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}
.bsg-lb__prev { left: 12px; }
.bsg-lb__next { right: 12px; }

.bsg-lb--single .bsg-lb__nav,
.bsg-lb--single .bsg-lb__thumbs { display: none; }

.bsg-lb__thumbs {
	display: flex;
	gap: 8px;
	padding: 14px 18px 18px;
	overflow-x: auto;
	justify-content: safe center;
	scrollbar-width: thin;
}

.bsg-lb__thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 48px;
	padding: 0 !important;
	overflow: hidden;
	border-radius: 3px;
	opacity: 0.45;
	transition: opacity 0.2s;
}
.bsg-lb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.bsg-lb__thumb:hover { opacity: 0.8; }
.bsg-lb__thumb.is-active {
	opacity: 1;
	box-shadow: inset 0 0 0 2px currentColor !important;
}
.bsg-lb__thumb.is-active img { padding: 2px; }

body.bsg-lb-lock { overflow: hidden; }

@media (max-width: 767px) {
	.bsg-lb__stage { padding: 0 8px; }
	.bsg-lb__nav { width: 40px; height: 40px; background: rgba(0, 0, 0, 0.35); }
	.bsg-lb__prev { left: 6px; }
	.bsg-lb__next { right: 6px; }
	.bsg-lb__img { max-height: calc(100vh - 170px); }
	.bsg-lb__thumb { width: 52px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
	.bsg__item img,
	.bsg__btn,
	.bsg-lb,
	.bsg-lb__img { transition: none !important; }
}
