/* Feuille de style unique, sans framework. Thème clair/sombre automatique. */
:root {
  --fond: #f6f7f9; --surface: #ffffff; --fond-2: #eef1f5; --texte: #18202b; --doux: #5b6675;
  --accent: #1f56b8; --accent-fonce: #173f87; --accent-2: #e9f0fc; --bord: #dde2e9; --bord-fort: #c5ccd6;
  --ok: #11713a; --alerte: #a33a0c; --alerte-fond: #fdf1ea;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --ombre-forte: 0 2px 4px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .10);
  --rayon: 14px; --rayon-petit: 9px; --largeur: 54rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #0f1318; --surface: #171c23; --fond-2: #1d232c; --texte: #e7eaee; --doux: #9ba6b3;
          --accent: #7fb0ff; --accent-fonce: #a9c9ff; --accent-2: #1a2740; --bord: #2a313b; --bord-fort: #3a4350;
          --ok: #5fd08a; --alerte: #f3a274; --alerte-fond: #2b1d15;
          --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
          --ombre-forte: 0 2px 4px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35); }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
       color: var(--texte); background: var(--fond); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-fonce); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.45rem); margin: 1.4rem 0 .7rem; letter-spacing: -.022em; }
h2 { font-size: 1.4rem; margin: 2.6rem 0 .7rem; }
h3 { font-size: 1.08rem; margin: 1.5rem 0 .35rem; }
p { text-wrap: pretty; }
.conteneur { max-width: var(--largeur); margin: 0 auto; padding: 0 1.1rem; }
.evitement { position: absolute; left: -999px; }
.evitement:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem .8rem; z-index: 9; border-radius: var(--rayon-petit); }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 88%, transparent);
          backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
          border-bottom: 1px solid var(--bord); }
