/* Layout : barre de recherche collante + colonne de filtres (tiroir sur mobile) + grille produits 2 col. mobile → auto desktop */
:root {
  --bg: #F3F6F2;          /* blanc cassé légèrement vert (coton écru) */
  --surface: #FFFFFF;
  --ink: #17221C;
  --muted: #5A685F;
  --line: #DCE4DD;
  --gots: #1E6B45;        /* vert GOTS : accent principal */
  --gots-soft: #E3F0E7;
  --oeko: #2D5C88;        /* bleu ardoise : OEKO-TEX */
  --oeko-soft: #E4ECF4;
  --promo: #B3263E;
  --fav: #C23B5F;
  --shadow: 0 1px 2px rgb(23 34 28 / .06), 0 4px 14px rgb(23 34 28 / .06);
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101613; --surface: #18211C; --ink: #E5ECE7; --muted: #95A59B; --line: #2A3730;
    --gots: #62C48F; --gots-soft: #1C3527; --oeko: #84ADD8; --oeko-soft: #1D2B3A;
    --promo: #FF8095; --fav: #FF7E9E; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 14px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101613; --surface: #18211C; --ink: #E5ECE7; --muted: #95A59B; --line: #2A3730;
  --gots: #62C48F; --gots-soft: #1C3527; --oeko: #84ADD8; --oeko-soft: #1D2B3A;
  --promo: #FF8095; --fav: #FF7E9E; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 14px rgb(0 0 0 / .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--font-body);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--bg);
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gots); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--line); padding: 1px 5px; border-radius: 4px; }

/* --- Barre du haut ------------------------------------------------------ */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding-block: 10px; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 28px; height: 28px; stroke: none; }
.brand-mark circle { fill: var(--gots); }
.brand-mark path { fill: var(--bg); }
.brand-name { font: 800 21px/1 var(--font-display); letter-spacing: -.02em; }
.brand-name span { font-weight: 600; color: var(--gots); }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 42px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--gots); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); height: 100%; }
.btn-filters {
  display: none; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; flex: none;
}
.pill-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--gots); color: var(--surface); font-size: 12px; font-weight: 700;
}

/* --- Mise en page ------------------------------------------------------- */
.layout {
  max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 28px;
  padding-block: 20px 40px; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}

/* --- Filtres ------------------------------------------------------------ */
.filters {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 80px); align-self: start;
  max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 22px; padding-right: 6px;
}
.filters-head, .filters-foot { display: none; }
.filters-head h2 { margin: 0; font: 800 22px/1.1 var(--font-display); }
.fgroup { display: flex; flex-direction: column; gap: 10px; }
.fgroup h3 {
  margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  display: flex; align-items: baseline; gap: 6px;
}
.fgroup h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.fgroup h3 output { margin-left: auto; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px;
  font-size: 13.5px; cursor: pointer; line-height: 1.25; font-variant-numeric: tabular-nums;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .55; margin-left: 3px; font-size: 12px; }
.chip:disabled { opacity: .4; cursor: default; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { text-align: center; padding: 7px 6px; border-radius: 9px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--muted); }
.segmented input:checked + label { background: var(--gots); color: var(--surface); }
.segmented input:focus-visible + label { outline: 2px solid var(--gots); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check.small { font-size: 13.5px; color: var(--muted); }
.check input { accent-color: var(--gots); width: 16px; height: 16px; margin: 0; }

input[type="range"] { width: 100%; accent-color: var(--gots); }

.site-list { display: flex; flex-direction: column; gap: 2px; }
.site-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-size: 14px; }
.site-row input { accent-color: var(--gots); width: 16px; height: 16px; margin: 0; }
.site-row .n { margin-left: auto; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.btn-primary, .btn-ghost, .btn-more {
  height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--gots); color: var(--surface); }
.btn-ghost { background: transparent; border-color: var(--line); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 39; }

