/* NOP Popup sul sito. Nascosti finche' lo script li apre; senza script li apre un link #nopd-popup-<id> (:target). */
.nopdpu[hidden] { display: none; }
.nopdpu[hidden]:target, .nopdpu.is-open { display: block; }

.nopdpu {
	--nopdpu-bg: #fff;
	--nopdpu-ink: #1F2937;
	--nopdpu-muted: rgba(31, 41, 55, .72);
	--nopdpu-radius: 14px;
	--nopdpu-on-accent: #fff;
	position: fixed;
	z-index: 999990; /* sotto il banner dei cookie (NOP Cookie Consent: 999999), sopra il tema */
	box-sizing: border-box;
	font-size: 1rem;
	line-height: 1.5;
}
.nopdpu *, .nopdpu *::before, .nopdpu *::after { box-sizing: border-box; }

.nopdpu__box {
	position: relative;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	overscroll-behavior: contain;
	padding: 28px 28px 24px;
	border-radius: var(--nopdpu-radius);
	background: var(--nopdpu-bg);
	color: var(--nopdpu-ink);
	box-shadow: 0 24px 60px rgba(15, 23, 42, .28), 0 2px 8px rgba(15, 23, 42, .12);
	outline: 1px solid transparent; /* visibile con i colori forzati */
}
.nopdpu__box:focus { outline: none; }
/* La finestra prende il focus solo per portarci dentro chi usa la tastiera: niente anello attorno a tutto il popup. */
.nopdpu__box:focus-visible { outline: none; }

/* ---- Finestra al centro ---- */
.nopdpu--modal { inset: 0; padding: 16px; z-index: 999991; }
.nopdpu--modal.is-open, .nopdpu--modal[hidden]:target { display: flex; align-items: center; justify-content: center; }
.nopdpu__overlay { position: absolute; inset: 0; background: rgba(17, 17, 26, .58); cursor: default; }
.nopdpu--modal .nopdpu__box { width: 100%; }
.nopdpu--modal.nopdpu--small .nopdpu__box { max-width: 400px; }
.nopdpu--modal.nopdpu--medium .nopdpu__box { max-width: 560px; }
.nopdpu--modal.nopdpu--large .nopdpu__box { max-width: 780px; }

/* ---- Riquadro di lato ---- */
.nopdpu--slide { bottom: 20px; width: min(380px, calc(100% - 32px)); }
.nopdpu--right { right: 20px; }
.nopdpu--left { left: 20px; }
.nopdpu--slide .nopdpu__box { max-height: min(70vh, 560px); padding: 22px 22px 18px; }

/* ---- Barra ---- */
.nopdpu--bar { left: 0; right: 0; }
.nopdpu--top { top: 0; }
.nopdpu--bottom { bottom: 0; }
.admin-bar .nopdpu--top { top: 32px; }
.nopdpu--bar .nopdpu__box { max-height: 40vh; padding: 12px 56px 12px 20px; border-radius: 0; box-shadow: 0 4px 18px rgba(15, 23, 42, .18); }
.nopdpu--bar .nopdpu__content { max-width: 1100px; margin: 0 auto; text-align: center; }
.nopdpu--bar .nopdpu__content > * { margin-top: 0; margin-bottom: 6px; }
.nopdpu--bar .wp-block-buttons { justify-content: center; }

/* Barra che sposta la pagina: in alto scorre via con la pagina, in basso resta (lo spazio lo fa front.js). */
.nopdpu.nopdpu--pushtop { position: absolute; }
.nopdpu.nopdpu--pushtop.nopdpu--inbody { top: 0; }

