/* ═══════════════════════════════════════════════════════════════
   ARBOREO® — Tree Cover Canopy
   Palette campionata dai marchi: verde ALIAS #02642E, salvia
   ARBOREO #4B7C5C, erba #B4C0AC. La rampa è divergente attorno
   all'obiettivo del 30%: caldo sotto, verde sopra.

   Impaginazione: su schermo largo il pannello è una colonna a
   sinistra; sotto i 900px diventa un foglio che sale dal basso,
   con una presa che resta sempre visibile e mostra già il dato
   principale.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --alias:   #02642E;
  --canopy:  #4B7C5C;
  --bark:    #2A211E;
  --paper:   #F7F6F1;
  --straw:   #E4DFCB;
  --allerta: #A8452B;
  --linea:   rgba(42, 33, 30, .14);

  --display: 'Jost', 'Century Gothic', 'Trebuchet MS', sans-serif;
  --body:    'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --dato:    'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --rail: 360px;
  --r: 3px;
  --presa: 0px;              /* altezza della presa: 0 su desktop */
  --banner: 66px;
}

* { box-sizing: border-box; }

/* L'attributo hidden funziona perché il browser applica display:none,
   ma qualsiasi regola d'autore che imposta display lo sovrascrive: un
   elemento con class="velo" e display:flex resta visibile anche quando
   il codice lo dichiara nascosto. Questa riga rende hidden affidabile
   ovunque, ed evita di doverci pensare a ogni nuovo componente. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--body);
  color: var(--bark);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.skip {
  position: absolute; left: -9999px; z-index: 60;
  background: var(--alias); color: #fff; padding: .7rem 1rem;
  font-size: .85rem; text-decoration: none;
}
.skip:focus { left: .5rem; top: .5rem; }

:where(button, select, input, a, summary):focus-visible {
  outline: 2px solid var(--alias);
  outline-offset: 2px;
}

/* ───────── banner ─────────
   Il titolo dice cos'è la mappa, e i due marchi hanno ruoli diversi:
   ARBOREO è il progetto, ALIAS ne è l'elaboratore. Tenerli distinti
   evita di far sembrare l'uno il logo dell'altro. */

.banner {
  display: flex; align-items: center; gap: 1.25rem;
  height: var(--banner);
  padding: 0 1.1rem 0 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--linea);
  position: relative; z-index: 30;
}

.banner__marchio { height: 42px; width: auto; flex: none; }

.banner__titolo { flex: 1; min-width: 0; }
.banner__titolo h1 {
  margin: 0;
  font-family: var(--display); font-weight: 400;
  font-size: 1.16rem; line-height: 1.2; letter-spacing: .005em;
  color: var(--bark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner__titolo p {
  margin: .12rem 0 0;
  font-size: .66rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--canopy);
}

.banner__firma {
  display: flex; align-items: center; gap: .6rem;
  flex: none; text-decoration: none;
  padding: .3rem .4rem; border-radius: var(--r);
  transition: background .16s ease;
}
.banner__firma:hover { background: rgba(2, 100, 46, .07); }
.banner__firma span {
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(42, 33, 30, .45);
  text-align: right; line-height: 1.3; max-width: 5rem;
}
.banner__firma img { height: 34px; width: auto; display: block; }

.app { display: flex; height: calc(100% - var(--banner)); }

/* ───────── mappa ───────── */

.mappa { position: relative; flex: 1; min-width: 0; order: 2; }
#map { position: absolute; inset: 0; background: var(--straw); }

.stato {
  position: absolute; left: 50%; top: 1rem; transform: translateX(-50%);
  margin: 0; padding: .5rem .95rem;
  font-size: .82rem; color: var(--bark);
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--linea); border-radius: 999px;
  box-shadow: 0 2px 10px rgba(42, 33, 30, .1);
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
  z-index: 10; max-width: 80%; text-align: center;
}
.stato.visibile { opacity: 1; }

/* ───────── pannello ───────── */

.rail {
  order: 1;
  width: var(--rail);
  flex: 0 0 var(--rail);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--linea);
  z-index: 20;
}

.rail__corpo {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.presa { display: none; }

.brand {
  padding: 1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--linea);
  background: #fff;
}
.brand__mark { width: 100%; max-width: 262px; display: block; }

