:root {
  --bg: #0b1220;
  --bg-alt: #10192e;
  --card: #141f38;
  --border: #223252;
  --text: #eef2fb;
  --text-dim: #93a2c4;
  --accent: #35e08a;
  --accent-dim: #1c8f5a;
  --danger: #ff6b6b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.logo { font-weight: 700; font-size: 1.1rem; }

.topbar nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.topbar nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */

.hero {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem 4rem;
  gap: 0.5rem;
  background:
    radial-gradient(ellipse at top, rgba(53, 224, 138, 0.12), transparent 60%),
    var(--bg);
}

.fuel-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.pill {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pill:hover { color: var(--text); border-color: var(--accent-dim); }
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06210f;
  font-weight: 600;
}

.price-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  justify-content: center;
}

.prezzo {
  font-size: clamp(4.5rem, 18vw, 9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.unit {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--text-dim);
}

.sottotitolo {
  margin: 0.6rem 0 0;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.variazione {
  margin: 0.4rem 0 0;
  min-height: 1.3em;
  font-weight: 600;
  font-size: 1rem;
}
.variazione.up { color: var(--danger); }
.variazione.down { color: var(--accent); }

.aggiornato {
  margin: 1.2rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.scroll-cue {
  margin-top: 2.5rem;
  font-size: 1.6rem;
  text-decoration: none;
  color: var(--text-dim);
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- Sections comuni ---------- */

main section {
  padding: 4rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

/* ---------- Regioni ---------- */

.regioni { background: var(--bg); }

.regioni-toolbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

#btn-geoloc {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}
#btn-geoloc:hover { border-color: var(--accent-dim); }

.geoloc-msg { color: var(--text-dim); font-size: 0.9rem; }

.lista-regioni {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.7rem;
}

.regione-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.regione-card .nome { font-weight: 500; }
.regione-card .valore {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

.regione-card.min { border-color: var(--accent); }
.regione-card.max .valore { color: var(--danger); }
.regione-card.evidenziata {
  border-color: var(--accent);
  transform: scale(1.02);
  box-shadow: 0 0 0 2px rgba(53, 224, 138, 0.35);
}

.placeholder { color: var(--text-dim); }

/* ---------- Calcolatore ---------- */

.calcolatore { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.calc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.calc-presets button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}
.calc-presets button span { font-size: 0.78rem; color: var(--text-dim); }
.calc-presets button:hover { border-color: var(--accent-dim); }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.calc-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.calc-grid input,
.calc-grid select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.calc-risultato {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.3rem 1.5rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.calc-riga { color: var(--text-dim); }

.calc-costo {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
}

/* ---------- Notizie ---------- */

.notizie { background: var(--bg); }

.lista-notizie {
  display: grid;
  gap: 0.7rem;
}

.notizia-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.notizia-card:hover { border-color: var(--accent-dim); }

.notizia-titolo { font-weight: 500; line-height: 1.4; }
.notizia-meta { font-size: 0.8rem; color: var(--text-dim); }

.info {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.info h2 { font-size: 1.3rem; }
.info p {
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 70ch;
}
.info strong { color: var(--text); font-weight: 600; }

footer {
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  main section { padding: 3rem 1rem; }
}
