/**
 * Goweb — Aviso 30 Aniversario · frontend
 * Prefijo: gwa-
 */

:root {
	--gwa-overlay-z: 999990;
	--gwa-header-z: 999991;
}

/* ---------------------------------------------------------------------------
 * Contenedor principal: capa fija que empieza bajo la cabecera
 * ------------------------------------------------------------------------- */

.gwa-overlay {
	position: fixed;
	top: var(--gwa-header-bottom, 270px);
	right: 0;
	bottom: 0;
	left: 0;
	z-index: var(--gwa-overlay-z, 999990);
	overflow: hidden;
	cursor: pointer;
	isolation: isolate;
	background: #f4f6f7;
	opacity: 0;
	visibility: hidden;
	transition:
		opacity var(--gwa-anim-duration, 250ms) ease,
		visibility var(--gwa-anim-duration, 250ms) ease;
	min-height: calc(100vh - var(--gwa-header-bottom, 270px));
	min-height: calc(100dvh - var(--gwa-header-bottom, 270px));
	-webkit-tap-highlight-color: transparent;
}

.gwa-overlay.is-ready {
	opacity: 1;
	visibility: visible;
}

.gwa-overlay.is-closing {
	opacity: 0;
	pointer-events: none;
}

.gwa-overlay:focus-visible {
	outline: 3px solid #6db33f;
	outline-offset: -3px;
}

/* ---------------------------------------------------------------------------
 * Capa trasera: cubre todo el hueco con la misma imagen ampliada y desenfocada
 * ------------------------------------------------------------------------- */

.gwa-overlay__backdrop {
	position: absolute;
	inset: -24px;
	z-index: -2;
	background-image: var(--gwa-desktop-image);
	background-position: var(--gwa-position-x, 50%) var(--gwa-position-y, 50%);
	background-repeat: no-repeat;
	background-size: cover;
	filter: blur(18px) saturate(0.95) brightness(1.03);
	transform: scale(1.06);
}

.gwa-overlay__backdrop::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.10);
}

/* Modo cover puro: la capa trasera no necesita desenfoque */
.gwa-overlay[data-fit-mode="cover"] .gwa-overlay__backdrop {
	filter: none;
	transform: none;
	inset: 0;
}

/* ---------------------------------------------------------------------------
 * Capa delantera: cartel completo y legible
 * ------------------------------------------------------------------------- */

.gwa-overlay__picture,
.gwa-overlay__poster {
	display: block;
	width: 100%;
	height: 100%;
}

.gwa-overlay__picture {
	position: absolute;
	inset: 0;
	z-index: -1;
}

.gwa-overlay__poster {
	object-fit: contain;
	object-position: var(--gwa-position-x, 50%) var(--gwa-position-y, 50%);
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}

.gwa-overlay[data-fit-mode="cover"] .gwa-overlay__poster {
	object-fit: cover;
}

.gwa-overlay[data-fit-mode="contain"] .gwa-overlay__backdrop {
	background-image: none;
	background-color: #f4f6f7;
	filter: none;
	transform: none;
}

/* ---------------------------------------------------------------------------
 * Copy HTML (modo fondo + texto dinámico)
 * ------------------------------------------------------------------------- */

.gwa-overlay__copy {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	height: 100%;
	padding: clamp(1.5rem, 5vw, 4rem);
	text-align: center;
	color: #2d3436;
}

.gwa-overlay__eyebrow {
	margin: 0;
	font-size: clamp(0.85rem, 1.5vw, 1.05rem);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #6db33f;
}

.gwa-overlay__title {
	margin: 0;
	font-size: clamp(1.6rem, 4vw, 3rem);
	font-weight: 700;
	line-height: 1.15;
	max-width: 22ch;
}

.gwa-overlay__subtitle {
	margin: 0;
	font-size: clamp(1rem, 2.2vw, 1.4rem);
	line-height: 1.4;
	max-width: 45ch;
}

.gwa-overlay__hint {
	margin: 1.25rem 0 0;
	font-size: clamp(0.85rem, 1.6vw, 1rem);
	color: #5f6d63;
}

/* En modo cartel completo, el copy queda oculto visualmente:
 * el texto ya está dentro de los píxeles de la imagen. */
.gwa-overlay--full_poster .gwa-overlay__copy {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
 * Botón de cierre accesible
 * ------------------------------------------------------------------------- */

.gwa-overlay__close {
	position: absolute;
	top: clamp(0.75rem, 2vw, 1.5rem);
	right: clamp(0.75rem, 2vw, 1.5rem);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(45, 52, 54, 0.15);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	color: #2d3436;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease;
}

.gwa-overlay__close:hover,
.gwa-overlay__close:focus-visible {
	background: #ffffff;
	transform: scale(1.06);
}

.gwa-overlay__close:focus-visible {
	outline: 3px solid #6db33f;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Texto solo para lectores de pantalla (por si el tema no define la clase)
 * ------------------------------------------------------------------------- */

.gwa-overlay .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
 * Bloqueo del scroll mientras el aviso está abierto
 * ------------------------------------------------------------------------- */

html.gwa-overlay-open,
html.gwa-overlay-open body {
	overflow: hidden;
	overscroll-behavior: none;
}

/* ---------------------------------------------------------------------------
 * Cabecera por encima del aviso mientras está abierto
 * ------------------------------------------------------------------------- */

.gwa-header-above-overlay {
	position: relative;
	z-index: var(--gwa-header-z, 999991) !important;
}

/* ---------------------------------------------------------------------------
 * Imagen móvil / orientación vertical
 * ------------------------------------------------------------------------- */

@media (max-width: 767px), (orientation: portrait) {
	.gwa-overlay__backdrop {
		background-image: var(--gwa-mobile-image, var(--gwa-desktop-image));
	}

	.gwa-overlay__poster {
		object-position: var(--gwa-mobile-position-x, 50%) var(--gwa-mobile-position-y, 50%);
	}
}

/* ---------------------------------------------------------------------------
 * Accesibilidad: reducción de movimiento
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.gwa-overlay,
	.gwa-overlay__close {
		transition: none;
	}
}
