/* Mise en page : en-tête blanc, onglets (Mobile / Internet / Internet + TV), puis filtres à gauche et offres à droite.
   TOUTES LES COULEURS SONT ICI : pour changer le style du site, modifie seulement ces lignes. */
:root {
  --bg: #f4faf6;          /* fond de la page (blanc légèrement vert) */
  --surface: #ffffff;     /* fond des cartes */
  --ink: #10241a;         /* texte principal */
  --muted: #557064;       /* texte secondaire */
  --line: #d6ebdd;        /* séparations fines */
  --edge: #9fd6b4;        /* contour vert des filtres et des offres */
  --green: #14894f;       /* vert principal (boutons, accents) */
  --green-soft: #e3f4ea;  /* vert très clair (fonds) */
  --on-green: #ffffff;    /* texte posé sur le vert */
  --promo: #ffd25e;       /* étiquette promo */
  --promo-ink: #4a3300;
  --heart: #e0365a;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 14px;
}
/* Le site reste toujours clair (blanc et vert), même si l'ordinateur du visiteur est en mode sombre. */
:root { color-scheme: light; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.wrap {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ---------- En-tête ---------- */
header.top { background: var(--surface); border-bottom: 2px solid var(--edge); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-block: 14px; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--green); display: grid; place-items: center; }
.logo-mark div { display: flex; align-items: end; height: 16px; }
.logo-mark span { display: block; width: 4px; background: var(--on-green); border-radius: 2px; margin: 0 1px; }
.logo em { font-style: normal; color: var(--green); }
.top-note { color: var(--muted); font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.top-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ---------- Intro + onglets ---------- */
.intro { background: var(--surface); border-bottom: 1px solid var(--line); }
.intro .wrap { padding-block: 32px 0; display: grid; gap: 16px; }
.intro h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 4.2vw, 2.8rem);
  line-height: 1.07; letter-spacing: -0.03em; margin: 0; max-width: 22ch; text-wrap: balance;
}
.intro h1 mark { background: none; color: var(--green); }
.intro p { margin: 0; color: var(--muted); max-width: 62ch; }

.tabs { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
.tab {
  border: 2px solid transparent; border-bottom: 0; background: none; cursor: pointer;
  padding: 12px 20px; border-radius: 12px 12px 0 0; font-weight: 700; font-size: 1rem;
  color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--bg); border-color: var(--edge); color: var(--green); }
.tab small { font-family: var(--font-num); font-size: 0.75rem; background: var(--green-soft); color: var(--green); padding: 1px 7px; border-radius: 999px; }

.needs-bar .wrap { padding-block: 18px 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.needs-bar .hint { color: var(--muted); font-size: 0.9rem; margin-right: 4px; }
.need {
  border: 1.5px solid var(--edge); background: var(--surface); border-radius: 999px;
  padding: 7px 15px; cursor: pointer; font-weight: 700; font-size: 0.92rem;
}
.need:hover { border-color: var(--green); }
.need[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); }

/* ---------- Zone principale ---------- */
.main .wrap { display: grid; grid-template-columns: 270px 1fr; gap: 24px; padding-block: 14px 48px; align-items: start; }
@media (max-width: 860px) { .main .wrap { grid-template-columns: 1fr; } }

/* Filtres */
.filters {
  background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius);
  padding: 18px; display: grid; gap: 18px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px);
}
@media (max-width: 860px) { .filters { position: static; } }
.filters-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.filters-head h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; }
.link-btn { background: none; border: 0; color: var(--green); cursor: pointer; font-weight: 700; padding: 4px; }
.toggle-filters { display: none; }
@media (max-width: 860px) {
  .toggle-filters { display: inline-block; }
  .filters.closed .filter-body { display: none; }
  .filters.closed .filters-head { padding-bottom: 0; border-bottom: 0; }
}
.filter-body { display: grid; gap: 20px; }
.group { display: grid; gap: 8px; }
.group > .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.range-row { display: flex; justify-content: space-between; font-family: var(--font-num); font-size: 0.9rem; }
.range-row strong { color: var(--green); }
input[type="range"] { width: 100%; accent-color: var(--green); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button {
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 9px; padding: 7px 4px;
  cursor: pointer; font-size: 0.86rem; font-weight: 700;
}
.seg button[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--green); margin: 0; flex: none; }
.check small { margin-left: auto; color: var(--muted); font-family: var(--font-num); }
.ops { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }

