/*
 * BuonoandCo – base: caratteri, variabili, tipografia, griglia, bottoni, campi, messaggi.
 * Valori da 05_SITO/wireframe/06-elenco-sezioni.md ("Regole comuni") e dal brand book v1.
 * Questi valori non si cambiano dall'amministrazione.
 */

/* ---------- Caratteri (ospitati nel tema, licenza OFL) ---------- */
@font-face {
	font-family: "Gloock";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/gloock-latin-400-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Gloock";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/gloock-latin-ext-400-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Albert Sans";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/albert-sans-latin-400-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Albert Sans";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/albert-sans-latin-ext-400-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Albert Sans";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/albert-sans-latin-600-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Albert Sans";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/albert-sans-latin-ext-600-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Variabili ---------- */
:root {
	/* Palette del brand book v1 (non si aggiungono colori) */
	--nero: #000000;
	--bianco: #ffffff;
	--oro: #c4a05e;          /* mai per testo su bianco */
	--grigio-testo: #6b6b6b; /* solo su bianco pieno o #F4F4F4 (5,3:1 e 4,9:1) */
	--grigio-linee: #e3e3e3;
	--grigio-fondo: #f4f4f4;

	/* Colori funzionali: PROPOSTA da approvare (il brand book non li definisce). Solo messaggi di sistema. */
	--errore: #9e2b25;   /* rosso mattone scuro: 7,4:1 su bianco, 6,8:1 su #F4F4F4 */
	--conferma: #2f5f3a; /* verde bosco scuro: 7,5:1 su bianco, 6,8:1 su #F4F4F4 */

	/* Caratteri */
	--font-titoli: "Gloock", Georgia, "Times New Roman", serif;
	--font-testo: "Albert Sans", "Helvetica Neue", Arial, sans-serif;

	/* Scala tipografica: valori mobile (390). I valori desktop sono sotto, da 1024 px. */
	--fs-display: 2.875rem;  --lh-display: 3.125rem;  /* 46/50 */
	--fs-h1: 2.375rem;       --lh-h1: 2.625rem;       /* 38/42 */
	--fs-h2: 2rem;           --lh-h2: 2.375rem;       /* 32/38 */
	--fs-h3: 1.5rem;         --lh-h3: 1.875rem;       /* 24/30 */
	--fs-h4: 1.25rem;        --lh-h4: 1.625rem;       /* 20/26 */
	--fs-testo: 1rem;        --lh-testo: 1.5rem;      /* 16/24 */
	--fs-piccolo: 0.875rem;  --lh-piccolo: 1.25rem;   /* 14/20 */
	--fs-etichetta: 0.75rem;                           /* 12 */
	--ls-etichetta: 0.14em;                            /* maiuscolo +14% */

	/* Griglia: 390 con margini 20, 1440 con margini 80 e contenuto 1280 */
	--contenuto: 1280px;
	--margine: clamp(20px, calc(5.714vw - 2.29px), 80px);
	--colonne: 12;
	--gap: clamp(16px, calc(1.524vw + 10.06px), 32px);

	/* Spaziatura verticale delle sezioni: 48-56 mobile, 96-112 desktop */
	--sezione: clamp(48px, calc(4.571vw + 30.17px), 96px);
	--sezione-l: clamp(56px, calc(5.333vw + 35.2px), 112px);

	/* Bottoni e campi: 48 mobile, 52 desktop */
	--alt-controllo: 48px;
	--filetto-l: 56px;
	--filetto-s: 3px;
}
@media (min-width: 1024px) {
	:root {
		--fs-display: 5.5rem;   --lh-display: 5.875rem;  /* 88/94 */
		--fs-h1: 4rem;          --lh-h1: 4.375rem;       /* 64/70 */
		--fs-h2: 3rem;          --lh-h2: 3.375rem;       /* 48/54 */
		--fs-h3: 2rem;          --lh-h3: 2.375rem;       /* 32/38 */
		--fs-h4: 1.5rem;        --lh-h4: 1.875rem;       /* 24/30 */
		--fs-testo: 1.125rem;   --lh-testo: 1.75rem;     /* 18/28 */
		--fs-piccolo: 0.9375rem; --lh-piccolo: 1.375rem; /* 15/22 */
		--fs-etichetta: 0.8125rem;                        /* 13 */
		--alt-controllo: 52px;
	}
}

/* ---------- Reset essenziale ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bianco);
	color: var(--nero);
	font-family: var(--font-testo);
	font-size: var(--fs-testo);
	line-height: var(--lh-testo);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
p, ul, ol, figure, blockquote { margin: 0; }
/* :where() azzera la specificità: prima questa regola (0,1,1) vinceva sulle classi delle sezioni e ne annullava
   i margini interni (filo oro di Come funziona, fila dello scaffale, sottovoci del menu mobile…). 26/10/2026 */
:where(ul[class], ol[class]) { list-style: none; padding: 0; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Tipografia ---------- */
h1, h2, h3, h4, .t-display, .t-h1, .t-h2, .t-h3, .t-h4 {
	font-family: var(--font-titoli);
	font-weight: 400;
	font-style: normal; /* Gloock mai in corsivo */
	margin: 0;
	letter-spacing: -0.01em;
}
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: -0.02em; }
h1, .t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2, .t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3, .t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }
h4, .t-h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); }
.t-testo { font-size: var(--fs-testo); line-height: var(--lh-testo); }
.t-piccolo { font-size: var(--fs-piccolo); line-height: var(--lh-piccolo); }
.t-etichetta {
	font-family: var(--font-testo);
	font-size: var(--fs-etichetta);
	line-height: 1.4;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: var(--ls-etichetta);
}
.t-secondario { color: var(--grigio-testo); } /* solo su bianco pieno o #F4F4F4 */
strong, b { font-weight: 600; }

