/* ==========================================================================
   Grotte del Faedo-Casaron — TOTEM museale, schermo touch fisso 16:9
   Direzione estetica: identita' del MUSEO DEL PRIABONIANO applicata allo
   schermo. Le linee guida del museo sono nate per pannelli stampati 70x100
   su fondo bianco; qui il fondo resta scuro (antracite #36454F virato piu'
   scuro) perche' il totem e' fatto di foto in grotta a tutto schermo, che su
   bianco perderebbero forza e leggibilita'. Colori, font e gerarchia
   tipografica sono invece quelli del museo.

   Riferimenti (vedi docs/identita-museo-priaboniano.md):
   - palette: #36454F antracite, #1886A0 teal, #E96432 arancio, #E8C831 giallo
   - font: NeulisNeue nei pannelli; qui Poppins, sostituto libero piu' vicino
     (geometrico, 'a' e 'g' a un piano) nei tre pesi Regular/Medium/ExtraBold
   - gerarchia (pannello 70x100): titolo 100pt/115 ExtraBold maiuscolo,
     sottotitolo 50/65 Medium, paragrafo 35/50 Regular, didascalia 15/21
   ========================================================================== */

@font-face {
  font-family: "Poppins";
  src: url("/assets/poppins-regular-fa5c5353.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/poppins-medium-fc3ede95.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/poppins-extrabold-e43f3619.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- colori istituzionali del Museo del Priaboniano (valori dichiarati
     nel PDF del logo: non reinventarli, sono la fonte autorevole) --- */
  --museo-antracite: #36454F;
  --museo-teal:      #1886A0;
  --museo-arancio:   #E96432;
  --museo-giallo:    #E8C831;

  /* Fondali: stessa famiglia cromatica dell'antracite museo, virata piu'
     scura perche' il totem e' pieno di foto in grotta a tutto schermo. */
  --bg: #1b242a;
  --bg-elevated: #243139;
  --bg-elevated-2: #2e3d46;
  --border: #3f515c;
  --border-faint: #2a373f;

  --text: #f2f1ee;
  --text-muted: #a9b8c1;
  --text-faint: #76858f;

  /* Accento primario: il teal del museo e' troppo cupo per il testo su fondo
     scuro (contrasto ~3:1), quindi il valore pieno resta per bordi e superfici
     e per il testo si usa una versione schiarita (~6:1). */
  --glow: #4fb6cd;
  --glow-dim: var(--museo-teal);
  --glow-wash: rgba(79, 182, 205, 0.10);

  --ember: var(--museo-arancio);
  --ember-dim: #a04422;
  --ember-wash: rgba(233, 100, 50, 0.14);

  --gold: var(--museo-giallo);

  /* Una sola famiglia, come nelle linee guida del museo (li' NeulisNeue nei
     pesi Regular/Medium/ExtraBold). Il nome --font-mono resta per non
     riscrivere le decine di regole che lo usano: indica le etichette in
     maiuscoletto spaziato, non piu' un monospaziato. */
  --font-display: "Poppins", system-ui, -apple-system, sans-serif;
  --font-body: "Poppins", system-ui, -apple-system, sans-serif;
  --font-mono: "Poppins", system-ui, -apple-system, sans-serif;

  --radius: 3px;
}

/* ---------------------------------------------------------------------- */
/* reset                                                                   */
/* ---------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;              /* niente scroll, mai, da nessuna parte */
  background: #000;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;             /* schermo touch: niente selezione testo accidentale */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;    /* niente doppio-tap-zoom sui bersagli touch */
}

img { max-width: 100%; display: block; user-select: none; -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------------- */
/* shell 16:9 fissa, centrata e letterboxata                             */
/* ---------------------------------------------------------------------- */

.tv-stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.tv-screen {
  position: relative;
  width: min(100vw, 177.7778vh);   /* 16/9 = 1.77778 */
  height: min(100vh, 56.25vw);     /*  9/16 = 0.5625  */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 45% at 12% -8%, rgba(79, 182, 205, 0.07), transparent 60%),
    radial-gradient(ellipse 45% 40% at 100% 8%, rgba(233, 100, 50, 0.05), transparent 55%);
  container-type: inline-size;
  container-name: tv;
}

/* unita' di scala: 1cqw = 1% della larghezza schermo (sempre 1920 di riferimento, 16:9) */

