/* =====================================================================
   ANTROPOCENE — timeline viva del clima · stile
   ===================================================================== */
:root {
  --bg: #03060f;
  --bg2: #060b1c;
  --ink: #e8eefc;
  --ink-dim: rgba(232, 238, 252, .55);
  --ink-faint: rgba(232, 238, 252, .28);
  --clima: #3ee6ff;
  --uomo: #ffb347;
  --scienza: #c8b8ff;
  --cont: #ff3b5c;
  --cont2: #ff7a3d;
  --fix: #3dff9a;
  --fix2: #d8ff5a;
  --line: rgba(232, 238, 252, .12);
  --font-display: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --node: 150px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; touch-action: none; overscroll-behavior: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
/* dentro le schede e il pannello Fonti il dito può scorrere il testo */
.card .scroll, #about .inner { touch-action: pan-y; }
/* schermi touch: niente stati "hover" appiccicosi, bersagli più grandi per le dita */
@media (hover: none) {
  .decade:hover { transform: scale(var(--zs)); }
  .ev:hover:not(.active) .dot { transform: none; box-shadow: none; }
  .ev.minor:hover:not(.active) .dot { animation: wiggle var(--wd, 7s) ease-in-out var(--wp, 0s) infinite; }
  .ev:hover:not(.active) .lbl { transform: none; background: transparent; box-shadow: none; }
}
/* modalità chiosco (?kiosk): nessun cursore, tocco sull'intro per iniziare */
body.kiosk, body.kiosk * { cursor: none !important; }
#intro .kiosk-hint { display: none; margin-top: 30px; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--clima); animation: focusBreath 2.4s ease-in-out infinite; }
body.kiosk #intro .btns, body.kiosk #intro .kbd { display: none; }
body.kiosk #intro .kiosk-hint { display: block; }
body.kiosk #btnFull, body.kiosk #copy { display: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: grab;
}
body.dragging { cursor: grabbing; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- piani: cielo · flussi · date · eventi ---------- */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; pointer-events: none; }
.layer { position: absolute; top: 0; left: 0; height: 100%; width: 0; will-change: transform; }
#layer-dates { z-index: 2; --zs: 1; }
#layer-events { z-index: 3; }
/* strati rivelati dallo zoom */
.layer.z0 .ev { opacity: 0; pointer-events: none; }
.layer.z1 .ev.minor { opacity: 0; pointer-events: none; }
.layer.z0 .branch-label, .layer.z1 .ev .lbl { opacity: 0 !important; }
#sky, #bg, #layer-dates, #layer-events { transition: filter .6s ease, opacity .6s ease; }
body.card-open #sky, body.card-open #layer-dates { filter: blur(7px) brightness(.7); }
body.card-open #bg { filter: blur(4px) brightness(.6); }
body.card-open #layer-events { filter: blur(5px) brightness(.6); }
body.card-open #layer-events .ev.active { filter: none; }
#layer-card { z-index: 5; }
body.card-open #minimap, body.card-open #zoomctl, body.card-open header .legend { opacity: .35; transition: opacity .6s; }

