/* Carburanti e Colonnine Oggi: foglio di stile unico, mobile first, senza framework. */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f6f8;
  --fg: #1b1f23;
  --muted: #5b6470;
  --line: #dde2e7;
  --accent: #0b6e4f;
  --accent-soft: #e4f3ec;
  --link: #0b5fa5;
  --warn-bg: #fff4e0;
  --warn-fg: #6b4300;
  --best-bg: #dff3e8;
  --best-fg: #075a3f;
  --max: 72rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --bg-soft: #1d2126;
    --fg: #e7eaed;
    --muted: #9aa5b1;
    --line: #2e353c;
    --accent: #5ccb9a;
    --accent-soft: #1b352a;
    --link: #7fb8f0;
    --warn-bg: #3a2c10;
    --warn-fg: #ffd98a;
    --best-bg: #1d3f30;
    --best-fg: #9fe4c3;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 1rem 0 .25rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .35rem; }
p { margin: .5rem 0; }
abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--muted); cursor: help; }
code { font-size: .95em; background: var(--bg-soft); padding: 0 .25rem; border-radius: .2rem; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute; left: .5rem; top: 0; z-index: 30;
  padding: .5rem .85rem; background: var(--bg); color: var(--fg); border: 2px solid var(--accent); border-radius: .5rem;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Testata e ricerca */
.site-header { background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.logo { font-weight: 700; font-size: 1.15rem; color: var(--accent); text-decoration: none; }
.search { position: relative; flex: 1 1 14rem; min-width: 0; }
.search input {
  width: 100%;
  font: inherit;
  padding: .5rem .75rem;
  border: 1px solid var(--muted);
  border-radius: .5rem;
  background: var(--bg);
  color: var(--fg);
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  margin: .25rem 0 0; padding: .25rem 0; list-style: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: .5rem;
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15);
  max-height: 60vh; overflow-y: auto;
}
.results li a { display: block; padding: .45rem .75rem; text-decoration: none; color: var(--fg); }
.results li a small { color: var(--muted); }
.results li:first-child a, .results li a:hover, .results li a:focus { background: var(--accent-soft); }
.results li.empty { padding: .45rem .75rem; color: var(--muted); }

/* Struttura di pagina */
.crumbs { font-size: .9rem; margin-top: .75rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.crumbs li + li::before { content: "›"; color: var(--muted); margin-right: .25rem; }
.sub { color: var(--muted); margin: 0 0 1rem; }
.hint, .fine { color: var(--muted); font-size: .9rem; }
.block { margin-bottom: 1.5rem; }
.notice { padding: .75rem 1rem; border-radius: .5rem; background: var(--bg-soft); border: 1px solid var(--line); }
.notice.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.links { margin: 2rem 0 1rem; }
.plain, .others { padding-left: 1.25rem; }
.two-col { display: grid; gap: 1rem; }
@media (min-width: 700px) { .two-col { grid-template-columns: 1fr 1fr; } }
.ad { margin: 1.25rem 0; }
.prose { max-width: 46rem; }
.prose li { margin: .25rem 0; }

/* Card prezzi */
.cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.card { border: 1px solid var(--line); border-radius: .75rem; padding: .85rem 1rem; background: var(--bg-soft); }
.card h3 { margin: 0 0 .25rem; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card .price { font-size: 1.75rem; font-weight: 700; margin: 0; color: var(--accent); }
.card .where { margin: .25rem 0; font-size: .92rem; }
.card .deltas { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); }
.card .median { font-size: .88rem; color: var(--muted); }
.rank { font-weight: 600; margin-top: .75rem; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; line-height: 1.3;
  padding: .05rem .4rem; border-radius: .6rem; vertical-align: middle;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted);
}
.badge.low { background: var(--best-bg); color: var(--best-fg); border-color: transparent; }

/* Tabelle accessibili con scorrimento orizzontale */
.table-wrap {
  position: relative;
  overflow-x: auto;
  max-width: 100%;
  margin: .75rem 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  -webkit-overflow-scrolling: touch;
}
.table-wrap:focus { outline: 2px solid var(--accent); }
.stations-block .table-wrap { max-height: 85vh; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
caption { text-align: left; padding: .6rem .75rem; font-weight: 600; color: var(--muted); font-size: .9rem; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-soft);
  text-align: left; font-weight: 600;
  padding: .5rem .6rem;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody th, tbody td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }
tbody th small, thead th small { display: block; font-weight: 400; color: var(--muted); }
tbody td small { color: var(--muted); }
td:empty::before { content: "–"; color: var(--muted); }
.stations { min-width: 72rem; }
.stations td { white-space: nowrap; }
.stations td:nth-child(2) { white-space: normal; min-width: 16rem; }
.stations tbody th { min-width: 14rem; }
.compare, .nearby, .cheapest, .comuni, .province, .topcomuni, .cities, .regions, .provrank { min-width: 0; }
.compare td, .cheapest td, .comuni td, .province td, .topcomuni td, .cities td, .regions td, .provrank td, .premium td { white-space: nowrap; }
.nearby td { min-width: 6.5rem; }
.nearby td:nth-child(2) { min-width: 0; white-space: nowrap; }
.best { color: var(--best-fg); background: var(--best-bg); padding: 0 .3rem; border-radius: .3rem; white-space: nowrap; }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }

/* Sotto 700 px: una scheda per distributore; sotto il nome l'indirizzo, poi i prezzi con il self prima del servito. */
@media (max-width: 699.98px) {
  .stations-block .table-wrap { max-height: none; border: 0; }
  .stations, .stations tbody { display: block; min-width: 0; }
  .stations caption { display: block; }
  .stations thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stations tr {
    display: flex; flex-wrap: wrap; align-items: baseline;
    gap: .15rem .9rem;
    padding: .6rem .25rem;
    border-bottom: 1px solid var(--line);
  }
  .stations th, .stations td { display: block; border: 0; padding: 0; }
  .stations tbody th { flex: 1 0 100%; order: 0; }
  .stations tbody th small { display: inline; margin-left: .35rem; }
  .stations td { order: 3; font-size: .9rem; white-space: nowrap; }
  .stations td:nth-child(2) { order: 1; flex: 1 0 100%; color: var(--muted); font-size: .85rem; white-space: normal; }
  .stations td:nth-child(3), .stations td:nth-child(5), .stations td:nth-child(7), .stations td:nth-child(8) { order: 2; }
  .stations td:nth-child(4), .stations td:nth-child(6), .stations td:nth-child(9) { order: 3; color: var(--muted); }
  .stations td:nth-child(10) { order: 4; }
  .stations td:empty { display: none; }
  .stations td:nth-child(3)::before { content: "Benzina self "; color: var(--muted); }
  .stations td:nth-child(4)::before { content: "Benzina servito "; }
  .stations td:nth-child(5)::before { content: "Gasolio self "; color: var(--muted); }
  .stations td:nth-child(6)::before { content: "Gasolio servito "; }
  .stations td:nth-child(7)::before { content: "GPL "; color: var(--muted); }
  .stations td:nth-child(8)::before { content: "Metano "; color: var(--muted); }
  .stations td:nth-child(9)::before { content: "HVO "; }
  .stations td:nth-child(10)::before { content: "agg. "; color: var(--muted); }
}

