:root {
  --bg: #f7f6f2; --surface: #ffffff; --text: #1d2420; --muted: #5d6862; --line: #dfe3dd;
  --accent: #1f6b4a; --accent-soft: #e3f1e9; --warn-soft: #fbf0d9; --warn: #7a5300;
  --review-soft: #eee9fb; --review: #4b3a8c; --radius: 10px;
  --nocite: #b42318; --nocite-soft: #fdecea; --on-nocite: #ffffff;
  /* The two sections: "Do it yourself" (blue) and regional rules (amber). */
  --diy: #1e4f8a; --diy-soft: #e8f0fa; --diy-line: #9dbbe0; --local-line: #d9b56b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --surface: #1b211e; --text: #e6ebe7; --muted: #9aa69f; --line: #2c3530;
    --accent: #6fcf9f; --accent-soft: #1d3329; --warn-soft: #3a2f17; --warn: #f0c46b;
    --review-soft: #2a2540; --review: #c4b5fd;
    --nocite: #ff8a80; --nocite-soft: #3b1d1b; --on-nocite: #2a0a08;
    --diy: #9cc3f5; --diy-soft: #17243a; --diy-line: #2e4a72; --local-line: #6b5422;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.tagline { color: var(--muted); font-size: .9rem; }
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; margin: 0 0 8px; }
/* The welcome: title, mission and two questions, centred. It gives way to the tips once answered. */
.welcome { text-align: center; padding: 8px 0 16px; }
.welcome[hidden], .you[hidden], .results[hidden], .choose[hidden] { display: none; }
.welcome p { color: var(--muted); max-width: 60ch; margin: 0 auto 1em; }
.choose { max-width: 620px; margin: 28px auto 8px; }
.choose fieldset { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
.choose legend { font-weight: 700; font-size: 1.1rem; margin: 0 auto 10px; padding: 0; }
.choices { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.choice { display: block; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%;
  padding: 16px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font-weight: 600; cursor: pointer; }
.choice span:hover { border-color: var(--accent); }
.choice .icon { width: 1.8em; height: 1.8em; color: var(--accent); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.flag-icon { border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }
.go-row { margin: 4px auto 8px !important; }
.go { font: inherit; font-weight: 700; color: var(--surface); background: var(--accent); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 12px 28px; cursor: pointer; }
.go:hover:not(:disabled) { filter: brightness(1.1); }
.go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.go:disabled { color: var(--muted); background: var(--bg); border-color: var(--line); cursor: not-allowed; }
.skip { margin: 0 auto 1.5em !important; }
/* After the welcome: one line saying who the tips are for, with a way to change it. */
.you { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-weight: 600; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 20px 0 8px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.filters .search { grid-column: 1 / -1; }
/* Secondary filters fold away so the first tips fit on a phone screen. */
.more-filters { grid-column: 1 / -1; }
.more-filters summary { cursor: pointer; font-size: .95rem; font-weight: 600; color: var(--accent); padding: 4px 0; width: max-content; }
.more-filters summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Four equal columns, with each select at the bottom of its cell, so the selects line up
   even when a label runs to two lines in one language. */
.more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 12px; margin-top: 10px; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--surface);
  font-size: .78rem; text-align: center; margin-left: 4px; }
.badge[hidden] { display: none; }
.filters .check { flex-direction: row; align-items: center; gap: 8px; grid-column: 1 / -1; color: var(--text); font-size: .95rem; }
input[type=search], select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.count-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 12px 0; }
.count { color: var(--muted); font-size: .9rem; margin: 0; }
.link-button { font: inherit; font-size: .9rem; color: var(--accent); background: none; border: 0; padding: 4px 0; text-decoration: underline; cursor: pointer; }
.link-button[hidden], .more[hidden] { display: none; }
.more { margin: 24px 0 0; text-align: center; }
.more p { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.more-button { font: inherit; font-weight: 600; color: var(--accent); background: var(--surface); border: 1px solid var(--accent);
  border-radius: 8px; padding: 10px 16px; cursor: pointer; }
.more-button:hover { background: var(--accent-soft); }
.more-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.group { margin-top: 20px; }
.group[hidden] { display: none; }
.group h2 { font-size: 1.05rem; margin: 0 0 12px; color: var(--text); font-weight: 700; }
.group h2 .n { font-size: .85rem; font-weight: 400; color: var(--muted); }
/* Option B: each section sits in a tinted box; the cards inside stay plain. */
.group.diy, .group.local { border: 1px solid; border-radius: 14px; padding: 14px; }
.group.diy { background: var(--diy-soft); border-color: var(--diy-line); }
.group.local { background: var(--warn-soft); border-color: var(--local-line); }
.coverage { margin: 0 0 12px; font-size: .93rem; }
.tag { display: inline-block; align-self: flex-start; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid; margin-bottom: 8px; }
.tag.diy { color: var(--diy); border-color: var(--diy); }
.tag.local { color: var(--warn); border-color: var(--warn); }
.tag-row { margin: 0 0 8px; }
.fresh { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); font-size: .9rem; background: var(--accent-soft); color: var(--text); }
.fresh.overdue { background: var(--warn-soft); color: var(--warn); }
.freshness { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 8px; margin: 24px 0; }
.freshness h2 { margin-top: 12px; }

/* The effort ladder and "who are you": rows of radio buttons styled as steps. */
.filters fieldset { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; min-width: 0; }
.filters legend { font-size: .85rem; color: var(--muted); padding: 0; margin-bottom: 6px; }
.filters legend .hint { font-size: .8rem; }
.ladder legend { font-weight: 600; color: var(--text); font-size: .95rem; }
/* Steps share a row in equal widths, so every language gets the same boxes and rows line up. */
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.filters .step { flex: 1 1 auto; flex-direction: row; gap: 0; font-size: .9rem; color: var(--text); }
.step input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.step span { display: flex; align-items: center; justify-content: center; align-content: center; flex-wrap: wrap; column-gap: .3em; height: 100%; box-sizing: border-box; width: 100%; text-align: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); cursor: pointer; }
.step small { color: var(--muted); }
.step input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.step input:checked + span small { color: inherit; }
.step input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ladder .step b { margin-right: 2px; }
/* Room for two lines in every language, so French and Dutch labels that wrap
   don't make their rows taller than the English ones. */