/* ---------- nodo decennio ---------- */
.decade {
  position: absolute; top: 50%;
  width: var(--node); height: var(--node);
  margin: calc(var(--node) / -2) 0 0 calc(var(--node) / -2);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(3,6,15,.92) 0%, rgba(3,6,15,.75) 60%, rgba(3,6,15,0) 72%);
  cursor: pointer;
  transform: scale(var(--zs));
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  --c: var(--clima);
}
.decade::before {               /* anello sottile */
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border: 1.5px solid var(--c);
  opacity: .75;
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 25%, transparent);
}
.decade::after {                /* arco luminoso rotante */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 78%, var(--c) 92%, transparent 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 calc(50% - 4px), #000 calc(50% - 3px) 50%, transparent 51%);
          mask: radial-gradient(circle, transparent 0 calc(50% - 4px), #000 calc(50% - 3px) 50%, transparent 51%);
  animation: spin 14s linear infinite;
  opacity: .9;
}
.decade:hover { transform: scale(calc(var(--zs) * 1.06)); }
.decade .num {
  font-family: var(--font-display); font-weight: 200; line-height: .85;
  display: flex; align-items: flex-start; letter-spacing: -.02em;
  text-shadow: 0 0 24px color-mix(in srgb, var(--c) 40%, transparent);
}
.decade .num .c { font-size: 26px; margin-top: 6px; margin-right: 2px; font-weight: 300; }
.decade .num .d { font-size: 66px; }
.decade .hint { display: none; }
.decade .hint.today { display: block; margin-top: 10px; font-size: 9px; letter-spacing: .22em; text-transform: uppercase; }
.decade.today { --c: #ffffff; width: 190px; height: 190px; margin: -95px 0 0 -95px; }
.decade.today::before { animation: pulse 3s ease-in-out infinite; }
.decade.today .num .d { font-size: 78px; }
.decade.today .hint { color: #fff; opacity: .8; }
.decade.cont { --c: var(--cont); }
.decade.fix  { --c: var(--fix); }
.decade.cont, .decade.fix { --node: 118px; }
/* nodi finali del 2126: più grandi, con didascalia e alone del colore del ramo */
.decade.final { --node: 150px; }
.decade.final::before { box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 70%, transparent), 0 0 40px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 30px color-mix(in srgb, var(--c) 18%, transparent); animation: pulse 4s ease-in-out infinite; }
.decade.final .num .d { font-size: 58px; } .decade.final .num .c { font-size: 22px; }
.decade.final .hint.final { display: block; margin-top: 8px; font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--c); opacity: .9; }
.decade.cont .num .d, .decade.fix .num .d { font-size: 50px; }
.decade.cont .num .c, .decade.fix .num .c { font-size: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:.6; transform: scale(1);} 50% { opacity:1; transform: scale(1.04);} }

/* etichetta ramo, tra i due rami futuri */
.branch-label {
  position: absolute; font-family: var(--font-display); font-weight: 300;
  letter-spacing: .3em; text-transform: uppercase; font-size: 11px; white-space: nowrap;
  color: var(--c); opacity: .85; text-shadow: 0 0 14px color-mix(in srgb, var(--c) 60%, transparent);
  pointer-events: none; transition: opacity .5s;
}
.branch-label small { display:block; letter-spacing:.1em; text-transform:none; font-size:11px; color: var(--ink-dim); margin-top:4px; }

