/* Font Ubuntu (licenza Ubuntu Font Licence), servito dal sito */
@font-face { font-family: "Ubuntu"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ubuntu-500.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/ubuntu-700.woff2") format("woff2"); }

:root {
  --rosso: #c1121f;          /* sinistra, deciso */
  --rosso-chiaro: #fbe3e5;   /* sinistra, chiaro */
  --blu: #1546b8;            /* destra, deciso */
  --blu-chiaro: #dde8fb;     /* destra, chiaro */
  --neutro: #4b5563;
  --neutro-chiaro: #eceef1;
  --testo: #1b1f27;
  --fondo: #f7f8fa;
  --bordo: #d9dce2;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--testo);
       background: var(--fondo); line-height: 1.5; font-size: 17px; }
a { color: inherit; }
h1 { font-size: 1.6rem; margin: .4rem 0 1rem; }
h2.titoletto { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--neutro); margin: 1.4rem 0 .6rem; }

/* Testata a due piani: bandiera sopra, simboli sotto */
.testata { background: #fff; border-bottom: 1px solid var(--bordo); position: sticky; top: 0; z-index: 10; }
.bandiera { display: grid; grid-template-columns: 1fr 2fr 1fr; min-height: 68px; text-decoration: none; }
.bandiera .verde { background: #009246; }
.bandiera .bianco { background: #fff; display: grid; place-items: center; text-align: center; padding: .4rem .5rem; border-block: 1px solid var(--bordo); }
.nome-sito { font-family: "Ubuntu", system-ui, sans-serif; font-weight: 700; font-size: clamp(.95rem, 3.5vw, 2.2rem); letter-spacing: .02em; line-height: 1.1; color: var(--testo); white-space: nowrap; }
.bandiera .rosso { background: #ce2b37; }
.simboli { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1.4rem .15rem; padding: .6rem 1rem .2rem; }
.nota-ordine { margin: 0; padding: 0 1rem .5rem; text-align: center; font-size: .75rem; color: var(--neutro); }
.nota-ordine a { color: inherit; }
.simbolo { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; position: relative; border: 3px solid var(--bordo); color: var(--neutro); background: #fff; text-decoration: none; font-weight: 700; font-size: .8rem; }
.simbolo img { width: 100%; height: 100%; object-fit: contain; }
.simbolo.con-logo { padding: 0; border-width: 3px; background: #fff; }
.simbolo.con-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.simbolo.attivo { box-shadow: 0 0 0 3px var(--testo); }
.percento { position: absolute; left: 50%; bottom: -1.15rem; transform: translateX(-50%); font-size: .7rem; font-weight: 600; color: var(--neutro); white-space: nowrap; }
.simboli { padding-bottom: 1.4rem; }

.pagina { max-width: 1400px; margin: 0 auto; padding: 1rem; }
.vuoto { color: var(--neutro); padding: 1rem; background: #fff; border: 1px dashed var(--bordo); border-radius: 10px; }
.briciole { margin: 0; font-size: .95rem; }

/* Card: solo titolo */
.griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.card { display: block; padding: 1.1rem 1rem; min-height: 64px; border-radius: 12px; text-decoration: none; font-weight: 600;
        border: 1px solid var(--bordo); border-left-width: 8px; background: #fff; }
.card.SX { border-left-color: var(--rosso); background: var(--rosso-chiaro); }
.card.DX { border-left-color: var(--blu); background: var(--blu-chiaro); }
.card.CE { border-left-color: var(--neutro); background: var(--neutro-chiaro); }
.card.SX:hover { background: var(--rosso); color: #fff; }
.card.DX:hover { background: var(--blu); color: #fff; }
.card.CE:hover { background: var(--neutro); color: #fff; }
.anno { display: block; font-weight: 400; font-size: .85rem; opacity: .8; }
h1 .anno { display: inline; margin-left: .4rem; }

.intestazione { padding-left: .8rem; border-left: 8px solid var(--neutro); }
.intestazione.SX { border-left-color: var(--rosso); }
.intestazione.DX { border-left-color: var(--blu); }

/* Dettaglio: due colonne */
.due-colonne { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.pannello { background: #fff; border: 1px solid var(--bordo); border-radius: 12px; padding: 1rem; }
.pannello header { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.pannello h3 { margin: 0; font-size: 1.1rem; }
.originale { position: sticky; top: 160px; }
#pdf { display: block; width: 100%; height: calc(100vh - 260px); min-height: 420px; border: 1px solid var(--bordo); border-radius: 8px; background: #fff; }
.colonna-commenti .commento { margin-bottom: 1rem; }
.tasto, .tasto-pagina { display: inline-block; padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--bordo);
        background: #fff; text-decoration: none; font: inherit; font-size: .95rem; cursor: pointer; min-height: 44px; }
.tasto-pagina { min-height: 40px; padding: .4rem .8rem; white-space: nowrap; }

.commento { background: #fff; border: 1px solid var(--bordo); border-radius: 12px; padding: 1rem; }
.commento header { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.commento h3 { margin: 0 0 .4rem; font-size: 1.1rem; }
.commento h4 { margin: 1rem 0 .2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--neutro); }
.commento p { margin: .3rem 0; }
.fattibilita { display: flex; align-items: center; gap: .6rem; }
.motivazione { color: var(--neutro); }
.misuratore { display: inline-flex; gap: 4px; }
.misuratore i { width: 22px; height: 8px; border-radius: 4px; background: var(--bordo); }
.f-B .misuratore i:nth-child(1), .f-M .misuratore i:nth-child(-n+2), .f-A .misuratore i { background: var(--testo); }

/* Telefono: colonne una sotto l'altra */
@media (max-width: 900px) {
  .testata { position: static; }
  .simbolo { width: 52px; height: 52px; }
  .due-colonne { grid-template-columns: 1fr; }
  .originale { position: static; }
  #pdf { height: 60vh; min-height: 300px; }
  h1 { font-size: 1.35rem; }
}

/* Telefoni stretti: la destra va su una seconda riga */
@media (max-width: 640px) {
  .bandiera { min-height: 56px; grid-template-columns: 1fr 3fr 1fr; }
  .bandiera .bianco { padding: .3rem .3rem; }
  .nome-sito { font-size: clamp(.95rem, 4.2vw, 2rem); }
  .simboli { justify-content: center; column-gap: .15rem; row-gap: 1.5rem; }
}

/* Card neutre (confronti) */
.card.neutra { border-left-color: var(--neutro); background: var(--neutro-chiaro); }
.card.neutra:hover { background: var(--neutro); color: #fff; }
.invito { color: var(--neutro); }

/* Punteggi */
.voti { margin: .4rem 0 .6rem; }
.voto { display: grid; grid-template-columns: 8.5rem 1fr 1.2rem; align-items: center; gap: .5rem; font-size: .9rem; margin: .15rem 0; }
.barra { height: 8px; border-radius: 4px; background: var(--bordo); position: relative; overflow: hidden; }
.barra::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 20%); background: var(--testo); border-radius: 4px; }
.media { margin: .4rem 0 0; }
.etichetta { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border: 1px solid var(--neutro); border-radius: 999px; color: var(--neutro); white-space: nowrap; }
.costo { margin: .4rem 0; }
.tema { margin: .4rem 0; font-size: .95rem; }

/* Confronto per tema: colonne affiancate, una sotto l'altra sul telefono */
.filtri { display: flex; flex-wrap: wrap; gap: .5rem; }
.tasto-filtro { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--bordo); border-radius: 999px; text-decoration: none; background: #fff; min-height: 44px; line-height: 1.8; }
.tasto-filtro.on { background: var(--testo); color: #fff; border-color: var(--testo); }
.colonne-confronto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.commento.confronto { border-top: 6px solid var(--neutro); }
.commento.confronto.SX { border-top-color: var(--rosso); }
.commento.confronto.DX { border-top-color: var(--blu); }
.partito-riga { display: flex; align-items: center; gap: .6rem; }
.partito-riga img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.commento.confronto .voto { grid-template-columns: 7rem 1fr 1.2rem; }

/* Pagine di testo */
.testo { max-width: 760px; background: #fff; border: 1px solid var(--bordo); border-radius: 12px; padding: 1rem 1.2rem; }
.testo h2 { font-size: 1.15rem; margin: 1.4rem 0 .4rem; }
.tabella { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabella th, .tabella td { border: 1px solid var(--bordo); padding: .4rem .5rem; text-align: left; vertical-align: top; }
.tabella th { background: var(--neutro-chiaro); }

/* Piede */
.piede { margin-top: 2rem; padding: 1rem; border-top: 1px solid var(--bordo); background: #fff; color: var(--neutro); font-size: .9rem; }
.menu-piede { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-bottom: .5rem; }
.menu-piede a { color: var(--testo); font-weight: 600; padding: .4rem 0; min-height: 44px; display: inline-flex; align-items: center; }
.piede p { max-width: 760px; margin: 0 0 .5rem; }
.marchio-piede { color: var(--testo); }

.card.preparazione { opacity: .7; border-left-style: dashed; }
.avviso { background: #fff8e1; border: 1px solid #f0d98a; border-radius: 10px; padding: .8rem 1rem; }

/* Risultati elettorali */
.riquadro { background: #fff; border: 1px solid var(--bordo); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.riquadro h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.selettore { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.selettore .select2-container { flex: 1 1 260px; }
.selettore .select2-selection { min-height: 44px; }
.scroll-orizzontale { overflow-x: auto; }
.tabella-voti td.num, .tabella-voti th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabella-voti td:first-child { min-width: 11rem; }
.tabella-voti { font-size: .95rem; }
@media (max-width: 640px) { .tabella-voti td:first-child { min-width: 0; } .tabella-voti th, .tabella-voti td { padding: .35rem .3rem; font-size: .85rem; } }
.barra-voti { display: block; height: 6px; margin-top: .25rem; border-radius: 3px; background: linear-gradient(90deg, var(--testo) calc(var(--p) * 1%), var(--bordo) 0); max-width: 100%; }
.nota-fonte { font-size: .85rem; color: var(--neutro); max-width: 760px; }

/* Referendum */
.quesito { border-top: 1px solid var(--bordo); padding: .8rem 0; }
.quesito:first-of-type { border-top: 0; }
.quesito header { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.quesito h3 { margin: 0; font-size: 1.02rem; }
.si-no { height: 14px; border-radius: 7px; background: var(--neutro); overflow: hidden; margin: .5rem 0 .3rem; }
.si-no .si { display: block; height: 100%; background: var(--testo); }
.valori-si-no { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; }
.card.attiva { background: var(--neutro); color: #fff; }
.riquadro h3.titoletto { margin: 1rem 0 .3rem; }

/* Quadro partiti di oggi nella pagina di una elezione */
.quadro { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem .6rem; }
.quadro .voce { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem; text-decoration: none; color: inherit; }
.quadro .voce b { font-size: 1.3rem; }
.quadro .voce small { font-size: .75rem; color: var(--neutro); }
.quadro .simbolo { width: 72px; height: 72px; }
.quadro .no-voto { border: 8px solid #d33; background: linear-gradient(135deg, transparent 45%, #d33 45%, #d33 55%, transparent 55%); }
@media (max-width: 640px) { .quadro { grid-template-columns: repeat(2, 1fr); } }
.sigla-lista { font-size: .55rem; line-height: 1.1; padding: 4px; word-break: break-word; }
.quadro .simbolo { overflow: hidden; }

/* Home: simboli dei partiti come link ai programmi, senza colori di schieramento */
.simboli-home { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 1rem; justify-items: center; }
.simbolo-home { width: 104px; height: 104px; border-radius: 50%; border: 3px solid var(--bordo); background: #fff; display: grid; place-items: center; text-decoration: none; color: var(--neutro); font-weight: 700; overflow: hidden; }
.simbolo-home img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.simbolo-home:hover, .simbolo-home:focus-visible { box-shadow: 0 0 0 3px var(--testo); }
@media (max-width: 480px) { .simboli-home { grid-template-columns: repeat(3, 1fr); } .simbolo-home { width: 88px; height: 88px; } }

/* Nuova testata: logo + tre voci */
.logo-navbar { display: block; max-width: 680px; margin: 0 auto; }
.logo-navbar img { display: block; width: 100%; height: auto; }
.voci-navbar { display: flex; justify-content: center; gap: .4rem 2rem; flex-wrap: wrap; padding: .5rem 1rem 0; }
.voci-navbar a { color: var(--testo); text-decoration: none; font-size: 1rem; padding: .35rem .2rem; white-space: nowrap; }
.voci-navbar a:hover { text-decoration: underline; }
@media (max-width: 480px) { .voci-navbar { flex-wrap: nowrap; gap: .3rem; padding: .5rem .3rem 0; } .voci-navbar a { font-size: 2.75vw; padding: .35rem 0; } }