/* Barre de résultats */
.results { display: grid; gap: 14px; min-width: 0; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.count { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.count span { color: var(--green); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.sort select { border: 1.5px solid var(--edge); background: var(--surface); border-radius: 9px; padding: 7px 10px; }

/* Carte d'offre */
.offer {
  background: var(--surface); border: 1.5px solid var(--edge); border-radius: var(--radius);
  display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 18px; align-items: center; padding: 18px 20px;
  transition: border-color .15s, box-shadow .15s;
}
.offer:hover { border-color: var(--green); box-shadow: 0 4px 18px -10px var(--green); }
.offer.best { border: 2.5px solid var(--green); }
@media (max-width: 720px) {
  .offer { grid-template-columns: 1fr 1fr; }
  .offer .col-name { grid-column: 1 / -1; }
  .offer .col-price { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; text-align: left; padding-top: 12px; border-top: 1px solid var(--line); }
}
.col-name { min-width: 0; display: grid; gap: 6px; }
.op { display: flex; align-items: center; gap: 10px; }
.op-badge {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  font-family: var(--font-display); font-weight: 800; font-size: 0.92rem; color: #fff;
}
.op-name { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.offer-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.76rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.hi { color: var(--green); border-color: var(--edge); background: var(--green-soft); }
.tag.top { background: var(--green); border-color: var(--green); color: var(--on-green); }
.stat { min-width: 0; }
.stat .k { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.stat .v { font-family: var(--font-num); font-weight: 700; font-size: 1.3rem; line-height: 1.25; }
.stat .s { font-size: 0.86rem; color: var(--muted); }
.stat .s strong { color: var(--ink); }
.col-price { text-align: right; display: grid; gap: 6px; justify-items: end; }
@media (max-width: 720px) { .col-price { justify-items: start; } }
.price { font-family: var(--font-num); font-weight: 700; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price small { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.from { font-size: 0.78rem; color: var(--muted); }
.old { font-family: var(--font-num); color: var(--muted); text-decoration: line-through; font-size: 0.85rem; }
.promo { background: var(--promo); color: var(--promo-ink); font-weight: 700; font-size: 0.78rem; padding: 3px 9px; border-radius: 6px; max-width: 24ch; text-align: center; }
.actions { display: flex; gap: 8px; align-items: center; }
.cta {
  background: var(--green); color: var(--on-green); text-decoration: none; font-weight: 700;
  padding: 9px 14px; border-radius: 10px; white-space: nowrap; font-size: 0.92rem;
}
.cta:hover { filter: brightness(1.08); }
.cta.disabled { background: var(--line); color: var(--muted); pointer-events: none; }
.fav { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--edge); background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.fav[aria-pressed="true"] { color: var(--heart); border-color: var(--heart); }

.empty { background: var(--surface); border: 2px dashed var(--edge); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); }

footer { background: var(--surface); border-top: 2px solid var(--edge); color: var(--muted); font-size: 0.88rem; }
footer .wrap { padding-block: 24px; display: grid; gap: 8px; }
footer a { color: var(--green); }

@media (prefers-reduced-motion: no-preference) {
  .offer { animation: rise .25s ease both; }
  @keyframes rise { from { transform: translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
}
a.logo { color: inherit; text-decoration: none; }

/* ---------- Menu du haut ---------- */
.menu { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.menu a {
  padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: 0.92rem;
  color: var(--ink); text-decoration: none; white-space: nowrap; border: 1.5px solid transparent;
}
.menu a:hover { border-color: var(--edge); color: var(--green); }
.menu a.active { background: var(--green-soft); color: var(--green); border-color: var(--edge); }
@media (max-width: 900px) {
  header.top .wrap { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .menu { min-width: 0; }
  .menu { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin-inline: -4px; padding-bottom: 2px; scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
}

/* Logo d'opérateur (quand un fichier est indiqué dans data/offres.json) */
.op-badge.has-logo { width: 46px; background: #fff; border: 1px solid var(--line); padding: 4px; }
.op-badge.has-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
