/**
 * Popup promo.
 *
 * Il popup di Elementor tirava dentro l'intero frontend del plugin (e Ultimate Elementor
 * con lui) su ogni pagina del sito. Questo pesa 1,5 KB.
 */

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

.gs-popup {
	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.gs-popup-sfondo {
	position: absolute;
	inset: 0;
	background: rgba(20, 17, 15, .62);
	cursor: pointer;
	animation: gs-popup-in .18s ease-out;
}

.gs-popup-box {
	position: relative;
	/* Niente overflow: il riquadro si adatta all'immagine invece di tagliarla e mettere una
	   barra di scorrimento. La larghezza è quella che l'immagine può avere restando dentro
	   l'altezza dello schermo, qualunque siano le sue proporzioni. */
	width: auto;
	max-width: min(560px, 92vw);
	padding: 10px;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(20, 17, 15, .3);
	animation: gs-popup-su .22s cubic-bezier(.2, .8, .3, 1);
}

.gs-popup-box * {
	box-sizing: border-box;
}

.gs-popup-t {
	margin: 2px 34px 12px 4px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: #1a1613;
}

.gs-popup-img {
	display: block;
	width: auto;
	height: auto;
	/* l'immagine sta sempre dentro lo schermo, senza deformarsi e senza far scorrere nulla */
	max-width: 100%;
	max-height: calc(88vh - 20px);
	border-radius: 12px;
	object-fit: contain;
}

.gs-popup-link {
	display: block;
	line-height: 0;
	text-decoration: none;
}

/* Se c'è un titolo, l'immagine gli lascia spazio senza uscire dallo schermo. */
.gs-popup-box:has(.gs-popup-t) .gs-popup-img {
	max-height: calc(88vh - 70px);
}

/* Il pulsante di chiusura deve essere raggiungibile col pollice e visibile su qualsiasi
   immagine: fondo pieno, non trasparente. */
.gs-popup-x {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #1a1613;
	color: #fff;
	cursor: pointer;
	transition: background .15s;
}

.gs-popup-x:hover,
.gs-popup-x:focus-visible {
	background: #c2410c;
	outline: 2px solid #fff;
	outline-offset: -4px;
}

@keyframes gs-popup-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes gs-popup-su {
	from { opacity: 0; transform: translateY(14px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.gs-popup-sfondo,
	.gs-popup-box {
		animation: none;
	}
}

@media (max-width: 560px) {
	.gs-popup {
		padding: 12px;
	}

	.gs-popup-box {
		max-width: none;
		padding: 10px;
	}
}
