/* ==========================================================================
   Grotte del Faedo-Casaron — TOTEM museale, schermo touch fisso 16:9
   Direzione estetica: "rilievo speleologico" (stessa di prima: calcare in
   ombra, bagliore ciano di lampada frontale, accento ambra da caschetto).
   Qui pero' cambia la meccanica: schermo a rapporto fisso, mai scroll,
   navigazione a schermate con grandi bersagli touch.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fraunces-var-2a0ad122.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fraunces-italic-400-77635c71.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/sourceserif-var-8b2b4348.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/sourceserif-italic-400-1e06bf74.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/spacemono-regular-400-2fb0d22d.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/spacemono-bold-700-27e084bd.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("/assets/spacemono-italic-400-3e8583be.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #14110d;
  --bg-elevated: #1d1811;
  --bg-elevated-2: #272016;
  --border: #382e1f;
  --border-faint: #241d14;

  --text: #ece4d6;
  --text-muted: #a89880;
  --text-faint: #6e6250;

  --glow: #bdeeea;
  --glow-dim: #6f9f9b;
  --glow-wash: rgba(189, 238, 234, 0.08);

  --ember: #dd8145;
  --ember-dim: #8f5230;
  --ember-wash: rgba(221, 129, 69, 0.12);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --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(189, 238, 234, 0.06), transparent 60%),
    radial-gradient(ellipse 45% 40% at 100% 8%, rgba(221, 129, 69, 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-style: italic;
  font-weight: 600;
  font-size: 1.55cqw;
  color: var(--text);
  padding: 0.7cqw 1.3cqw;
  border-radius: 999px;
  border: 1px solid var(--border-faint);
  background: rgba(20, 17, 13, 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: 600;
  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;
}
/* 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: 300;
  font-size: 4.6cqw;
  line-height: 1.02;
  max-width: 20ch;
  color: var(--text);
  text-shadow: 0 0.3cqw 1.5cqw rgba(0,0,0,0.5);
}
.home-title em { font-style: italic; font-weight: 600; 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: italic; }
.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: 300;
  font-size: 3cqw;
  margin: 0.5cqw 0 0;
  color: var(--text);
}
.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(20,17,13,0.94) 0%, rgba(20,17,13,0.6) 50%, rgba(20,17,13,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: 600;
  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.6;
  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: 600;
  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 (img/video "nudi", senza figure) */
.pager-track img { max-width: 100%; height: auto; }
.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(20,17,13,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(20,17,13,0.82);
  backdrop-filter: blur(6px);
}
.cluster-toggle.is-active { background: var(--bg-elevated-2); color: var(--glow); border-color: var(--glow-dim); }

/* --- marker + label --- */
.gm { background: none; border: none; }
.gm-label {
  background: rgba(20,17,13,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(20,17,13,.85);
  box-shadow: 0 0.2cqw 0.8cqw rgba(0,0,0,.5), 0 0 0 5px rgba(20,17,13,.4);
  color: rgba(20,17,13,.9);
  font-family: var(--font-mono);
  font-weight: 700;
  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: 700 !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(20,17,13,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: 300; font-size: 2cqw; line-height: 1.05; margin: 0; color: var(--text); }
.side-title em, .side-title strong { color: var(--glow); }
.side-lede { font-size: 0.95cqw; line-height: 1.5; 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: 700;
  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: 600; 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: 700; }
.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.5;
  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; }
.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;
  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); }
