/* SPW Promo Modal */

.spw-modal {
	--spw-ink: #1d1a16;
	--spw-paper: #fffaf0;
	--spw-accent: #ffd23f;      /* evidenziatore codice */
	--spw-accent-ink: #1d1a16;
	--spw-radius: 14px;

	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	opacity: 0;
	transition: opacity .25s ease;
}

.spw-modal[hidden] { display: none; }
.spw-modal.is-visible { opacity: 1; }

.spw-modal *,
.spw-modal *::before,
.spw-modal *::after { box-sizing: border-box; }

html.spw-modal-open { overflow: hidden; }

/* Overlay */
.spw-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 16, 10, .72);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	cursor: pointer;
}

/* Box */
.spw-modal__box {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: 100%;
	overflow-y: auto;
	border-radius: var(--spw-radius);
	background-color: var(--spw-ink);
	background-size: cover;
	background-position: center;
	color: #fff;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
	transform: translateY(14px) scale(.98);
	transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}

.spw-modal.is-visible .spw-modal__box { transform: none; }

/* Velo scuro per leggere il testo sopra l'immagine */
.spw-modal__box.has-image::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(180deg, rgba(20, 16, 10, .45) 0%, rgba(20, 16, 10, .82) 100%);
	pointer-events: none;
}

.spw-modal__content {
	position: relative;
	padding: 56px 36px 40px;
	text-align: center;
}

.spw-modal .spw-modal__title {
	margin: 0 0 12px;
	padding: 0;
	font-size: clamp(1.7rem, 5vw, 2.3rem);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -.01em;
	color: #fff;
}

.spw-modal .spw-modal__subtitle {
	margin: 0 auto 30px;
	max-width: 38ch;
	font-size: 1.05rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, .88);
}

/* ---------- Codice sconto in risalto ---------- */
.spw-modal__code-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.spw-modal__code {
	position: relative;
	display: inline-block;
	padding: 16px 32px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: clamp(1.6rem, 6vw, 2.2rem);
	font-weight: 800;
	letter-spacing: .14em;
	line-height: 1;
	color: var(--spw-accent-ink);
	background: var(--spw-accent);
	border: 3px dashed var(--spw-accent-ink);
	border-radius: 10px;
	box-shadow: 0 0 0 6px rgba(255, 210, 63, .28), 0 10px 30px rgba(0, 0, 0, .35);
	user-select: all;
	-webkit-user-select: all;
	animation: spw-code-pulse 2.4s ease-in-out 0.6s 2;
}

/* "Tacche" del coupon ai lati */
.spw-modal__code::before,
.spw-modal__code::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-top: -9px;
	border-radius: 50%;
	background: var(--spw-ink);
}
.spw-modal__code::before { left: -12px; }
.spw-modal__code::after  { right: -12px; }

.spw-modal__box.has-image .spw-modal__code::before,
.spw-modal__box.has-image .spw-modal__code::after {
	background: #14100a;
}

@keyframes spw-code-pulse {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.05); }
}

.spw-modal .spw-modal__copy {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 10px 20px;
	font: inherit;
	font-size: .95rem;
	font-weight: 600;
	color: #fff;
	background: transparent;
	border: 2px solid rgba(255, 255, 255, .6);
	border-radius: 999px;
	cursor: pointer;
	transition: background .2s, color .2s, border-color .2s;
}
.spw-modal .spw-modal__copy:hover,
.spw-modal .spw-modal__copy:focus-visible {
	background: #fff;
	color: var(--spw-ink);
	border-color: #fff;
}
.spw-modal .spw-modal__copy.is-copied {
	background: var(--spw-accent);
	color: var(--spw-accent-ink);
	border-color: var(--spw-accent);
}

/* Pulsante chiudi */
.spw-modal .spw-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: rgba(0, 0, 0, .35);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background .2s, transform .2s;
}
.spw-modal .spw-modal__close:hover,
.spw-modal .spw-modal__close:focus-visible {
	background: rgba(0, 0, 0, .65);
	transform: rotate(90deg);
}

.spw-modal button:focus-visible {
	outline: 3px solid var(--spw-accent);
	outline-offset: 2px;
}

@media (max-width: 480px) {
	.spw-modal__content { padding: 52px 22px 30px; }
	.spw-modal__code { padding: 14px 22px; letter-spacing: .1em; }
}

@media (prefers-reduced-motion: reduce) {
	.spw-modal,
	.spw-modal__box,
	.spw-modal .spw-modal__close { transition: none; }
	.spw-modal__code { animation: none; }
}