/* ---------- Contenitore e griglia ---------- */
.contenitore {
	width: 100%;
	max-width: calc(var(--contenuto) + 2 * var(--margine));
	margin-inline: auto;
	padding-inline: var(--margine);
}
.griglia { display: grid; grid-template-columns: repeat(var(--colonne), minmax(0, 1fr)); column-gap: var(--gap); }
.sezione { padding-block: var(--sezione); }

/* ---------- Fondi e texture (05_SITO/tema/texture/LEGGIMI.md) ---------- */
.fondo-bianco { background: var(--bianco); color: var(--nero); }
.fondo-grigio { background: var(--grigio-fondo); color: var(--nero); }
.fondo-carta-vergata { background: var(--bianco) url("../../texture/carta-bianca-vergata-mobile.webp") center / cover no-repeat; color: var(--nero); }
.fondo-carta-liscia { background: var(--bianco) url("../../texture/carta-bianca-liscia-mobile.webp") center / cover no-repeat; color: var(--nero); }
.fondo-velina { background: var(--bianco) url("../../texture/velina-bianca-mobile.webp") center / cover no-repeat; color: var(--nero); }
.fondo-nera-liscia { background: var(--nero) url("../../texture/carta-nera-liscia-mobile.webp") center / cover no-repeat; color: var(--bianco); }
.fondo-nera-goffrata { background: var(--nero) url("../../texture/carta-nera-goffrata-mobile.webp") center / cover no-repeat; color: var(--bianco); }
.fondo-pacchi-nera { background: var(--nero) url("../../texture/carta-pacchi-nera-mobile.webp") center / cover no-repeat; color: var(--bianco); }
@media (min-width: 768px) {
	.fondo-carta-vergata { background-image: url("../../texture/carta-bianca-vergata-desktop.webp"); }
	.fondo-carta-liscia { background-image: url("../../texture/carta-bianca-liscia-desktop.webp"); }
	.fondo-velina { background-image: url("../../texture/velina-bianca-desktop.webp"); }
	.fondo-nera-liscia { background-image: url("../../texture/carta-nera-liscia-desktop.webp"); }
	.fondo-nera-goffrata { background-image: url("../../texture/carta-nera-goffrata-desktop.webp"); }
	.fondo-pacchi-nera { background-image: url("../../texture/carta-pacchi-nera-desktop.webp"); }
}
/* Sulle carte bianche con texture il grigio non passa l'AA: i testi secondari restano neri. */
.fondo-carta-vergata .t-secondario, .fondo-carta-liscia .t-secondario, .fondo-velina .t-secondario { color: var(--nero); }
/* Sul nero i testi sono sempre bianchi. */
.fondo-nera-liscia .t-secondario, .fondo-nera-goffrata .t-secondario, .fondo-pacchi-nera .t-secondario { color: var(--bianco); }

/* ---------- Oro: le forme previste ---------- */
.filetto { display: block; width: var(--filetto-l); height: var(--filetto-s); background: var(--oro); border: 0; margin: 0 0 24px; }

/* ---------- Focus visibile: nero su chiaro, bianco su scuro ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--nero); outline-offset: 3px; }
.fondo-nera-liscia :focus-visible, .fondo-nera-goffrata :focus-visible, .fondo-pacchi-nera :focus-visible, .su-scuro :focus-visible { outline-color: var(--bianco); }

/* ---------- Bottoni: rettangoli ad angoli vivi ---------- */
.bottone, .button, button.button, input[type="submit"].button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: var(--alt-controllo);
	padding: 0 32px;
	border: 1px solid var(--nero);
	border-radius: 0;
	background: var(--nero);
	color: var(--bianco);
	font-family: var(--font-testo);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
