/* idea.utopolis.it — identità di Utopolis: Blu Istituzionale, Plus Jakarta Sans e Inter. */
@font-face {
  font-family: "Plus Jakarta Sans Variable";
  src: url("./plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Inter Variable";
  src: url("./inter-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #f4f5f8;
  --paper: #ffffff;
  --line: #d5d9e5;
  --line-strong: #8a90a6; /* 3,2:1 su bianco: bordo dei campi */
  --ink: #1a1d2e;
  --ink-2: #4a5068; /* 7,9:1 su bianco */
  --brand: #1d4ed8; /* 6,3:1 su bianco */
  --brand-ink: #153a9d;
  --brand-tint: #e8eefc;
  --red: #b3261e; /* 6,5:1 su bianco */
  --red-tint: #fbe9e7;
  --green: #17683a;
  --ff-display: "Plus Jakarta Sans Variable", system-ui, sans-serif;
  --ff-text: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 var(--ff-text);
}
h1, h2, legend, .marchio, .bottone, .scelta-titolo { font-family: var(--ff-display); }
h1, h2, legend, .marchio, .bottone, .scelta-titolo { word-spacing: 0.14em; }
h1, h2 { line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.salta {
  position: absolute; left: 12px; top: -80px; z-index: 10;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-weight: 700;
}
.salta:focus { top: 12px; }
.solo-lettore {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.testata {
  background: var(--brand);
  color: #fff;
  padding: 40px 16px 88px;
}
.testata > * { max-width: 640px; margin-inline: auto; }
.marchio { font-size: 1.05rem; font-weight: 800; margin-bottom: 28px; letter-spacing: -0.01em; }
.marchio-sezione {
  font-weight: 600; background: rgba(255, 255, 255, 0.18); padding: 3px 10px; border-radius: 999px; margin-left: 4px;
}
h1 { font-size: clamp(1.9rem, 6vw, 2.75rem); font-weight: 800; }
.sottotitolo { margin-top: 14px; font-size: 1.0625rem; color: #eef2ff; text-wrap: pretty; }

main { padding: 0 16px 40px; }
.carta {
  max-width: 640px;
  margin: -56px auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 24px 28px;
  box-shadow: 0 10px 30px rgba(26, 29, 46, 0.08);
}

fieldset { border: 0; margin: 0; padding: 24px 0 4px; min-width: 0; }
fieldset + fieldset { border-top: 1px solid var(--line); }
legend {
  padding: 0; font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 10px; float: left; width: 100%;
  margin-bottom: 16px;
}
legend + * { clear: both; }
.passo {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 0.9rem;
}

.campo { margin-bottom: 18px; }
.due-colonne { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .due-colonne { grid-template-columns: 1fr 1fr; } }
label, .etichetta { display: block; font-weight: 600; margin-bottom: 6px; }
.facoltativo { font-weight: 400; color: var(--ink-2); font-size: 0.9rem; margin-left: 4px; }
input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
}
textarea { resize: vertical; min-height: 96px; }
select:disabled { background: var(--bg); color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand); border-radius: 12px;
}
[aria-invalid="true"] { border-color: var(--red); background: var(--red-tint); }
.aiuto { color: var(--ink-2); font-size: 0.9rem; margin-top: 6px; }
.errore-campo { color: var(--red); font-weight: 600; font-size: 0.92rem; margin-top: 6px; }

/* I tre bottoni grandi: sono veri pulsanti di scelta, usabili da tastiera. */
.scelte { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 560px) { .scelte { grid-template-columns: repeat(3, 1fr); } }
.scelta { margin: 0; cursor: pointer; position: relative; }
.scelta input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scelta-corpo {
  display: grid; grid-template-columns: 40px 1fr; gap: 2px 14px; align-items: center;
  height: 100%;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
  transition: border-color 0.12s, background-color 0.12s;
}
.scelta-corpo svg {
  grid-row: span 2; width: 40px; height: 40px; fill: none; stroke: var(--brand); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.scelta-titolo { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.scelta-testo { font-weight: 400; color: var(--ink-2); font-size: 0.9rem; line-height: 1.3; }
@media (min-width: 560px) {
  .scelta-corpo { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 12px; gap: 6px; }
  .scelta-corpo svg { grid-row: auto; width: 48px; height: 48px; margin-bottom: 4px; }
}
.scelta:hover .scelta-corpo { border-color: var(--brand); }
.scelta input:checked + .scelta-corpo {
  border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand);
}
.scelta input:focus-visible + .scelta-corpo { outline: 3px solid var(--ink); outline-offset: 2px; }
.scelte[aria-invalid="true"] .scelta-corpo { border-color: var(--red); }

.trappola { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consenso { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 6px; }
.riga-spunta { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; margin: 0; }
.riga-spunta input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--brand); }

.bottone {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 54px; padding: 12px 24px;
  background: var(--brand); color: #fff; border: 0; border-radius: 14px;
  font-size: 1.1rem; font-weight: 800; text-decoration: none; cursor: pointer;
}
.bottone:hover { background: var(--brand-ink); }
.bottone[aria-disabled="true"] { opacity: 0.65; cursor: progress; }
.stato { margin-top: 10px; color: var(--ink-2); min-height: 1.5em; text-align: center; }

.avviso { border-radius: 12px; padding: 14px 16px; margin-top: 20px; }
.avviso.errore { background: var(--red-tint); border: 1.5px solid var(--red); color: #5c120d; }
.avviso ul { margin: 6px 0 0; padding-left: 20px; }
.avviso a { color: inherit; font-weight: 600; }

.grazie { text-align: center; padding: 40px 24px; }
.grazie svg {
  width: 64px; height: 64px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: 12px;
}
.grazie h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; }
.grazie p { margin-bottom: 12px; color: var(--ink-2); }
.grazie .bottone { width: auto; margin-top: 8px; }

/* ---------- Proposte e mappa, sotto il form ---------- */
.blocco { margin-top: 24px; padding: 28px 24px; }
.blocco h2 { font-size: 1.45rem; font-weight: 800; margin-bottom: 8px; }
.blocco-intro { color: var(--ink-2); margin-bottom: 18px; }
.centrato { text-align: center; }
.bottone.secondario { background: #fff; color: var(--brand-ink); box-shadow: inset 0 0 0 2px var(--brand); }
.bottone.secondario:hover { background: var(--brand-tint); }

.proposte { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: proposta; }
.proposte li {
  counter-increment: proposta; display: grid; grid-template-columns: 32px 1fr auto; gap: 4px 12px; align-items: start;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.proposte li:first-child { border-top: 0; padding-top: 0; }
.proposte li::before {
  content: counter(proposta); width: 32px; height: 32px; border-radius: 50%; background: var(--brand-tint);
  color: var(--brand-ink); display: grid; place-items: center; font: 800 0.95rem var(--ff-display);
}
.proposta-titolo { font-weight: 600; line-height: 1.35; }
.proposta-stato { display: block; color: var(--ink-2); font-size: 0.88rem; font-weight: 400; margin-top: 2px; }
.proposta-sostegni { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.88rem; }
.proposta-sostegni b { display: block; font: 800 1.25rem/1.1 var(--ff-display); color: var(--ink); }

:root { --t-cittadini: #1d4ed8; --t-attivita: #b45309; --t-associazioni: #0f766e; }
.pallino { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; }
.pallino.t-cittadini { background: var(--t-cittadini); }
.pallino.t-attivita { background: var(--t-attivita); }
.pallino.t-associazioni { background: var(--t-associazioni); }

.filtro { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filtro-voce { margin: 0; position: relative; cursor: pointer; font-weight: 500; }
.filtro-voce input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.filtro-voce span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: #fff;
}
.filtro-voce input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.filtro-voce input:checked + span .pallino { box-shadow: 0 0 0 2px #fff; }
.filtro-voce input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

.mappa-barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; margin-bottom: 8px; }
.mappa-dove { color: var(--ink-2); font-size: 0.95rem; }
.bottone-piccolo {
  font: 700 0.95rem var(--ff-display); min-height: 44px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--brand-ink); border: 2px solid var(--brand);
}
.bottone-piccolo:hover { background: var(--brand-tint); }
.mappa-tela { background: #eef2f9; border-radius: 16px; padding: 8px; }
#mappa-svg { display: block; width: 100%; height: auto; max-height: 76vh; touch-action: manipulation; }
.m-regione { fill: #fff; stroke: #b9c0d3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.m-regione.con-dati { fill: #dfe7fb; cursor: pointer; }
.m-regione.con-dati:hover { fill: #c9d6f8; }
.m-regione.spenta { fill: #f6f7fa; stroke: #d5d9e5; }
.m-provincia { fill: #fff; stroke: #8a90a6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.m-provincia.con-dati { fill: #dfe7fb; }
.m-bolla { cursor: pointer; }
.m-bolla:focus { outline: none; }
.m-bolla .m-alone { fill: none; stroke: transparent; }
.m-bolla:focus-visible .m-alone, .m-bolla.scelta .m-alone { stroke: var(--ink); }
.m-bolla .m-centro { fill: #fff; }
.m-bolla .m-pieno { stroke: #fff; }
.m-bolla text { font-family: var(--ff-display); font-weight: 800; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.m-bolla .m-pieno + text, .m-bolla.piena text { fill: #fff; }
.f-total { fill: var(--brand); } .f-cittadini { fill: var(--t-cittadini); } .f-attivita { fill: var(--t-attivita); } .f-associazioni { fill: var(--t-associazioni); }

.dettaglio { margin-top: 14px; min-height: 96px; }
.dettaglio h3 { font: 800 1.1rem var(--ff-display); margin: 0 0 8px; }
.barre { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: 0.95rem; }
.barra { height: 12px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 6px; }
.barre .n { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.b-cittadini { background: var(--t-cittadini); } .b-attivita { background: var(--t-attivita); } .b-associazioni { background: var(--t-associazioni); }
.l-0 { width: 0; } .l-5 { width: 5%; } .l-10 { width: 10%; } .l-15 { width: 15%; } .l-20 { width: 20%; } .l-25 { width: 25%; }
.l-30 { width: 30%; } .l-35 { width: 35%; } .l-40 { width: 40%; } .l-45 { width: 45%; } .l-50 { width: 50%; } .l-55 { width: 55%; }
.l-60 { width: 60%; } .l-65 { width: 65%; } .l-70 { width: 70%; } .l-75 { width: 75%; } .l-80 { width: 80%; } .l-85 { width: 85%; }
.l-90 { width: 90%; } .l-95 { width: 95%; } .l-100 { width: 100%; }

.tabella-dati { margin: 14px 0 10px; }
.tabella-dati summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); min-height: 44px; display: flex; align-items: center; }
.tabella-scorri { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td:nth-child(n + 3), th:nth-child(n + 3) { text-align: right; font-variant-numeric: tabular-nums; }

.piede { text-align: center; color: var(--ink-2); font-size: 0.9rem; padding: 24px 16px 40px; }

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