/* ============================================================================
   Visor modal compartido — portafolio, galería de Foresta y portada
   ----------------------------------------------------------------------------
   El comportamiento está en shared/visor.js. Antes vivía dentro de
   internas.css, pero la portada no puede cargar ese archivo: trae el reset y
   la barra de las internas y pisaría styles.css. Solo usa tokens que definen
   tanto styles.css como internas.css.

   `.visor-cierre` es la última diapositiva: la invitación al portafolio
   completo. Solo aparece cuando el <dialog> la incluye; portafolio y Foresta
   no la tienen y siguen funcionando igual.
   ========================================================================== */

/* ============ VISOR MODAL ============ */
/* Ocupa la ventana entera porque el fondo oscuro y los botones laterales
   vienen de la versión anterior. */
.visor {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: clamp(16px, 4vw, 48px);
	border: 0;
	/* El velo va solo en el backdrop: si el dialog también pintara fondo, las
	   dos capas se sumarían y el sitio de atrás desaparecería. */
	background: transparent;
	color: var(--paper);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(4px, 2vw, 16px);
	overflow: auto;
}

.visor::backdrop {
	background: rgba(26, 23, 20, 0.72);
}

/* El `display: flex` de arriba le gana al `dialog:not([open])` del navegador,
   así que hay que devolver el ocultado a mano. */
.visor:not([open]) {
	display: none;
}

.visor-figura {
	/* La figura ocupa el espacio entre las flechas, así que su ancho no
	   depende de la foto y los botones no saltan al pasar de una a otra. */
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}

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

.visor-imagen,
.visor-video {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 78vh;
	object-fit: contain;
	background: var(--ink);
}

/* El `img { display: block }` de este archivo le gana al [hidden] del
   navegador: sin esto, al abrir un video se veían la portada y el video. */
.visor-imagen[hidden],
.visor-video[hidden] {
	display: none;
}

.visor-pie {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: center;
	gap: 6px 16px;
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	text-align: center;
}

.visor-texto {
	opacity: 0.8;
}

.visor-enlace {
	padding-bottom: 3px;
	border-bottom: 1px solid rgba(244, 241, 234, 0.4);
}

.visor-enlace:hover,
.visor-enlace:focus-visible {
	color: var(--ochre);
}

.visor button {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	font-size: 18px;
	color: var(--paper);
	border: 1px solid rgba(244, 241, 234, 0.4);
	transition: background 0.3s;
}

.visor button:hover,
.visor button:focus-visible {
	background: rgba(244, 241, 234, 0.14);
}

.visor-cerrar {
	position: absolute;
	top: 18px;
	right: 18px;
}

.visor-cuenta {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	opacity: 0.7;
}

/* ============ CIERRE DEL RECORRIDO ============ */
.visor-cierre {
	display: flex;
	/* Igual que la figura: ocupa el espacio entre las flechas para que los
	   botones no se muevan al entrar al cierre. */
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: clamp(24px, 5vw, 48px);
	text-align: center;
}

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

.visor-cierre-eyebrow {
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--sand);
}

/* El visor es letra clara sobre el velo oscuro: su display va en el corte
   Negative, igual que la cita del inicio y los tiles. */
.visor-cierre-titulo {
	font-family: var(--display-tinta);
	font-weight: 500;
	font-size: clamp(29px, 4.2vw, 46px);
	line-height: 1.1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.visor-cierre-texto {
	max-width: 34rem;
	font-size: 14px;
	line-height: 1.6;
	opacity: 0.8;
}

.visor-cierre-enlace {
	margin-top: 8px;
	padding-bottom: 4px;
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--paper);
	border-bottom: 1px solid rgba(244, 241, 234, 0.4);
	transition: color 0.3s, border-color 0.3s;
}

.visor-cierre-enlace:hover,
.visor-cierre-enlace:focus-visible {
	color: var(--ochre);
	border-color: var(--ochre);
}

@media (max-width: 560px) {
	.visor {
		padding: 12px;
		gap: 6px;
	}
	.visor button {
		width: 38px;
		height: 38px;
	}
	.visor-imagen,
	.visor-video {
		max-height: 70vh;
	}
	.visor-pie {
		letter-spacing: 0.12em;
	}
	.visor-cierre {
		gap: 10px;
		padding: 12px;
	}
}