.entete .conteneur { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding-block: .65rem; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.08rem; text-decoration: none; color: var(--texte); letter-spacing: -.01em; }
.logo:hover { color: var(--texte); }
.logo::before { content: "€"; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 8px;
                background: linear-gradient(135deg, var(--accent), var(--accent-fonce)); color: #fff; font-size: 1.05rem; font-weight: 800; }
@media (prefers-color-scheme: dark) { .logo::before { background: linear-gradient(135deg, #3d7be0, #1f56b8); } }
.entete ul { display: flex; flex-wrap: wrap; gap: .2rem; list-style: none; margin: 0; padding: 0; font-size: .93rem; }
.entete li a { display: block; padding: .35rem .7rem; border-radius: 999px; color: var(--doux); text-decoration: none; font-weight: 550; }
.entete li a:hover { background: var(--fond-2); color: var(--texte); }
.entete li a[aria-current="page"] { background: var(--accent-2); color: var(--accent); }

/* Textes d'introduction */
.chapo { font-size: 1.14rem; color: var(--doux); margin-top: 0; max-width: 42rem; }
.maj { display: inline-flex; align-items: center; gap: .45rem; font-size: .86rem; color: var(--ok); font-weight: 600;
       background: color-mix(in srgb, var(--ok) 10%, transparent); padding: .25rem .7rem; border-radius: 999px; margin: .2rem 0 0; }
.maj::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.ariane { font-size: .88rem; color: var(--doux); margin-top: 1.4rem; }
.ariane a { color: var(--doux); }

/* Accueil */
.intro { padding: 2.2rem 0 .6rem; }
.intro h1 { font-size: clamp(2rem, 5vw, 2.9rem); max-width: 40rem; margin-top: .4rem; }
.intro p { color: var(--doux); font-size: 1.1rem; max-width: 44rem; }
.cartes { list-style: none; padding: 0; margin: 1.8rem 0 0; display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); }
.carte a { position: relative; display: flex; flex-direction: column; gap: .5rem; height: 100%; padding: 1.35rem 1.4rem 1.2rem;
           border: 1px solid var(--bord); border-radius: var(--rayon); text-decoration: none; color: inherit;
           background: var(--surface); box-shadow: var(--ombre); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.carte a::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: var(--rayon) var(--rayon) 0 0;
                   background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #19b3a6)); opacity: .85; }
.carte a:hover, .carte a:focus-visible { transform: translateY(-2px); box-shadow: var(--ombre-forte); border-color: var(--bord-fort); }
.carte h2 { margin: .2rem 0 0; font-size: 1.15rem; color: var(--texte); }
.carte p { margin: 0; color: var(--doux); font-size: .97rem; flex: 1; }
.carte .cta { margin-top: .6rem; font-weight: 650; font-size: .95rem; color: var(--accent); }
.carte .cta::after { content: " →"; display: inline-block; transition: transform .15s ease; }
.carte a:hover .cta::after { transform: translateX(3px); }

/* Simulateur */
.outil { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.4rem 1.5rem 1.5rem;
         margin: 1.6rem 0; box-shadow: var(--ombre-forte); }
form { display: grid; gap: 1.1rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.champ { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.champ.large { grid-column: 1 / -1; }
label, legend { font-weight: 620; font-size: .93rem; }
.aide { display: block; font-size: .83rem; color: var(--doux); font-weight: 400; margin-top: .1rem; }
input, select { font: inherit; font-size: 1.02rem; padding: .65rem .8rem; border: 1px solid var(--bord-fort); border-radius: var(--rayon-petit);
                background: var(--fond); color: var(--texte); width: 100%; min-height: 2.9rem;
                transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease; }
input:hover, select:hover { border-color: var(--doux); }
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface);
                            box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
input[inputmode] { font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset legend { padding: 0; margin-bottom: .35rem; }
/* Boutons radio présentés en sélecteur segmenté */
fieldset.champ { display: flex; flex-direction: row; flex-wrap: wrap; gap: .35rem; align-content: flex-start; }
fieldset.champ legend { width: 100%; }
fieldset.champ label { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.9rem;
                       padding: .5rem .8rem; border: 1px solid var(--bord-fort); border-radius: var(--rayon-petit); background: var(--fond);
                       font-weight: 520; cursor: pointer; text-align: center; line-height: 1.3;
                       transition: border-color .12s ease, background-color .12s ease, color .12s ease; }
fieldset.champ label:hover { border-color: var(--doux); }
fieldset.champ label:has(input:checked) { border-color: var(--accent); background: var(--accent-2); color: var(--accent); font-weight: 650;
                                          box-shadow: inset 0 0 0 1px var(--accent); }
fieldset.champ label:has(input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type=radio], input[type=checkbox] { width: 1.1rem; height: 1.1rem; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.champ > label:has(input[type=checkbox]) { display: flex; align-items: flex-start; gap: .6rem; font-weight: 520; cursor: pointer; padding-top: .2rem; }
.champ > label:has(input[type=checkbox]) input { margin-top: .22rem; }

/* Résultat */
.resultat { margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px dashed var(--bord-fort); }
.resultat:empty { display: none; }
.chiffre-cle { position: relative; overflow: hidden; border-radius: var(--rayon); padding: 1.1rem 1.3rem 1.15rem; margin-bottom: 1rem;
               background: linear-gradient(135deg, var(--accent) 0%, var(--accent-fonce) 100%); color: #fff;
               font-size: .95rem; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 28%, transparent); }
@media (prefers-color-scheme: dark) { .chiffre-cle { background: linear-gradient(135deg, #2c66c9 0%, #173f87 100%); } }
.chiffre-cle::after { content: ""; position: absolute; right: -3rem; top: -3rem; width: 10rem; height: 10rem; border-radius: 50%;
                      background: rgba(255, 255, 255, .08); pointer-events: none; }
.chiffre-cle .valeur { display: block; font-size: clamp(1.9rem, 6vw, 2.5rem); font-weight: 780; line-height: 1.15; margin: .2rem 0 .3rem;
                       letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #fff; }
.alerte { color: var(--alerte); background: var(--alerte-fond); border-left: 4px solid currentColor; padding: .7rem .9rem;
          border-radius: 0 var(--rayon-petit) var(--rayon-petit) 0; font-weight: 600; font-size: .95rem; }
.resultat .aide, .outil > .aide { font-size: .88rem; margin: .8rem 0 0; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); font-weight: 650; }
tbody tr:hover td { background: color-mix(in srgb, var(--fond-2) 60%, transparent); }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 750; border-bottom: 0; border-top: 2px solid var(--texte); font-size: 1.02rem; }
.outil details { margin-top: 1rem; }
.outil details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .95rem; }
.outil details[open] summary { margin-bottom: .5rem; }
section > table, section > h3 + table { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-petit);
                                        border-collapse: separate; border-spacing: 0; overflow: hidden; }
section > table td, section > h3 + table td { padding-inline: .8rem; }
section > table tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-petit); margin-bottom: .55rem;
               transition: border-color .12s ease, box-shadow .12s ease; }
.faq details:hover { border-color: var(--bord-fort); }
.faq details[open] { box-shadow: var(--ombre); }
.faq summary { cursor: pointer; font-weight: 620; padding: .85rem 2.6rem .85rem 1.1rem; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
                      font-size: 1.35rem; font-weight: 400; color: var(--accent); transition: transform .15s ease; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details > :not(summary) { margin: 0 1.1rem .9rem; }
.faq details > :not(summary):first-of-type { margin-top: 0; }

/* Sources */
.sources { margin-top: 2.6rem; padding: 1.3rem 1.5rem; background: var(--fond-2); border-radius: var(--rayon); }
.sources h2 { margin-top: 0; font-size: 1.2rem; }
.sources ul { padding-left: 1.2rem; }
.sources li { margin-bottom: .35rem; font-size: .95rem; }
.texte { max-width: 44rem; }

/* Pied de page */
.pied { border-top: 1px solid var(--bord); margin-top: 4rem; padding: 1.6rem 0 2.4rem; font-size: .88rem; color: var(--doux); background: var(--surface); }
.pied p { max-width: 44rem; }
.pied a { color: var(--doux); }
.pied a:hover { color: var(--texte); }

@media (max-width: 40rem) {
  .entete .conteneur { justify-content: center; }
  .entete ul { justify-content: center; }
  .outil { padding: 1.1rem 1rem 1.2rem; margin-inline: -.4rem; }
  .sources { padding: 1.1rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media print {
  .entete, .pied, form { display: none; }
  body, .outil, .carte a { background: #fff; box-shadow: none; }
  .chiffre-cle { background: none; color: #000; border: 2px solid #000; box-shadow: none; }
  .chiffre-cle .valeur { color: #000; }
}
