/*
  InfraRoute (site web) — identite visuelle propre, distincte du systeme
  "aurora indigo/cyan sur fond sombre" de l'app mobile ET de la palette
  vert sapin / terre cuite / creme de PrixDuMetre. Meme raison que documentee
  dans le CLAUDE.md de PrixDuMetre : eviter tout signal de "site duplique /
  template" pour Google AdSense, qui sert deja d'autres sites de la famille.

  Parti pris : fond clair "papier officiel" bleu-gris tres pale, encre
  bleu nuit, accents empruntes au langage colorimetrique de la signalisation
  routiere francaise (bleu = obligation/info, ambre = danger/attention,
  rouge = interdiction/delit) plutot qu'une palette de marque generique.
  Serif "Lora" pour les titres (registre "texte de loi/code"), sans-serif
  "IBM Plex Sans" pour le corps — different du Manrope de l'app et du
  Fraunces + Public Sans de PrixDuMetre.
*/

:root {
  --bg: #eef1f6;
  --bg-alt: #e4e9f2;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #d3dae6;
  --border-strong: #b7c1d4;
  --ink: #16202f;
  --ink-muted: #52607a;
  --ink-faint: #8b96ac;

  --accent: #1652a3;      /* bleu signalisation "obligation" */
  --accent-ink: #0d3b78;
  --accent-soft: rgba(22, 82, 163, 0.09);
  --accent-soft-strong: rgba(22, 82, 163, 0.16);

  --niveau-legere: #1652a3;
  --niveau-moyenne: #a8720f;
  --niveau-grave: #c8571e;
  --niveau-delit: #a91d2f;

  --ok: #206b46;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --shadow-card: 0 1px 2px rgba(22, 32, 47, 0.04), 0 8px 24px -12px rgba(22, 32, 47, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141d;
    --bg-alt: #161b26;
    --surface: #171d29;
    --surface-raised: #1c2330;
    --border: #2b3345;
    --border-strong: #3c4759;
    --ink: #eef1f6;
    --ink-muted: #a7b1c4;
    --ink-faint: #6d7890;

    --accent: #5b9bf0;
    --accent-ink: #8ebbf7;
    --accent-soft: rgba(91, 155, 240, 0.14);
    --accent-soft-strong: rgba(91, 155, 240, 0.24);

    --niveau-legere: #5b9bf0;
    --niveau-moyenne: #e0a838;
    --niveau-grave: #f08249;
    --niveau-delit: #f0596f;

    --ok: #58c890;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; color: var(--ink); line-height: 1.25; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--ink); }
p, li { color: var(--ink-muted); }

.conteneur { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.conteneur-etroit { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- entete ---------- */
header.entete {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
header.entete .barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1080px;
  margin: 0 auto;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logo .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--accent), var(--accent-ink));
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 700;
}
nav.nav-principale {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
nav.nav-principale a {
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  text-decoration: none;
}
nav.nav-principale a:hover, nav.nav-principale a.actif {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ---------- hero ---------- */
.hero {
  padding: 56px 20px 40px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 700px 260px at 15% -10%, var(--accent-soft), transparent),
    var(--bg-alt);
}
.hero .conteneur { text-align: left; }
.hero .oeillet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-strong);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  margin: 0 0 14px;
  max-width: 18ch;
}
.hero p.lede {
  font-size: 1.08rem;
  max-width: 62ch;
  margin: 0 0 28px;
}
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primaire, .btn-secondaire {
  background: #16202f;
  color: #fff;
  border-color: #16202f;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-primaire:hover, .btn-secondaire:hover {
  text-decoration: none;
  background: linear-gradient(155deg, var(--accent), var(--accent-ink));
  border-color: var(--accent);
}

/* ---------- recherche ---------- */
.recherche-globale { position: relative; max-width: 560px; }
.recherche-globale input {
  width: 100%;
  font-size: 1rem;
  font-family: var(--font-sans);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}
.recherche-globale input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
  z-index: 30;
}
.suggestions button.ligne-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--ink);
}
.suggestions button.ligne-suggestion:last-child { border-bottom: none; }
.suggestions button.ligne-suggestion:hover { background: var(--accent-soft); }
.suggestions .titre-suggestion { font-weight: 600; display: block; }
.suggestions .meta-suggestion { color: var(--ink-faint); font-size: 0.84rem; }
.suggestions .vide { padding: 16px; color: var(--ink-faint); font-size: 0.9rem; }

