:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2a2420;
  --muted: #6e645b;
  --line: #e6ddd2;
  --accent: #b8742a;
  --accent-strong: #8f5518;
  --accent-soft: #f5e7d6;
  --green: #2f6b45;
  --green-soft: #e3f0e6;
  --red: #a63d2f;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1815;
    --surface: #25211d;
    --text: #f1ebe4;
    --muted: #a89d92;
    --line: #3a342e;
    --accent: #e09a4c;
    --accent-strong: #f0b06a;
    --accent-soft: #3a2b1b;
    --green: #7cc495;
    --green-soft: #1f3326;
    --red: #e58474;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1815; --surface: #25211d; --text: #f1ebe4; --muted: #a89d92; --line: #3a342e;
  --accent: #e09a4c; --accent-strong: #f0b06a; --accent-soft: #3a2b1b;
  --green: #7cc495; --green-soft: #1f3326; --red: #e58474; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
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-strong); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.muted { color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 960px; margin: 0 auto; padding: 18px 16px;
}
.logo { font-weight: 800; font-size: 1.3rem; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
.logo .q { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--text); }
.topbar nav a[aria-current="page"] { font-weight: 600; }

.demo-banner {
  background: var(--accent-soft); color: var(--accent-strong);
  text-align: center; font-size: .9rem; padding: 8px 16px;
}

main { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.hero { padding: 48px 0 32px; max-width: 640px; }

/* Home page: the hero, with the latest articles beside it on wide screens and below it on phones. */
.intro { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 40px; }
@media (min-width: 880px) {
  .intro { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; }
  .intro .a-lire { padding: 48px 0 32px; }
}
.a-lire { padding: 0 0 24px; }
.a-lire h2 { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
#a-lire-liste { display: grid; gap: 10px; }
.a-lire-carte {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.a-lire-carte:hover { border-color: var(--accent); }
.a-lire-carte img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.alc-texte { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.alc-titre { font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.a-lire-carte:hover .alc-titre { color: var(--accent-strong); }
.alc-resume { color: var(--muted); font-size: .92rem; line-height: 1.45; }
.alc-meta { color: var(--muted); font-size: .82rem; }
.alc-meta::after { content: " · Lire →"; color: var(--accent-strong); font-weight: 600; }
.a-lire-carte.petite .alc-texte { padding: 10px 16px 12px; }
.a-lire-carte.petite .alc-titre { font-size: .98rem; }
.a-lire-tous { display: inline-block; margin-top: 10px; font-size: .9rem; font-weight: 600; }
@media (max-width: 879px) {
  .a-lire { max-width: 640px; }
  .a-lire-carte { flex-direction: row; align-items: stretch; }
  .a-lire-carte img { width: 128px; aspect-ratio: auto; flex: none; }
  .a-lire-carte .alc-resume { display: none; }
}
@media (max-width: 420px) { .a-lire-carte img { width: 96px; } }
.hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.02em; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 24px; }
.lead strong { color: var(--text); }

.cp-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.cp-row { display: flex; gap: 8px; }
.cp-row input {
  flex: 0 1 200px; min-width: 0;
  font: inherit; font-size: 1.25rem; letter-spacing: .08em;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.cp-row input:focus { outline: none; border-color: var(--accent); }
button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px 22px;
}
button:hover { background: var(--accent-strong); }
button:disabled { opacity: .6; cursor: wait; }
button.link { background: none; color: var(--accent-strong); padding: 0; font-weight: 500; text-decoration: underline; }
.help { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.error { color: var(--red); font-weight: 500; margin: 8px 0 0; }

.results { padding: 8px 0 32px; }
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.results-head h2 { font-size: 1.5rem; margin: 0; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  margin: 20px 0 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.filters legend { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0; margin-bottom: 4px; width: 100%; }
.filters label { font-size: .95rem; white-space: nowrap; }
.filters select {
  font: inherit; font-size: .95rem; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}

.summary { color: var(--muted); margin: 0 0 12px; }

.offers { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.offer {
  display: grid; grid-template-columns: 1fr auto; gap: 12px 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.offer.best { border-color: var(--green); border-width: 2px; padding: 15px 17px; }
.offer .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.tag.cert { background: var(--green-soft); color: var(--green); border-color: transparent; }
.tag.best { background: var(--green); color: #fff; border-color: transparent; }
.tag.promo { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.tag.nolabel { color: var(--red); }
.offer h3 { font-size: 1.1rem; margin: 0 0 2px; }
.offer .seller { color: var(--muted); font-size: .92rem; margin: 0 0 4px; }
.offer .details { font-size: .9rem; color: var(--muted); margin: 0; }

.price { text-align: right; }
.price .per-t { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.price .per-t small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.price .alt { font-size: .9rem; font-weight: 600; margin: 2px 0 0; }
.price .total { font-size: .9rem; color: var(--muted); margin: 2px 0 10px; }
.price .total s { margin-right: 4px; }
.price a.cta {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 600; padding: 9px 16px; border-radius: 10px; white-space: nowrap;
}
.price a.cta:hover { background: var(--accent-strong); }
.price .releve { font-size: .75rem; color: var(--muted); margin: 6px 0 0; }

.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 20px; color: var(--muted);
}
.disclosure { font-size: .82rem; color: var(--muted); margin: 20px 0 0; max-width: 720px; }

.method { padding: 40px 0 48px; border-top: 1px solid var(--line); margin-top: 24px; }
.method h2 { font-size: 1.5rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.cards article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.cards h3 { font-size: 1.05rem; }
.cards p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Catalogue des granulés ---------- */
.hero-small { padding: 32px 0 8px; max-width: 720px; }
.hero-small h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.catalogue-filters .grow { flex: 1 1 240px; }
.catalogue-filters input[type="search"] {
  width: 100%; font: inherit; font-size: .95rem; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.catalogue { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); scroll-margin-top: 16px; min-width: 0;
}
.product.highlight { border-color: var(--accent); border-width: 2px; padding: 15px 17px; }
.product h3 { font-size: 1.1rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.product .seller { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.figures { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.figures div { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.figures dt { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.figures dd { margin: 0; font-weight: 700; white-space: nowrap; }
.no-data { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.product details { font-size: .9rem; }
.product summary { cursor: pointer; color: var(--accent-strong); font-weight: 500; }
.product details h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 4px; }
.product details ul { margin: 0; padding-left: 18px; }
.product details li { margin: 2px 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
.specs { border-collapse: collapse; width: 100%; }
.specs th, .specs td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { font-weight: 600; }
.specs td:nth-child(2) { white-space: nowrap; font-weight: 600; }
@media (max-width: 600px) {
  .specs, .specs tbody { display: block; }
  .specs tr { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .specs th, .specs td { border: 0; padding: 0; }
  .specs td:nth-child(3), .specs td:nth-child(4) { grid-column: 1 / -1; font-size: .85rem; }
}
.offer h3 a { color: inherit; text-decoration: none; }
.offer h3 a:hover { text-decoration: underline; }

.footer {
  max-width: 960px; margin: 0 auto; padding: 24px 16px 40px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem;
}
.footer p { margin: 0 0 4px; }

@media (max-width: 600px) {
  .hero { padding-top: 24px; }
  .cp-row input { flex: 1 1 auto; }
  .offer { grid-template-columns: 1fr; }
  .price { text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .price .total { margin: 0; flex: 1 1 auto; }
  .price a.cta { width: 100%; text-align: center; margin-top: 6px; }
}
.figures .rev { background: transparent; border: 1px dashed var(--line); }
.rev-note { font-size: .78rem; color: var(--muted); margin: -4px 0 10px; }

/* Catalogue: the badges on each card are filter buttons (granules.js). */
.product .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
button.tag { font: inherit; font-size: .75rem; font-weight: 600; line-height: inherit; cursor: pointer; }
button.tag:hover { border-color: var(--green); }
button.tag:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.tag.actif { background: var(--green); color: var(--surface); border-color: var(--green); }