/* ---------------------------------------------------------------------- */
/* navigazione persistente                                                */
/* ---------------------------------------------------------------------- */

.tv-nav-home {
  position: absolute;
  top: 2.2cqw;
  left: 2.2cqw;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.9cqw;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.55cqw;
  color: var(--text);
  padding: 0.7cqw 1.3cqw;
  border-radius: 999px;
  border: 1px solid var(--border-faint);
  background: rgba(27, 36, 42, 0.55);
  backdrop-filter: blur(6px);
}
.tv-nav-home .dot {
  width: 0.55cqw;
  height: 0.55cqw;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 0.35cqw var(--glow-wash);
  flex-shrink: 0;
}

.tv-nav-back {
  position: absolute;
  top: 2.2cqw;
  right: 2.2cqw;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 1.05cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.9cqw 1.5cqw;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.tv-nav-back:active { border-color: var(--glow-dim); color: var(--glow); }

/* ---------------------------------------------------------------------- */
/* contenuto schermata                                                    */
/* ---------------------------------------------------------------------- */

.tv-screen-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eyebrow {
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
}

/* ---------------------------------------------------------------------- */
/* pulsanti totem (bersagli touch grandi)                                 */
/* ---------------------------------------------------------------------- */

.kiosk-btn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.7cqw;
  padding: 2cqw;
  border-radius: 0.6cqw;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-elevated-2));
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.kiosk-btn:active { transform: scale(0.98); border-color: var(--glow-dim); background: var(--bg-elevated-2); }

.kiosk-btn .kiosk-btn-icon {
  color: var(--glow);
  line-height: 1;
}
.kiosk-btn .kiosk-btn-icon svg { width: 2.6cqw; height: 2.6cqw; display: block; }
.kiosk-btn .kiosk-btn-label {
  font-family: var(--font-display);
  font-size: 1.75cqw;
  font-weight: 500;
  line-height: 1.15;
  color: var(--text);
}
.kiosk-btn .kiosk-btn-hint {
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.kiosk-btn--ember { border-color: var(--ember-dim); }
.kiosk-btn--ember .kiosk-btn-icon { color: var(--ember); }

/* ---------------------------------------------------------------------- */
/* schermata home                                                         */
/* ---------------------------------------------------------------------- */

.home-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* slideshow: le slide sono impilate, solo .is-active è visibile (crossfade) */
.home-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease;
  transform: scale(1.06);
  animation: kenburns 12s ease-out forwards;
  animation-play-state: paused;
}
.home-slide.is-active { opacity: 1; animation-play-state: running; }
@keyframes kenburns {
  from { transform: scale(1.06); }
  to { transform: scale(1.0); }
}
.home-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(10,8,6,0.94) 0%, rgba(10,8,6,0.55) 42%, rgba(10,8,6,0.35) 100%);
}

.home-content {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 4cqw 4.5cqw 6cqw;
  gap: 3cqw;
}

/* logo del gruppo che cura il totem: angolo in alto a destra */
.home-brand {
  position: absolute;
  top: 2.8cqw;
  right: 4.5cqw;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1.6cqw;
}
/* Le linee guida del museo chiedono il logo largo almeno 12 cm su un pannello
   da 70 (=17% della base). Qui vale la stessa proporzione sulla larghezza dello
   schermo, cosi' il marchio ha lo stesso peso visivo dei pannelli in sala. */
.home-brand-museo { width: 17cqw; height: auto; }
.home-brand-sep {
  width: 1px;
  height: 3.6cqw;
  background: rgba(255, 255, 255, 0.22);
  flex: none;
}
/* alone soffuso dietro al logo: senza, il cerchio bianco del logo galleggia isolato sopra la foto
   di sfondo; un velo radiale scuro lo "ancora" alla composizione invece di sembrare incollato sopra */
.home-brand::before {
  content: "";
  position: absolute;
  inset: -2.2cqw;
  z-index: -1;
  background: radial-gradient(circle, rgba(10,8,6,0.55) 0%, rgba(10,8,6,0.25) 55%, transparent 75%);
}
.home-brand-logo {
  width: 10.42cqw;   /* ~200px a 1920 di riferimento */
  height: 10.42cqw;
  object-fit: contain;
  filter: drop-shadow(0 0.3cqw 1.2cqw rgba(0,0,0,0.65));
}