/* ---- Contenuto ---- */
.nopdpu .nopdpu__title { margin: 0 40px 12px 0; padding: 0; font-size: 1.35rem; line-height: 1.25; letter-spacing: normal; text-transform: none; color: inherit; }
.nopdpu__sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.nopdpu__content > :first-child { margin-top: 0; }
.nopdpu__content > :last-child { margin-bottom: 0; }
.nopdpu__content > h1:first-child, .nopdpu__content > h2:first-child, .nopdpu__content > h3:first-child { padding-right: 36px; }
.nopdpu__content img { max-width: 100%; height: auto; }
.nopdpu--slide .nopdpu__content :is(h1, h2), .nopdpu--asbox .nopdpu__content :is(h1, h2), .nopdpu--bar .nopdpu__content :is(h1, h2) { font-size: 1.3em; line-height: 1.25; }
.nopdpu__content a:not(.wp-element-button) { color: inherit; text-decoration: underline; }
.nopdpu--accent .wp-element-button:not(.is-style-outline *), .nopdpu--accent .nopdfm__button { background: var(--nopdpu-accent); color: var(--nopdpu-on-accent); }

/* Editor a blocchi: il tema non decide misure e spazi (titoli enormi, pulsanti sopra il testo). */
.nopdpu--blocks .nopdpu__content { display: flex; flex-direction: column; gap: 14px; }
.nopdpu--blocks .nopdpu__content > * { margin: 0; max-width: 100%; }
.nopdpu--blocks .nopdpu__content :is(h1, h2, h3, h4) { margin: 0; padding: 0; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.01em; text-transform: none; color: inherit; overflow-wrap: anywhere; }
.nopdpu--blocks .nopdpu__content :is(h3, h4) { font-size: 1.2rem; }
.nopdpu--blocks .nopdpu__content p { margin: 0; font-size: 1rem; line-height: 1.5; }
.nopdpu--blocks .nopdpu__content .wp-block-buttons { margin: 4px 0 0; gap: 10px; }
.nopdpu--blocks .nopdpu__content .wp-element-button { display: inline-block; margin: 0; padding: .75em 1.4em; font-size: 1rem; line-height: 1.2; border-radius: calc(var(--nopdpu-radius) * .6); text-decoration: none; }
.nopdpu--accent .is-style-outline .wp-element-button { color: var(--nopdpu-accent); border-color: currentColor; }

/* ---- Chiudi ----
 * Con JavaScript diventa un <button>: i temi danno ai pulsanti posizione,
 * larghezza, margini, sfondo. Qui tutto con selettori piu' specifici di
 * "body button" o ".site button" (0,3,0), cosi' resta nell'angolo. */
