/* ================================================================
   italianparliament-mcp — atlante celeste
   inchiostro di notte, linee d'ottone, serif editoriale + mono
   ================================================================ */

:root {
  --ink-0: #05080f;
  --ink-1: #0a1020;
  --ink-2: #101a30;
  --line: rgba(201, 168, 76, 0.22);
  --gold: #c9a84c;
  --gold-hi: #e8cf8a;
  --star: #ece9dd;
  --text: #d9d6ca;
  --text-dim: #8f8d82;
  --ok: #6fd695;
  --no: #ff7a70;
  --abst: #97a1ad;
  --serif: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink-0);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 340;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--ink-0); }

.mono { font-family: var(--mono); }

a { color: var(--gold-hi); text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { color: #fff; border-bottom-color: var(--gold); }

em { font-style: italic; font-weight: 500; color: var(--gold-hi); }

code { font-family: var(--mono); font-size: 0.85em; color: var(--gold-hi); }

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #16223d 0%, var(--ink-1) 45%, var(--ink-0) 100%);
  overflow: hidden;
}

#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.sky-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: rgba(5, 8, 15, 0.92);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.45rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--star);
  max-width: 260px;
  backdrop-filter: blur(4px);
}
.sky-tooltip .tt-group { color: var(--gold-hi); }
.sky-tooltip .tt-chamber { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.62rem; }
.sky-tooltip .tt-open { color: var(--ok); font-size: 0.62rem; }

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 0 clamp(1.2rem, 6vw, 6rem) clamp(3.5rem, 8vh, 6rem);
  max-width: 720px;
  pointer-events: none;
}
.hero-copy a, .hero-copy .btn { pointer-events: auto; }

.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
}
.live-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(111, 214, 149, 0.7);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(111, 214, 149, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(111, 214, 149, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 214, 149, 0); }
}

h1 {
  font-size: clamp(2.8rem, 8.5vw, 6.2rem);
  font-weight: 560;
  font-variation-settings: "opsz" 144;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--star);
  margin-bottom: 1.4rem;
}
h1 em { font-weight: 340; color: var(--gold-hi); }

.lede {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  max-width: 56ch;
  color: var(--text);
  margin-bottom: 1.8rem;
}
.lede strong { color: var(--gold-hi); font-weight: 500; }

.hero-counters {
  display: flex;
  gap: clamp(1.2rem, 3vw, 2.6rem);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.counter .num {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}
.counter .cap {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.7rem 1.3rem;
  border-radius: 2px;
  border: 1px solid var(--gold);
}
.btn-gold { background: var(--gold); color: var(--ink-0); font-weight: 600; }
.btn-gold:hover { background: var(--gold-hi); border-color: var(--gold-hi); color: var(--ink-0); }
.btn-ghost { color: var(--gold-hi); background: transparent; }
.btn-ghost:hover { border-color: var(--gold-hi); color: #fff; }

.hero-legend {
  position: absolute;
  z-index: 2;
  right: clamp(1rem, 4vw, 4rem);
  bottom: clamp(3.5rem, 8vh, 6rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  max-width: 220px;
}
.hero-legend .lg-item { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.hero-legend .lg-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.scroll-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.9rem;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%,0);} 50% { transform: translate(-50%,7px);} }

/* ---------------- sezioni comuni ---------------- */

section { position: relative; padding: clamp(5rem, 12vh, 9rem) clamp(1.2rem, 6vw, 6rem); }

.section-head { max-width: 720px; margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }

.overline {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.overline code { text-transform: none; letter-spacing: 0; }

h2 {
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  font-weight: 560;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: var(--star);
  margin-bottom: 1.1rem;
}

.section-lede { color: var(--text); max-width: 58ch; }

/* ---------------- la strada ---------------- */

.road-section {
  background: linear-gradient(180deg, var(--ink-0) 0%, var(--ink-1) 18%, var(--ink-1) 82%, var(--ink-0) 100%);
}

.road-wrap { position: relative; max-width: 900px; margin: 0 auto; }

.road-svg { display: block; width: 100%; height: auto; overflow: visible; }

.road-svg .road-bed { stroke: rgba(201,168,76,0.12); }
.road-svg .road-line { stroke: var(--gold); }

.milestone {
  position: absolute;
  width: min(300px, 38vw);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.milestone .ms-num { color: var(--gold-hi); font-weight: 600; font-size: 0.78rem; }
.milestone .ms-years { color: var(--text-dim); }
.milestone.left { text-align: right; }
.milestone.right { text-align: left; }

.era-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 2rem);
  color: var(--gold);
  opacity: 0.85;
  white-space: nowrap;
  text-shadow: 0 0 30px rgba(201,168,76,0.25);
}

.road-fallback, .votes-fallback { color: var(--text-dim); font-size: 0.8rem; padding: 2rem 0; }

/* ---------------- votazioni ---------------- */

.votes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.vote-card {
  background: var(--ink-1);
  padding: 1.4rem 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.vote-card:hover { background: var(--ink-2); }

.vote-date { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--text-dim); display: flex; justify-content: space-between; }

.vote-title {
  font-size: 0.98rem;
  font-weight: 480;
  color: var(--star);
  line-height: 1.4;
  flex: 1;
}
.vote-atto {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.5;
}
.vote-atto:empty { display: none; }

.vote-links {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
}
.vote-links a { color: var(--gold-hi); border-bottom-color: transparent; }
.vote-links a:hover { border-bottom-color: var(--gold); }
.vote-links .sep { color: var(--text-dim); }

.vote-badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  border: 1px solid;
}
.vote-badge.ok { color: var(--ok); border-color: rgba(111,214,149,0.4); }
.vote-badge.no { color: var(--no); border-color: rgba(255,122,112,0.4); }

