/* =============================================================
   Photo Atlas Piemonte — foglio di stile
   -------------------------------------------------------------
   Identità ripresa da photoatlas.andreapiacenza.com:
   carta avorio, granata profondo, accento terracotta.
   Titoli in serif, microtesto in sans maiuscoletto spaziato,
   angoli quasi squadrati. Impianto editoriale, non da cruscotto.

   DUE TEMI, UNA SOLA IDENTITÀ
   Il tema chiaro è quello del sito ed è il predefinito. Ma questa
   è un'app che si consulta al buio, in auto, prima di un'uscita
   notturna: un fondo avorio a quel punto acceca. Il tema notturno
   usa gli stessi colori invertiti — il granata diventa fondo,
   la carta diventa testo — così l'identità resta riconoscibile.
   Si attiva dall'interruttore in alto a destra e viene ricordato.
   ============================================================= */

/* I font migliorano molto la resa, ma l'app deve restare leggibile
   anche offline: da qui la catena di ripieghi di sistema. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* --- tema chiaro: quello del sito --- */
  --bg:        #F4F1E8;   /* carta */
  --bg-2:      #FBF9F3;   /* schede */
  --bg-3:      #EAE5D6;   /* superfici alternate */
  --bordo:     #DAD2C6;
  --testo:     #1E1517;   /* nero con nota granata */
  --testo-2:   #5C5153;
  --testo-3:   #8E8385;
  --accento:   #B4531F;   /* terracotta */
  --accento-2: #6B1F2E;   /* granata */
  --viola:     #6E5A86;   /* Via Lattea */
  --verde:     #4C6B3C;
  --rosso:     #A63B26;
  --su-accento:#FBF9F3;   /* testo sopra i fondi pieni */
  --su-scuro:  #F1EDE0;

  --ombra:     0 1px 2px rgba(30,21,23,.05), 0 8px 24px rgba(30,21,23,.06);
  --ombra-alta:0 2px 6px rgba(30,21,23,.08), 0 24px 48px rgba(30,21,23,.12);
  --raggio:    3px;
  --raggio-pill: 100px;
  --topbar-h:  66px;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- tema notturno: stessa famiglia, invertita --- */
html[data-tema="notte"] {
  --bg:        #171012;
  --bg-2:      #201618;
  --bg-3:      #2B1E21;
  --bordo:     #3D2C30;
  --testo:     #EFE7E2;
  --testo-2:   #B3A5A3;
  --testo-3:   #857674;
  --accento:   #DE8551;
  --accento-2: #C9707F;   /* granata schiarito per il fondo scuro */
  --viola:     #A991C4;
  --verde:     #8FBF6E;
  --rosso:     #DE7A62;
  --su-accento:#171012;
  --su-scuro:  #F3EBE8;
  --ombra:     0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --ombra-alta:0 2px 6px rgba(0,0,0,.4), 0 24px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--testo);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Microtesto in maiuscoletto spaziato: è la cifra tipografica
   che tiene insieme etichette, intestazioni e numerazioni. */
.etichetta, summary, .sc-sezione h4, .ris-sez h5, .mese h3,
.dato .k, .campo label, .interpretazione h4, .box .l, .ev .pt .l {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
}

/* ---------------- TOPBAR ---------------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 26px;
  padding: 0 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--bordo);
  position: relative; z-index: 500;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px; flex: none;
  color: var(--su-scuro);
  background: var(--accento-2);
  border-radius: 50%;
  padding: 7px;
}
.topbar h1 {
  font-family: var(--serif);
  font-size: 19px; font-weight: 500; letter-spacing: -.01em;
  line-height: 1.1;
}
.topbar h1 span { color: var(--testo); font-weight: 400; }
.tagline {
  font-size: 9.5px; color: var(--testo-3);
  text-transform: uppercase; letter-spacing: .18em; margin-top: 3px;
}

.tabs { display: flex; gap: 4px; margin-left: auto; }
/* NB: il selettore è vincolato a .tabs perché esiste anche una
   <table class="tab"> nelle schede, che altrimenti ereditava
   maiuscoletto e spaziatura dai pulsanti di navigazione. */
