/**
 * Popup global — Boomit
 * Lo dibuja mu-plugins/boomit-popup.php. Tres formas (tarjeta, modal, barra)
 * por tres contenidos (texto, imagen, video).
 *
 * La version anterior tapaba el contenido con un ::after difuminado: el arreglo
 * de z-index solo alcanzaba a style1, asi que el modal grande y la barra se veian
 * lavados. Aca el velo va en el fondo y nunca encima de la caja.
 */

.bmt-popup {
	--bmt-tinta: #24284d;
	--bmt-azul: #3d4ee4;
	--bmt-coral: #ea464e;
	--bmt-papel: #fff;

	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .28s ease;
}

/* El estado cerrado de verdad es el atributo hidden: saca el dialogo del arbol
   de accesibilidad y del orden de tabulacion. No usamos visibility porque, al
   estar en transicion, computa "hidden" en el primer cuadro y focus() no
   engancha el boton de cerrar. */
.bmt-popup[hidden] {
	display: none;
}

.bmt-popup.is-abierto {
	opacity: 1;
	pointer-events: auto;
}

/* Sin backdrop-filter a proposito.
   El velo cubre la pantalla entera y la home tiene un SVG de 2467 nodos y una
   animacion CSS (floatShape) que no para nunca: con blur, el compositor tiene
   que volver a desenfocar todo el viewport en cada cuadro mientras el popup
   este abierto, y en maquinas sin GPU potente eso traba el navegador.
   Un velo opaco un poco mas oscuro se ve casi igual y cuesta una capa. */
.bmt-popup__fondo {
	position: absolute;
	inset: 0;
	background: rgba(14, 16, 36, .74);
	cursor: pointer;
}

/* ── Caja ──────────────────────────────────────────────────────────── */

.bmt-popup__caja {
	position: relative;
	z-index: 1;
	width: 100%;
	max-height: calc(100vh - 48px);
	overflow: auto;
	overscroll-behavior: contain;
	background: var(--bmt-papel);
	color: var(--bmt-tinta);
	border-radius: 32px;
	box-shadow: 0 30px 70px rgba(16, 18, 40, .28);
	transform: translateY(14px) scale(.97);
	transition: transform .28s cubic-bezier(.22, .8, .3, 1);
}

.bmt-popup.is-abierto .bmt-popup__caja {
	transform: none;
}

/* La caja recibe el foco al abrirse (ver popup.js) y no necesita marcarlo:
   el dialogo entero ya es la senal. El anillo queda para lo que se tabula. */
.bmt-popup__caja:focus { outline: none; }

.bmt-popup--tarjeta .bmt-popup__caja { max-width: 560px; }
.bmt-popup--modal .bmt-popup__caja   { max-width: 940px; }

/* ── Cerrar ────────────────────────────────────────────────────────── */

/* Blanco solido con aro oscuro: se lee igual sobre un video, sobre una foto y
   sobre el fondo blanco de la caja. La version translucida anterior se perdia
   contra los fotogramas claros. 46 px de lado, por encima del minimo tactil. */
