/**
 * Aviso emergente en el frontend.
 *
 * @package Aray_Aviso_Popup
 */

.aip-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	/* El diálogo se centra con margin:auto: así, cuando la imagen es más
	   alta que la pantalla, se puede hacer scroll sin que se corte por arriba. */
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px 22px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

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

.aip-popup--visible {
	opacity: 1;
}

.aip-popup__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	cursor: pointer;
}

.aip-popup__dialog {
	position: relative;
	margin: auto;
	width: 100%;
	max-width: var(--aip-popup-max-width, 560px);
	background: transparent;
	/* Sin overflow aquí: recortaría el botón de cerrar. */
	transform: translateY(12px) scale(0.98);
	transition: transform 0.25s ease;
}

.aip-popup--visible .aip-popup__dialog {
	transform: translateY(0) scale(1);
}

.aip-popup__body {
	line-height: 0;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.aip-popup__picture {
	display: block;
	line-height: 0;
}

.aip-popup__image {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.aip-popup__link {
	display: block;
	line-height: 0;
	text-decoration: none;
	border: 0;
}

.aip-popup__close {
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	font-size: 26px;
	line-height: 1;
	color: #111;
	background: #fff;
	border: 0;
	border-radius: 50%;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	transition: transform 0.15s ease;
}

.aip-popup__close:hover,
.aip-popup__close:focus {
	transform: scale(1.08);
}

.aip-popup__close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

/* Evita que la página de detrás haga scroll con el aviso abierto. */
html.aip-popup-open,
html.aip-popup-open body {
	overflow: hidden;
}

@media (max-width: 600px) {
	.aip-popup {
		padding: 26px 20px;
	}

	.aip-popup__close {
		top: -12px;
		right: -12px;
		width: 36px;
		height: 36px;
		font-size: 22px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aip-popup,
	.aip-popup__dialog,
	.aip-popup__close {
		transition: none;
	}

	.aip-popup__dialog {
		transform: none;
	}
}

@media print {
	.aip-popup {
		display: none !important;
	}
}