.tabs .tab {
  background: none; border: 0; color: var(--testo-2);
  font: inherit; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 9px 4px; margin: 0 9px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs .tab:hover { color: var(--testo); }
.tabs .tab.active { color: var(--testo); border-bottom-color: var(--accento); }

.topbar-right { margin-left: 20px; display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--testo-2); background: var(--bg-3);
  padding: 6px 13px; border-radius: var(--raggio-pill); white-space: nowrap;
}
.btn-tema {
  width: 34px; height: 34px; flex: none; cursor: pointer;
  background: none; border: 1px solid var(--bordo); border-radius: 50%;
  color: var(--testo-2); font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.btn-tema:hover { border-color: var(--accento); color: var(--accento); }

/* ---------------- LAYOUT VISTE ---------------- */
main { height: calc(100vh - var(--topbar-h)); position: relative; }
.view { display: none; height: 100%; }
.view.active { display: flex; }
#view-elenco.active, #view-planner.active, #view-cielo.active { display: block; overflow-y: auto; }

/* ---------------- SIDEBAR ---------------- */
.sidebar {
  width: 390px; flex: none; height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--bordo);
}
.filtri { padding: 18px; border-bottom: 1px solid var(--bordo); overflow-y: auto; max-height: 55%; }

#ricerca {
  width: 100%; padding: 12px 14px; margin-bottom: 16px;
  background: var(--bg-2); border: 1px solid var(--bordo); border-radius: var(--raggio);
  color: var(--testo); font: inherit; font-size: 14px;
}
#ricerca:focus { outline: none; border-color: var(--accento-2); }
#ricerca::placeholder { color: var(--testo-3); }

details { margin-bottom: 14px; }
summary {
  cursor: pointer; color: var(--testo-3); padding: 6px 0; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: '+ '; display: inline-block; width: 14px; color: var(--accento); }
details[open] summary::before { content: '– '; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; }
.chip {
  font-size: 12px; padding: 5px 12px; border-radius: var(--raggio-pill); cursor: pointer;
  background: none; border: 1px solid var(--bordo); color: var(--testo-2);
  transition: all .12s; user-select: none;
}
.chip:hover { border-color: var(--testo-3); color: var(--testo); }
.chip.on { background: var(--accento-2); border-color: var(--accento-2); color: var(--su-scuro); font-weight: 500; }

.slider { display: block; font-size: 12.5px; color: var(--testo-2); margin: 14px 0; }
.slider b { color: var(--accento); font-weight: 600; }
.slider input { width: 100%; margin-top: 7px; accent-color: var(--accento); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--testo-2); margin: 9px 0; cursor: pointer; }
.check input { accent-color: var(--accento); }