.bmt-popup__cerrar {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 3;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow:
		0 0 0 1.5px rgba(16, 18, 40, .18),
		0 4px 16px rgba(16, 18, 40, .35);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.bmt-popup__cerrar:hover {
	background: var(--bmt-coral);
	transform: rotate(90deg);
}

.bmt-popup__cerrar:hover span { background: #fff; }

.bmt-popup__cerrar:focus-visible {
	outline: 3px solid var(--bmt-azul);
	outline-offset: 3px;
}

.bmt-popup__cerrar span {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 19px;
	height: 3px;
	margin: -1.5px 0 0 -9.5px;
	border-radius: 2px;
	background: var(--bmt-tinta);
	transition: background .2s ease;
}

.bmt-popup__cerrar span:first-child { transform: rotate(45deg); }
.bmt-popup__cerrar span:last-child  { transform: rotate(-45deg); }

/* Sobre media el boton no cambia de color: el blanco solido con aro ya contrasta
   contra cualquier fotograma, y evita el backdrop-filter que costaba GPU. */

/* ── Media ─────────────────────────────────────────────────────────── */

.bmt-popup__media {
	position: relative;
	overflow: hidden;
	border-radius: 32px 32px 0 0;
	background: #0f1128;
	line-height: 0;
}

/* Sin texto debajo, la media es toda la caja y se redondea entera. */
.bmt-popup__media:last-child { border-radius: 32px; }

.bmt-popup__media a { display: block; }

.bmt-popup__imagen {
	display: block;
	width: 100%;
	height: auto;
}

.bmt-popup__video {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
}

/* Reserva de alto para navegadores sin aspect-ratio (Safari < 15). */
@supports not (aspect-ratio: 16 / 9) {
	.bmt-popup__video { padding-top: 56.25%; }
}

.bmt-popup__video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.bmt-popup__portada {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bmt-popup__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 84px;
	height: 60px;
	margin: -30px 0 0 -42px;
	padding: 0;
	border: 0;
	border-radius: 16px;
	background: rgba(16, 18, 40, .72);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.bmt-popup__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -11px 0 0 -7px;
	border-style: solid;
	border-width: 11px 0 11px 19px;
	border-color: transparent transparent transparent #fff;
}

.bmt-popup__play:hover { background: var(--bmt-coral); transform: scale(1.06); }
.bmt-popup__play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Un video sin titulo ni bajada es solo el reproductor: fondo negro y nada mas. */
.bmt-popup--video .bmt-popup__caja { background: #0f1128; }
.bmt-popup--video .bmt-popup__media { border-radius: 32px; }
.bmt-popup--video .bmt-popup__texto + .bmt-popup__media,
.bmt-popup--video .bmt-popup__media:not(:last-child) { border-radius: 32px 32px 0 0; }
.bmt-popup--video .bmt-popup__texto { background: var(--bmt-papel); border-radius: 0 0 32px 32px; }

/* ── Texto ─────────────────────────────────────────────────────────── */

.bmt-popup__texto {
	position: relative;
	z-index: 2;
	padding: 40px;
	text-align: center;
}

.bmt-popup--texto .bmt-popup__texto { padding-top: 62px; }

/* Tipografias explicitas y no heredadas: asi el popup se ve igual en el sitio
   que en la vista previa del panel, que corre en un iframe aparte. */
.bmt-popup__texto h2 {
	margin: 0 0 12px;
	color: var(--bmt-tinta);
	font-family: "GalanoGrotesque-SemiBold", "Galano Grotesque", sans-serif;
	font-size: 34px;
	font-weight: normal;
	line-height: 1.18;
}

.bmt-popup--modal .bmt-popup__texto h2 { font-size: 44px; }

.bmt-popup__texto p {
	margin: 0 auto;
	max-width: 56ch;
	font-family: Roboto, -apple-system, "Segoe UI", sans-serif;
	font-size: 17px;
	line-height: 1.55;
	color: rgba(36, 40, 77, .82);
}

.bmt-popup__cta {
	display: inline-block;
	margin-top: 26px;
	padding: 16px 34px;
	border-radius: 60px;
	background: var(--bmt-azul);
	color: #fff;
	font-family: Poppins, sans-serif;
	font-size: 17px;
	font-weight: 500;
	letter-spacing: .3px;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: 0 14px 28px rgba(61, 78, 228, .24);
	transition: background .25s ease, transform .25s ease;
}

.bmt-popup__cta:hover,
.bmt-popup__cta:focus {
	background: var(--bmt-coral);
	color: #fff;
	transform: translateY(-2px);
}

.bmt-popup__cta:focus-visible { outline: 3px solid var(--bmt-tinta); outline-offset: 3px; }

/* ── Barra inferior ────────────────────────────────────────────────── */

.bmt-popup--barra {
	align-items: flex-end;
	padding: 0 16px 20px;
}

/* La barra no oscurece la pagina: se sigue leyendo con ella abierta. */
.bmt-popup--barra .bmt-popup__fondo {
	background: transparent;
	pointer-events: none;
}

.bmt-popup--barra .bmt-popup__caja {
	display: flex;
	align-items: center;
	gap: 28px;
	max-width: 1180px;
	max-height: min(70vh, 460px);
	border-radius: 24px;
	transform: translateY(24px);
}

.bmt-popup--barra.is-abierto .bmt-popup__caja { transform: none; }

.bmt-popup--barra .bmt-popup__media {
	flex: 0 0 auto;
	width: 220px;
	border-radius: 24px 0 0 24px;
	align-self: stretch;
}

.bmt-popup--barra .bmt-popup__media:last-child { width: 100%; border-radius: 24px; }
.bmt-popup--barra .bmt-popup__imagen { height: 100%; object-fit: cover; }

/* En la barra el video se recorta al alto disponible en vez de guardar el 16:9,
   que dejaba una franja negra debajo. */
.bmt-popup--barra .bmt-popup__video {
	width: 220px;
	height: 100%;
	aspect-ratio: auto;
	padding-top: 0;
}

.bmt-popup--barra .bmt-popup__media:last-child .bmt-popup__video { width: 100%; }

/* Titulo y bajada apilados a la izquierda, el boton a la derecha ocupando
   las dos filas. Con flex quedaban uno al lado del otro. */
.bmt-popup--barra .bmt-popup__texto {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 4px 28px;
	flex: 1 1 auto;
	padding: 22px 84px 22px 32px;
	text-align: left;
}

.bmt-popup--barra .bmt-popup__texto h2,
.bmt-popup--barra .bmt-popup__texto p { grid-column: 1; }

.bmt-popup--barra .bmt-popup__texto h2 { font-size: 24px; margin-bottom: 0; }
.bmt-popup--barra .bmt-popup__texto p  { margin: 0; max-width: none; font-size: 15px; }

.bmt-popup--barra .bmt-popup__cta {
	grid-column: 2;
	grid-row: 1 / -1;
	align-self: center;
	margin-top: 0;
	padding: 13px 28px;
	font-size: 16px;
}

.bmt-popup--barra.bmt-popup--video .bmt-popup__caja  { background: var(--bmt-papel); }
.bmt-popup--barra.bmt-popup--video .bmt-popup__media { border-radius: 24px 0 0 24px; }

/* ── Bloqueo del scroll de fondo ───────────────────────────────────── */

body.bmt-popup-abierto {
	overflow: hidden;
}

/* La barra no tapa la pagina: se puede seguir leyendo con ella abierta. */
body.bmt-popup-abierto.bmt-popup-abierto--barra {
	overflow: visible;
	padding-right: 0 !important;
}

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 991px) {
	.bmt-popup { padding: 18px; }
	.bmt-popup__texto { padding: 32px; }
	.bmt-popup--texto .bmt-popup__texto { padding-top: 58px; }
	.bmt-popup--modal .bmt-popup__texto h2 { font-size: 34px; }

	.bmt-popup--barra .bmt-popup__caja { gap: 20px; }
	.bmt-popup--barra .bmt-popup__media { width: 160px; }
	.bmt-popup--barra .bmt-popup__video { width: 160px; }
	.bmt-popup--barra .bmt-popup__texto { padding: 20px 66px 20px 24px; }
}

@media (max-width: 767px) {
	.bmt-popup { padding: 14px; }

	.bmt-popup__caja,
	.bmt-popup--barra .bmt-popup__caja {
		max-height: calc(100vh - 28px);
		border-radius: 26px;
	}

	.bmt-popup__media,
	.bmt-popup--video .bmt-popup__media { border-radius: 26px 26px 0 0; }
	.bmt-popup--video .bmt-popup__texto { border-radius: 0 0 26px 26px; }

	.bmt-popup__texto { padding: 26px 22px 30px; }
	.bmt-popup--texto .bmt-popup__texto { padding-top: 54px; }

	.bmt-popup__texto h2,
	.bmt-popup--modal .bmt-popup__texto h2 { font-size: 26px; }
	.bmt-popup__texto p { font-size: 16px; }
	.bmt-popup__cta { margin-top: 20px; padding: 14px 28px; font-size: 16px; }

	/* No achicarlo en movil: es el unico modo de salir del popup con el dedo. */
	.bmt-popup__cerrar { top: 10px; right: 10px; width: 44px; height: 44px; }
	.bmt-popup__play { width: 68px; height: 48px; margin: -24px 0 0 -34px; }
	.bmt-popup__play::before { border-width: 9px 0 9px 15px; margin: -9px 0 0 -5px; }

	/* La barra pasa a ser una tarjeta apoyada abajo. */
	.bmt-popup--barra { padding: 0 12px 12px; }

	.bmt-popup--barra .bmt-popup__caja {
		display: block;
		max-height: 82vh;
		overflow: auto;
	}

	.bmt-popup--barra .bmt-popup__media,
	.bmt-popup--barra .bmt-popup__video {
		width: 100%;
		border-radius: 26px 26px 0 0;
	}

	.bmt-popup--barra .bmt-popup__video { height: auto; aspect-ratio: 16 / 9; }

	.bmt-popup--barra .bmt-popup__imagen { height: auto; max-height: 180px; }

	.bmt-popup--barra .bmt-popup__texto {
		display: block;
		padding: 24px 22px 26px;
		text-align: center;
	}

	.bmt-popup--barra .bmt-popup__texto h2 { font-size: 22px; }
	.bmt-popup--barra .bmt-popup__cta { margin-top: 18px; }

	body.bmt-popup-abierto.bmt-popup-abierto--barra { overflow: hidden; }
}

/* ── Movimiento reducido ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.bmt-popup,
	.bmt-popup__caja,
	.bmt-popup__cerrar,
	.bmt-popup__cta,
	.bmt-popup__play {
		transition: none;
	}

	.bmt-popup__caja { transform: none; }
	.bmt-popup__cerrar:hover { transform: none; }
}