.vote-bars { display: flex; flex-direction: column; gap: 0.3rem; }
.vote-bar { display: grid; grid-template-columns: 1.4rem 1fr 2.6rem; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.66rem; color: var(--text-dim); }
.vote-bar .bar-track { display: block; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.vote-bar .bar-fill { display: block; height: 100%; width: 0; border-radius: 2px; transform-origin: left; }
.vote-bar.f .bar-fill { background: var(--ok); }
.vote-bar.c .bar-fill { background: var(--no); }
.vote-bar.a .bar-fill { background: var(--abst); }
.vote-bar .bar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------------- strumenti ---------------- */

.tools-section { background: linear-gradient(180deg, var(--ink-0), var(--ink-1) 30%, var(--ink-0)); }

.tools-groups { display: flex; flex-direction: column; gap: 3rem; }

.tool-family .tf-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.tool-family .tf-name::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tool-family .tf-count { color: var(--text-dim); letter-spacing: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.8rem;
}

.tool-chip {
  border: 1px solid rgba(201,168,76,0.16);
  border-radius: 3px;
  padding: 0.85rem 1rem;
  background: rgba(16,26,48,0.35);
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.tool-chip:hover { border-color: var(--gold); background: var(--ink-2); transform: translateY(-2px); }
.tool-chip .tc-name { font-family: var(--mono); font-size: 0.78rem; font-weight: 600; color: var(--gold-hi); margin-bottom: 0.25rem; display: flex; align-items: baseline; gap: 0.4rem; }
.tool-chip .tc-name::before { content: "✦"; font-size: 0.6rem; color: var(--gold); }
.tool-chip .tc-desc {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- tre modi ---------------- */

.use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}

.use-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.6rem;
  background: var(--ink-1);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.use-card h3 { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.use-card p { font-size: 0.92rem; color: var(--text); }
.use-card .note { font-size: 0.68rem; color: var(--text-dim); }

.code {
  background: var(--ink-0);
  border: 1px solid rgba(201,168,76,0.14);
  border-radius: 3px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
.code code { color: var(--star); font-size: 0.74rem; line-height: 1.7; }

.terminal { border: 1px solid rgba(201,168,76,0.2); border-radius: 5px; overflow: hidden; background: #04060c; }
.term-bar { display: flex; gap: 6px; padding: 8px 10px; background: var(--ink-2); }
.term-bar span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.14); }
.term-body {
  padding: 0.9rem 1rem;
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--star);
  min-height: 7.5em;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-body .prompt { color: var(--ok); }
.term-body .dim { color: var(--text-dim); }
.term-body .caret { display: inline-block; width: 7px; height: 1em; background: var(--gold-hi); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- footer ---------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 4rem clamp(1.2rem, 6vw, 6rem) 5rem;
  text-align: center;
  background: radial-gradient(ellipse 100% 120% at 50% 120%, #131f39 0%, var(--ink-0) 60%);
}
.footer-inner { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; font-size: 0.9rem; }
.footer-star { color: var(--gold); font-size: 1.4rem; }
.footer-links { font-size: 0.76rem; }
.footer-meta { font-size: 0.64rem; color: var(--text-dim); }

/* ---------------- responsive ---------------- */

@media (max-width: 760px) {
  .hero-legend { display: none; }
  .hero { align-items: flex-end; }
  .milestone { width: 40vw; font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint, .live-dot.on { animation: none; }
  html { scroll-behavior: auto; }
}