/* ---------- sections / grilles ---------- */
section.section { padding: 44px 20px; }
section.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.entete-section { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.entete-section h2 { font-size: 1.5rem; margin: 0; }
.entete-section .voir-tout { font-size: 0.9rem; font-weight: 600; }

.grille-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.carte-categorie {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.carte-categorie:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-2px); }
.carte-categorie .icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.35rem;
  margin-bottom: 14px;
}
.carte-categorie h3 { font-size: 1.08rem; margin: 0 0 6px; }
.carte-categorie p { font-size: 0.88rem; margin: 0 0 12px; }
.carte-categorie .compte { font-size: 0.78rem; color: var(--ink-faint); font-weight: 600; }

/* ---------- fil d'ariane ---------- */
.fil-ariane { font-size: 0.85rem; color: var(--ink-faint); margin: 20px 0 8px; }
.fil-ariane a { color: var(--ink-faint); }

/* ---------- listes d'infractions ---------- */
.liste-infractions { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.ligne-infraction {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
}
.ligne-infraction:hover { border-color: var(--border-strong); text-decoration: none; }
.ligne-infraction .pastille-niveau {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.ligne-infraction .corps { flex: 1; min-width: 0; }
.ligne-infraction .titre-infraction { font-weight: 600; color: var(--ink); display: block; margin-bottom: 3px; }
.ligne-infraction .resume-infraction { font-size: 0.86rem; color: var(--ink-muted); }
.ligne-infraction .chevron { color: var(--ink-faint); flex: 0 0 auto; }

/* ---------- pastilles ---------- */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.pastille.points { background: rgba(200, 87, 30, 0.1); color: var(--niveau-grave); }
.pastille.neutre { background: var(--bg-alt); color: var(--ink-muted); border: 1px solid var(--border); }

/* ---------- fiche infraction ---------- */
.fiche-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 20px 0 28px;
  box-shadow: var(--shadow-card);
}
.fiche-hero .badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.fiche-hero h1 { font-size: 1.7rem; margin: 0 0 10px; }
.fiche-hero .resume { font-size: 1.02rem; color: var(--ink-muted); margin: 0 0 22px; }
.stat-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .valeur { display: block; font-family: var(--font-serif); font-size: 1.4rem; font-weight: 600; color: var(--ink); }
.stat .libelle { font-size: 0.78rem; color: var(--ink-faint); }

.bloc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 0 0 20px;
}
.bloc h2 { font-size: 1.2rem; margin: 0 0 16px; }