.btn-ghost {
  width: 100%; padding: 9px; margin-top: 8px;
  background: none; border: 1px solid var(--bordo); border-radius: var(--raggio);
  color: var(--testo-2); font: inherit; font-size: 12px;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { color: var(--testo); border-color: var(--testo-3); }

/* ---------------- LISTA ---------------- */
.lista { flex: 1; overflow-y: auto; padding: 0; }
.card {
  padding: 15px 18px; border-bottom: 1px solid var(--bordo);
  background: none; cursor: pointer; transition: background .12s;
  position: relative;
}
.card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accento); opacity: 0; transition: opacity .12s;
}
.card:hover { background: var(--bg-2); }
.card.attiva { background: var(--bg-2); }
.card.attiva::before { opacity: 1; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 {
  font-family: var(--serif); font-size: 17px; font-weight: 500;
  line-height: 1.25; letter-spacing: -.01em;
}
.card .luogo { font-size: 12px; color: var(--testo-3); margin-top: 3px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mini {
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--raggio);
  background: var(--bg-3); color: var(--testo-2);
}
.mini.b2, .mini.b3 { background: rgba(110,90,134,.14); color: var(--viola); }
.mini.b4, .mini.b5 { background: rgba(107,31,46,.10); color: var(--accento-2); }
html[data-tema="notte"] .mini.b4, html[data-tema="notte"] .mini.b5 { background: rgba(201,112,127,.15); }
.mini.b6, .mini.b7, .mini.b8, .mini.b9 { color: var(--testo-3); }
.stella { background: none; border: 0; font-size: 17px; cursor: pointer; color: var(--testo-3); line-height: 1; padding: 0; flex: none; }
.stella.on { color: var(--accento); }

/* ---------------- MAPPA ---------------- */
.mappa-wrap { flex: 1; position: relative; }
#mappa { width: 100%; height: 100%; background: var(--bg-3); }
.leaflet-container { font: inherit; background: var(--bg-3); }
.leaflet-popup-content-wrapper {
  background: var(--bg-2); color: var(--testo);
  border: 1px solid var(--bordo); border-radius: var(--raggio); box-shadow: var(--ombra-alta);
}
.leaflet-popup-tip { background: var(--bg-2); border: 1px solid var(--bordo); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; color: var(--testo-2); }
.leaflet-popup-content b {
  display: block; margin-bottom: 4px; font-family: var(--serif);
  font-size: 16px; font-weight: 500; color: var(--testo);
}
.leaflet-popup-content button {
  margin-top: 10px; padding: 6px 14px; font: inherit; font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
  background: var(--accento-2); color: var(--su-scuro);
  border: 0; border-radius: var(--raggio); cursor: pointer;
}
.leaflet-control-attribution {
  background: rgba(244,241,232,.9) !important; color: var(--testo-3) !important; font-size: 10px !important;
}
html[data-tema="notte"] .leaflet-control-attribution { background: rgba(23,16,18,.9) !important; }
.leaflet-control-attribution a { color: var(--testo-2) !important; }
.leaflet-bar a { background: var(--bg-2) !important; color: var(--testo) !important; border-color: var(--bordo) !important; }
.leaflet-bar a:hover { background: var(--bg-3) !important; }

/* --- PIN DELLA MAPPA ---
   Goccia classica. Il foro centrale è del colore del fondo, così il
   pin "buca" la mappa invece di appoggiarcisi sopra, e il contorno
   sottile lo stacca dalle tessere chiare come da quelle scure. */
.pin-mappa { color: var(--testo-3); }
.pin-mappa svg {
  display: block;
  filter: drop-shadow(0 2px 3px rgba(30,21,23,.35));
  transition: transform .12s cubic-bezier(.34,1.56,.64,1);
  transform-origin: 50% 97%;
}
.pin-mappa path { fill: currentColor; stroke: var(--bg-2); stroke-width: 1.4; }
.pin-mappa circle { fill: var(--bg-2); }
html[data-tema="notte"] .pin-mappa svg { filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }

.pin-mappa.b2, .pin-mappa.b3 { color: var(--viola); }
.pin-mappa.b4, .pin-mappa.b5 { color: var(--accento-2); }
.pin-mappa.b6, .pin-mappa.b7, .pin-mappa.b8, .pin-mappa.b9 { color: var(--testo-3); }

.pin-mappa:hover svg { transform: scale(1.12); }
.pin-mappa.evidenziato { color: var(--accento); z-index: 1000 !important; }
.pin-mappa.evidenziato svg { transform: scale(1.3); }
.pin-mappa.evidenziato path { stroke-width: 1.8; }

.legenda {
  position: absolute; bottom: 16px; left: 16px; z-index: 400;
  display: flex; gap: 15px; padding: 10px 15px;
  background: var(--bg-2); border: 1px solid var(--bordo);
  border-radius: var(--raggio); font-size: 11px; color: var(--testo-2);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  box-shadow: var(--ombra);
}
.legenda span { display: flex; align-items: center; gap: 7px; }
.pin {
  width: 9px; height: 9px; display: inline-block;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
}
.pin.b2 { background: var(--viola); }
.pin.b4 { background: var(--accento-2); }
.pin.b6 { background: var(--testo-3); }

/* ---------------- GRIGLIA ---------------- */
.griglia {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px; padding: 26px;
}
.gcard {
  background: var(--bg-2); border: 1px solid var(--bordo); border-radius: var(--raggio);
  padding: 20px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.gcard:hover { border-color: var(--accento); box-shadow: var(--ombra); }
.gcard h3 { font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 4px; letter-spacing: -.01em; }
.gcard .luogo { font-size: 12px; color: var(--testo-3); }
.gcard p { font-size: 13px; color: var(--testo-2); margin: 12px 0 0; line-height: 1.6; }
.gcard .card-meta { margin-top: 14px; }

/* ---------------- SCHEDA LOCATION ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(30,21,23,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 900;
}
.overlay.on { opacity: 1; pointer-events: auto; }
.scheda {
  position: fixed; top: 0; right: 0; bottom: 0; width: 580px; max-width: 94vw;
  background: var(--bg-2); border-left: 1px solid var(--bordo);
  box-shadow: var(--ombra-alta); overflow-y: auto; z-index: 1000;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
}
.scheda.on { transform: translateX(0); }
.chiudi {
  position: sticky; top: 14px; float: right; margin: 14px 16px 0 0;
  width: 32px; height: 32px; border-radius: 50%; z-index: 10;
  background: var(--bg-3); border: 1px solid var(--bordo); color: var(--testo-2);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.chiudi:hover { color: var(--testo); border-color: var(--testo-3); }

#scheda-contenuto { padding: 0 0 70px; }
.sc-copertina:not(.con-foto) + .sc-titolo { margin-top: 26px; }
#scheda-contenuto > *:not(.sc-copertina) { margin-left: 32px; margin-right: 32px; }

/* --- COPERTINA ---
   Fascia a tutta larghezza sopra il titolo, ma solo quando una
   fotografia esiste davvero: il riquadro nasce a altezza zero e si
   apre con la foto. Per le location senza immagini su Commons la
   scheda comincia direttamente dal nome, senza spazi vuoti. */
.sc-copertina {
  position: relative; height: 0; overflow: hidden;
  margin-bottom: 0; transition: height .28s cubic-bezier(.4,0,.2,1), margin-bottom .28s;
}
.sc-copertina.con-foto { height: 210px; margin-bottom: 24px; }
.sc-copertina img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.sc-copertina.con-foto::after {
  /* sfumatura in basso: regge il credito e lega la foto alla carta */
  content: ''; position: absolute; inset: auto 0 0 0; height: 55%;
  background: linear-gradient(transparent, rgba(30,21,23,.72));
  pointer-events: none;
}
html[data-tema="notte"] .sc-copertina.con-foto::after {
  background: linear-gradient(transparent, rgba(0,0,0,.8));
}
.sc-credito {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 9px 32px; display: flex; gap: 10px; align-items: baseline;
  flex-wrap: wrap; font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255,255,255,.82);
}
.sc-credito a { color: rgba(255,255,255,.95); text-decoration: underline; text-underline-offset: 2px; }
.sc-credito .mia {
  background: var(--accento); color: var(--su-accento);
  padding: 3px 9px; font-weight: 600; letter-spacing: .1em;
}
.sc-titolo {
  font-family: var(--serif); font-size: 32px; font-weight: 400;
  line-height: 1.12; letter-spacing: -.02em; padding-right: 44px;
}
.sc-luogo {
  font-size: 11px; color: var(--testo-3); margin-top: 8px;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
}
.sc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 26px; }