.block {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--linea);
}

.label {
  display: block;
  font-size: .67rem; font-weight: 600;
  letter-spacing: .15em; text-transform: uppercase;
  color: rgba(42, 33, 30, .5);
  margin-bottom: .5rem;
}
.label--riga {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
}
.label--slider { margin-top: 1rem; }

.nota {
  margin: .6rem 0 0;
  font-size: .76rem; line-height: 1.45;
  color: rgba(42, 33, 30, .55);
}

.reset {
  border: 0; background: none; padding: 0;
  font-family: var(--body); font-size: .7rem;
  color: var(--alias); cursor: pointer;
  border-bottom: 1px solid currentColor;
}

/* select */
.select { position: relative; }
.select::after {
  content: ''; position: absolute; right: .85rem; top: 50%;
  width: .42rem; height: .42rem; margin-top: -.3rem;
  border-right: 1.5px solid var(--canopy);
  border-bottom: 1.5px solid var(--canopy);
  transform: rotate(45deg); pointer-events: none;
}
.select select {
  appearance: none; width: 100%;
  padding: .7rem 2rem .7rem .8rem;
  font-family: var(--display); font-size: 1rem;
  color: var(--bark); background: #fff;
  border: 1px solid var(--linea); border-radius: var(--r);
  cursor: pointer;
}

/* ───────── due livelli di lettura ───────── */

.segmenti {
  display: flex; gap: 2px;
  padding: 2px;
  background: rgba(42, 33, 30, .06);
  border-radius: var(--r);
  margin-bottom: 1rem;
}
.segmenti button {
  flex: 1; padding: .5rem .4rem;
  font-family: var(--body); font-size: .8rem;
  color: rgba(42, 33, 30, .6);
  background: none; border: 0; border-radius: 2px;
  cursor: pointer; transition: background .16s ease, color .16s ease;
}
.segmenti button.on {
  background: #fff; color: var(--bark); font-weight: 600;
  box-shadow: 0 1px 3px rgba(42, 33, 30, .1);
}
.segmenti button:disabled { opacity: .4; cursor: not-allowed; }

/* ───────── sintesi ───────── */

