/* Aidalie (ex nom de code ClairÂge) — design system v1.
   Identité : la clarté sur le grand âge. Sobre, chaleureux, lisible par des
   aidants de 45-65 ans souvent en situation de stress. Polices système
   (zéro CDN — RGPD), contrastes AA+, corps de texte généreux.
   Tokens uniques ici — JAMAIS de couleur/espacement en dur dans les templates. */

:root {
  /* palette */
  --paper: #FBF7F0;        /* fond crème chaud */
  --paper-card: #FFFFFF;
  --ink: #26221C;          /* texte principal */
  --ink-soft: #5B5346;     /* texte secondaire */
  --bleu: #1F4E5F;         /* bleu-vert profond : confiance, en-têtes */
  --bleu-pale: #E3EDEF;
  --miel: #B7791F;         /* accent miel : chiffres clés, liens d'action */
  --miel-pale: #FBEEDB;
  --vert: #2F6B4F;         /* positif / score haut */
  --vert-pale: #E4F0E9;
  --rouge: #9B3B2E;        /* alerte / score bas */
  --rouge-pale: #F7E6E2;
  --ligne: #E4DCCE;
  --miel-fonce: #8a5a16;     /* texte sur fond miel-pale */
  --miel-hover: #9c6519;
  --bleu-bord: #BFD4D9;
  --miel-bord: #E8CD9E;
  --rouge-bord: #E3BBB3;
  --footer-texte: #D9E4E7;

  /* typo (système : zéro requête externe) */
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* espacements (échelle ×4) */
  --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px;
  --sp6: 24px; --sp8: 32px; --sp12: 48px; --sp16: 64px;

  --radius: 10px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
}
h1, h2, h3 { font-family: var(--serif); color: var(--bleu); line-height: 1.25; }
h1 { font-size: 2rem; margin: var(--sp6) 0 var(--sp3); }
h2 { font-size: 1.45rem; margin: var(--sp8) 0 var(--sp3); }
h3 { font-size: 1.15rem; margin: var(--sp6) 0 var(--sp2); }
a { color: var(--bleu); text-underline-offset: 3px; }
a:hover { color: var(--miel); }
p { margin: var(--sp3) 0; }
.muted { color: var(--ink-soft); font-size: .92rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp4); }

/* ---- header / footer ---- */
.site-header {
  background: var(--paper); border-bottom: 1px solid var(--ligne); padding: var(--sp3) 0;
}
.site-header .wrap { display: flex; align-items: center; gap: var(--sp6); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--sp3);
  text-decoration: none; }
.brand-logo { height: 42px; width: auto; display: block; }
.brand small { color: var(--ink-soft); font-family: var(--sans); font-weight: 400;
  font-size: .8rem; }
.nav { margin-left: auto; display: flex; gap: var(--sp4); flex-wrap: wrap; align-items: center; }
.nav a { color: var(--bleu); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--miel); }
.site-footer { background: var(--paper); border-top: 1px solid var(--ligne);
  color: var(--ink-soft); margin-top: var(--sp16);
  padding: var(--sp8) 0; font-size: .9rem; }
.site-footer a { color: var(--bleu); }
.site-footer a:hover { color: var(--miel); }
.site-footer strong { color: var(--ink); }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp6); }
.footer-logo { height: 38px; width: auto; display: block; margin-bottom: var(--sp2); }
.edite-par { margin-top: var(--sp6); padding-top: var(--sp4); border-top: 1px solid var(--ligne);
  font-size: .85rem; color: var(--ink-soft); }
.edite-par a { color: var(--ink-soft); text-decoration: underline; }
.edite-par a:hover { color: var(--miel); }
.edite-par strong { color: var(--ink); }

/* ---- fil d'ariane ---- */
.crumbs { font-size: .88rem; color: var(--ink-soft); margin: var(--sp4) 0; }
.crumbs a { color: var(--ink-soft); }