.sc-sezione { margin-bottom: 28px; }
.sc-sezione h4 {
  color: var(--accento); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--bordo);
}
.sc-sezione ul { list-style: none; }
.sc-sezione li { font-size: 14px; color: var(--testo); padding: 6px 0 6px 18px; position: relative; line-height: 1.6; }
.sc-sezione li::before { content: ''; position: absolute; left: 0; top: 14px; width: 6px; height: 1px; background: var(--accento); }
.sc-sezione p { font-size: 14px; color: var(--testo); line-height: 1.65; }

/* Griglia dei dati: bordi sottili condivisi, come una tabella editoriale */
.dati {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--bordo); border-left: 1px solid var(--bordo);
}
.dato { border-right: 1px solid var(--bordo); border-bottom: 1px solid var(--bordo); padding: 12px 14px; }
.dato .k { color: var(--testo-3); display: block; margin-bottom: 5px; }
.dato .v { font-family: var(--serif); font-size: 18px; font-weight: 400; line-height: 1.25; }
.dato .v small { font-family: var(--sans); font-size: 11px; color: var(--testo-2); display: block; margin-top: 3px; }

.allin {
  background: var(--bg-3); border-left: 2px solid var(--viola);
  padding: 14px 16px; margin-bottom: 10px;
}
.allin .cosa { font-family: var(--serif); font-size: 16px; font-weight: 500; }
.allin .quando {
  font-size: 10.5px; color: var(--accento); margin: 5px 0 7px;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
}
.allin .nota { font-size: 13px; color: var(--testo-2); line-height: 1.6; }