/* --- Résultats ---------------------------------------------------------- */
.results { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.intro h1 { margin: 0; font: 800 clamp(22px, 1.6vw + 15px, 30px)/1.12 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.intro p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; max-width: 64ch; text-wrap: pretty; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.summary { margin: 0; color: var(--muted); font-size: 14px; }
.summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.sort select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--ink); }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.active-chips:empty { display: none; }
.active-chips .chip { background: var(--gots-soft); border-color: transparent; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.active-chips .chip svg { width: 14px; height: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 18px 14px; }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.card-img {
  display: block; aspect-ratio: 4 / 5; max-width: 100%; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card-img.noimg { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
@media (hover: hover) { .card:hover .card-img img { transform: scale(1.03); } }
.fav {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 999px; border: 0;
  display: grid; place-items: center; cursor: pointer; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink);
  box-shadow: var(--shadow);
}
.fav[aria-pressed="true"] { color: var(--fav); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 2px 0; min-width: 0; }
.shop { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.labels { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 60px); }
.badge {
  font: 700 10.5px/1 var(--font-body); letter-spacing: .04em; padding: 4px 7px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-gots { background: var(--gots); color: var(--surface); }
.badge-oeko { background: var(--oeko-soft); color: var(--oeko); border-color: color-mix(in srgb, var(--oeko) 30%, transparent); }
.labels .badge { box-shadow: var(--shadow); font-size: 11px; padding: 5px 8px; }
.title {
  color: var(--ink); text-decoration: none; font-size: 14.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.title:hover { text-decoration: underline; text-underline-offset: 2px; }
.price-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.price { font-weight: 700; font-size: 16px; }
.old { color: var(--muted); font-size: 13px; }
.off { color: var(--promo); font-size: 12.5px; font-weight: 700; }
.card-sizes { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.card-sizes mark { background: none; color: var(--gots); font-weight: 700; }
.evidence {
  margin: 4px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere;
}
.evidence a { color: var(--gots); }

.more { display: flex; flex-direction: column; gap: 6px; }
.compare {
  align-self: flex-start; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--gots); cursor: pointer;
}
.compare[aria-expanded="true"] { background: var(--gots-soft); border-color: transparent; }
.variants { font-size: 12.5px; color: var(--muted); }
.offers {
  list-style: none; margin: 0; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.offers li { display: flex; align-items: center; gap: 8px; padding: 5px 0; min-width: 0; }
.offers li + li { border-top: 1px solid var(--line); }
.o-site { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-price { font-weight: 700; }
.offers a { display: inline-flex; align-items: center; gap: 3px; color: var(--gots); font-weight: 600; text-decoration: none; }
.offers a svg { width: 13px; height: 13px; }
.btn-more { align-self: center; background: var(--surface); border-color: var(--line); margin-top: 8px; }
.empty { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h2 { margin: 0; font: 800 22px/1.2 var(--font-display); text-wrap: balance; }
.empty p { margin: 0 0 8px; color: var(--muted); max-width: 46ch; }

.aside-info { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--line); padding-top: 22px; }
.labels-explain summary { cursor: pointer; font: 600 17px/1.3 var(--font-display); }
.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 14px; }
.explain-grid p { margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 62ch; }
.explain-grid strong { color: var(--ink); }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: 1360px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding-block: 20px 32px; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.footer-inner p { margin: 0; color: var(--muted); font-size: 13px; max-width: 90ch; text-wrap: pretty; }
.footer-inner a { color: var(--gots); }

/* --- Page « robot » ------------------------------------------------------ */
.doc {
  max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding-block: 28px 56px; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.doc h1 { margin: 0; font: 800 clamp(26px, 2vw + 18px, 36px)/1.1 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.doc h2 { margin: 16px 0 0; font: 600 20px/1.25 var(--font-display); text-wrap: balance; }
.doc p, .doc li { max-width: 65ch; }
.doc p { margin: 0; }
.doc .lead { font-size: 17px; color: var(--muted); }
.doc ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.doc pre { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.doc pre code { background: none; padding: 0; }
.doc a { color: var(--gots); }
.doc .back { margin-top: 12px; }

/* --- Mobile : filtres en tiroir ---------------------------------------- */
@media (max-width: 860px) {
  .brand-name { display: none; }
  .doc-page .brand-name { display: inline; }
  .intro p { display: none; }
  .btn-filters { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-block: 14px 32px; }
  .filters {
    position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); max-height: none; z-index: 40;
    align-self: stretch; height: 100%; /* sinon align-self:start (desktop) le laisse à la hauteur du contenu, sans défilement */
    background: var(--bg); padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
    padding-bottom: 0; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
    transform: translateX(100%); transition: transform .25s ease; visibility: hidden;
  }
  .filters.open { transform: none; visibility: visible; }
  .filters-head { display: flex; justify-content: space-between; align-items: center; }
  .filters-foot {
    display: flex; gap: 10px; position: sticky; bottom: 0; margin-top: auto; background: var(--bg);
    padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line);
  }
  .filters-foot .btn-primary { flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
  .results-head .summary { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
