/* GW Popup Manager: popup promozionale con carosello. Valori identici allo script originale. */

.gw-popup__sr-only {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* Overlay a schermo intero: parte invisibile e viene attivato con .is-active. */
.gw-popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	/* In chiusura `visibility` cambia a dissolvenza finita; in apertura subito, così il focus può entrare. */
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.gw-popup.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.gw-popup__wrapper {
	position: relative;
	width: 90%;
	max-width: 480px;
	max-height: 90vh;
	margin: auto;
}

.gw-popup__content {
	position: relative;
	background: #000;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
	display: flex;
	flex-direction: column;
}

/* Carosello */
.gw-popup__carousel {
	position: relative;
	overflow: hidden;
}

.gw-popup__track {
	display: flex;
	transition: transform 0.5s ease;
	will-change: transform;
}

.gw-popup__slide {
	flex: 0 0 100%;
	width: 100%;
	line-height: 0;
}

.gw-popup__link {
	position: relative;
	display: block;
	line-height: 0;
}

.gw-popup__image {
	width: 100%;
	height: auto;
	max-height: 85vh;
	object-fit: contain;
	display: block;
}

/*
 * Pallini: il pulsante è 24×24 px (WCAG 2.5.8) e il pallino da 10 px è disegnato al centro.
 * Con gap 0 i centri distano 24 px: lo spazio visibile tra i pallini è 14 px.
 */
.gw-popup__dots {
	position: absolute;
	bottom: 7px;
	left: 0;
	width: 100%;
	display: flex;
	justify-content: center;
	gap: 0;
	z-index: 10;
}

.gw-popup__dot {
	position: relative;
	width: 24px;
	height: 24px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	padding: 0;
	cursor: pointer;
}

.gw-popup__dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
	box-sizing: border-box;
	border-radius: 50%;
	border: 2px solid #fff;
	background: rgba(255, 255, 255, 0.3);
	transition: background 0.2s ease, transform 0.2s ease;
}

.gw-popup__dot:hover::before,
.gw-popup__dot:focus::before {
	transform: scale(1.15);
}

.gw-popup__dot:hover,
.gw-popup__dot:focus {
	outline: none;
}

.gw-popup__dot.is-active::before {
	background: #fff;
}

.gw-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	/* La × è un SVG centrato con flex: il glifo di testo cadeva più in basso e dipendeva dal font del sistema. */
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 20;
	transition: background 0.2s ease, transform 0.2s ease;
	padding: 0;
}

.gw-popup__close svg {
	display: block;
	width: 12px;
	height: 12px;
	pointer-events: none;
}

.gw-popup__close:hover,
.gw-popup__close:focus {
	background: #fff;
	color: #000;
	transform: scale(1.05);
	outline: none;
}

/* Indicatore di focus da tastiera (l'originale lo toglieva senza sostituirlo). */
.gw-popup__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
	box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.7);
}

.gw-popup__dot:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 0;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.7);
}

/* Anello sopra l'immagine (un'ombra sul link finirebbe sotto): bianco con alone scuro, leggibile su locandine chiare e scure. */
.gw-popup__link:focus-visible {
	outline: none;
}

.gw-popup__link:focus-visible::after {
	content: "";
	position: absolute;
	inset: 3px;
	border: 3px solid #fff;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.7), inset 0 0 0 3px rgba(0, 0, 0, 0.7);
	pointer-events: none;
}

/* Impedisce lo scorrimento della pagina mentre il dialog è aperto. */
body.gw-popup-open {
	overflow: hidden;
}

@media screen and (max-height: 600px) {
	.gw-popup__wrapper {
		max-width: 320px;
	}

	.gw-popup__image {
		max-height: 75vh;
	}
}

/* Rispetta la preferenza utente per animazioni ridotte */
@media (prefers-reduced-motion: reduce) {
	.gw-popup__track {
		transition: none;
	}
}