.avviso {
  background: rgba(166,59,38,.08); border-left: 2px solid var(--rosso);
  padding: 14px 16px; font-size: 13.5px; color: var(--rosso); line-height: 1.6;
}
html[data-tema="notte"] .avviso { background: rgba(222,122,98,.1); }

.link-esterni { display: flex; flex-wrap: wrap; gap: 8px; }
.link-esterni a {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  padding: 9px 15px; border-radius: var(--raggio); text-decoration: none;
  background: var(--accento-2); border: 1px solid var(--accento-2); color: var(--su-scuro);
  display: inline-flex; align-items: center; gap: 6px;
}
.link-esterni a:hover { background: var(--accento); border-color: var(--accento); color: var(--su-accento); }

textarea.note-personali, input.file-foto {
  width: 100%; padding: 12px 14px; background: var(--bg); color: var(--testo);
  border: 1px solid var(--bordo); border-radius: var(--raggio);
  font: inherit; font-size: 14px; resize: vertical;
}
textarea.note-personali:focus { outline: none; border-color: var(--accento-2); }
.salvato { font-size: 11px; color: var(--verde); margin-top: 7px; height: 15px;
           text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.galleria { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 8px; margin-top: 12px; }
.galleria figure { position: relative; }
.galleria img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border: 1px solid var(--bordo); display: block; }
.galleria button {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(30,21,23,.75); color: #fff; border: 0; cursor: pointer; font-size: 13px; line-height: 1;
}

.bussola { display: block; margin: 6px auto; max-width: 270px; }

/* ---------------- PLANNER ---------------- */
.planner-wrap { max-width: 880px; margin: 0 auto; padding: 44px 26px 80px; }
.planner-head h2 {
  font-family: var(--serif); font-size: 40px; font-weight: 400;
  letter-spacing: -.025em; line-height: 1.08;
}
.planner-head p { color: var(--testo-2); font-size: 15px; margin-top: 14px; max-width: 620px; line-height: 1.65; }

.planner-form { margin: 30px 0 16px; }
#query {
  width: 100%; padding: 18px 20px; font: inherit; font-size: 16px; line-height: 1.6;
  background: var(--bg-2); border: 1px solid var(--bordo); border-radius: var(--raggio);
  color: var(--testo); resize: vertical;
}
#query:focus { outline: none; border-color: var(--accento-2); }
#query::placeholder { color: var(--testo-3); }
.planner-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }

.btn-primary {
  padding: 12px 28px; font: inherit; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  background: var(--accento-2); color: var(--su-scuro);
  border: 0; border-radius: var(--raggio-pill); cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accento); color: var(--su-accento); }
.btn-primary:disabled { opacity: .45; cursor: wait; }

.esempi { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 32px; }
.esempi > span { font-size: 10.5px; color: var(--testo-3); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.esempio {
  font: inherit; font-size: 12.5px; padding: 6px 13px; border-radius: var(--raggio-pill); cursor: pointer;
  background: none; border: 1px solid var(--bordo); color: var(--testo-2); text-align: left;
}
.esempio:hover { border-color: var(--accento); color: var(--accento); }

.interpretazione {
  background: var(--bg-3); border-radius: var(--raggio);
  padding: 18px 22px; margin-bottom: 24px;
}
.interpretazione h4 { color: var(--testo-3); margin-bottom: 12px; }
.interpretazione .kv { display: flex; flex-wrap: wrap; gap: 8px; }
.interpretazione .kv span {
  font-size: 12px; padding: 5px 11px; border-radius: var(--raggio);
  background: var(--bg-2); border: 1px solid var(--bordo); color: var(--testo-2);
}
.interpretazione .kv b { color: var(--testo); font-weight: 600; }
.interpretazione .nota { font-size: 12px; color: var(--testo-3); margin-top: 11px; font-style: italic; }

.risultato {
  background: var(--bg-2); border: 1px solid var(--bordo); border-radius: var(--raggio);
  padding: 24px 26px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.risultato::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--bordo); }
