/* ==========================================================================
   UPdate — modulo di iscrizione alla newsletter
   Sostituisce l'iframe di Substack nel footer. Sorgente versionato in
   C:\Progetti\Ultima Pagina\up-newsletter-footer\
   ========================================================================== */

.up-nl {
	--nl-navy: #002740;
	--nl-giallo: var(--tertiary, #FDC548);
	--nl-giallo-caldo: #f6b92d;
	--nl-teal: var(--secondary, #106F8C);
	--nl-rosso: var(--primary, #960F0F);
	--nl-bordo: rgba(0, 39, 64, .22);
	--nl-tenue: rgba(0, 39, 64, .72);

	display: grid;
	gap: .625rem;
	width: 100%;
	max-width: 29rem;
	color: var(--nl-navy);
	font-family: 'Raleway', system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 500;
	line-height: 1.5;
	text-align: left;
}

.up-nl *,
.up-nl *::before,
.up-nl *::after { box-sizing: border-box; }

/* display:grid/flex vincerebbero sull'attributo hidden. */
.up-nl [hidden] { display: none !important; }

/* Il modulo su un piano crema, lo stesso dei box corsi del blog: sulla card
   bianca il campo bianco resta il punto più chiaro, e il gruppo ha un bordo. */
.up-nl--pannello {
	max-width: 30rem;
	/* Alta come il modulo: passando alla conferma il footer non salta. */
	min-height: 15.0625rem;
	align-content: center;
	padding: 1.375rem 1.25rem 1.25rem;
	border: 1px solid rgba(0, 39, 64, .09);
	border-radius: 1rem;
	background: var(--up-crema, #FAF7F2);
}

.up-nl__modulo {
	display: grid;
	gap: .625rem;
	margin: 0;
}

/* --- campo ---------------------------------------------------------------- */

.up-nl__label {
	display: block;
	color: rgba(0, 39, 64, .8);
	font-size: .875rem;
	font-weight: 600;
	line-height: 1.3;
}

.up-nl__input {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 3.375rem;
	padding: 0 1.0625rem;
	border: 2px solid var(--nl-bordo);
	border-radius: .75rem;
	background: #fff;
	color: var(--nl-navy);
	font: inherit;
	font-size: 1.0625rem;
	line-height: 3.25rem;
	transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.up-nl__input::placeholder { color: rgba(0, 39, 64, .68); }
.up-nl__input:hover { border-color: rgba(0, 39, 64, .36); }

.up-nl__input:focus {
	outline: none;
	border-color: var(--nl-teal);
	box-shadow: 0 0 0 4px rgba(16, 111, 140, .16);
}

.up-nl__input:disabled {
	background: rgba(0, 39, 64, .04);
	color: var(--nl-tenue);
	-webkit-text-fill-color: var(--nl-tenue);
	opacity: 1;
}

.up-nl[data-stato="errore"] .up-nl__input {
	border-color: var(--nl-rosso);
	box-shadow: 0 0 0 4px rgba(150, 15, 15, .12);
}

/* --- bottone -------------------------------------------------------------- */

.up-nl__bottone {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	width: 100%;
	min-height: 3.375rem;
	padding: .75rem 1.5rem;
	border: 0;
	border-radius: 1.75rem;
	background: var(--nl-giallo);
	box-shadow: 0 6px 16px -8px rgba(0, 39, 64, .55);
	color: #16100a;
	font: inherit;
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: transform .2s cubic-bezier(.16, 1, .3, 1), background-color .18s ease, box-shadow .2s ease;
}

.up-nl__bottone:hover {
	background: var(--nl-giallo-caldo);
	box-shadow: 0 12px 24px -10px rgba(0, 39, 64, .6);
	transform: translateY(-1px);
}

.up-nl__bottone:active {
	box-shadow: 0 4px 10px -8px rgba(0, 39, 64, .6);
	transform: translateY(0);
}

.up-nl__bottone:focus-visible {
	outline: 3px solid var(--nl-teal);
	outline-offset: 3px;
}

.up-nl__bottone[disabled] {
	background: rgba(253, 197, 72, .5);
	box-shadow: none;
	color: rgba(0, 39, 64, .6);
	cursor: progress;
	transform: none;
}

.up-nl__rotella {
	width: 1.125rem;
	height: 1.125rem;
	flex: 0 0 auto;
	animation: up-nl-gira 900ms linear infinite;
}

.up-nl__rotella circle {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-dasharray: 34 22;
}

@keyframes up-nl-gira { to { transform: rotate(1turn); } }

/* --- messaggi ------------------------------------------------------------- */

.up-nl__errore {
	display: flex;
	align-items: flex-start;
	gap: .375rem;
	margin: -.125rem 0 0;
	color: var(--nl-rosso);
	font-size: .875rem;
	font-weight: 600;
	line-height: 1.4;
}

.up-nl__errore svg {
	width: 1.0625rem;
	height: 1.0625rem;
	flex: 0 0 auto;
	margin-top: .0625rem;
}

.up-nl__nota {
	margin: .125rem 0 0;
	color: var(--nl-tenue);
	font-size: .8125rem;
	font-weight: 500;
	line-height: 1.5;
}

.up-nl__nota a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: .15em;
	text-decoration-thickness: 1px;
	transition: color .15s ease;
}

.up-nl__nota a:hover { color: var(--nl-teal); }

/* --- trappola per i bot --------------------------------------------------- */

.up-nl__esca {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* --- conferma ------------------------------------------------------------- */

.up-nl__fatto {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: .25rem .875rem;
	padding: .25rem 0;
}

.up-nl__spunta {
	width: 2.5rem;
	height: 2.5rem;
	grid-row: span 2;
	flex: 0 0 auto;
}

.up-nl__spunta circle {
	fill: rgba(16, 111, 140, .09);
	stroke: rgba(16, 111, 140, .35);
	stroke-width: 1.5;
}

.up-nl__spunta path {
	fill: none;
	stroke: var(--nl-teal);
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.up-nl__fatto-titolo {
	margin: 0;
	color: var(--nl-navy);
	font-family: 'Recoleta', Georgia, serif;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.2;
}

.up-nl__fatto-testo {
	margin: 0;
	color: var(--nl-tenue);
	font-size: .9375rem;
	line-height: 1.55;
}

/* Il momento: la conferma sale, si mette a fuoco e la spunta si disegna. */
.up-nl[data-stato="fatto"] .up-nl__fatto {
	animation: up-nl-sale .6s cubic-bezier(.16, 1, .3, 1) both;
}

.up-nl[data-stato="fatto"] .up-nl__spunta path {
	stroke-dasharray: 32;
	stroke-dashoffset: 32;
	animation: up-nl-traccia .5s .22s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes up-nl-sale {
	from { opacity: 0; transform: translateY(12px); filter: blur(7px); }
	to   { opacity: 1; transform: none; filter: blur(0); }
}

@keyframes up-nl-traccia { to { stroke-dashoffset: 0; } }

/* --- schermi stretti ------------------------------------------------------ */

@media (max-width: 767px) {
	.up-nl { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
	.up-nl *,
	.up-nl *::before,
	.up-nl *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
	.up-nl[data-stato="fatto"] .up-nl__spunta path { stroke-dashoffset: 0; }
}