.home-title-block .eyebrow { font-size: 1.05cqw; margin-bottom: 0.9cqw; display: block; }
.home-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.6cqw;
  line-height: 1.15;
  max-width: 20ch;
  color: var(--text);
  text-shadow: 0 0.3cqw 1.5cqw rgba(0,0,0,0.5);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.home-title em { font-style: normal; font-weight: 800; color: var(--glow); }

.home-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4cqw;
}

.home-credits {
  position: absolute;
  left: 4.5cqw;
  right: 4.5cqw;
  bottom: 1.4cqw;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5cqw;
  font-family: var(--font-mono);
  font-size: 0.72cqw;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}
.home-credits-project { display: inline-flex; align-items: center; gap: 0.7cqw; }
.home-credits-project em { color: var(--text-muted); font-style: normal; }
.home-credits-logo { height: 2.2cqw; width: 2.2cqw; object-fit: contain; flex-shrink: 0; }
/* il logo HILL è scuro su fondo trasparente: sul totem (sfondo scuro) serve un fondo chiaro
   proprio, altrimenti sparisce (bug reale segnalato: "nero su sfondo nero") */
.home-credits-logo--wide {
  width: auto;
  height: 1.7cqw;
  background: #f2ede1;
  border: 1px solid var(--border);
  border-radius: 0.25cqw;
  padding: 0.3cqw 0.5cqw;
  box-sizing: content-box;
}
.home-credits-photo {
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.6s ease;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------- */
/* schermata a griglia (territorio, elenco grotte...)                     */
/* ---------------------------------------------------------------------- */

.grid-screen-head {
  /* padding-top sufficiente a liberare il pill "Soprattutto sotto" sempre presente in alto a
     sinistra (.tv-nav-home): bug reale trovato testando con screenshot, il testo "eyebrow"
     finiva nascosto dietro il pill */
  padding: 6.4cqw 4.5cqw 1.5cqw;
}
.grid-screen-head h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3cqw;
  margin: 0.5cqw 0 0;
  color: var(--text);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.grid-screen-head .eyebrow { font-size: 1.05cqw; }

.tile-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 1.1cqw;
  padding: 1rem 4.5cqw 3.4cqw;
  overflow: hidden;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.3cqw;
  border-radius: 0.5cqw;
  border: 1px solid var(--border-faint);
  background: var(--bg-elevated);
  gap: 0.5cqw;
  overflow: hidden;
  position: relative;
}
.tile:active { border-color: var(--glow-dim); }
/* trattamento "seppia d'archivio" uniforme su tutte le copertine: alcuni capitoli hanno solo
   rilievi/disegni tecnici pallidi al posto di foto, che stonavano forte contro le foto atmosferiche
   delle altre card - un'unica tonalita' calda su tutte le rende coerenti come un archivio d'epoca */
.tile-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: grayscale(0.2) sepia(0.15) saturate(1.1) brightness(0.95) contrast(1.02);
}
/* velo scuro sopra la foto per mantenere leggibili numero e titolo, piu' denso in basso */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(27, 36, 42,0.94) 0%, rgba(27, 36, 42,0.6) 50%, rgba(27, 36, 42,0.1) 100%);
  z-index: 1;
}
.tile .tile-num {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  color: var(--ember);
}
.tile .tile-title {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 1.25cqw;
  font-weight: 500;
  line-height: 1.15;
  color: var(--text);
}

/* ---------------------------------------------------------------------- */
/* lettore paginato (capitoli, racconti)                                  */
/* ---------------------------------------------------------------------- */

.pager {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 1rem 4.5cqw 2.4cqw;
}
/* curve di livello sfumate in un angolo: un tocco decorativo leggero per le pagine con poco testo,
   dove restava altrimenti molto vuoto sotto la colonna di lettura (ora anche piu' stretta) */
.pager::before {
  content: "";
  position: absolute;
  right: -8cqw;
  bottom: -8cqw;
  width: 32cqw;
  height: 32cqw;
  background: repeating-radial-gradient(circle, transparent 0, transparent 2.2cqw, var(--border-faint) 2.2cqw, var(--border-faint) calc(2.2cqw + 1px));
  opacity: 0.5;
  pointer-events: none;
}