.risultato.top::before { background: var(--accento); width: 3px; }
.ris-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.ris-head h3 { font-family: var(--serif); font-size: 24px; font-weight: 400; line-height: 1.2; letter-spacing: -.02em; }
.ris-head .luogo { font-size: 11px; color: var(--testo-3); margin-top: 5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.punteggio { text-align: center; flex: none; }
.punteggio .n { font-family: var(--serif); font-size: 34px; font-weight: 400; color: var(--accento); line-height: 1; }
.punteggio .l { color: var(--testo-3); margin-top: 4px; }

.ris-riga { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.ris-sez { margin-top: 18px; }
.ris-sez h5 { color: var(--testo-3); margin-bottom: 9px; }
.ris-sez ul { list-style: none; }
.ris-sez li { font-size: 14px; padding: 5px 0 5px 20px; position: relative; line-height: 1.6; color: var(--testo); }
.ris-sez li::before { content: '✓'; position: absolute; left: 0; color: var(--verde); font-size: 12px; }
.ris-sez.contro li::before { content: '!'; color: var(--rosso); font-weight: 700; left: 5px; }
.ris-orari { background: var(--bg-3); padding: 14px 16px; margin-top: 16px; font-size: 13px; color: var(--testo-2); line-height: 1.8; }
.ris-orari b { color: var(--testo); }
.ris-azioni { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.ris-azioni button, .ris-azioni a {
  font: inherit; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  padding: 8px 15px; border-radius: var(--raggio); cursor: pointer; text-decoration: none;
  background: none; border: 1px solid var(--bordo); color: var(--testo-2);
}
.ris-azioni button:hover, .ris-azioni a:hover { border-color: var(--accento); color: var(--accento); }

.stato { padding: 30px; text-align: center; color: var(--testo-3); font-size: 14px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 14px;
  border: 2px solid var(--bordo); border-top-color: var(--accento);
  border-radius: 50%; animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------------- CIELO ---------------- */
.cielo-wrap { max-width: 880px; margin: 0 auto; padding: 44px 26px 80px; }
.cielo-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.cielo-head h2 { font-family: var(--serif); font-size: 40px; font-weight: 400; letter-spacing: -.025em; }
.cielo-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.cielo-controls label { font-size: 10.5px; color: var(--testo-3); display: flex; flex-direction: column; gap: 5px;
                        text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.cielo-controls input, .cielo-controls select {
  padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--bordo);
  border-radius: var(--raggio); color: var(--testo); font: inherit; font-size: 13px;
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.pannello { background: var(--bg-2); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 22px 24px; margin-bottom: 14px; }
.pannello h3 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; }
.pannello h3 .ico { font-size: 18px; color: var(--accento); }
.timeline { position: relative; height: 46px; overflow: hidden; margin: 16px 0 7px; background: var(--bg-3); border-radius: var(--raggio); }
.timeline .fascia { position: absolute; top: 0; bottom: 0; }
.timeline-etichette { display: flex; justify-content: space-between; font-size: 10px; color: var(--testo-3);
                      text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.tl-legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--testo-2); margin-top: 11px; }
.tl-legenda span { display: flex; align-items: center; gap: 6px; }
.tl-legenda i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

table.tab { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tab td { padding: 10px 0; border-bottom: 1px solid var(--bordo); }
table.tab tr:last-child td { border: 0; }
table.tab td:first-child { color: var(--testo-2); }
table.tab td:last-child { text-align: right; font-weight: 600; font-family: var(--serif); font-size: 16px; }

.barra { height: 5px; background: var(--bg-3); overflow: hidden; margin-top: 7px; }
.barra i { display: block; height: 100%; background: var(--accento); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
  .tagline { display: none; }
  .tabs { margin-left: auto; order: 3; width: 100%; justify-content: space-between; }
  .tabs .tab { flex: 1; margin: 0; padding: 8px 4px; font-size: 11px; text-align: center; }
  .topbar-right { margin-left: auto; }
  .badge { display: none; }
  main { height: auto; min-height: 0; }
  html, body { overflow: auto; }
  #view-mappa.active { flex-direction: column; height: auto; }
  .sidebar { width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--bordo); }
  .filtri { max-height: none; }
  .lista { max-height: 46vh; }
  .mappa-wrap { height: 62vh; }
  .scheda { width: 100%; }
  #scheda-contenuto { padding: 20px 20px 70px; }
  .sc-titolo { font-size: 26px; }
  .griglia { grid-template-columns: 1fr; padding: 16px; }
  .planner-wrap, .cielo-wrap { padding: 26px 16px 70px; }
  .planner-head h2, .cielo-head h2 { font-size: 30px; }
}

/* --- rifiniture su prova nel browser --- */
.topbar h1 { font-size: 22px; }
.tagline { margin-top: 1px; }
/* i marker sulla carta chiara vanno stagliati o spariscono */
.marker-pin { width: 13px; height: 13px; box-shadow: 0 0 0 1px rgba(30,21,23,.35), 0 1px 3px rgba(30,21,23,.3); }
html[data-tema="notte"] .marker-pin { box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
/* la sidebar si stacca dalla mappa */
.sidebar { background: var(--bg-2); }
.filtri { background: var(--bg); }

/* Il contenitore della mappa deve seguire il tema anche mentre le
   tessere nuove stanno ancora caricando, altrimenti si vede per un
   attimo il fondo del tema precedente. */
#mappa, #mappa-all, .leaflet-container { background: var(--bg-3); transition: background .2s; }

/* Avviso quando le tessere della mappa non caricano */
.avviso-mappa {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 450; max-width: 460px;
  background: var(--bg-2); border: 1px solid var(--accento);
  border-radius: var(--raggio); padding: 14px 18px;
  font-size: 13px; color: var(--testo-2); line-height: 1.6;
  box-shadow: var(--ombra-alta);
}
.avviso-mappa b { color: var(--testo); display: block; margin-bottom: 4px; }
.avviso-mappa button {
  margin-top: 10px; padding: 6px 14px; font: inherit; font-size: 10.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  background: var(--accento-2); color: var(--su-scuro);
  border: 0; border-radius: var(--raggio); cursor: pointer;
}
