/* Sempre clar: fons blanc, sense mode fosc (decisió de Victor, 20/10/2026). Les normes són a DESIGN.md. */
:root {
  --bg: #fff; --ink: #1a1a18; --muted: #4d4d47; --line: #cfcfc6; --soft: #f3f3ee;
  --accent: #0b6e4f; --accent-dark: #08573e; --accent-ink: #fff;
  /* Punts del mapa: els mateixos colors que a mapa.js. */
  --cheap: #0b7a3e; --mid: #d97a00; --dear: #c62828; --none: #9e9e9e;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 20px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* Rètols com «CARBURANTS+DEL+CAMP+DE+LLUTXENT» no hi caben a 390 px: es parteixen. word-break, per a iOS d'abans del 15.4. */
body { word-break: break-word; overflow-wrap: anywhere; }
a, button, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
header, main, footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Capçalera i peu */
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; text-decoration: none; color: var(--ink); padding: 8px 0; }
.lang { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 99px; font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
footer { margin-top: 56px; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--line); }

/* Text */
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 24px 0 8px; text-wrap: balance; }
h2 { font-size: 1.35rem; line-height: 1.25; margin: 40px 0 14px; text-wrap: balance; }
h3, .card h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 10px; }
.lead { margin: 0 0 8px; }
.updated, .crumbs, .muted, footer { color: var(--muted); font-size: .9rem; }
.updated { margin: 0; }
.crumbs { margin-top: 12px; }
.crumbs a { display: inline-block; padding: 8px 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* Preus: una caixa per combustible, el número gran */
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.prices > span { display: flex; flex-direction: column; padding: 8px 12px; background: var(--soft); border-radius: 10px; color: var(--muted); font-size: .9rem; }
.prices b { color: var(--ink); font-size: 1.5rem; line-height: 1.25; font-variant-numeric: tabular-nums; }

/* Fitxa de benzinera */
.cards { display: grid; gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card p { margin: 4px 0; }
.badge { display: inline-block; vertical-align: middle; padding: 2px 10px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .8rem; font-weight: 700; white-space: nowrap; }

/* Botons */
button { font: inherit; cursor: pointer; }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; margin-top: 12px; padding: 8px 16px; background: var(--bg); color: var(--accent); border: 2px solid var(--accent); border-radius: 12px; font-weight: 700; text-decoration: none; }
.btn:hover, .btn:active { background: var(--soft); }
.big { display: block; width: 100%; min-height: 60px; padding: 12px 16px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; font-size: 1.1rem; font-weight: 700; }
.big:hover, .big:active { background: var(--accent-dark); }
.choice { display: flex; gap: 10px; margin: 12px 0; }
.choice button { flex: 1; min-height: 52px; padding: 8px; background: var(--bg); color: var(--ink); border: 2px solid var(--line); border-radius: 12px; font-weight: 600; }
.choice button:hover, .choice button:active { border-color: var(--accent); }
.choice button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.choice button[aria-pressed="true"]::before { content: "✓ " / ""; }
#near-out { margin-top: 14px; }

/* Llistes d'enllaços: tota la fila és clicable */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.links a, .row { display: flex; align-items: center; min-height: 56px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.links a { font-weight: 600; }
.links a:hover, .row:hover, .links a:active, .row:active { border-color: var(--accent); color: var(--ink); }
.top, .munis { display: grid; gap: 8px; }
.row { justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.row > span { display: flex; flex-direction: column; }
.row small { color: var(--muted); font-size: .9rem; }
.row .price { font-size: 1.3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Buscador */
.find { display: block; margin-bottom: 14px; font-weight: 700; }
.find input { display: block; width: 100%; min-height: 56px; margin-top: 8px; padding: 0 16px; background: var(--bg); color: var(--ink); border: 2px solid var(--muted); border-radius: 12px; font: inherit; }
.empty { color: var(--muted); }

/* Mapa */
.map { height: min(60vh, 440px); margin: 12px 0 10px; border: 1px solid var(--line); border-radius: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; color: var(--muted); font-size: .9rem; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--muted); }
.dot.g { background: var(--cheap); } .dot.a { background: var(--mid); } .dot.r { background: var(--dear); } .dot.n { background: var(--none); }
.leaflet-container { font: inherit; font-size: 1rem; }
.leaflet-popup-content p { margin: 6px 0; }
.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 24px; }

/* Historial: fletxa de 7 dies dins de cada caixa de preu i gràfic de 30 dies */
.trend { margin-top: 2px; color: var(--muted); font-size: .85rem; line-height: 1.3; }
.trend.down { color: var(--cheap); }
.trend.up { color: var(--dear); }
.trend span { font-weight: 800; }
.hist { margin: 8px 0 0; }
.hist summary { padding: 10px 0; color: var(--accent); font-weight: 700; cursor: pointer; }
.chart { display: block; width: 100%; max-width: 520px; height: auto; margin: 4px 0 8px; }
.chart text { fill: var(--muted); font-size: 15px; }
.chart line { stroke: var(--line); }
.chart path { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart path.c95 { stroke: var(--accent); }
.chart path.cA { stroke: var(--ink); stroke-dasharray: 7 5; }
.chart text.c95 { fill: var(--accent); font-weight: 700; }
.chart text.cA { fill: var(--ink); font-weight: 700; }