.titoli {
  display: flex; gap: 1.1rem; flex-wrap: wrap;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--linea);
}
.titolo { flex: 1 1 7rem; display: flex; align-items: baseline; gap: .1rem; flex-wrap: wrap; }
.titolo__num {
  font-family: var(--dato); font-weight: 700;
  font-size: 2.3rem; line-height: 1; letter-spacing: -.04em;
  color: var(--alias);
  font-variant-numeric: tabular-nums;
}
.titolo__unita { font-family: var(--dato); font-size: 1rem; color: var(--canopy); }
.titolo__voce {
  flex-basis: 100%; margin-top: .35rem;
  font-size: .68rem; line-height: 1.35;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(42, 33, 30, .5);
}
.titolo__voce em {
  font-style: normal; text-transform: none; letter-spacing: .01em;
  color: rgba(42, 33, 30, .42);
}
.titolo--allerta .titolo__num { color: var(--allerta); }
.titolo--allerta .titolo__unita { color: #C4703F; }

.cifre { margin: .85rem 0 0; }
.cifre--griglia { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1rem; }
.cifre--griglia > div { display: flex; flex-direction: column; gap: .12rem; padding: .38rem 0; }
.cifre--griglia dt { font-size: .72rem; color: rgba(42, 33, 30, .55); }
.cifre--lettura > div {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: .34rem 0;
  border-bottom: 1px dotted var(--linea);
}
.cifre--lettura > div:last-child { border-bottom: 0; }
.cifre--lettura dt { font-size: .78rem; color: rgba(42, 33, 30, .6); }
.cifre dd {
  margin: 0; font-family: var(--dato); font-size: .86rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ───────── istogramma ───────── */

.profilo__lettura {
  margin: 0 0 .55rem; min-height: 2.2em;
  font-size: .77rem; line-height: 1.4;
  color: rgba(42, 33, 30, .72);
}
.profilo__lettura b { font-family: var(--dato); font-weight: 700; }

.profilo { display: flex; flex-direction: column; gap: 1px; }

.classe {
  display: grid; grid-template-columns: 22px 1fr;
  align-items: center; gap: .45rem;
  padding: 0; margin: 0; background: none; border: 0; cursor: pointer;
}
.profilo[data-filtro] .classe[aria-pressed="false"] { opacity: .34; }
.classe__scala {
  font-family: var(--dato); font-size: .58rem; font-weight: 500;
  color: rgba(42, 33, 30, .45); text-align: right; line-height: 1;
}
.classe__barra {
  position: relative; height: 11px;
  background: rgba(42, 33, 30, .045); border-radius: 1px;
}
.classe__riempi {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 1px;
  transition: width .5s cubic-bezier(.2, .8, .3, 1);
}
.classe:hover .classe__barra,
.classe[aria-pressed="true"] .classe__barra {
  outline: 1px solid rgba(2, 100, 46, .5); outline-offset: 1px;
}

.soglia {
  position: relative; height: 0;
  border-top: 1.5px dashed var(--bark);
  margin: 3px 0 3px 27px; opacity: .55;
}
.soglia span {
  position: absolute; right: 0; top: -1.05em;
  padding: 0 .25rem; background: var(--paper);
  font-family: var(--dato); font-size: .6rem; font-weight: 500;
  color: var(--bark); white-space: nowrap;
}

.profilo__asse {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: .5rem 0 0;
  font-size: .63rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(42, 33, 30, .38);
}

/* ───────── schede del click ───────── */

.scheda {
  padding: .8rem .9rem;
  border-radius: var(--r);
  margin-bottom: .7rem;
  border-left: 3px solid var(--canopy);
}
.scheda--quartiere { border-left-color: var(--canopy); background: rgba(75, 124, 92, .07); }
.scheda--cella { border-left-color: var(--alias); background: rgba(2, 100, 46, .06); }
.scheda:last-of-type { margin-bottom: 0; }

.scheda__titolo {
  margin: 0; font-family: var(--body);
  font-size: .68rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: rgba(42, 33, 30, .55);
  display: flex; justify-content: space-between; gap: .5rem;
}
.scheda__titolo span {
  font-weight: 400; letter-spacing: .02em; text-transform: none;
  color: rgba(42, 33, 30, .5);
}
.scheda__cifra { display: flex; align-items: baseline; gap: .12rem; margin-top: .3rem; }
.scheda__cifra b {
  font-family: var(--dato); font-size: 1.7rem; font-weight: 700;
  line-height: 1; letter-spacing: -.03em; color: var(--alias);
  font-variant-numeric: tabular-nums;
}
.scheda__cifra span { font-family: var(--dato); font-size: .85rem; color: var(--canopy); }
.scheda .cifre { margin-top: .5rem; }

/* ───────── ritorno alle statistiche ───────── */

.ritorno {
  display: inline-flex; align-items: center; gap: .4rem;
  margin: 0 0 .9rem; padding: .4rem .7rem .4rem .55rem;
  font-family: var(--body); font-size: .78rem;
  color: var(--alias); background: rgba(2, 100, 46, .07);
  border: 0; border-radius: var(--r); cursor: pointer;
  transition: background .16s ease;
}
.ritorno:hover { background: rgba(2, 100, 46, .13); }
.ritorno span { font-size: .95rem; line-height: 1; }

/* la traduzione in alberi: il numero che rende il dato una richiesta */
.traguardo {
  margin: .9rem 0 0; padding: .6rem .7rem;
  font-size: .8rem; line-height: 1.5;
  color: rgba(42, 33, 30, .75);
  background: rgba(168, 69, 43, .08);
  border-left: 2px solid var(--allerta);
  border-radius: 0 var(--r) var(--r) 0;
}
.traguardo b { font-family: var(--dato); font-weight: 700; color: var(--allerta); }

/* ───────── simulazione di riforestazione ───────── */

.simulazione {
  margin-top: .9rem; padding-top: .8rem;
  border-top: 1px solid var(--linea);
}
.simulazione .label { margin-bottom: .45rem; }

.scenari { display: flex; gap: 2px; }
.scenari button {
  flex: 1; padding: .42rem .3rem;
  font-family: var(--body); font-size: .74rem;
  color: rgba(42, 33, 30, .62);
  background: rgba(42, 33, 30, .06);
  border: 0; border-radius: 2px; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.scenari button:hover { background: rgba(75, 124, 92, .16); }
.scenari button.on { background: var(--canopy); color: #fff; }
.scenari b { display: block; font-family: var(--dato); font-size: .68rem; font-weight: 500; }

.simulazione__nota {
  margin: .45rem 0 .7rem;
  font-size: .72rem; line-height: 1.4; color: rgba(42, 33, 30, .5);
}

.tappe { display: flex; flex-direction: column; gap: 1px; }
.tappa {
  display: grid; grid-template-columns: 2.6rem 1fr auto;
  align-items: center; gap: .5rem;
  padding: .34rem .45rem;
  border-radius: 2px;
  font-size: .78rem;
}
.tappa--obiettivo { background: rgba(2, 100, 46, .07); }
.tappa__quota {
  font-family: var(--dato); font-weight: 700; font-size: .82rem;
  color: var(--bark);
}
.tappa--obiettivo .tappa__quota { color: var(--alias); }
.tappa__alberi { font-family: var(--dato); font-variant-numeric: tabular-nums; }
.tappa__densita {
  font-family: var(--dato); font-size: .68rem;
  color: rgba(42, 33, 30, .45); white-space: nowrap;
}
.tappa--eccessiva .tappa__densita { color: var(--allerta); font-weight: 700; }

.simulazione__avviso {
  margin: .6rem 0 0; padding: .5rem .6rem;
  font-size: .74rem; line-height: 1.45;
  color: rgba(42, 33, 30, .7);
  background: rgba(168, 69, 43, .08);
  border-left: 2px solid var(--allerta);
  border-radius: 0 var(--r) var(--r) 0;
}

/* ───────── controlli sulla mappa ───────── */

.ctrl-livelli, .ctrl-sfondo { position: relative; }

.ctrl-bottone {
  display: flex; align-items: center; justify-content: center;
  width: 29px; height: 29px; padding: 0;
  background: #fff; border: 0; cursor: pointer;
  color: rgba(42, 33, 30, .4);
  transition: color .16s ease, background .16s ease;
}
.ctrl-bottone svg { width: 17px; height: 17px; }
.ctrl-bottone:hover { background: rgba(75, 124, 92, .12); }
.ctrl-bottone.on { color: var(--alias); }
.ctrl-bottone.on::after {
  content: ''; position: absolute; right: 2px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--alias); margin-top: -13px;
}
.ctrl-bottone:disabled { opacity: .35; cursor: not-allowed; }
.ctrl-bottone + .ctrl-bottone { border-top: 1px solid rgba(42, 33, 30, .1); }

.ctrl-pannello {
  position: absolute; top: 0; right: 34px;
  width: 176px; padding: .7rem .8rem;
  background: #fff; border-radius: var(--r);
  box-shadow: 0 2px 12px rgba(42, 33, 30, .22);
  text-align: left;
}
.ctrl-titolo {
  display: block;
  font-size: .63rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(42, 33, 30, .45);
  margin-bottom: .45rem;
}
.ctrl-scelte { display: flex; flex-direction: column; gap: 2px; margin-bottom: .9rem; }
.ctrl-scelta {
  padding: .4rem .55rem; text-align: left;
  font-family: var(--body); font-size: .78rem;
  color: rgba(42, 33, 30, .68);
  background: rgba(42, 33, 30, .05);
  border: 0; border-radius: 2px; cursor: pointer;
}
.ctrl-scelta:hover { background: rgba(75, 124, 92, .14); }
.ctrl-scelta.on { background: var(--canopy); color: #fff; }

input[type="range"] {
  appearance: none; width: 100%; height: 3px; margin: .1rem 0 .2rem;
  background: linear-gradient(90deg, #A8452B, #EFC069, #8FB86F, #12482C);
  border-radius: 2px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--canopy);
  box-shadow: 0 1px 3px rgba(42, 33, 30, .3);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--canopy);
}

.crediti {
  margin: 0 1.25rem; padding: 1.1rem 0 .4rem;
  border-top: 1px solid var(--linea);
}
.crediti__nota {
  margin: 0;
  font-size: .67rem; line-height: 1.55; color: rgba(42, 33, 30, .45);
}
.crediti__nota a { color: var(--canopy); }

/* ═══════════ finestra di benvenuto ═══════════
   Spiega perché il 30% è la soglia della mappa: senza il contesto
   normativo e la regola 3-30-300 sembrerebbe una scelta arbitraria. */

.velo {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(42, 33, 30, .45);
  backdrop-filter: blur(2px);
  animation: comparsa .25s ease;
}
@keyframes comparsa { from { opacity: 0; } to { opacity: 1; } }

.benvenuto {
  position: relative;
  width: min(660px, 100%);
  max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(42, 33, 30, .35);
  overflow: hidden;
}

.benvenuto__chiudi {
  position: absolute; top: .5rem; right: .7rem; z-index: 2;
  width: 32px; height: 32px;
  font-size: 1.5rem; line-height: 1;
  color: rgba(255, 255, 255, .75);
  background: none; border: 0; cursor: pointer;
}
.benvenuto__chiudi:hover { color: #fff; }

.benvenuto__testa {
  padding: 1.5rem 1.6rem 1.3rem;
  background: var(--alias); color: #fff;
}
.benvenuto__testa h2 {
  margin: 0;
  font-family: var(--display); font-weight: 300;
  font-size: 1.9rem; line-height: 1.1; letter-spacing: .01em;
}
.benvenuto__testa p {
  margin: .3rem 0 0;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
}

.benvenuto__corpo {
  padding: 1.4rem 1.6rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.benvenuto__attacco {
  margin: 0 0 1.4rem;
  font-size: .93rem; line-height: 1.6;
  color: rgba(42, 33, 30, .82);
}
.benvenuto__attacco b { color: var(--alias); }

.benvenuto h3 {
  margin: 0;
  font-family: var(--body); font-size: .7rem; font-weight: 600;
  letter-spacing: .15em; text-transform: uppercase;
  color: rgba(42, 33, 30, .5);
}

/* che cosa entra nel conteggio: senza questo, il dato viene letto come
   copertura dell'intero territorio comunale, che è un'altra cosa */
.perimetro {
  margin-bottom: 1.4rem; padding: .9rem 1rem;
  background: rgba(75, 124, 92, .08);
  border-left: 3px solid var(--canopy);
  border-radius: 0 var(--r) var(--r) 0;
}
.perimetro__intro {
  margin: .55rem 0 .6rem;
  font-size: .85rem; line-height: 1.5; color: rgba(42, 33, 30, .75);
}
.perimetro__voci {
  list-style: none; margin: 0 0 .7rem; padding: 0;
  display: flex; flex-direction: column; gap: .3rem;
}
.perimetro__voci li {
  position: relative; padding-left: 1.1rem;
  font-size: .85rem; line-height: 1.45; color: rgba(42, 33, 30, .78);
}
.perimetro__voci li::before {
  content: ''; position: absolute; left: 0; top: .52em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--canopy);
}
.perimetro__voci b { color: var(--bark); }
.perimetro__nota {
  margin: 0; padding-top: .6rem;
  border-top: 1px solid rgba(42, 33, 30, .1);
  font-size: .78rem; line-height: 1.5; color: rgba(42, 33, 30, .55);
}

.regola { padding-top: 1.2rem; border-top: 1px solid var(--linea); }
.regola__fonte {
  margin: .2rem 0 1rem;
  font-size: .75rem; font-style: italic; color: rgba(42, 33, 30, .45);
}
.regola__voci { list-style: none; margin: 0; padding: 0; }
.regola__voci li {
  display: flex; align-items: flex-start; gap: .9rem;
  padding: .55rem 0;
  font-size: .88rem; line-height: 1.5;
  color: rgba(42, 33, 30, .72);
}
.regola__voci b { color: var(--bark); }
.regola__voci em {
  display: block; margin-top: .1rem;
  font-style: normal; font-size: .76rem; color: var(--canopy);
}
.regola__icona {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--alias); color: #fff;
}
.regola__icona svg { width: 22px; height: 22px; }
/* la voce che questa mappa misura davvero */
.regola__voci--qui .regola__icona {
  box-shadow: 0 0 0 3px rgba(2, 100, 46, .18);
}

.lettura { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--linea); }
.lettura p { margin: .8rem 0 0; font-size: .85rem; line-height: 1.55; color: rgba(42, 33, 30, .72); }

.lettura__rampa { margin-top: .9rem; }
.lettura__barra { display: flex; height: 16px; border-radius: 2px; overflow: hidden; }
.lettura__barra span { flex: 1; }
.lettura__scala {
  position: relative; height: 1.4em; margin-top: .25rem;
  font-family: var(--dato); font-size: .62rem; color: rgba(42, 33, 30, .5);
}
.lettura__scala i { position: absolute; font-style: normal; transform: translateX(-50%); }
.lettura__scala i.obiettivo { color: var(--alias); font-weight: 700; }
.lettura__scala i.obiettivo::before {
  content: ''; position: absolute; left: 50%; top: -.45rem;
  width: 1px; height: .35rem; background: var(--alias);
}

.lettura__voci { margin: 1.1rem 0 0; }
.lettura__voci > div { padding: .5rem 0; border-bottom: 1px dotted var(--linea); }
.lettura__voci > div:last-child { border-bottom: 0; }
.lettura__voci dt {
  font-size: .74rem; font-weight: 600;
  letter-spacing: .04em; color: var(--canopy);
  margin-bottom: .15rem;
}
.lettura__voci dd {
  margin: 0; font-size: .84rem; line-height: 1.5;
  color: rgba(42, 33, 30, .7);
}
.lettura__voci b { color: var(--bark); }

.benvenuto__firma {
  margin: 1.3rem 0 0; padding-top: 1rem;
  border-top: 1px solid var(--linea);
  font-size: .78rem; color: rgba(42, 33, 30, .5);
}
.benvenuto__firma a { color: var(--canopy); }

.benvenuto__piede {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1.6rem;
  background: #fff;
  border-top: 1px solid var(--linea);
}
.benvenuto__ricorda {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: rgba(42, 33, 30, .6); cursor: pointer;
}
.benvenuto__ricorda input {
  appearance: none; width: 16px; height: 16px;
  border: 1.5px solid rgba(42, 33, 30, .3); border-radius: 2px;
  cursor: pointer; position: relative;
}
.benvenuto__ricorda input:checked { background: var(--canopy); border-color: var(--canopy); }
.benvenuto__ricorda input:checked::after {
  content: ''; position: absolute; left: 4.5px; top: 1px;
  width: 4px; height: 8px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}
.benvenuto__piede .azione {
  width: auto; padding: .6rem 1.4rem;
  font-family: var(--display); font-size: .92rem;
  color: #fff; background: var(--alias);
  border: 0; border-radius: var(--r); cursor: pointer;
  transition: background .16s ease;
}
.benvenuto__piede .azione:hover { background: #04773a; }

/* pulsante nel banner che la richiama */
.banner__info {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  color: rgba(42, 33, 30, .38);
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  transition: color .16s ease, background .16s ease;
}
.banner__info:hover { color: var(--alias); background: rgba(2, 100, 46, .08); }
.banner__info svg { width: 19px; height: 19px; }

@media (max-width: 700px) {
  .velo { padding: 0; align-items: stretch; }
  .benvenuto {
    width: 100%; max-height: 100%; border-radius: 0;
    max-height: 100dvh;
  }
  .benvenuto__testa { padding: 1.2rem 1.2rem 1rem; }
  .benvenuto__testa h2 { font-size: 1.5rem; }
  .benvenuto__corpo { padding: 1.1rem 1.2rem; }
  .benvenuto__piede { padding: .8rem 1.2rem; }
  .benvenuto__piede .azione { flex: 1; }
  .regola__icona { width: 34px; height: 34px; }
  .regola__icona svg { width: 19px; height: 19px; }
}

/* popup */
.maplibregl-popup-content {
  padding: .65rem .8rem; border-radius: var(--r);
  font-family: var(--body);
  box-shadow: 0 4px 18px rgba(42, 33, 30, .18);
}
.pop__riga { font-size: .78rem; color: rgba(42, 33, 30, .65); margin-top: .25rem; }
.pop__riga:first-child { margin-top: 0; }
.pop__riga b { font-family: var(--dato); font-weight: 700; color: var(--alias); }
.maplibregl-ctrl-group { border-radius: var(--r) !important; }

/* ═══════════ schermi medi ═══════════ */

@media (max-width: 1180px) {
  :root { --rail: 320px; }
  .titolo__num { font-size: 2rem; }
}

/* ═══════════ schermi stretti: foglio dal basso ═══════════ */

@media (max-width: 900px) {
  :root { --presa: 62px; --banner: 54px; }

  .app { display: block; height: calc(100% - var(--banner)); }
  .mappa { position: absolute; inset: var(--banner) 0 var(--presa) 0; }

  .banner { gap: .7rem; padding: 0 .7rem 0 .9rem; }
  .banner__marchio { height: 32px; }
  .banner__titolo h1 { font-size: .94rem; }
  /* il sottotitolo è ridondante quando lo spazio stringe */
  .banner__titolo p { display: none; }
  .banner__firma { gap: .4rem; padding: .2rem; }
  .banner__firma span { display: none; }
  .banner__firma img { height: 27px; }

  .rail {
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; flex: none;
    height: calc(100vh - var(--banner) - 8px);
    height: calc(100dvh - var(--banner) - 8px);
    border-right: 0;
    border-top: 1px solid var(--linea);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(42, 33, 30, .18);
    /* chiuso resta fuori schermo tranne la presa */
    transform: translateY(calc(100% - var(--presa)));
    transition: transform .3s cubic-bezier(.2, .8, .3, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rail[data-aperto="true"] { transform: translateY(0); }

  /* la presa mostra già il dato principale: si legge senza aprire */
  .presa {
    display: flex; align-items: center; gap: .8rem;
    width: 100%; height: var(--presa);
    padding: 0 1.1rem;
    background: none; border: 0; cursor: pointer;
    text-align: left; flex: none;
  }
  .presa__tacca {
    position: absolute; top: .5rem; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(42, 33, 30, .2);
  }
  .presa__testo {
    display: flex; flex-direction: column; gap: .1rem;
    padding-top: .4rem;
  }
  .presa__citta {
    font-family: var(--display); font-size: 1.02rem; color: var(--bark);
    line-height: 1.1;
  }
  .presa__cifra {
    font-size: .74rem; color: rgba(42, 33, 30, .55);
  }
  .presa__cifra b {
    font-family: var(--dato); font-weight: 700; font-size: .9rem;
    color: var(--alias);
  }

  .brand { padding: .6rem 1.1rem .8rem; background: none; }
  .brand__mark { max-width: 200px; }
  .block { padding: .9rem 1.1rem; }
  .crediti { margin: 0 1.1rem; }

  /* bersagli più generosi al tocco */
  .classe { grid-template-columns: 24px 1fr; }
  .classe__barra { height: 15px; }
  .soglia { margin-left: 29px; }
  .opt { padding: .5rem 0; }
  .segmenti button { padding: .65rem .4rem; }

  .stato { top: .6rem; }

  /* i controlli della mappa vanno ingranditi per il tocco e tenuti
     lontani dal foglio che sale dal basso */
  .ctrl-bottone { width: 36px; height: 36px; }
  .ctrl-bottone svg { width: 19px; height: 19px; }
  .ctrl-bottone.on::after { margin-top: -16px; }
  .ctrl-pannello { right: 41px; width: 168px; }
  .maplibregl-ctrl-top-right { top: .3rem; }
}

@media (max-width: 460px) {
  :root { --banner: 60px; }
  .banner__titolo h1 {
    white-space: normal; font-size: .84rem; line-height: 1.15;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .banner__marchio { height: 28px; }
  .banner__firma img { height: 24px; }
}

@media (max-width: 420px) {
  .titoli { gap: .8rem; }
  .titolo__num { font-size: 1.9rem; }
  .cifre--griglia { grid-template-columns: 1fr; }
}

/* schermi bassi in orizzontale: il foglio non deve coprire tutto */
@media (max-width: 900px) and (max-height: 480px) {
  :root { --presa: 52px; --banner: 46px; }
  .rail {
    height: calc(100vh - var(--banner) - 4px);
    height: calc(100dvh - var(--banner) - 4px);
  }
  .banner__marchio { height: 27px; }
  .banner__titolo h1 { font-size: .86rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