/* Stati interattivi: il brand book non li definisce. Proposta: al passaggio il bottone si inverte. */
.bottone:hover, .button:hover { background: var(--bianco); color: var(--nero); }
.bottone--contorno { background: transparent; color: var(--nero); }
.bottone--contorno:hover { background: var(--nero); color: var(--bianco); }
.bottone--bianco { background: var(--bianco); color: var(--nero); border-color: var(--bianco); }
.bottone--bianco:hover { background: transparent; color: var(--bianco); }
.bottone--contorno-bianco { background: transparent; color: var(--bianco); border-color: var(--bianco); }
.bottone--contorno-bianco:hover { background: var(--bianco); color: var(--nero); }
.bottone:disabled, .bottone[aria-disabled="true"] { background: var(--grigio-linee); border-color: var(--grigio-linee); color: var(--grigio-testo); cursor: not-allowed; }
.bottone--largo { width: 100%; }

/* Link di testo con freccia ("Vedi tutto →"): sottolineatura piena sotto testo e freccia */
.link-freccia {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 6px;
	border-bottom: 1px solid currentColor;
	font-weight: 600;
	font-size: var(--fs-piccolo);
	line-height: 1.3;
	text-decoration: none;
}
.link-freccia .icona { width: 16px; height: 16px; transition: transform .15s ease; }
.link-freccia:hover .icona { transform: translateX(3px); }

/* ---------- Campi: etichetta sopra, bordo #6B6B6B ---------- */
.campo { display: grid; gap: 8px; }
.campo label, .etichetta-campo { font-size: var(--fs-piccolo); line-height: var(--lh-piccolo); font-weight: 600; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="number"], input[type="password"], input[type="url"], input[type="date"], select, textarea {
	width: 100%;
	min-height: var(--alt-controllo);
	padding: 12px 16px;
	border: 1px solid var(--grigio-testo); /* 5,3:1 sul bianco */
	border-radius: 0;
	background: var(--bianco);
	color: var(--nero);
	font-size: 1rem; /* almeno 16 px: niente zoom automatico su iPhone */
	line-height: 1.4;
	appearance: none;
}
textarea { min-height: 140px; resize: vertical; }
::placeholder { color: var(--grigio-testo); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--nero); outline-offset: 0; border-color: var(--nero); }
[aria-invalid="true"] { border-color: var(--errore); }
.campo__errore { color: var(--errore); font-size: var(--fs-piccolo); font-weight: 600; }

/* Casella di spunta quadrata */
.spunta { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-piccolo); line-height: var(--lh-piccolo); }
.spunta input[type="checkbox"] {
	flex: none;
	width: 20px; height: 20px; margin: 0;
	border: 1px solid currentColor; border-radius: 0; background: transparent;
	appearance: none; display: grid; place-content: center;
}
.spunta input[type="checkbox"]::after { content: ""; width: 10px; height: 10px; background: currentColor; transform: scale(0); transition: transform .1s ease; }
.spunta input[type="checkbox"]:checked::after { transform: scale(1); }
/* L'area di tocco della casella è tutta la riga con l'etichetta. */

/* ---------- Messaggi di sistema (errore, conferma, avviso) ---------- */
.messaggio {
	display: grid;
	gap: 4px;
	padding: 16px 20px;
	background: var(--grigio-fondo);
	border-left: 4px solid var(--nero);
	color: var(--nero);
	font-size: var(--fs-piccolo);
	line-height: var(--lh-piccolo);
}
.messaggio__titolo { font-weight: 600; }
.messaggio--errore { border-left-color: var(--errore); }
.messaggio--errore .messaggio__titolo { color: var(--errore); }
.messaggio--conferma { border-left-color: var(--conferma); }
.messaggio--conferma .messaggio__titolo { color: var(--conferma); }

/* ---------- Accessibilità ---------- */
.screen-reader-text, .sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}
.salta {
	position: absolute; left: 12px; top: -100px; z-index: 1000;
	padding: 12px 20px; background: var(--nero); color: var(--bianco);
	font-weight: 600; text-decoration: none;
}
.salta:focus { top: 12px; outline: 2px solid var(--bianco); outline-offset: -5px; }

/* Elenco nel riquadro di errore: ogni voce porta al campo */
.messaggio__elenco { display: grid; gap: 4px; margin: 4px 0 0; padding-left: 18px; }
.messaggio__elenco a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.is-nascosto { display: none !important; }
