/* Les normes, a DESIGN.md: sempre clar, lletra de 20 px, un sol color de marca. */
:root {
  --bg: #fff; --ink: #1a1a18; --muted: #4d4d47; --line: #cfcfc6; --soft: #f3f3ee;
  --accent: #0b6e4f; --accent-dark: #08573e; --accent-ink: #fff;
  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; overflow-wrap: anywhere; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* «Vés al contingut»: per a qui navega amb el teclat; amagat fins que hi arriba el focus. */
.skip { position: absolute; top: -100px; left: 16px; z-index: 1000; padding: 10px 16px; border-radius: 12px; background: var(--accent); font-weight: 700; }
.skip, .skip:hover { color: #fff; }
.skip:focus { top: 8px; }
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; flex-wrap: wrap; 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; }
/* A la dreta: el botó a preusavui.com i el de l'idioma. */
.corner { display: flex; gap: 8px; margin-left: auto; }
.lang, .home { 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; }
.lead { margin: 12px 0; }
.updated, .crumbs, footer { color: var(--muted); font-size: .9rem; }
.updated { margin: 0 0 20px; }
.crumbs { margin-top: 12px; }
.crumbs a { display: inline-block; padding: 8px 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }

/* Botó */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; margin-top: 32px; 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); }


/* Llistes de municipis i comarques (com a la gasolina) */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.links a, .row { display: flex; flex-direction: column; justify-content: 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; }
a.row:hover, .links a:hover, a.row:active, .links a:active { border-color: var(--accent); color: var(--ink); }
.rows { display: grid; gap: 8px; }
.row small { color: var(--muted); font-size: .9rem; }

/* Buscador */
.find { display: block; margin: 24px 0 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); }

/* ---- Lloguer ---- */
/* El preu, gran, sota la frase de dalt */
.big { margin: 8px 0 12px; padding: 12px 16px; background: var(--soft); border-radius: 12px; color: var(--muted); font-size: .9rem; }
.big b { display: block; color: var(--ink); font-size: 2rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
/* Rànquings: el nom a l'esquerra i el preu a la dreta */
a.row.rank { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.row > span { display: flex; flex-direction: column; }
.row .price { font-size: 1.3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Comparació: el municipi de la pàgina, amb la vora de marca */
.row.me { border: 2px solid var(--accent); }
/* Gràfic de l'evolució (SVG fet al build, com el de la gasolina) */
.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: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
/* Taula dels trimestres */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: normal; }
td:nth-child(n+2) { white-space: nowrap; }
th { color: var(--muted); font-size: .9rem; font-weight: 600; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: right; }
