/*
 * galeria.css — visor de imágenes a pantalla completa.
 *
 * Solo estructura y comportamiento. El color lo pone cada identidad
 * redefiniendo las variables --v-*, igual que hace con el resto del tema.
 * Escrito primero para 390 px.
 */

.bsr-visor {
	--v-fondo:  rgba(10, 10, 12, 0.96);
	--v-panel:  rgba(255, 255, 255, 0.08);
	--v-borde:  rgba(255, 255, 255, 0.18);
	--v-texto:  #f2f2f4;
	--v-suave:  rgba(242, 242, 244, 0.66);
	--v-acento: #ffffff;

	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 56px 12px 84px;
	background: var(--v-fondo);
	overscroll-behavior: contain;
}

.bsr-visor[hidden] {
	display: none;
}

/* Bloquea el desplazamiento del documento mientras el visor está abierto. */
.bsr-sin-scroll,
.bsr-sin-scroll body {
	overflow: hidden;
}

.bsr-visor__fondo {
	position: absolute;
	inset: 0;
	cursor: zoom-out;
}

/* ------------------------------------------------------------- La imagen */

.bsr-visor__figura {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	max-width: 100%;
	margin: 0;
	pointer-events: none;   /* el gesto de deslizar lo recoge el visor entero */
}

.bsr-visor__img {
	max-width: 100%;
	max-height: 68svh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	opacity: 0;
	transition: opacity 0.22s ease;
}

.bsr-visor__img.esta {
	opacity: 1;
}

.bsr-visor__pie {
	max-width: 46ch;
	color: var(--v-suave);
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: center;
	text-wrap: balance;
}

/* -------------------------------------------------------------- Controles */

.bsr-visor__cerrar {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid var(--v-borde);
	border-radius: 50%;
	background: var(--v-panel);
	color: var(--v-texto);
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease;
}

.bsr-visor__cerrar:hover,
.bsr-visor__cerrar:focus-visible {
	border-color: var(--v-acento);
	background: rgba(255, 255, 255, 0.16);
}

/* En móvil, el mando va abajo y en fila: flechas al alcance del pulgar. */
.bsr-visor__mando {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}

.bsr-visor__flecha {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 1px solid var(--v-borde);
	border-radius: 50%;
	background: var(--v-panel);
	color: var(--v-texto);
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease;
}

.bsr-visor__flecha:hover,
.bsr-visor__flecha:focus-visible {
	border-color: var(--v-acento);
	background: rgba(255, 255, 255, 0.16);
}

.bsr-visor__contador {
	min-width: 5.5ch;
	color: var(--v-suave);
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

/* Una sola foto en el grupo: sin flechas ni contador. */
.bsr-visor--sola .bsr-visor__flecha,
.bsr-visor--sola .bsr-visor__contador {
	display: none;
}

/* ------------------------------------------ La miniatura como disparador */

.bsr-ampliar {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
}

.bsr-ampliar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
	.bsr-visor__img {
		transition: none;
	}
}

/* ============================================================= Tableta */

@media (min-width: 700px) {

	.bsr-visor {
		padding: 72px 88px 72px;
	}

	.bsr-visor__img {
		max-height: 74svh;
	}

	.bsr-visor__cerrar {
		top: 16px;
		right: 16px;
		width: 52px;
		height: 52px;
	}

	/* En escritorio las flechas se van a los lados: se navega con el ratón sin
	   mover la vista del centro, o directamente con el teclado. */
	.bsr-visor__mando {
		inset: 0;
		display: block;
		padding: 0;
		pointer-events: none;
	}

	.bsr-visor__flecha {
		position: absolute;
		top: 50%;
		width: 56px;
		height: 56px;
		margin-top: -28px;
		pointer-events: auto;
	}

	.bsr-visor__flecha--ant {
		left: 16px;
	}

	.bsr-visor__flecha--sig {
		right: 16px;
	}

	.bsr-visor__contador {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 24px;
		pointer-events: auto;
	}
}