.pager-viewport {
  height: 100%;
  overflow: hidden;
  touch-action: pan-y;   /* swipe orizzontale gestito da pager_controller.js, non dal browser */
}

.pager-track {
  height: 100%;
  columns: 1;
  column-gap: 4.5cqw;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  font-size: 1.15cqw;
  line-height: 1.43;
  color: var(--text);
}
/* colonna di lettura piu' stretta della larghezza disponibile: righe piu' corte e confortevoli
   invece di stendersi sull'intera larghezza schermo (~100+ caratteri a riga, difficile da seguire) */
.pager-track p, .pager-track h3, .pager-track figure {
  max-width: 70cqw;
  margin-left: auto;
  margin-right: auto;
}
.pager-track p { margin-bottom: 1em; }
.pager-track strong { color: var(--glow); }
.pager-track h3 {
  break-inside: avoid;
  break-after: avoid;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4cqw;
  line-height: 1.2;
  color: var(--ember);
  margin-bottom: 0.7em;
  padding-top: 0.3em;
}
.pager-track h3:first-child { padding-top: 0; }
.pager-track figure { break-inside: avoid; margin-bottom: 1em; }
.pager-track figure img { border-radius: 0.4cqw; border: 1px solid var(--border); max-height: 32cqw; object-fit: cover; }
.pager-track figcaption { font-family: var(--font-mono); font-size: 0.72cqw; color: var(--text-faint); margin-top: 0.5cqw; }

/* Media inseriti dall'editor negli articoli. Le immagini caricate da CKEditor
   arrivano gia' come <figure class="image"> e ricadono quindi nelle regole delle
   figure qui sopra (stessa resa delle immagini estratte dal libro). Questa regola
   copre il caso limite dell'<img> scritto a mano nella vista sorgente, che senza
   tetto di altezza uscirebbe dallo schermo e sfonderebbe l'impaginazione. */
.pager-track img { max-width: 100%; max-height: 32cqw; height: auto; }
/* allineamenti prodotti da ImageStyle */
.pager-track figure.image-style-align-left  { float: left;  margin: 0 1.2cqw 0.8cqw 0; max-width: 34cqw; }
.pager-track figure.image-style-align-right { float: right; margin: 0 0 0.8cqw 1.2cqw; max-width: 34cqw; }
.pager-track figure.image-style-align-left img,
.pager-track figure.image-style-align-right img { max-height: 24cqw; }
.pager-track figure.image img { width: 100%; }
.pager-track video { display: block; max-width: 70cqw; margin: 1cqw auto; border-radius: 0.4cqw; }

.pager-controls {
  position: absolute;
  bottom: 1.2cqw;
  right: 4.5cqw;
  display: flex;
  align-items: center;
  gap: 1cqw;
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  color: var(--text-faint);
}
.pager-btn {
  width: 2.6cqw;
  height: 2.6cqw;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1cqw;
}
.pager-btn:active { border-color: var(--glow-dim); color: var(--glow); }
.pager-btn[disabled] { opacity: 0.3; }

/* ---------------------------------------------------------------------- */
/* mappa (totem)                                                          */
/* ---------------------------------------------------------------------- */

.map-screen { flex-direction: row; }
.map-canvas { flex: 1; position: relative; overflow: hidden; }
/* isolation: crea un contesto di stacking proprio, cosi' i pannelli interni di Leaflet (z-index
   fino a 700) non possono mai scavalcare i controlli overlay posizionati sopra la mappa */
#kiosk-map { width: 100%; height: 100%; background: #0e0c09; touch-action: none; isolation: isolate; }

/* mini-mappa dentro le schede (scheda grotta, Buso della Rana): riempie il contenitore */
.mini-map { flex: 1; position: relative; overflow: hidden; }

