/* Popup de la programació en PDF del Foment. */

.fmp-popup[hidden] {
	display: none;
}

.fmp-popup {
	/* --fmp-max-width y --fmp-ratio los inyecta el plugin según los ajustes y el PDF. */
	--fmp-viewport: 96vh;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
}

.fmp-popup__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.55);
	cursor: pointer;
}

/*
 * El documento ocupa todo el diálogo: el cierre y la descarga van superpuestos,
 * no reservan espacio. Así el PDF se ve al mayor tamaño que permita la pantalla.
 */
.fmp-popup__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(var(--fmp-max-width, 1300px), 100%);
	height: min(var(--fmp-viewport), 100%);
	overflow: hidden;
	background-color: #fefefe;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/*
 * En pantallas anchas pero bajas de altura, estrechamos el diálogo para que el hueco
 * del documento conserve la proporción del PDF y no queden franjas vacías a los lados.
 */
@media (min-width: 768px) {
	.fmp-popup__dialog {
		max-width: calc(var(--fmp-viewport) * var(--fmp-ratio, 1.414));
	}
}

.fmp-popup--open .fmp-popup__dialog {
	animation: fmp-sway 0.5s ease;
}

.fmp-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	color: #c9ac8d;
	font-size: 32px;
	line-height: 1;
	font-weight: bold;
	cursor: pointer;
}

.fmp-popup__close:hover,
.fmp-popup__close:focus {
	background-color: #fff;
	color: #000;
}

.fmp-popup__frame {
	flex: 1;
	width: 100%;
	border: none;
	background-color: #f4f1ec;
}

/* Solo se usa en móvil o si el navegador no puede mostrar el PDF incrustado. */
.fmp-popup__fallback {
	display: none;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 46px 18px 74px;
	text-align: center;
}

.fmp-popup__fallback-title {
	margin: 0;
	font-size: 22px;
	font-weight: bold;
}

.fmp-popup__btn {
	display: inline-block;
	padding: 12px 22px;
	background-color: #c9ac8d;
	color: #fff;
	text-decoration: none;
	border-radius: 5px;
	font-weight: bold;
}

.fmp-popup__btn:hover,
.fmp-popup__btn:focus {
	background-color: #b3946f;
	color: #fff;
}

.fmp-popup__btn--download {
	position: absolute;
	bottom: 14px;
	left: 50%;
	z-index: 2;
	transform: translateX(-50%);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	white-space: nowrap;
}

/* En pantallas pequeñas el PDF incrustado no se lee: se ofrece abrirlo. */
@media (max-width: 767px) {
	.fmp-popup__dialog {
		height: auto;
		min-height: 260px;
	}

	.fmp-popup__frame {
		display: none;
	}

	.fmp-popup__fallback {
		display: flex;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fmp-popup--open .fmp-popup__dialog {
		animation: none;
	}
}

@keyframes fmp-sway {
	0%   { transform: translateX(0); }
	25%  { transform: translateX(-5px); }
	75%  { transform: translateX(5px); }
	100% { transform: translateX(0); }
}