/* ---- cartes & blocs ---- */
.card {
  background: var(--paper-card); border: 1px solid var(--ligne);
  border-radius: var(--radius); padding: var(--sp6); margin: var(--sp4) 0;
}
.grid { display: grid; gap: var(--sp4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.kpi { text-align: center; padding: var(--sp4); }
.kpi .val { font-family: var(--serif); font-size: 1.9rem; color: var(--miel); font-weight: 700; }
.kpi .lbl { font-size: .88rem; color: var(--ink-soft); }

/* ---- tableaux ---- */
table { border-collapse: collapse; width: 100%; margin: var(--sp4) 0; font-size: .95rem; }
th, td { text-align: left; padding: var(--sp2) var(--sp3); border-bottom: 1px solid var(--ligne); }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); font-weight: 600; }
tr:hover td { background: var(--bleu-pale); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- score ---- */
.score-badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 92px; height: 92px; border-radius: 50%;
  font-family: var(--serif); font-weight: 700; color: #fff;
  background: var(--bleu);
}
.score-badge .n { font-size: 1.9rem; line-height: 1; }
.score-badge .sur { font-size: .7rem; font-family: var(--sans); font-weight: 400; opacity: .85; }
.score-badge.haut { background: var(--vert); }
.score-badge.moyen { background: var(--miel); }
.score-badge.bas { background: var(--rouge); }
.score-comp { margin: var(--sp2) 0; }
.score-comp .row { display: flex; align-items: center; gap: var(--sp3); margin: var(--sp2) 0; }
.score-comp .lbl { width: 180px; font-size: .9rem; }
.score-comp .bar { flex: 1; height: 10px; background: var(--ligne); border-radius: 5px; overflow: hidden; }
.score-comp .bar > i { display: block; height: 100%; background: var(--bleu); border-radius: 5px; }
.score-comp .v { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.score-comp .manquant { color: var(--ink-soft); font-style: italic; font-size: .88rem; }

/* ---- badges / pills ---- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; }
.pill.public { background: var(--bleu-pale); color: var(--bleu); }
.pill.prive_non_lucratif { background: var(--vert-pale); color: var(--vert); }
.pill.prive_commercial { background: var(--miel-pale); color: var(--miel-fonce); }
.pill.ash { background: var(--vert-pale); color: var(--vert); }
.pill.cotA { background: var(--vert-pale); color: var(--vert); }
.pill.cotB { background: var(--bleu-pale); color: var(--bleu); }
.pill.cotC { background: var(--miel-pale); color: var(--miel-fonce); }
.pill.cotD { background: var(--rouge-pale); color: var(--rouge); }

/* ---- bannières ---- */
.banner { border-radius: var(--radius); padding: var(--sp4) var(--sp6); margin: var(--sp4) 0;
  border: 1px solid; font-size: .95rem; }
.banner.info { background: var(--bleu-pale); border-color: var(--bleu-bord); }
.banner.warn { background: var(--miel-pale); border-color: var(--miel-bord); }
.banner.alerte { background: var(--rouge-pale); border-color: var(--rouge-bord); }

/* ---- boutons ---- */
.btn { display: inline-block; padding: var(--sp3) var(--sp6); border-radius: var(--radius);
  text-decoration: none; font-weight: 600; border: 0; cursor: pointer; font-size: 1rem; }
.btn.primaire { background: var(--miel); color: #fff; }
.btn.primaire:hover { background: var(--miel-hover); color: #fff; }
.btn.secondaire { background: transparent; color: var(--bleu); border: 2px solid var(--bleu); }
.btn.secondaire:hover { background: var(--bleu-pale); }

/* ---- hero ---- */
.hero { padding: var(--sp12) 0 var(--sp8); }
.hero h1 { font-size: 2.4rem; margin-top: 0; }
.hero .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 700px; }

/* ---- recherche ---- */
.search input {
  width: 100%; max-width: 540px; padding: var(--sp3) var(--sp4);
  font-size: 1.05rem; border: 2px solid var(--bleu); border-radius: var(--radius);
  background: #fff;
}
.search .resultats { max-width: 540px; background: #fff; border: 1px solid var(--ligne);
  border-radius: var(--radius); margin-top: var(--sp1); }
.search .resultats a { display: block; padding: var(--sp2) var(--sp4); text-decoration: none; }
.search .resultats a:hover { background: var(--bleu-pale); }

/* ---- listes de liens (depts, communes) ---- */
.linklist { columns: 3; column-gap: var(--sp6); list-style: none; padding: 0; }
.linklist li { margin: var(--sp1) 0; break-inside: avoid; }
@media (max-width: 800px) { .linklist { columns: 2; } }
@media (max-width: 520px) { .linklist { columns: 1; } h1 { font-size: 1.6rem; } }

/* ---- simulateur ---- */
.simu label { display: block; font-weight: 600; margin: var(--sp4) 0 var(--sp1); }
.simu input, .simu select {
  width: 100%; max-width: 380px; padding: var(--sp2) var(--sp3);
  font-size: 1rem; border: 1px solid var(--ligne); border-radius: 6px; background: #fff;
}
.simu .resultat { font-family: var(--serif); font-size: 1.7rem; color: var(--bleu); }
.simu table { max-width: 560px; }

/* ---- évolution prix (sparkline-table) ---- */
.evol-up { color: var(--rouge); }
.evol-down { color: var(--vert); }

/* ---- plan d'action ---- */
.pa-item { padding: var(--sp3) 0; border-bottom: 1px solid var(--ligne); }
.pa-item:last-child { border-bottom: 0; }
.pa-item strong { color: var(--bleu); }

/* ---- checklists ---- */
ul.cl { list-style: none; padding: 0; }
ul.cl li { display: flex; gap: var(--sp3); padding: var(--sp3) 0; border-bottom: 1px solid var(--ligne); break-inside: avoid; }
ul.cl li:last-child { border-bottom: 0; }
.cl-box { flex: none; width: 20px; height: 20px; border: 2px solid var(--bleu); border-radius: 4px; margin-top: 2px; }

/* ---- impression ---- */
@media print { .site-header, .site-footer, .nav, .search, .btn, .no-print, .crumbs { display: none; }
  body { font-size: 12pt; } .cl-box { border-color: #000; } a { color: #000; text-decoration: none; } }

/* --- Offre dynamique (affiliation / mise en relation) — clairement signalée --- */
.offre { margin: var(--sp8) 0; padding: var(--sp4) var(--sp6); border: 1px solid var(--miel);
  border-radius: var(--radius); background: var(--miel-pale); position: relative; }
.offre-tag { display: inline-block; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--miel-fonce); font-weight: 700; margin-bottom: var(--sp2); }
.offre-body strong { display: block; font-size: 1.05rem; color: var(--ink); margin-bottom: var(--sp1); }
.offre-sub { margin: 0 0 var(--sp3); color: var(--ink-soft); font-size: .92rem; }
.offre-cta { display: inline-block; margin-top: var(--sp2); padding: var(--sp2) var(--sp4);
  background: var(--miel-fonce); color: #fff; border-radius: 6px; text-decoration: none;
  font-weight: 600; }
.offre-cta:hover { filter: brightness(1.08); }
.offre-lead { display: flex; flex-direction: column; gap: var(--sp2); max-width: 460px; margin-top: var(--sp2); }
.offre-lead input[type="text"], .offre-lead input[type="tel"] { padding: var(--sp2) var(--sp3);
  border: 1px solid var(--ligne); border-radius: 6px; font: inherit; }
.offre-consent { display: flex; gap: var(--sp2); align-items: flex-start; font-size: .82rem; color: var(--ink-soft); }
.offre-lead button { padding: var(--sp2) var(--sp4); background: var(--miel-fonce); color: #fff;
  border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; }
.offre-lead button:disabled { opacity: .6; cursor: default; }
.offre-status { margin: var(--sp2) 0 0; font-size: .9rem; color: var(--vert); font-weight: 600; }
