/* Guías de Talles Simple — frontend */

/* Enlace en la ficha ----------------------------------------------------- */

.gts-wrap {
	margin: 0 0 15px;
	line-height: 1;
}

.gts-trigger,
.gts-trigger:visited {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	font-size: 0.9em;
	line-height: 1.3;
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
	opacity: 0.8;
	transition: opacity 0.15s ease;
	cursor: pointer;
}

.gts-trigger:hover,
.gts-trigger:focus-visible {
	color: inherit;
	opacity: 1;
	text-decoration: none;
}

.gts-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.gts-trigger__icon {
	flex: none;
	width: 1.15em;
	height: 1.15em;
}

/* Modal (lightbox) ------------------------------------------------------- */

html.gts-lock,
html.gts-lock body {
	overflow: hidden;
}

.gts-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.gts-modal[hidden] {
	display: none;
}

.gts-modal.is-open {
	opacity: 1;
}

.gts-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.20);
	cursor: pointer;
}

/* Escenario: centra la imagen y la deja entrar entera en la pantalla. */

.gts-modal__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	/* El espacio de arriba y de los costados es el que ocupa la X al costado
	   de la imagen; así nunca se sale de la pantalla. */
	padding: 60px 62px 24px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.gts-modal__figure {
	position: relative;
	display: flex;
	max-width: 100%;
	max-height: 100%;
	margin: auto;
}

.gts-modal__img {
	display: block;
	/* Nunca más grande que la pantalla ni que la imagen original: se ve entera
	   y sin estirarse, aunque la guía sea muy apaisada. Se mide contra el
	   viewport (y no con %) porque dentro del flex los porcentajes no resuelven. */
	max-width: calc( 100vw - 124px );
	max-height: calc( 100vh - 84px );
	width: auto;
	height: auto;
	margin: auto;
	object-fit: contain;
	/* Sin fondo ni sombra: se ve la imagen sola, sin marco alrededor. */
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	opacity: 0;
	transform: scale(0.985);
	transition: opacity 0.22s ease, transform 0.22s ease;
	cursor: default;
}

@supports ( max-width: min(10px, 10px) ) {
	.gts-modal__img {
		max-width: min( calc( 100vw - 124px ), 900px );
	}
}

/* En móviles la barra del navegador cambia el alto: dvh evita que la imagen
   quede cortada. */
@supports ( height: 100dvh ) {
	.gts-modal__img {
		max-height: calc( 100dvh - 84px );
	}
}

@media (max-width: 600px) {
	@supports ( height: 100dvh ) {
		.gts-modal__img {
			max-height: calc( 100dvh - 70px );
		}
	}
}

.gts-modal.is-zoomed .gts-modal__img {
	max-width: none;
	max-height: none;
}

.gts-modal.is-loaded .gts-modal__img {
	opacity: 1;
	transform: none;
}

.gts-modal.can-zoom .gts-modal__img {
	cursor: zoom-in;
}

/* Ampliada: se sale del ajuste a pantalla y el escenario se vuelve scrollable. */

.gts-modal.is-zoomed .gts-modal__stage {
	align-items: flex-start;
	justify-content: flex-start;
	padding: 60px 0 0;
}

.gts-modal.is-zoomed .gts-modal__figure {
	display: block;
	max-width: none;
	max-height: none;
	margin: 0 auto;
}

.gts-modal.is-zoomed .gts-modal__img {
	max-width: none;
	max-height: none;
	margin: 0 auto;
	cursor: zoom-out;
}

/* Botón cerrar: flota sobre el fondo, arriba a la derecha.
   Va con !important porque los estilos globales de botones del tema
   (Woodmart / Elementor "Site settings → Buttons") le meten fondo y color
   propios y la X termina invisible. */

.gts-modal .gts-modal__close {
	position: absolute;
	top: -46px;
	right: -50px;
	z-index: 2;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: #fff !important;
	box-shadow: none !important;
	text-shadow: none !important;
	line-height: 1 !important;
	font-size: 0 !important;
	opacity: 0.85;
	transform: none !important;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.gts-modal .gts-modal__close:hover,
.gts-modal .gts-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.35) !important;
	color: #fff !important;
	opacity: 1;
	outline: none;
}

.gts-modal .gts-modal__close:focus-visible {
	box-shadow: 0 0 0 2px currentColor !important;
}

.gts-modal .gts-modal__close svg {
	display: block !important;
	width: 24px !important;
	height: 24px !important;
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 1.8 !important;
	stroke-linecap: round !important;
	opacity: 1 !important;
	/* Con el fondo apenas oscurecido, la X blanca puede caer sobre una zona
	   clara de la página: la sombra la mantiene legible siempre. */
	filter: drop-shadow( 0 1px 2px rgba(0, 0, 0, 0.7) ) drop-shadow( 0 0 6px rgba(0, 0, 0, 0.45) );
}

.gts-modal .gts-modal__close svg path {
	fill: none !important;
	stroke: currentColor !important;
	stroke-width: 1.8 !important;
}

.gts-modal__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: gts-spin 0.8s linear infinite;
}

.gts-modal.is-loaded .gts-modal__spinner {
	display: none;
}

@keyframes gts-spin {
	to { transform: rotate(360deg); }
}

/* Ampliada, o en pantallas chicas donde no sobra lugar al costado de la
   imagen: la X vuelve a la esquina de la pantalla. */

.gts-modal.is-zoomed .gts-modal__close,
.gts-modal.is-narrow .gts-modal__close {
	position: fixed;
	top: 8px;
	right: 10px;
}

@media (max-width: 600px) {
	.gts-modal__stage {
		padding: 54px 12px 16px;
	}

	.gts-modal__img {
		max-width: calc( 100vw - 24px );
		max-height: calc( 100vh - 70px );
	}

	.gts-modal .gts-modal__close {
		position: fixed;
		top: 8px;
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gts-trigger,
	.gts-modal,
	.gts-modal__img,
	.gts-modal .gts-modal__close {
		transition: none;
	}

	.gts-modal__img {
		transform: none;
	}

	.gts-modal__spinner {
		animation-duration: 1.6s;
	}
}