.ladder .step span { min-height: calc(3em + 18px); }
.ladder legend .hint { font-weight: 400; color: var(--muted); }
/* Levels below the chosen one are included too, so they stay lit. */
.ladder .step:has(~ .step input:checked) span { background: var(--accent-soft); border-color: var(--accent); }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.card[hidden] { display: none; }
.card:hover { border-color: var(--accent); }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.card h3 { font-size: 1.05rem; margin: 0 0 6px; line-height: 1.3; }
.card a { text-decoration: none; color: var(--text); }
.card a:focus { outline: none; }
/* The title link covers the whole card, so tapping anywhere on it opens the tip. */
.card a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:hover h3 { color: var(--accent); text-decoration: underline; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: .93rem; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.cat { color: var(--text); }
.chip.save { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.review { background: var(--review-soft); border-color: transparent; color: var(--review); }
.chip.level { color: var(--text); font-weight: 600; }
.chip.constant { border-color: var(--accent); color: var(--accent); }
.chip.variable { border-color: var(--warn); color: var(--warn); }
/* Impact: a filled badge for big wins, then weaker styles from large to small. */
.chip.bigwin { background: var(--accent); border-color: transparent; color: var(--surface); font-weight: 700; }
.chip.impact.large { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.impact.medium { border-color: var(--accent); color: var(--accent); }
.chip.co2 { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
/* Phosphor icons inside chips (src/icons.mjs) */
.chip .icon { width: 1.05em; height: 1.05em; vertical-align: -0.17em; }
.chip.bigwin .icon { margin-right: .3em; }
.chip.co2 .icon { margin-left: .05em; }
.impact-intro { font-size: .95rem; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: .95rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.empty { color: var(--muted); }

.back { margin: 0 0 16px; }
.tip { max-width: 720px; }
.tip .lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 12px; }
.tip > .chips { margin-bottom: 20px; }
.details h2 { font-size: 1.15rem; margin-top: 28px; }
.facts { width: 100%; border-collapse: collapse; margin: 12px 0 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts th { width: 38%; color: var(--muted); font-weight: 500; }
@media (max-width: 520px) {
  .facts th, .facts td { display: block; width: 100%; }
  .facts th { padding: 8px 14px 0; border-bottom: 0; font-size: .82rem; }
  .facts td { padding: 2px 14px 8px; }
}
.prose p { margin: 0 0 1em; }
.notice { border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; background: var(--accent-soft); }
.notice p { margin: 4px 0; }
.pairs h2 { font-size: 1.15rem; margin-top: 28px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.sources h2 { font-size: 1.15rem; margin-top: 28px; }
.sources ol { padding-left: 20px; }
.sources li { margin-bottom: 12px; overflow-wrap: anywhere; }
.src-meta { font-size: .85rem; color: var(--muted); }
.muted { color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 16px 0; }
.lang { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; }
.lang a { color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.lang a:hover { color: var(--accent); background: var(--accent-soft); }
.lang [aria-current] { color: var(--text); padding: 4px 6px; }
.lang .sep { color: var(--line); }
.chip.nocite { background: var(--nocite-soft); border-color: transparent; color: var(--nocite); font-weight: 600; }
/* Open points sit after the advice; the chip and inline tags already flag uncited text. */
.notice.nocite, .notice.review { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--review); }
.notice.nocite { border-left-color: var(--nocite); }
.points { list-style: none; padding-left: 0 !important; }
.points li { margin: 6px 0; }
.flag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 4px; white-space: nowrap; }
.flag.no-citation, .nocite-tag { background: var(--nocite); color: var(--on-nocite); }
.flag.secondary-source { background: var(--warn-soft); color: var(--warn); }
.flag.to-verify { background: var(--review-soft); color: var(--review); }
.nocite-tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 0 7px; border-radius: 999px; vertical-align: 1px; cursor: help; white-space: nowrap; }

/* Phones: drop the tagline so the language switch stays on the brand row, and tighten the filters. */
@media (max-width: 520px) {
  .group.diy, .group.local { padding: 10px; margin-left: -6px; margin-right: -6px; }
  .tagline { display: none; }
  .site-header .wrap { padding-top: 10px; padding-bottom: 10px; }
  main { padding-top: 16px; }
  .welcome p { font-size: .95rem; }
  .choose { margin-top: 20px; }
  .choices.regions { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice span { padding: 12px 8px; }
  .filters { padding: 12px; gap: 10px; margin-top: 14px; }
  .filters .step { font-size: .85rem; }
  .steps { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .step:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ladder .step span { min-height: 0; }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step span { padding: 7px 8px; }
}

/* News: headlines from official sources. Beside the tips on wide screens, folded above them otherwise. */
.wrap.wide { max-width: 1260px; }
.news { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0 0; }
.news[hidden] { display: none; }
.news summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; color: var(--accent); }
.news summary::before { content: "▸"; font-size: .9rem; }
.news details[open] > summary::before { content: "▾"; }
.news summary h2 { font-size: 1rem; margin: 0; color: inherit; display: inline; }
.news-count { font-size: .75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 7px; }
.news-latest { flex-basis: 100%; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news details[open] .news-latest { display: none; }
.news ul { list-style: none; margin: 10px 0 0; padding: 0; }
.news li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.news li:first-child { border-top: 0; padding-top: 0; }
.news li[hidden] { display: none; }
.news li a { font-weight: 600; text-decoration: none; line-height: 1.35; }
.news li a:hover { text-decoration: underline; }
.news-meta { font-size: .8rem; color: var(--muted); }
.news-lang { font-size: .7rem; font-weight: 700; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 2px; text-decoration: none; }
.news-note { font-size: .78rem; color: var(--muted); margin: 8px 0 0; }
@media (min-width: 1100px) {
  .results.has-news:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 280px; column-gap: 24px; align-items: start; }
  .results.has-news > * { grid-column: 1; }
  .results.has-news > .news { grid-column: 2; grid-row: 1 / span 12; position: sticky; top: 16px; margin-top: 20px; }
  .news summary { cursor: default; pointer-events: none; }
  .news summary::-webkit-details-marker { display: none; }
  .news summary { list-style: none; }
  .news summary::before { display: none; }
}