/* --- controlli in overlay (switch base + selettore marker) --- */
.map-controls {
  position: absolute;
  /* sotto il pill "Soprattutto sotto" (sempre presente in alto a sinistra, vedi .tv-nav-home):
     bug reale trovato testando col click automatizzato, il pill copriva i pulsanti base mappa */
  top: 6.2cqw;
  left: 1.4cqw;
  z-index: 30;
  display: flex;
  flex-direction: column;   /* toggle "raggruppa settori" sotto lo switch delle basi */
  gap: 0.7cqw;
  align-items: flex-start;
}
.base-switch {
  display: flex;
  gap: 0.25cqw;
  background: rgba(27, 36, 42,0.82);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3cqw;
  backdrop-filter: blur(6px);
}
.base-btn {
  font-family: var(--font-mono);
  font-size: 0.75cqw;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5cqw 1cqw;
  border-radius: 999px;
  border: none;
  background: transparent;
}
.base-btn.is-active { background: var(--bg-elevated-2); color: var(--glow); }
.cluster-toggle {
  font-family: var(--font-mono);
  font-size: 0.75cqw;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5cqw 1cqw;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(27, 36, 42,0.82);
  backdrop-filter: blur(6px);
}
.cluster-toggle.is-active { background: var(--bg-elevated-2); color: var(--glow); border-color: var(--glow-dim); }

/* i due toggle della mappa hanno testi di lunghezza molto diversa: si allineano
   a sinistra e restano su una riga sola, senza far ballare la colonna controlli */
.map-controls .cluster-toggle { white-space: nowrap; }

/* --- marker + label --- */
.gm { background: none; border: none; }
.gm-label {
  background: rgba(27, 36, 42,0.9);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.62cqw;
  padding: 0.15cqw 0.4cqw;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.gm-label::before { display: none; }
#kiosk-map.labels-on .gm-label { opacity: 1; }

/* bolle di clustering per settore nella vista d'insieme (vedi map_controller#buildClusters) */
.gm-cluster { background: none; border: none; }
.gm-cluster span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(27, 36, 42,.85);
  box-shadow: 0 0.2cqw 0.8cqw rgba(0,0,0,.5), 0 0 0 5px rgba(27, 36, 42,.4);
  color: rgba(27, 36, 42,.9);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.05cqw;
}
.leaflet-popup, .leaflet-control-attribution { display: none !important; }

/* controlli zoom: ingranditi e resi ben visibili per un uso touch diretto, con l'unita' cqw
   coerente col resto dell'interfaccia invece del px fisso di default di Leaflet */
.leaflet-bottom.leaflet-right { margin: 0 1.6cqw 1.6cqw 0; }
.leaflet-control-zoom {
  /* Leaflet applica di suo un margine fisso di 10px (non in cqw) ai suoi controlli: lo si
     azzera qui per lasciare che sia solo il margine cqw del contenitore sopra a posizionarlo,
     altrimenti a bordo destro risulta ~10px piu' a sinistra del previsto e disallineato rispetto
     a .zoom-hint (bug reale: il chip "pizzica per zoomare" non risultava a filo col controllo) */
  margin: 0 !important;
  border: 1px solid var(--border-faint) !important;
  border-radius: 0.7cqw !important;
  overflow: hidden;
  box-shadow: 0 0.4cqw 1.4cqw rgba(0,0,0,0.5) !important;
}
.leaflet-control-zoom a {
  background: var(--bg-elevated-2) !important;
  color: var(--glow) !important;
  border-color: var(--border-faint) !important;
  width: 3.6cqw !important;
  height: 3.6cqw !important;
  line-height: 3.5cqw !important;
  font-family: var(--font-mono) !important;
  font-size: 1.9cqw !important;
  font-weight: 800 !important;
}
.leaflet-control-zoom a:active { background: var(--bg-elevated) !important; }