/* Sparkline */
.spark-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.spark { margin: 0; }
.spark-svg { width: 100%; height: auto; display: block; background: var(--bg-soft); border-radius: .5rem; }
.spark-svg text { font-size: 12px; fill: var(--fg); }
.spark-min { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-med { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.spark figcaption { font-size: .88rem; color: var(--muted); margin-top: .3rem; }

/* Piè di pagina */
.site-footer { margin-top: 3rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: .9rem; color: var(--muted); }
.foot-nav { list-style: none; margin: .5rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-footer .fine { font-size: .82rem; }

/* Sezione ricarica auto elettrica */
.sec-nav { margin: .75rem 0 1rem; }
.sec-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.sec-nav li { flex: 1 1 auto; }
.sec-nav a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: .35rem .85rem;
  border: 1px solid var(--line); border-radius: .6rem;
  background: var(--bg-soft); color: var(--link); text-decoration: none;
}
.sec-nav a:hover { border-color: var(--accent); }
.sec-nav a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); font-weight: 600; }
.card-link { display: inline-block; padding: .65rem 0; font-weight: 600; }
.tools .card p { margin: .35rem 0; }
.tools .card p a { display: inline-block; padding: .65rem 0; }
.stat {
  margin: .75rem 0; padding: .85rem 1rem;
  border: 1px solid var(--line); border-radius: .75rem; background: var(--bg-soft);
  font-size: 1.15rem; font-weight: 700; color: var(--accent);
}
.gloss { margin: .5rem 0 1rem; }
.gloss dt { font-weight: 600; margin-top: .85rem; }
.gloss dd { margin: .15rem 0 0; }
@media (min-width: 700px) {
  .gloss { display: grid; grid-template-columns: 11rem 1fr; gap: .6rem 1.25rem; }
  .gloss dt, .gloss dd { margin: 0; }
}
.sources { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.sources li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.sources li:last-child { border-bottom: 0; }
.sources .meta { display: block; color: var(--muted); font-size: .9rem; }
.facts { margin: .5rem 0 0; font-size: .92rem; }
.facts dt { font-weight: 600; color: var(--muted); margin-top: .5rem; }
.facts dd { margin: 0; }
.parts.facts { font-size: 1rem; max-width: 46rem; }
.parts.facts dt { color: var(--fg); margin-top: .75rem; }
.card .price small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.formula { font-size: 1.15rem; margin: .75rem 0; padding: .75rem 1rem; border-left: 4px solid var(--accent); background: var(--bg-soft); border-radius: 0 .5rem .5rem 0; }

/* Tabella operatori: un tbody per operatore (riga dei dati + riga della nota) */
.tariffe tbody { border-bottom: 1px solid var(--line); }
.tariffe tbody:last-child { border-bottom: 0; }
.tariffe tbody th, .tariffe tbody td { border-bottom: 0; }
.tariffe tbody th { min-width: 8rem; }
.tariffe td { min-width: 5rem; }
.tariffe .abb { min-width: 14rem; }
.tariffe td small { display: block; }
.tariffe tr.row-note td { padding-top: 0; color: var(--muted); font-size: .9rem; }
.tariffe td a { display: inline-block; padding: .7rem 0; }
.cell-list { margin: 0; padding-left: 1.1rem; }
.cell-list li { margin: .15rem 0; }

/* Sotto 900 px una scheda per operatore; le etichette vengono da data-label. */
@media (max-width: 899.98px) {
  .tariffe, .tariffe tbody { display: block; min-width: 0; }
  .tariffe caption { display: block; padding-left: 0; }
  .tariffe thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tariffe tr { display: block; }
  .tariffe tbody tr:not(.row-note) { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem 1.1rem; padding: .75rem .25rem .3rem; }
  .tariffe tbody th, .tariffe tbody td, .tariffe tbody .abb { display: block; min-width: 0; padding: 0; border: 0; }
  .tariffe tbody th { flex: 1 0 100%; font-size: 1.05rem; }
  .tariffe tbody th small { display: block; margin-left: 0; }
  .tariffe td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .82rem; }
  .tariffe .abb, .tariffe td[colspan="3"] { flex: 1 0 100%; }
  .tariffe tr.row-note { padding: .1rem .25rem .85rem; }
  .tariffe tr.row-note td { display: block; padding: 0; }
}
