/* Forum, il sito: un foglio solo, leggibile da telefono. L'aspetto è quello di un registro
   pubblico reso leggibile: carta, inchiostro, un solo rosso da timbro, righe sottili al posto
   delle schede, cifre e codici in monospazio. Niente font esterni (la CSP ammette solo 'self'):
   serif e monospazio dei sistemi, scelti in ordine di qualità.
   Testi almeno 4,5:1 sul loro sfondo in entrambi i temi, i pallini del semaforo almeno 3:1
   (WCAG 2.1, 1.4.3 e 1.4.11). */
:root {
  --fondo: #f3efe6;
  --carta: #fbf9f4;
  --testo: #1b1a17;
  --tenue: #5c574d;
  --linea: #d6cfbf;
  --linea-forte: #1b1a17;
  --accento: #a8231b;
  --accento-scuro: #7d1912;
  --accento-chiaro: #f6e4df;
  --avviso: #8a3a0a;
  --avviso-chiaro: #f8ebdc;
  --finta: #e3ddcf;
  --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #14130f;
    --carta: #1c1a15;
    --testo: #ece6d8;
    --tenue: #a8a091;
    --linea: #39342a;
    --linea-forte: #ece6d8;
    --accento: #f08a7c;
    --accento-scuro: #f6b2a8;
    --accento-chiaro: #2e1c18;
    --avviso: #f0a070;
    --avviso-chiaro: #2c211b;
    --finta: #2c2922;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--testo);
  font: 17px/1.55 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
a { color: var(--accento); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accento-scuro); text-decoration-thickness: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.012em; }
h1 { font-size: 2.1rem; line-height: 1.12; margin: 1.6rem 0 .6rem; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 2.4rem 0 .6rem; }
strong { font-weight: 700; }
small { display: block; color: var(--tenue); font-size: .78rem; font-weight: normal; }
.largo { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.sotto { color: var(--tenue); font-size: 1.1rem; margin-top: 0; max-width: 62ch; }
.tenue { color: var(--tenue); font-size: .92rem; }
.nascosto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.briciole { font: .78rem/1.4 var(--mono); letter-spacing: .02em; color: var(--tenue); margin: 1.4rem 0 0; }
.briciole a { color: inherit; }

/* Etichette da registro: maiuscoletto in monospazio. */
.occhiello, .stadio, thead th, .cifre dt, .filtri label, .modulo legend {
  font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
}
.occhiello { color: var(--accento); margin: 0 0 .4rem; }

/* ---- testata e piede ------------------------------------------------------------ */
.testata { background: var(--fondo); border-bottom: 3px double var(--linea-forte); }
.testata .largo { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: baseline; justify-content: space-between; padding-top: 1rem; padding-bottom: .7rem; }
.marchio { font: 700 1.55rem/1 var(--serif); color: var(--testo); text-decoration: none; letter-spacing: -.03em; }
.marchio::after { content: "."; color: var(--accento); }
.testata nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: baseline; font: .8rem/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.testata nav a { color: var(--testo); text-decoration: none; }
.testata nav a:hover { color: var(--accento); }
.testata nav .bottone { color: var(--carta); }
.chi { color: var(--tenue); text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }

.piede { margin-top: 4rem; border-top: 1px solid var(--linea-forte); color: var(--tenue); font-size: .82rem; padding: 1.2rem 0 2.5rem; }
.piede p { max-width: 90ch; }
.piede a { color: var(--tenue); }

/* ---- comandi -------------------------------------------------------------------- */
.bottone {
  display: inline-block; border: 1px solid var(--linea-forte); border-radius: 0; cursor: pointer;
  background: var(--testo); color: var(--carta); font: 600 .82rem/1.2 var(--mono);
  letter-spacing: .06em; text-transform: uppercase;
  padding: .85rem 1.2rem; text-decoration: none; text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.bottone:hover { background: var(--accento); border-color: var(--accento); color: #fff; }
@media (prefers-color-scheme: dark) { .bottone:hover { color: #14130f; } }
.bottone.piccolo { padding: .4rem .7rem; font-size: .72rem; }
.secondario { margin-left: 1rem; font-size: .95rem; }

input[type=email], input:not([type]), input[type=text], select {
  font: 1rem/1.3 var(--serif); padding: .8rem .9rem; border: 1px solid var(--linea-forte);
  border-radius: 0; background: var(--carta); color: var(--testo); width: 100%; max-width: 100%;
}
input::placeholder { color: var(--tenue); font-family: var(--mono); font-size: .9rem; }
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid var(--accento); outline-offset: 2px;
}
.riga-modulo { display: flex; flex-wrap: wrap; gap: 0; margin: 1.4rem 0 .6rem; max-width: 640px; }
.riga-modulo input { flex: 1 1 14rem; min-width: 0; width: auto; border-right: 0; font-family: var(--mono); letter-spacing: .06em; }
.riga-modulo .bottone { flex: none; }

/* ---- home ----------------------------------------------------------------------- */
.eroe { padding: 2.6rem 0 1rem; border-bottom: 1px solid var(--linea); }
.eroe h1 { font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -.03em; max-width: 16ch; margin: .2rem 0 1rem; }
.eroe .sotto { font-size: 1.2rem; }
.registro { font: .78rem/1.6 var(--mono); letter-spacing: .02em; color: var(--tenue); margin: 1.6rem 0 0; padding-top: .8rem; border-top: 1px dashed var(--linea); }

.estratto { margin: 2.4rem 0 1rem; padding: 1.2rem 1.4rem .4rem; background: var(--carta); border: 1px solid var(--linea-forte); box-shadow: 6px 6px 0 var(--linea); }
.estratto .tenue { margin: 0 0 .4rem; }
.estratto .opp:first-child { border-top: 0; }

.fatti { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 2.2rem; margin: 2.6rem 0 1rem; border-top: 1px solid var(--linea-forte); }
.fatti > div { padding-top: 1.1rem; }
.fatti .cifra { display: block; font: 600 2.6rem/1 var(--mono); letter-spacing: -.04em; color: var(--accento); font-variant-numeric: tabular-nums; }
.fatti h2 { margin: .6rem 0 .5rem; font-size: 1.15rem; }
.fatti p { margin: 0 0 .7rem; font-size: .98rem; }

/* La sezione "tre" delle pagine vecchie usa la stessa impaginazione. */
.tre { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 2rem; border-top: 1px solid var(--linea-forte); }
.tre h2 { margin-top: 1rem; font-size: 1.1rem; }

.richiamo { margin-top: 3rem; padding: 1.4rem 0 1.2rem; border-top: 3px double var(--linea-forte); border-bottom: 1px solid var(--linea-forte); }
.richiamo h2 { margin-top: 0; font-size: 1.5rem; }
.richiamo p { max-width: 60ch; }

/* ---- cifre ---------------------------------------------------------------------- */
.cifre { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin: 1.4rem 0; padding: 0; border-top: 1px solid var(--linea-forte); border-bottom: 1px solid var(--linea); }
.cifre div { padding: .8rem 1rem .8rem 0; border-right: 1px solid var(--linea); margin-right: 1rem; }
.cifre div:last-child { border-right: 0; }
.cifre dt { color: var(--tenue); }
.cifre dd { margin: .3rem 0 0; font: 600 1.6rem/1.1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---- elenchi e tabelle ---------------------------------------------------------- */
.elenco-enti { list-style: none; padding: 0; margin: 0; columns: 2 300px; column-gap: 2.4rem; border-top: 1px solid var(--linea-forte); }
.elenco-enti li { break-inside: avoid; padding: .5rem 0; border-bottom: 1px solid var(--linea); }
.elenco-enti a { color: var(--testo); text-decoration: none; }
.elenco-enti a:hover { color: var(--accento); text-decoration: underline; }
.elenco-enti .tenue { font: .75rem var(--mono); }

section { margin-bottom: 1rem; }
.scorre { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--linea-forte); border-bottom: 1px solid var(--linea-forte); background: transparent; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .55rem .7rem .55rem 0; border-bottom: 1px solid var(--linea); vertical-align: top; }
td { font-family: var(--mono); font-size: .85rem; }
thead th { color: var(--tenue); white-space: nowrap; border-bottom: 1px solid var(--linea-forte); }
tbody th { font-weight: 500; min-width: 11rem; }
td small { white-space: nowrap; }
tfoot th, tfoot td { font-weight: 700; border-bottom: 0; }
table.spesa td { white-space: nowrap; }
table.livelli td, table.livelli thead th:not(:first-child) { white-space: nowrap; text-align: center; padding-left: .7rem; }
table.livelli td.si { color: var(--testo); }
table.livelli td.no { color: var(--tenue); }
table.livelli tfoot td { white-space: normal; font-family: var(--serif); font-size: .95rem; }
table.livelli tbody th { min-width: 0; }
@media (max-width: 560px) {
  /* Le tre colonne dei livelli devono stare nello schermo: è il confronto che conta. */
  table.livelli { font-size: .8rem; }
  table.livelli th, table.livelli td { padding: .45rem .35rem; }
  table.livelli thead th { white-space: normal; }
}

/* ---- opportunità: voci di un registro -------------------------------------------- */
.opps, .voci { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.opp {
  display: grid; grid-template-columns: 10.5rem 1fr; column-gap: 1.6rem;
  padding: 1.1rem 0; border-top: 1px solid var(--linea);
}
.opps .opp:first-child { border-top-color: var(--linea-forte); }
.opp > * { grid-column: 2; }
.opp-testa { grid-column: 1; grid-row: 1 / span 9; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.voci li { padding: .8rem 0; border-top: 1px solid var(--linea); }
.voci li p { margin: .1rem 0; }
.opp p { margin: .15rem 0; }
.importo { font: 600 1.25rem/1.1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.opp-cosa { font-size: 1.08rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; margin-bottom: .3rem !important; }
.opp-ente { font-size: .95rem; }
.opp-ente a { color: var(--testo); text-decoration: none; border-bottom: 1px solid var(--linea); }
.opp-ente a:hover { color: var(--accento); border-color: var(--accento); }
.opp-quando { font: .78rem/1.5 var(--mono); color: var(--tenue); }
.opp-perche, .opp-chi, .opp-paga { font-size: .92rem; color: var(--tenue); }
.opp-chi { color: var(--testo); }
.stadio { color: var(--accento); border: 1px solid currentColor; padding: .2rem .45rem; font-size: .66rem; line-height: 1.2; }
.stadio-scadenza { color: var(--avviso); }
.paga { font-size: 1.05rem; }
.pallino { display: inline-block; width: .65em; height: .65em; border-radius: 50%; margin-right: .4em; vertical-align: .02em; background: #7d868c; }
.pallino-verde { background: #1a7f37; }
.pallino-giallo { background: #b7791f; }
.pallino-rosso { background: #d9443a; }
@media (max-width: 640px) {
  .opp { grid-template-columns: 1fr; }
  .opp-testa { grid-column: 1; grid-row: auto; flex-direction: row; align-items: baseline; justify-content: space-between; margin-bottom: .4rem; }
  .opp > * { grid-column: 1; }
}

/* ---- parti chiuse ---------------------------------------------------------------- */
.oscurato { position: relative; border: 1px dashed var(--linea-forte); background: var(--carta); padding: 1.1rem; overflow: hidden; }
.finte { display: grid; gap: .6rem; opacity: .9; }
.finte span { display: block; height: .8rem; background: repeating-linear-gradient(90deg, var(--finta) 0 6px, transparent 6px 9px); }
.finte span:nth-child(2n) { width: 75%; }
.finte span:nth-child(3n) { width: 55%; }
.invito { margin-top: .9rem; }
.invito p { margin: 0 0 .7rem; }
.icona { width: 1em; height: 1em; vertical-align: -.12em; fill: currentColor; }

/* ---- filtri e moduli ------------------------------------------------------------- */
.filtri { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: flex-end; margin: .8rem 0 1.2rem; padding: 1rem 0; border-top: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.filtri div { display: grid; gap: .3rem; flex: 1 1 12rem; min-width: 0; }
.filtri label { color: var(--tenue); }
select { padding: .55rem .6rem; font-size: .95rem; }

.modulo { display: grid; gap: .4rem; max-width: 640px; }
.modulo label { font-weight: 600; margin-top: .5rem; }
.modulo fieldset { border: 1px solid var(--linea-forte); border-radius: 0; padding: .8rem 1rem; margin: 1rem 0; background: var(--carta); }
.modulo legend { padding: 0 .4rem; }
.modulo .spunta { display: flex; gap: .7rem; align-items: flex-start; font-weight: normal; font-size: .92rem; color: var(--tenue); }
.spunta input { margin-top: .3rem; flex: none; width: 1.05rem; height: 1.05rem; accent-color: var(--accento); }
.spunta strong { color: var(--testo); }
.modulo .bottone { justify-self: start; margin-top: .6rem; }
.errore { border-left: 3px solid var(--avviso); background: var(--avviso-chiaro); color: var(--avviso); padding: .7rem .9rem; }
.avviso { border-left: 3px solid var(--accento); padding: .4rem .9rem; }
.informativa { max-height: 17rem; overflow-y: auto; border: 1px solid var(--linea); background: var(--carta); padding: .3rem 1rem; font-size: .88rem; color: var(--tenue); }
.informativa p { margin: .6rem 0; }
.informativa strong { color: var(--testo); }

/* ---- entrata della pagina -------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .eroe > * { animation: entra .6s cubic-bezier(.2, .7, .2, 1) both; }
  .eroe > :nth-child(2) { animation-delay: .06s; }
  .eroe > :nth-child(3) { animation-delay: .14s; }
  .eroe > :nth-child(4) { animation-delay: .22s; }
  .eroe > :nth-child(n+5) { animation-delay: .3s; }
  .estratto { animation: entra .7s .38s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .eroe { padding-top: 1.6rem; }
  .riga-modulo input { border-right: 1px solid var(--linea-forte); border-bottom: 0; }
  .riga-modulo .bottone { width: 100%; }
  .secondario { display: block; margin: .8rem 0 0; }
  .cifre div { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--linea); }
  .estratto { padding: 1rem 1rem .2rem; box-shadow: 4px 4px 0 var(--linea); }
}