.zoom-hint {
  position: absolute;
  /* stesso bordo destro dei pulsanti +/- sotto (right della .leaflet-control-zoom e' 1.6cqw):
     il chip e' piu' largo dei pulsanti, quindi si allarga verso sinistra restando allineato
     a destra con essi, invece di centrarsi sopra (con un chip cosi' largo, centrarlo sopra ai
     pulsanti stretti lo farebbe sporgere ed essere tagliato dal bordo della mappa) */
  right: 1.6cqw;
  width: max-content;
  max-width: 13cqw;
  bottom: 9.4cqw;
  z-index: 30;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68cqw;
  line-height: 1.45;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(27, 36, 42,0.82);
  border: 1px solid var(--border);
  border-radius: 0.6cqw;
  padding: 0.55cqw 0.8cqw;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

/* --- sidebar a 3 stati --- */
.map-sidebar {
  width: 27cqw;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.side-view {
  position: absolute;
  inset: 0;
  padding: 3.2cqw 1.8cqw 1.8cqw;
  display: flex;
  flex-direction: column;
  gap: 0.9cqw;
  overflow: hidden;
}
.side-view[hidden] { display: none; }
.side-view .eyebrow { font-size: 0.8cqw; }
.side-title { font-family: var(--font-display); font-weight: 800; font-size: 2cqw; line-height: 1.15; margin: 0; color: var(--text);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.side-title em, .side-title strong { color: var(--glow); }
.side-lede { font-size: 0.95cqw; line-height: 1.30; color: var(--text-muted); margin: 0; }
.side-lede strong { color: var(--glow); }
.side-back {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.75cqw;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0.3cqw;
}
.side-back:active { color: var(--glow); }

.side-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4cqw; margin-top: 0.5cqw; }
.side-scroll::-webkit-scrollbar { width: 0.4cqw; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.sett-item {
  display: flex;
  align-items: center;
  gap: 0.7cqw;
  padding: 0.75cqw 0.9cqw;
  border-radius: 0.4cqw;
  border: 1px solid transparent;
  background: var(--bg-elevated-2);
  text-align: left;
}
.sett-item:active { border-color: var(--glow-dim); }
.sett-dot { width: 0.7cqw; height: 0.7cqw; border-radius: 50%; flex-shrink: 0; }
.sett-name { flex: 1; font-family: var(--font-body); font-size: 1cqw; color: var(--text); }
.sett-count { font-family: var(--font-mono); font-size: 0.8cqw; color: var(--text-faint); }

.grotta-item {
  display: flex;
  align-items: center;
  gap: 0.9cqw;
  padding: 0.7cqw 0.9cqw;
  border-radius: 0.4cqw;
  border: 1px solid transparent;
  background: var(--bg-elevated-2);
  text-align: left;
}
.grotta-item:active { border-color: var(--glow-dim); }
.gi-code {
  flex-shrink: 0;
  width: 2.4cqw;
  height: 2.4cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35cqw;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  font-weight: 500;
  color: var(--ember);
}
.gi-text { display: flex; flex-direction: column; gap: 0.15cqw; min-width: 0; }
.gi-name { font-family: var(--font-display); font-size: 1.05cqw; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-meta { font-family: var(--font-mono); font-size: 0.72cqw; color: var(--text-faint); }

/* --- scheda grotta (mini-infografica) --- */
.grotta-card { display: flex; flex-direction: column; gap: 1cqw; height: 100%; }
.gc-photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 0.5cqw;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
.gc-photo img { width: 100%; height: 100%; object-fit: cover; }
.gc-body { display: flex; flex-direction: column; gap: 0.9cqw; flex: 1; overflow: hidden; }
.gc-eyebrow { font-family: var(--font-mono); font-size: 0.75cqw; letter-spacing: 0.08em; text-transform: uppercase; }
.gc-title { font-family: var(--font-display); font-weight: 500; font-size: 1.8cqw; line-height: 1.05; margin: 0; color: var(--text); }

.gc-infographic { display: flex; gap: 1.2cqw; align-items: stretch; }
.gc-depth { display: flex; gap: 0.6cqw; align-items: flex-end; }
.gc-depth-bar {
  width: 1.1cqw;
  height: 6cqw;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.gc-depth-bar span {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: block;
  background: linear-gradient(180deg, var(--glow), var(--glow-dim));
}
.gc-depth-num { align-self: flex-end; font-family: var(--font-mono); font-size: 1.3cqw; color: var(--glow); line-height: 1; }
.gc-depth-num small { display: block; font-size: 0.62cqw; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.3cqw; }
.gc-stats { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.55cqw; }
.gc-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5cqw; border-bottom: 1px dashed var(--border); padding-bottom: 0.35cqw; }
.gc-stat b { font-family: var(--font-mono); font-size: 1cqw; color: var(--ember); font-weight: 500; }
.gc-stat small { font-family: var(--font-mono); font-size: 0.68cqw; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.gc-excerpt {
  font-family: var(--font-body);
  font-size: 0.92cqw;
  line-height: 1.43;
  color: var(--text-muted);
  margin: 0;
  overflow: hidden;
}
.gc-excerpt a { color: var(--glow); white-space: nowrap; }
.gc-cta {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--glow);
  border: 1px solid var(--glow-dim);
  border-radius: 999px;
  padding: 0.85cqw 1.2cqw;
  text-align: center;
}
.gc-cta:active { background: var(--glow-wash); }

/* ---------------------------------------------------------------------- */
/* databook (statistiche in evidenza)                                     */
/* ---------------------------------------------------------------------- */

.stat-row { display: flex; gap: 2.4cqw; }
.stat-block .stat-value {
  font-family: var(--font-mono);
  font-size: 2.2cqw;
  color: var(--ember);
  line-height: 1;
}
.stat-block .stat-label {
  font-family: var(--font-mono);
  font-size: 0.75cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 0.4cqw;
}

/* ---------------------------------------------------------------------- */
/* tab interne (schermata Buso della Rana)                                */
/* ---------------------------------------------------------------------- */

.tab-strip {
  display: flex;
  gap: 0.6cqw;
  padding: 0 4.5cqw;
}
.tab-btn {
  font-family: var(--font-mono);
  font-size: 0.85cqw;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.7cqw 1.3cqw;
  border-radius: 999px 999px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  background: transparent;
}
.tab-btn.is-active { color: var(--glow); background: var(--bg-elevated); border-color: var(--border); }

.tab-panel { flex: 1; overflow: hidden; display: none; }
.tab-panel.is-active { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------------- */
/* galleria touch                                                         */
/* ---------------------------------------------------------------------- */

.gallery { flex: 1; display: flex; align-items: center; gap: 1.2cqw; padding: 1.4cqw 4.5cqw 2.4cqw; overflow: hidden; touch-action: pan-y; }
.gallery-stage { flex: 1; height: 100%; position: relative; border-radius: 0.5cqw; overflow: hidden; background: #000; }
.gallery-stage img, .gallery-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* La regola globale `img { display: block }` (vedi in alto) vince sull'[hidden] dello UA
   stylesheet per specificità: senza questa regola la slide precedente resta visibile sotto
   il video quando si passa a una slide video nella galleria. */
.gallery-stage img[hidden], .gallery-stage video[hidden] { display: none; }

/* ---------------------------------------------------------------------- */
/* pannello video (filmato lungo, Buso della Rana)                        */
/* ---------------------------------------------------------------------- */

/* due colonne: il racconto a sinistra, il filmato a destra dove c'e' piu' spazio */
.video-panel { flex: 1; display: flex; gap: 2.5cqw; padding: 1.4cqw 4.5cqw 2.4cqw; overflow: hidden; }
.video-intro { flex: none; width: 24cqw; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5cqw; }
.video-intro h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.7cqw; margin: 0; color: var(--text);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.video-intro p { font-size: 0.95cqw; line-height: 1.43; color: var(--text-muted); margin: 0; }
.video-meta { font-family: var(--font-mono); font-size: 0.75cqw; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ember); }

.video-fullscreen {
  margin-top: auto;                 /* ancorato in basso nella colonna */
  font-family: var(--font-mono);
  font-size: 0.75cqw; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 0.6cqw;
  padding: 0.7cqw 1.2cqw; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(27, 36, 42,0.82);
}
.video-fullscreen svg { width: 1.1cqw; height: 1.1cqw; }

.video-stage { flex: 1; min-height: 0; position: relative; border-radius: 0.5cqw; overflow: hidden; background: #000; }
.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }

/* bersaglio grande per il dito: i controlli nativi restano per scorrere e mettere in pausa */
.video-play {
  position: absolute; inset: 0; margin: auto;
  width: 7cqw; height: 7cqw; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4cqw; color: var(--text); padding-left: 0.5cqw;
  background: rgba(27, 36, 42,0.72); border: 1px solid var(--glow-dim);
  backdrop-filter: blur(6px);
}
.video-play[hidden] { display: none; }

.gallery-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1cqw 1.4cqw;
  background: linear-gradient(0deg, rgba(0,0,0,0.85), transparent);
  font-family: var(--font-mono);
  font-size: 0.78cqw;
  line-height: 1.40;
  color: var(--text-muted);
}
.gallery-arrow {
  width: 3.2cqw;
  height: 3.2cqw;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.3cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gallery-arrow:active { border-color: var(--glow-dim); color: var(--glow); }