/* ---------- eventi ---------- */
.ev {
  position: absolute; width: 0; height: 0; --c: var(--clima); transition: opacity .5s;
}
/* gli eventi secondari fluttuano con un lieve "wiggle"; al rollover vengono in primo piano */
.ev.minor .dot { animation: wiggle var(--wd, 7s) ease-in-out var(--wp, 0s) infinite; }
@keyframes wiggle {
  0%   { translate: 0 0; }
  25%  { translate: 2px -4px; }
  50%  { translate: -1px 3px; }
  75%  { translate: -3px -2px; }
  100% { translate: 0 0; }
}
.ev .dot {
  position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(3,6,15,.85);
  border: 1.2px solid var(--c);
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 55%, transparent);
  display: flex; align-items: center; justify-content: center;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s;
  cursor: pointer; overflow: hidden;
}
.ev .dot svg { width: 15px; height: 15px; fill: none; stroke: var(--c); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ev .dot svg text { fill: var(--c); }
.ev .dot img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.ev .stem {
  position: absolute; left: 0; width: 1px; background: linear-gradient(to bottom, var(--c), transparent);
  opacity: .5; pointer-events: none;
}
.ev .lbl {
  position: absolute; left: 22px; top: 0; transform: translateY(-50%);
  font-size: 11.5px; line-height: 1.25; max-width: 230px; width: max-content;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: 4px 9px; margin-left: -9px; border-radius: 9px; border: 1px solid transparent;
  pointer-events: none; opacity: 0; transform-origin: 0 50%;
  transition: opacity .4s, transform .38s cubic-bezier(.2,.8,.2,1), left .38s cubic-bezier(.2,.8,.2,1), background .38s, border-color .38s, box-shadow .38s;
}
.ev .lbl b { font-family: var(--font-mono); font-weight: 500; color: var(--c); margin-right: 8px; letter-spacing: .04em; transition: text-shadow .38s; }
.ev .lbl span { color: var(--ink-dim); transition: color .38s ease; }
/* al rollover l'etichetta cresce con l'icona e il testo passa da grigio a bianco */
/* al rollover: si sposta oltre l'icona ingrandita e si appoggia su un alone scuro traslucido */
.ev:hover .lbl, .ev.ghover .lbl {
  left: 46px; transform: translateY(-50%) scale(1.28);
  background: rgba(3,6,15,.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-color: transparent; box-shadow: 0 8px 26px rgba(0,0,0,.55);
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.ev:hover .lbl span, .ev.ghover .lbl span { color: #fff; }
.ev:hover .lbl b, .ev.ghover .lbl b { text-shadow: 0 0 10px var(--c); }
.ev.up .stem { bottom: 0; }
.ev.down .stem { top: 0; background: linear-gradient(to top, var(--c), transparent); }
.ev.near .lbl, .ev:hover .lbl, .ev.ghover .lbl { opacity: 1; }
.ev:hover, .ev.ghover { z-index: 5; }
.ev:hover .dot, .ev.ghover .dot { transform: scale(2.1); box-shadow: 0 0 34px var(--c), 0 0 6px #fff, 0 14px 30px rgba(0,0,0,.6); animation: none; border-width: 1px; }
.ev.active .dot { transform: scale(1.5); box-shadow: 0 0 26px var(--c), 0 0 4px #fff; animation: none; }
.ev.uomo { --c: var(--uomo); } .ev.scienza { --c: var(--scienza); }
.ev.cont { --c: var(--cont); } .ev.cont.uomo { --c: var(--cont2); }
.ev.fix  { --c: var(--fix); }  .ev.fix.uomo  { --c: var(--fix2); }
.ev.ostacolo .dot, .ev.scelta .dot { border-style: dashed; border-width: 1.5px; }
.ev.lobby .dot { background: rgba(60,10,20,.85); }
.ev.active .lbl { opacity: 0 !important; }

/* ---------- intestazione ---------- */
header {
  position: fixed; top: 0; left: 0; right: 0; padding: 22px 30px;
  display: flex; justify-content: space-between; align-items: flex-start; z-index: 20;
  pointer-events: none;
}
header > * { pointer-events: auto; }
.brand h1 { margin: 0; font-family: var(--font-display); font-weight: 200; font-size: 22px; letter-spacing: .42em; text-transform: uppercase; }
.brand p { margin: 4px 0 0; font-size: 11px; letter-spacing: .12em; color: var(--ink-dim); text-transform: uppercase; }
.legend { display: flex; gap: 14px; align-items: center; white-space: nowrap; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); }
.legend i { display: inline-block; width: 22px; height: 2px; margin-right: 8px; vertical-align: middle; border-radius: 2px; box-shadow: 0 0 8px currentColor; background: currentColor; transition: .3s; }
/* le voci della legenda sono interruttori: clic per accendere/spegnere un flusso o un ramo */
.legend > div:not(.controls) { cursor: pointer; padding: 4px 2px; border-radius: 6px; transition: opacity .3s, background .3s; }
.legend > div:not(.controls):hover { background: rgba(232,238,252,.06); }
.legend > div.off { opacity: .32; }
.legend > div.off i { background: transparent; box-shadow: none; border-top: 1px dashed currentColor; height: 0; }
.legend > div.off span { text-decoration: line-through; }
/* filtri: eventi, nodi ed etichette dei rami spenti */
body.off-clima .ev.clima, body.off-uomo .ev.uomo, body.off-scienza .ev.scienza,
body.off-cont .ev.cont, body.off-fix .ev.fix { opacity: 0 !important; pointer-events: none; }
body.off-cont .decade.cont, body.off-cont .branch-label.cont, body.off-fix .decade.fix, body.off-fix .branch-label.fix { opacity: .1; pointer-events: none; }
.decade, .branch-label { transition: opacity .5s, transform .5s cubic-bezier(.2,.8,.2,1); }
.legend .clima { color: var(--clima); } .legend .uomo { color: var(--uomo); }
.legend .scienza { color: var(--scienza); }
.legend .cont { color: var(--cont); }   .legend .fix { color: var(--fix); }
.legend span { color: var(--ink-dim); }
.controls { display: flex; gap: 8px; margin-left: 26px; }
.controls button {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim);
  backdrop-filter: blur(6px); background: rgba(3,6,15,.4); transition: .25s;
}
.controls button:hover { color: var(--ink); border-color: rgba(232,238,252,.35); }
.controls button.on { color: var(--ink); border-color: var(--clima); box-shadow: 0 0 12px color-mix(in srgb, var(--clima) 35%, transparent); }
/* pulsante schermo intero: solo icona, due glifi (espandi / riduci) */
.controls button.icon { width: 30px; height: 30px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.controls button.icon svg { width: 15px; height: 15px; }
.controls button.icon .compress, body.fullscreen .controls button.icon .expand { display: none; }
body.fullscreen .controls button.icon .compress { display: block; }

/* ---------- HUD dati (basso sinistra) ---------- */
#hud {
  position: fixed; left: 30px; bottom: 74px; z-index: 20; pointer-events: none;
  display: flex; align-items: flex-end; gap: 26px; transition: opacity .5s;
}
body.card-open #hud { opacity: .18; }
#hud .year { font-family: var(--font-display); font-weight: 200; font-size: 86px; line-height: .8; letter-spacing: -.03em; }
#hud .year small { display:block; font-size: 10px; letter-spacing:.3em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 10px; font-family: var(--font-body); font-weight: 400; }
#hud .stats { display: grid; grid-template-columns: auto auto; gap: 2px 14px; font-family: var(--font-mono); font-size: 11px; padding-bottom: 6px; }
#hud .stats span { color: var(--ink-faint); letter-spacing: .05em; }
#hud .stats b { font-weight: 500; color: var(--ink); }
#hud .stats b.warm { color: var(--cont); } #hud .stats b.cool { color: var(--fix); }
#hud .era { position: absolute; left: 0; bottom: -28px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-dim); white-space: nowrap; }

/* ---------- zoom (basso destra) e minimappa (basso) ---------- */
#zoomctl { position: fixed; right: 30px; bottom: 30px; z-index: 20; display: flex; align-items: center; gap: 8px; }
#zoomctl button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--ink-dim); font-size: 16px; background: rgba(3,6,15,.4); backdrop-filter: blur(6px); }
#zoomctl button:hover { color: #fff; border-color: rgba(232,238,252,.4); }
#zoomBar { width: 110px; height: 2px; background: rgba(232,238,252,.15); border-radius: 2px; overflow: hidden; }
#zoomBar i { display: block; height: 100%; width: 25%; background: var(--clima); box-shadow: 0 0 8px var(--clima); transition: width .2s; }
#minimap {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  width: min(720px, 60vw); height: 34px; z-index: 20; cursor: pointer;
}
#minimap canvas { width: 100%; height: 100%; display: block; }

/* ---------- pannello "Fonti e metodo" ---------- */
#about { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
  background: rgba(2,4,10,.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); opacity: 0; transition: opacity .4s; }
#about[hidden] { display: none; }        /* senza questa regola il display:flex vince su hidden e il pannello invisibile copre la pagina */
#about.open { opacity: 1; }
#about .panel { position: relative; width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 22px;
  background: linear-gradient(160deg, rgba(14,22,48,.55), rgba(6,10,24,.7)); box-shadow: 0 40px 100px rgba(0,0,0,.6);
  transform: translateY(16px) scale(.97); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
#about.open .panel { transform: none; }
#about .close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(3,6,15,.5); color: var(--ink-dim); font-size: 13px; z-index: 2; }
#about .close:hover { color: #fff; }
#about .inner { overflow: auto; padding: 36px 44px 30px; scrollbar-width: thin; scrollbar-color: rgba(232,238,252,.2) transparent; }
#about .tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--clima); }
#about h2 { font-family: var(--font-display); font-weight: 300; font-size: 34px; margin: 6px 0 4px; letter-spacing: -.01em; }
#about .sub { color: var(--ink-dim); font-size: 13px; margin: 0 0 22px; }
#about h3 { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--clima); margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
#about p { font-size: 13.5px; line-height: 1.65; color: rgba(232,238,252,.88); margin: 0 0 10px; }
#about h3.img { color: var(--uomo); }
#about .srcs { columns: 2; column-gap: 28px; font-size: 11.5px; line-height: 1.45; margin: 0; padding: 0; list-style: none; }
#about .srcs li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 38px 1fr; gap: 8px; }
#about .srcs li b { font-family: var(--font-mono); font-weight: 500; color: var(--clima); }
#about .srcs li.uomo b { color: var(--uomo); } #about .srcs li.scienza b { color: var(--scienza); } #about .srcs li.cont b { color: var(--cont); } #about .srcs li.fix b { color: var(--fix); }
#about .srcs li span { color: rgba(232,238,252,.85); }
#about .srcs li a { display: block; color: var(--ink-dim); text-decoration: none; font-size: 10.5px; border-bottom: 0; }
#about .srcs li a:hover { color: #fff; }
#about h4 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); margin: 18px 0 6px; column-span: all; }
#copy a#copyAbout { color: rgba(232,238,252,.45); }
@media (max-width: 800px) { #about .inner { padding: 28px 20px; } #about .srcs { columns: 1; } }

/* ---------- copyright (basso destra, sotto lo zoom) ---------- */
#copy { position: fixed; right: 30px; bottom: 9px; z-index: 20; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(232,238,252,.32); pointer-events: none; transition: opacity .5s; }
#copy a { color: inherit; text-decoration: none; pointer-events: auto; }
#copy a:hover { color: var(--ink); }
body.card-open #copy { opacity: .35; }

/* ---------- scheda di approfondimento (card ancorata all'evento) ---------- */
.card {
  position: absolute; width: 380px; z-index: 6; --c: var(--clima);
  display: flex; flex-direction: column;
  padding: 36px 24px 18px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(14,22,48,.30), rgba(6,10,24,.36));
  -webkit-backdrop-filter: blur(26px) saturate(1.4); backdrop-filter: blur(26px) saturate(1.4);
  border: 0;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  /* svaso semicircolare in alto al centro, dove alloggia il pin */
  -webkit-mask: radial-gradient(circle 26px at 50% 0, transparent 25px, #000 26.5px);
          mask: radial-gradient(circle 26px at 50% 0, transparent 25px, #000 26.5px);
  transform-origin: 50% 0; opacity: 0; transform: translateY(14px) scale(.94);
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,.8,.2,1);
  cursor: default; user-select: text; pointer-events: none;
}
.card.open { opacity: 1; transform: none; pointer-events: auto; }
.card.uomo { --c: var(--uomo); } .card.scienza { --c: var(--scienza); } .card.cont { --c: var(--cont); } .card.fix { --c: var(--fix); }
.card .close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(3,6,15,.35); font-size: 13px; color: var(--ink-dim); }
.card .close:hover { color: #fff; border-color: #fff; }
.card .tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--c); }
.card .tag i { display:inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); margin-right: 8px; vertical-align: middle; }
.card .yr { font-family: var(--font-display); font-weight: 200; font-size: 56px; line-height: 1; letter-spacing: -.03em; margin: 6px 0 0; text-shadow: 0 0 30px color-mix(in srgb, var(--c) 35%, transparent); }
.card .yr span { font-size: 20px; color: var(--ink-faint); }
.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.25; margin: 8px 0 12px; }
.card .scroll { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(232,238,252,.2) transparent; }
.card figure { margin: 2px 0 14px; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; background: #05091a; position: relative; }
.card figure img, .card figure canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.card figure::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); border-radius: 12px; }
.card p { font-size: 13.5px; line-height: 1.6; color: rgba(232,238,252,.88); margin: 0 0 12px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.card h2, .card .yr { text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.card .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.card .kv div { border: 0; border-radius: 8px; padding: 8px 10px; background: rgba(3,6,15,.28); }
.card .kv span { display:block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.card .kv b { font-family: var(--font-mono); font-weight: 500; font-size: 13.5px; }
.card .src { font-size: 11px; color: var(--ink-dim); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.card .src a { color: var(--c); text-decoration: none; border-bottom: 1px dotted; }
.card ul.list { list-style: none; padding: 0; margin: 6px 0 0; }
.card ul.list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; display: flex; gap: 10px; cursor: pointer; color: rgba(232,238,252,.8); }
.card ul.list li:hover { color: #fff; }
.card ul.list li b { font-family: var(--font-mono); font-weight: 500; color: var(--clima); min-width: 40px; }
.card ul.list li.uomo b { color: var(--uomo); } .card ul.list li.scienza b { color: var(--scienza); }
.card .scelta-box { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.card .scelta-box div { border-left: 2px solid var(--c); padding: 6px 10px; font-size: 12px; line-height: 1.45; color: rgba(232,238,252,.85); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 12%, transparent), transparent); }
.card .scelta-box span { display:block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--c); margin-bottom: 3px; }
.card .note { font-size: 10.5px; color: var(--ink-faint); font-style: italic; }
/* ---------- scheda finale ---------- */
.card.final { width: 560px; }
.card.final h2 { font-size: 24px; }
.card.final p.lead { font-size: 14px; color: rgba(232,238,252,.92); }
.card.final h3 { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--c); margin: 18px 0 8px; }
.card .cmp { display: grid; gap: 4px; }
.card .cmp .hd, .card .cmp .row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; align-items: center; }
.card .cmp .hd span { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); padding: 0 10px; }
.card .cmp .hd span.cont { color: var(--cont); } .card .cmp .hd span.fix { color: var(--fix); }
.card .cmp .row span { font-size: 11.5px; color: var(--ink-dim); padding: 6px 10px; }
.card .cmp .row b { font-family: var(--font-mono); font-weight: 500; font-size: 13px; padding: 6px 10px; border-radius: 8px; background: rgba(3,6,15,.22); color: rgba(232,238,252,.6); }
.card .cmp .row b.me { color: #fff; background: color-mix(in srgb, var(--c) 18%, rgba(3,6,15,.3)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
.card ul.outcomes { list-style: none; padding: 0; margin: 0; }
.card ul.outcomes li { position: relative; padding: 6px 0 6px 18px; font-size: 12.5px; line-height: 1.5; color: rgba(232,238,252,.85); border-bottom: 1px solid var(--line); }
.card ul.outcomes li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.card ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.card ol.steps li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .25s; border-radius: 6px; }
.card ol.steps li:hover { background: rgba(232,238,252,.05); }
.card ol.steps li.static { cursor: default; }
.card ol.steps li b { font-family: var(--font-mono); font-weight: 500; font-size: 12px; color: var(--c); min-width: 40px; padding-top: 2px; }
.card ol.steps li strong { display: block; font-weight: 500; font-size: 13px; line-height: 1.35; color: rgba(232,238,252,.95); }
.card ol.steps li small { display: block; font-size: 11.5px; line-height: 1.45; color: var(--ink-dim); margin-top: 2px; }
.card ol.steps li em.alt { display: inline-block; margin-top: 5px; font-style: normal; font-size: 11px; color: var(--fix); border-left: 2px solid var(--fix); padding: 2px 8px; cursor: pointer; background: linear-gradient(90deg, color-mix(in srgb, var(--fix) 14%, transparent), transparent); border-radius: 0 6px 6px 0; }
.card ol.steps li em.alt:hover { color: #fff; }
.card button.other { margin-top: 16px; width: 100%; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(3,6,15,.35); color: var(--ink); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; transition: .25s; }
.card button.other.cont { border-color: color-mix(in srgb, var(--cont) 60%, transparent); color: var(--cont); }
.card button.other.fix { border-color: color-mix(in srgb, var(--fix) 60%, transparent); color: var(--fix); }
.card button.other:hover { background: rgba(232,238,252,.08); color: #fff; }
/* il pin: sta fuori dalla card (la maschera lo cancellerebbe) nello svaso */
#pin { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; z-index: 7; --c: var(--clima);
  background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 60%, transparent), 0 0 18px var(--c), 0 0 40px color-mix(in srgb, var(--c) 50%, transparent);
  opacity: 0; transform: scale(.3); transition: opacity .3s, transform .5s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
#pin::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px solid var(--c); opacity: .6; animation: pulse 2.4s ease-in-out infinite; }
#pin.open { opacity: 1; transform: none; }
#pin.uomo { --c: var(--uomo); } #pin.scienza { --c: var(--scienza); } #pin.cont { --c: var(--cont); } #pin.fix { --c: var(--fix); }

/* ---------- intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, rgba(10,20,50,.85), rgba(3,6,15,.97) 70%);
  text-align: center; transition: opacity 1.2s ease; cursor: default;
}
#intro.hide { opacity: 0; pointer-events: none; }
#intro h1 { font-family: var(--font-display); font-weight: 100; font-size: clamp(42px, 8vw, 110px); letter-spacing: .38em; margin: 0 0 0 .38em; text-transform: uppercase; }
#intro h1 span { display:block; font-size: clamp(14px, 2vw, 22px); letter-spacing: .5em; font-weight: 300; color: var(--ink-dim); margin-top: 8px; }
#intro p { max-width: 560px; color: var(--ink-dim); font-size: 14px; line-height: 1.7; margin: 26px 20px 38px; }
#intro .btns { display: flex; gap: 14px; }
#intro button { border: 1px solid rgba(232,238,252,.4); border-radius: 999px; padding: 14px 34px; letter-spacing: .28em; text-transform: uppercase; font-size: 12px; transition: .3s; }
#intro button.primary { border-color: var(--clima); color: var(--clima); box-shadow: 0 0 24px color-mix(in srgb, var(--clima) 30%, transparent); }
#intro button:hover { background: rgba(232,238,252,.08); transform: translateY(-2px); }
#intro .ai { margin-top: 26px; font-size: 11px; letter-spacing: .08em; color: var(--ink-faint); max-width: 520px; text-align: center; line-height: 1.5; }
#intro .kbd { position: absolute; bottom: 30px; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- vignettatura e grana ---------- */
/* ---------- fascia di focus: la colonna centrale su cui HUD ed etichette fanno riferimento ---------- */
#focus {
  position: fixed; top: 0; bottom: 0; left: 50%; width: 260px; transform: translateX(-50%);
  z-index: 4; pointer-events: none; transition: opacity .6s;
  background:
    linear-gradient(90deg, transparent, rgba(62,230,255,.035) 30%, rgba(62,230,255,.075) 50%, rgba(62,230,255,.035) 70%, transparent),
    linear-gradient(rgba(232,238,252,.9), rgba(232,238,252,.9)) 50% 96px / 1px 18px no-repeat,
    linear-gradient(rgba(232,238,252,.9), rgba(232,238,252,.9)) 50% calc(100% - 78px) / 1px 18px no-repeat;
  -webkit-mask: linear-gradient(180deg, transparent 6%, #000 22%, #000 78%, transparent 94%);
  mask: linear-gradient(180deg, transparent 6%, #000 22%, #000 78%, transparent 94%);
  animation: focusBreath 7s ease-in-out infinite;
}
#focus::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: repeating-linear-gradient(180deg, rgba(232,238,252,.2) 0 7px, transparent 7px 16px); }
@keyframes focusBreath { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
body.card-open #focus { opacity: .5; }
/* riavvolgimento della deriva: breve dissolvenza mentre si torna al 1760 */
body.rewind #sky, body.rewind #bg, body.rewind #layer-dates, body.rewind #layer-events { filter: brightness(.25); }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 10;
  background: radial-gradient(ellipse at center, transparent calc(58% - var(--mood, 0) * 22%), rgba(0,0,0,calc(.5 + var(--mood, 0) * .4)) 100%); }
#scan { position: fixed; inset: 0; pointer-events: none; z-index: 11; opacity: .35; mix-blend-mode: overlay;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px); }

/* ---------- reduce motion / mobile ---------- */
@media (prefers-reduced-motion: reduce) { .decade::after { animation: none; } #focus { animation: none; } }
@media (max-width: 800px) {
  header { padding: 14px 16px; } .legend { display: none; }
  #hud { left: 16px; bottom: 64px; } #hud .year { font-size: 56px; } #hud .stats { display: none; }
  #minimap { width: 88vw; bottom: 14px; }
  #copy { display: none; } #focus { width: 140px; }
  .decade { --node: 110px; } .decade .num .d { font-size: 46px; }
}

/* schermi touch: bersagli più grandi (in fondo al foglio, così vincono sulle regole normali) */
@media (pointer: coarse) {
  .ev .dot::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
  #zoomctl button { width: 42px; height: 42px; font-size: 20px; }
  .card .close, #about .close { width: 42px; height: 42px; font-size: 15px; }
  .controls button { padding: 10px 15px; font-size: 11px; }
  .controls button.icon { width: 40px; height: 40px; }
  .legend > div:not(.controls) { padding: 8px 4px; }
  #minimap { height: 44px; }
}

/* ---------- gesti in webcam ---------- */
#ghand { position: fixed; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .25s; will-change: transform; }
#ghand.show { opacity: 1; }
#ghand svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#ghand .bg { fill: rgba(3,6,15,.35); stroke: rgba(232,238,252,.35); stroke-width: 1.5; }
#ghand .ring { fill: none; stroke: var(--clima); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; filter: drop-shadow(0 0 6px var(--clima)); }
#ghand i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #fff; transition: transform .2s, background .2s; }
#ghand.pinch i { transform: scale(1.8); background: var(--clima); }
#ghand.grab .bg { fill: rgba(255,179,71,.25); stroke: var(--uomo); } #ghand.grab i { transform: scale(0.6); }
#ghand.zoom { opacity: 0; }
#ghand .ring { transition: stroke-dashoffset .25s, opacity .25s; opacity: .55; } #ghand.over .ring { opacity: 1; }
#ghand.fired .bg { fill: rgba(62,230,255,.45); } #ghand.fired i { transform: scale(2.4); background: #fff; }
#gcam { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); width: 260px; aspect-ratio: 4/3; z-index: 21; opacity: 0; pointer-events: none; transition: opacity .4s; }
#gcam.show { opacity: 1; }
#gcam canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 0 6px rgba(0,0,0,.8)); }
#gcam .state { position: absolute; left: 0; right: 0; bottom: -18px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
#gcam .state.gestFist { color: var(--uomo); } #gcam .state.gestPinch, #gcam .state.gestTwo { color: var(--clima); } #gcam .state.gestOpen, #gcam .state.gestPoint { color: #fff; }
#gcam video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }   /* il video serve solo al riconoscimento: si vede lo scheletro */
#gmsg { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); z-index: 61; max-width: 80vw; padding: 9px 16px; border-radius: 999px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  background: rgba(3,6,15,.7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 0 0 1px rgba(232,238,252,.12); opacity: 0; pointer-events: none; transition: opacity .4s; text-align: center; }
#gmsg.show { opacity: 1; }
.controls button.wait { opacity: .5; animation: focusBreath 1s ease-in-out infinite; }
body.gesture #copy { bottom: 9px; }
/* con i gesti attivi il cursore del mouse sparisce dopo 2 s di inattività e torna appena lo muovi */
body.gesture.nocursor, body.gesture.nocursor * { cursor: none !important; }
/* legenda dei gesti, a destra dello scheletro */
#glegend { position: fixed; left: calc(50% + 150px); bottom: 78px; z-index: 21; display: none; flex-direction: column; gap: 5px; pointer-events: none; }
body.gesture #glegend { display: flex; }
#glegend .row { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: baseline; padding: 4px 10px; border-radius: 8px; font-size: 11.5px; color: var(--ink-dim); transition: background .25s, color .25s; }
#glegend .row b { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(232,238,252,.7); }
#glegend .row.fist b { color: var(--uomo); } #glegend .row.pinch b, #glegend .row.two b, #glegend .row.point b { color: var(--clima); }
#glegend .row.on { background: rgba(3,6,15,.6); color: #fff; box-shadow: inset 0 0 0 1px rgba(232,238,252,.15); }
@media (max-width: 1100px) { #glegend { left: auto; right: 20px; } }
