/* Normes a DESIGN.md (basat en el de preu-gasolina): 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;
  /* Hora barata, normal i cara: els colors dels punts del mapa de la gasolina. */
  --cheap: #0b7a3e; --mid: #d97a00; --dear: #c62828;
  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; }
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; }
.lead { margin: 12px 0; }
.updated, footer { color: var(--muted); font-size: .9rem; }
.updated { margin: 0; }
.updated::first-letter { text-transform: uppercase; }
ol { margin: 0; padding: 0; list-style: none; }

/* Preus: caixes amb el número gran */
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.prices > span, .now { display: flex; flex-direction: column; padding: 8px 12px; background: var(--soft); border-radius: 10px; color: var(--muted); font-size: .9rem; }
.prices b, .now b { color: var(--ink); font-size: 1.5rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
/* Dues caixes de costat: a 360 px no hi cabia «0,302 €/kWh», ni a 390 px un preu negatiu («-0,013 €/kWh»). */
.prices b { font-size: min(1.5rem, 5.6vw); }
/* «Ara»: la caixa més important, a tota l'amplada i amb la vora de marca */
.now { margin: 0 0 8px; border: 2px solid var(--accent); }
.now b { font-size: 1.9rem; }
.now small { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 1rem; font-weight: 700; }

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

/* Hora a hora: el color sempre amb la paraula al costat */
.hours { display: grid; gap: 6px; }
.hours li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 12px; min-height: 56px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 12px; }
.hours .hh { font-weight: 700; font-variant-numeric: tabular-nums; }
.hours b { grid-row: span 2; font-size: 1.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hours small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.hours li.is-now { border: 3px solid var(--accent); background: var(--soft); }
.dot { flex: none; 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); }

/* Barres del dia (SVG fet al build) */
.bars { display: block; width: 100%; max-width: 520px; height: auto; margin: 8px 0; }
.bars text { fill: var(--muted); font-size: 14px; }
.bars line { stroke: var(--line); }
.bars .g { fill: var(--cheap); } .bars .a { fill: var(--mid); } .bars .r { fill: var(--dear); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.legend > span { display: flex; align-items: center; gap: 6px; }

/* L'últim mes: una línia (SVG fet al build) i, plegat, cada dia en text */
.chart { display: block; width: 100%; max-width: 520px; height: auto; margin: 8px 0; }
.chart text { fill: var(--muted); font-size: 14px; }
.chart line { stroke: var(--line); }
.chart path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart circle { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.days summary { padding: 10px 0; color: var(--accent); font-weight: 700; cursor: pointer; }
.days summary:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.days .hh::first-letter { text-transform: uppercase; }
.days .hours b { grid-row: auto; }