.nopdpu .nopdpu__box .nopdpu__close {
	position: absolute;
	top: 8px;
	right: 8px;
	bottom: auto;
	left: auto;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 40px;
	min-width: 0;
	max-width: none;
	height: 40px;
	min-height: 0;
	max-height: none;
	margin: 0;
	padding: 0;
	float: none;
	border: 0;
	border-radius: 50%;
	outline: none;
	background: transparent;
	box-shadow: none;
	color: var(--nopdpu-ink);
	font-size: 0;
	line-height: 0;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	transform: none;
	cursor: pointer;
}
.nopdpu .nopdpu__box .nopdpu__close svg { display: block; width: 20px; height: 20px; max-width: none; margin: 0; fill: none; }
.nopdpu .nopdpu__box .nopdpu__close:focus, .nopdpu .nopdpu__box .nopdpu__close:active { background: transparent; color: var(--nopdpu-ink); box-shadow: none; border: 0; outline: none; }
.nopdpu .nopdpu__box .nopdpu__close:hover { background: rgba(127, 127, 127, .16); color: var(--nopdpu-ink); }
.nopdpu .nopdpu__box .nopdpu__close:focus-visible { outline: 3px solid var(--nopdpu-accent, #4F46E5); outline-offset: 1px; }
.nopdpu.nopdpu--bar .nopdpu__box .nopdpu__close { top: 50%; right: 8px; transform: translateY(-50%); }
.nopdpu .nopdpu__box:has(.nopdpu-d--media-top) .nopdpu__close { background: var(--nopdpu-bg); }

/* ---- Editor visivo: markup nostro, misure nostre ---- */
.nopdpu--visual .nopdpu__box { padding: 0; container-type: inline-size; }
.nopdpu .nopdpu-d { display: block; font-size: 1rem; line-height: 1.5; color: var(--nopdpu-ink); }
.nopdpu .nopdpu-d__body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 32px 32px 28px; }
.nopdpu--slide .nopdpu-d__body { padding: 24px 22px 20px; gap: 12px; }
.nopdpu .nopdpu-d--center .nopdpu-d__body { align-items: center; text-align: center; }
.nopdpu .nopdpu-d--left .nopdpu-d__body > .nopdpu-d__h:first-child, .nopdpu .nopdpu-d--left .nopdpu-d__body > .nopdpu-d__badge:first-child { padding-right: 32px; }
.nopdpu .nopdpu-d--center .nopdpu-d__body > :first-child { margin-top: 6px; }
.nopdpu .nopdpu-d__body > * { max-width: 100%; margin: 0; }
.nopdpu .nopdpu-d .nopdpu-d__h { margin: 0; padding: 0; font-family: inherit; font-weight: 700; font-style: normal; line-height: 1.15; letter-spacing: -.015em; text-transform: none; color: inherit; overflow-wrap: anywhere; text-wrap: balance; }
.nopdpu .nopdpu-d .nopdpu-d__h--s { font-size: 1.2rem; }
.nopdpu .nopdpu-d .nopdpu-d__h--m { font-size: 1.6rem; }
.nopdpu .nopdpu-d .nopdpu-d__h--l { font-size: clamp(1.8rem, 9cqi, 2.4rem); line-height: 1.08; }
.nopdpu .nopdpu-d .nopdpu-d__p { margin: 0; padding: 0; font-size: 1rem; line-height: 1.55; color: inherit; opacity: .82; text-wrap: pretty; }
.nopdpu .nopdpu-d .nopdpu-d__p--s { font-size: .875rem; }
.nopdpu .nopdpu-d .nopdpu-d__act { margin: 4px 0 0; padding: 0; }
.nopdpu .nopdpu-d .nopdpu-d__act--full { align-self: stretch; }
.nopdpu .nopdpu-d .nopdpu-d__btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 46px; margin: 0; padding: 12px 24px; border: 2px solid var(--nopdpu-accent, var(--nopdpu-ink)); border-radius: min(calc(var(--nopdpu-radius) * .7), 999px); background: var(--nopdpu-accent, var(--nopdpu-ink)); color: var(--nopdpu-on-accent); font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; letter-spacing: normal; text-transform: none; text-decoration: none; box-shadow: none; transition: filter .15s ease, transform .15s ease; }
.nopdpu:not(.nopdpu--accent) .nopdpu-d .nopdpu-d__btn--fill { color: var(--nopdpu-bg); }
.nopdpu .nopdpu-d .nopdpu-d__act--full .nopdpu-d__btn { width: 100%; }
.nopdpu .nopdpu-d .nopdpu-d__btn--outline { background: transparent; color: var(--nopdpu-accent, var(--nopdpu-ink)); }
.nopdpu .nopdpu-d .nopdpu-d__btn:hover { filter: brightness(1.08); color: var(--nopdpu-on-accent); text-decoration: none; }
.nopdpu:not(.nopdpu--accent) .nopdpu-d .nopdpu-d__btn--fill:hover { color: var(--nopdpu-bg); }
.nopdpu .nopdpu-d .nopdpu-d__btn--outline:hover { color: var(--nopdpu-accent, var(--nopdpu-ink)); }
.nopdpu .nopdpu-d .nopdpu-d__btn:active { transform: scale(.98); }
.nopdpu .nopdpu-d .nopdpu-d__btn:focus-visible, .nopdpu .nopdpu-d a:focus-visible, .nopdpu .nopdpu-d button:focus-visible { outline: 3px solid var(--nopdpu-accent, var(--nopdpu-ink)); outline-offset: 2px; }
.nopdpu .nopdpu-d .nopdpu-d__dismiss { margin: -4px 0 0; font-size: .875rem; }
.nopdpu .nopdpu-d .nopdpu-d__dismiss a { color: inherit; opacity: .7; text-decoration: underline; text-underline-offset: 3px; background: none; box-shadow: none; }
.nopdpu .nopdpu-d .nopdpu-d__badge { margin: 0; line-height: 1; }
.nopdpu .nopdpu-d .nopdpu-d__badge span { display: inline-block; padding: 6px 11px; border-radius: 999px; background: color-mix(in srgb, var(--nopdpu-accent, var(--nopdpu-ink)) 14%, transparent); color: var(--nopdpu-accent, var(--nopdpu-ink)); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nopdpu .nopdpu-d .nopdpu-d__coupon { display: flex; align-items: center; gap: 8px; align-self: stretch; justify-content: space-between; padding: 8px 8px 8px 16px; border: 2px dashed color-mix(in srgb, var(--nopdpu-accent, var(--nopdpu-ink)) 60%, transparent); border-radius: calc(var(--nopdpu-radius) * .6); background: color-mix(in srgb, var(--nopdpu-accent, var(--nopdpu-ink)) 6%, transparent); }
.nopdpu .nopdpu-d--center .nopdpu-d__coupon { justify-content: center; }
.nopdpu .nopdpu-d .nopdpu-d__coupon code { padding: 0; background: none; color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.2rem; font-weight: 700; letter-spacing: .08em; overflow-wrap: anywhere; }
.nopdpu .nopdpu-d .nopdpu-d__copy { position: static; flex: none; float: none; width: auto; height: auto; min-height: 0; margin: 0; padding: 8px 14px; border: 0; border-radius: calc(var(--nopdpu-radius) * .45); background: var(--nopdpu-ink); color: var(--nopdpu-bg); font: inherit; font-size: .8125rem; font-weight: 600; line-height: 1.2; text-transform: none; cursor: pointer; box-shadow: none; }
.nopdpu .nopdpu-d .nopdpu-d__img { margin: 0; align-self: stretch; }
.nopdpu .nopdpu-d .nopdpu-d__img--s { align-self: auto; width: 96px; }
.nopdpu .nopdpu-d .nopdpu-d__img--m { align-self: auto; width: min(240px, 100%); }
.nopdpu .nopdpu-d .nopdpu-d__img img { display: block; width: 100%; height: auto; margin: 0; border-radius: calc(var(--nopdpu-radius) * .6); }
.nopdpu .nopdpu-d .nopdpu-d__form { align-self: stretch; text-align: left; }
.nopdpu .nopdpu-d .nopdpu-d__hr { align-self: stretch; height: 0; margin: 2px 0; border: 0; border-top: 1px solid currentColor; opacity: .16; background: none; }
.nopdpu .nopdpu-d .nopdpu-d__sp--s { height: 0; }
.nopdpu .nopdpu-d .nopdpu-d__sp--m { height: 10px; }
.nopdpu .nopdpu-d .nopdpu-d__sp--l { height: 28px; }
.nopdpu .nopdpu-d__media { margin: 0; overflow: hidden; }
.nopdpu .nopdpu-d__media img { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; border-radius: 0; }
.nopdpu .nopdpu-d--media-top .nopdpu-d__media { aspect-ratio: 16 / 7; }
.nopdpu .nopdpu-d--media-side { display: grid; grid-template-columns: 42% minmax(0, 1fr); align-items: stretch; }
.nopdpu .nopdpu-d--media-side .nopdpu-d__body { justify-content: center; }
@container (max-width: 520px) {
	.nopdpu .nopdpu-d--media-side { display: block; }
	.nopdpu .nopdpu-d--media-side .nopdpu-d__media { aspect-ratio: 16 / 7; }
	.nopdpu .nopdpu-d__body { padding: 26px 22px 22px; }
}
.nopdpu--bar.nopdpu--visual .nopdpu__box { padding: 0 52px 0 16px; }
.nopdpu--bar .nopdpu-d__body { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; max-width: 1100px; margin: 0 auto; padding: 10px 0; text-align: center; }
.nopdpu--bar .nopdpu-d .nopdpu-d__h { font-size: 1.05rem; }
.nopdpu--bar .nopdpu-d .nopdpu-d__p { font-size: .9375rem; opacity: .9; }
.nopdpu--bar .nopdpu-d .nopdpu-d__act { margin: 0; }
.nopdpu--bar .nopdpu-d .nopdpu-d__btn { min-height: 36px; padding: 7px 16px; font-size: .875rem; }
.nopdpu--bar .nopdpu-d .nopdpu-d__dismiss { margin: 0; }
.nopdpu--bar .nopdpu-d .nopdpu-d__coupon { align-self: auto; padding: 4px 4px 4px 12px; }
.nopdpu--bar .nopdpu-d .nopdpu-d__coupon code { font-size: 1rem; }
.nopdpu--bar .nopdpu-d :is(.nopdpu-d__img, .nopdpu-d__hr, .nopdpu-d__sp, .nopdpu-d__form) { display: none; }

/* ---- Stili (Pro) ---- */
.nopdpu--dark { --nopdpu-bg: #111827; --nopdpu-ink: #F9FAFB; --nopdpu-muted: rgba(249, 250, 251, .75); }
.nopdpu--soft { --nopdpu-bg: #F5F3FF; --nopdpu-radius: 22px; }
.nopdpu--soft.nopdpu--accent .nopdpu__box { background: color-mix(in srgb, var(--nopdpu-accent) 9%, #fff); }

/* ---- Telefoni: niente che copra la pagina all'arrivo ---- */
@media (max-width: 767px) {
	.nopdpu--slide, .nopdpu--asbox { inset: auto 8px 8px 8px; width: auto; padding: 0; }
	.nopdpu--slide .nopdpu__box, .nopdpu--asbox .nopdpu__box { max-width: none; max-height: 38vh; padding: 18px 18px 14px; }
	.nopdpu--asbox.is-open { display: block; }
	.nopdpu--asbox .nopdpu__overlay { display: none; }
	.nopdpu--bar .nopdpu__box { max-height: 30vh; padding: 10px 52px 10px 14px; }
	.admin-bar .nopdpu--top { top: 46px; }
	.nopdpu--modal .nopdpu__box { padding: 24px 18px 18px; }
	.nopdpu--visual .nopdpu__box, .nopdpu--visual.nopdpu--modal .nopdpu__box, .nopdpu--visual.nopdpu--slide .nopdpu__box { padding: 0; }
	.nopdpu--visual.nopdpu--bar .nopdpu__box { padding: 0 48px 0 12px; }
	.nopdpu .nopdpu-d__body { padding: 22px 18px 18px; gap: 12px; }
	.nopdpu--asbox .nopdpu-d__media, .nopdpu--slide .nopdpu-d__media { display: none; }
	.nopdpu--asbox .nopdpu-d--media-side, .nopdpu--slide .nopdpu-d--media-side { display: block; }
}

/* ---- Movimento: solo all'apertura, e mai con prefers-reduced-motion ---- */
@media (prefers-reduced-motion: no-preference) {
	.nopdpu.is-open .nopdpu__box { animation: nopdpu-in .22s ease-out; }
	.nopdpu--modal.is-open:not(.nopdpu--asbox) .nopdpu__overlay { animation: nopdpu-fade .22s ease-out; }
	.nopdpu--slide.is-open .nopdpu__box, .nopdpu--asbox.is-open .nopdpu__box, .nopdpu--bottom.is-open .nopdpu__box { animation-name: nopdpu-up; }
	.nopdpu--top.is-open .nopdpu__box { animation-name: nopdpu-down; }
}
@keyframes nopdpu-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes nopdpu-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nopdpu-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes nopdpu-down { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

/* La finestra modale ferma lo scorrimento della pagina dietro (solo lei). */
html.nopdpu-lock { overflow: hidden; }

@media (forced-colors: active) {
	.nopdpu__box { outline: 2px solid CanvasText; }
}

.nopdpu-missing { padding: 8px 12px; border: 1px dashed #c3c4c7; color: #50575e; }