table.tableau-echeances { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.tableau-echeances th, table.tableau-echeances td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tableau-echeances th { color: var(--ink); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
table.tableau-echeances tr.principale td { font-weight: 600; color: var(--ink); }
table.tableau-echeances .montant { font-family: var(--font-serif); font-weight: 600; white-space: nowrap; }

.liste-sanctions { display: flex; flex-wrap: wrap; gap: 8px; }
.liste-sanctions span { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 6px 13px; font-size: 0.84rem; color: var(--ink-muted); }

.callout { background: var(--accent-soft); border: 1px solid var(--accent-soft-strong); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; }
.callout strong { display: block; margin-bottom: 4px; color: var(--accent-ink); }

.source-legale { font-size: 0.86rem; color: var(--ink-faint); }

/* ---------- guides / cartes ---------- */
.grille-guides { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grille-guides { grid-template-columns: 1fr 1fr; } }
.carte-guide { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; text-decoration: none; }
.carte-guide:hover { border-color: var(--border-strong); text-decoration: none; }
.carte-guide h3 { font-size: 1.08rem; margin: 0 0 8px; color: var(--ink); }
.carte-guide p { font-size: 0.92rem; margin: 0; }

/* ---------- simulateur ---------- */
.simulateur-grille { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 880px) { .simulateur-grille { grid-template-columns: 1.3fr 1fr; } }
.panneau-capital { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.choix-capital {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-muted);
}
.choix-capital.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.liste-simulateur { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.item-simulateur {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.item-simulateur input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; }
.item-simulateur .corps { flex: 1; min-width: 0; }
.item-simulateur .titre { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.item-simulateur .quantite { display: flex; align-items: center; gap: 6px; }
.item-simulateur .quantite button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--bg-alt); cursor: pointer; font-weight: 700; color: var(--ink); }
.item-simulateur .quantite span { min-width: 18px; text-align: center; font-weight: 700; }

.panneau-resultat {
  position: sticky;
  top: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  align-self: start;
}
.solde-jauge { text-align: center; margin-bottom: 18px; }
.solde-jauge .chiffre { font-family: var(--font-serif); font-size: 3rem; font-weight: 600; line-height: 1; }
.solde-jauge .sur { color: var(--ink-faint); font-size: 1rem; }
.statut-txt { text-align: center; font-weight: 700; margin-bottom: 6px; }
.statut-desc { text-align: center; font-size: 0.86rem; color: var(--ink-muted); margin-bottom: 18px; }
.options-simulateur { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; font-size: 0.88rem; }
.options-simulateur label { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); }

.comment-ca-marche { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 22px; }
.comment-ca-marche summary { cursor: pointer; font-weight: 600; font-size: 0.94rem; color: var(--ink); }
.comment-ca-marche .corps-explication { margin-top: 12px; font-size: 0.88rem; color: var(--ink-muted); }
.comment-ca-marche .corps-explication ul { padding-left: 20px; margin: 8px 0; }
.comment-ca-marche .corps-explication li { margin-bottom: 8px; }
.comment-ca-marche .corps-explication p { margin: 8px 0; }
.comment-ca-marche .corps-explication a { color: var(--accent); }

.formulaire-evenement { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.formulaire-evenement select { flex: 1 1 260px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-size: 0.88rem; }
.formulaire-evenement input[type="date"] { flex: 0 0 auto; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-size: 0.88rem; }
.bouton-ajouter { flex: 0 0 auto; border: none; background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 16px; font-size: 0.86rem; font-weight: 600; cursor: pointer; }

.liste-evenements { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.vide-evenements { color: var(--ink-faint); font-size: 0.86rem; margin: 0 0 8px; }
.ligne-evenement {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.84rem;
  flex-wrap: wrap;
}
.ligne-evenement .date-evenement { font-weight: 700; color: var(--ink); flex: 0 0 auto; }
.ligne-evenement .titre-evenement { flex: 1 1 160px; min-width: 0; color: var(--ink-muted); }
.ligne-evenement .points-evenement { flex: 0 0 auto; font-weight: 600; color: var(--niveau-grave); }
.ligne-evenement .recuperation-evenement { flex: 0 0 auto; font-size: 0.78rem; padding: 2px 8px; border-radius: var(--radius-full); }
.ligne-evenement .recuperation-evenement.recupere { color: var(--ok); background: rgba(30, 140, 90, .1); }
.ligne-evenement .recuperation-evenement.en-attente { color: var(--ink-faint); background: var(--bg-alt); }
.ligne-evenement .supprimer-evenement { flex: 0 0 auto; border: none; background: none; color: var(--ink-faint); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.ligne-evenement .supprimer-evenement:hover { color: var(--niveau-delit); }

.etiquette-date-sim { display: block; font-size: 0.8rem; color: var(--ink-faint); margin-bottom: 4px; }
.date-simulation { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-size: 0.9rem; margin-bottom: 18px; }

.chronologie-simulateur { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.chronologie-simulateur .titre-chronologie { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 0 0 10px; }
.etape-chronologie { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 0.82rem; }
.etape-chronologie:last-child { border-bottom: none; }
.etape-chronologie .date-etape { font-weight: 700; color: var(--ink); }
.etape-chronologie .detail-etape { color: var(--ink-muted); }
.etape-chronologie .statut-etape { font-size: 0.78rem; }
.etape-chronologie.recupere .statut-etape { color: var(--ok); }
.etape-chronologie.en-attente .statut-etape { color: var(--ink-faint); }

/* Prévisions de récupération : trajectoire complète (une étape par date de
   récupération encore en attente, solde résultant inclus) — distincte de la
   chronologie ci-dessus, qui liste chaque INFRACTION (passée ou future) sans
   indiquer le solde résultant. Fond légèrement teinté "ok" pour signaler
   qu'il s'agit de bonnes nouvelles à venir, pas d'un historique neutre. */
.previsions-simulateur { border: 1px solid var(--border); background: color-mix(in srgb, var(--ok) 6%, var(--bg-alt)); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.previsions-simulateur .titre-previsions { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 0 0 8px; }
.etape-prevision { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 0.82rem; }
.etape-prevision:last-child { border-bottom: none; }
.etape-prevision .date-etape { font-weight: 700; color: var(--ink); }
.etape-prevision .detail-etape { color: var(--ok); font-weight: 600; }

/* ---------- footer ---------- */
footer.pied { border-top: 1px solid var(--border); padding: 36px 20px 48px; margin-top: 24px; }
footer.pied .grille-pied { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 24px; }
@media (min-width: 640px) { footer.pied .grille-pied { grid-template-columns: 2fr 1fr 1fr; } }
footer.pied h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 0 0 12px; }
footer.pied ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
footer.pied a { color: var(--ink-muted); font-size: 0.9rem; }
footer.pied .mention-bas { border-top: 1px solid var(--border); padding-top: 18px; font-size: 0.8rem; color: var(--ink-faint); }

.avertissement { font-size: 0.84rem; color: var(--ink-faint); background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 24px 0; }

.erreur { color: var(--niveau-delit); }

@media (max-width: 640px) {
  nav.nav-principale a { padding: 6px 9px; font-size: .84rem; }
  .fiche-hero, .bloc { padding: 18px; }
}
