/* itineraire.org — feuille de style unique (≈9 Ko).
   Palette inspirée de la signalisation routière française :
   bleu autoroute, vert route nationale, jaune borne kilométrique. */

:root {
  --bleu: #0b4ea2;
  --bleu-fonce: #083a7a;
  --vert: #1d7a46;
  --jaune: #f5c518;
  --encre: #17212b;
  --texte-2: #536171;
  --papier: #ffffff;
  --gris: #f2f4f7;
  --ligne: #d9dee5;
  --focus: #f5c518;
  --rayon: 6px;
  --mesure: 72ch;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  font-family: var(--police);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--encre);
  background: var(--papier);
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--bleu); text-underline-offset: 2px; }
a:hover { color: var(--bleu-fonce); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 700; margin-top: 2em; }
h3 { font-size: 1.15rem; font-weight: 600; margin-top: 1.5em; }
p, ul, ol, table { margin: 0 0 1em; }
.prose { max-width: var(--mesure); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.3em; }
small, .discret { color: var(--texte-2); font-size: 0.9rem; }

.conteneur { width: min(100% - 2rem, 1120px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--jaune); color: var(--encre); padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }

/* En-tête */
.entete { border-bottom: 1px solid var(--ligne); background: var(--papier); }
.entete .conteneur { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; color: var(--encre); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav a { display: block; padding: 0.5rem 0.7rem; text-decoration: none; color: var(--encre); border-radius: var(--rayon); font-size: 0.97rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--gris); color: var(--bleu-fonce); }
.burger { display: none; background: none; border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 0.45rem 0.7rem; font: inherit; cursor: pointer; }
@media (max-width: 820px) {
  .burger { display: inline-block; }
  .nav { display: none; width: 100%; }
  .nav.ouvert { display: block; }
  .nav ul { flex-direction: column; padding-bottom: 0.75rem; }
  .entete .conteneur { flex-wrap: wrap; }
}

/* Fil d'Ariane */
.ariane { font-size: 0.9rem; color: var(--texte-2); margin-block: 1rem 1.5rem; }
.ariane ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ariane li + li::before { content: "›"; margin-right: 0.35rem; color: var(--ligne); }
.ariane a { color: var(--texte-2); }

/* Panneau (élément signature) : le calculateur ressemble à un panneau d'autoroute */
.panneau {
  background: var(--bleu);
  color: #fff;
  border-radius: 14px;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  box-shadow: inset 0 0 0 4px var(--bleu), inset 0 0 0 7px #fff;
  margin: 1.5rem 0 2rem;
}
.panneau h1, .panneau h2, .panneau p { color: #fff; }
.panneau p { opacity: 0.92; max-width: 60ch; }
.panneau a { color: #fff; }
.formulaire { display: grid; gap: 0.75rem; grid-template-columns: 1fr auto 1fr auto auto; align-items: end; margin-top: 1.25rem; }
.formulaire label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; opacity: 0.95; }
.formulaire input, .formulaire select {
  width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 0; border-radius: var(--rayon);
  background: #fff; color: var(--encre); min-height: 46px;
}
.formulaire button {
  font: inherit; font-weight: 700; padding: 0.7rem 1.2rem; border: 0; border-radius: var(--rayon);
  background: var(--jaune); color: var(--encre); cursor: pointer; min-height: 46px;
}
.formulaire button:hover { background: #e3b512; }
@media (max-width: 720px) {
  .formulaire { grid-template-columns: 1fr auto; }
  .formulaire .champ-arrivee, .formulaire .champ-mode, .formulaire button[type=submit] { grid-column: 1 / -1; }
}
.inverser { background: transparent !important; color: #fff !important; border: 2px solid rgba(255,255,255,0.6) !important; }
.inverser:hover { border-color: #fff !important; }

/* Carte */
.carte[hidden] { display: none; }
.carte {
  width: 100%; aspect-ratio: 16 / 9; min-height: 280px; max-height: 560px;
  background: var(--gris) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23d9dee5' stroke-width='1'/%3E%3C/svg%3E");
  border: 1px solid var(--ligne); border-radius: var(--rayon); position: relative; isolation: isolate;
}
.carte::before {
  content: attr(data-placeholder); position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--texte-2); font-size: 0.95rem; pointer-events: none;
}
.carte.leaflet-container::before { display: none; }
.carte.leaflet-container { background: #e9edf2; }

/* Résultat du calcul */
.resultat { margin-top: 1rem; }
.resultat[hidden] { display: none; }
.resume { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.borne {
  background: #fff; color: var(--encre); border: 1px solid var(--ligne); border-top: 10px solid var(--jaune);
  border-radius: var(--rayon); padding: 0.75rem 1.1rem; min-width: 150px;
}
.borne b { display: block; font-size: 1.6rem; line-height: 1.1; }
.borne span { color: var(--texte-2); font-size: 0.85rem; }
.borne.vert { border-top-color: var(--vert); }
.borne.bleu { border-top-color: var(--bleu); }
.etapes { max-height: 320px; overflow: auto; border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 0.75rem 1rem 0.75rem 2rem; font-size: 0.95rem; }
.alerte { background: #fff8db; border: 1px solid #f0d56b; border-radius: var(--rayon); padding: 0.7rem 1rem; }

/* Tableaux de faits */
.faits { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.faits th, .faits td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--ligne); vertical-align: top; }
.faits th { width: 34%; color: var(--texte-2); font-weight: 600; }
.faits.compare th { width: auto; }
.faits.compare thead th { color: var(--encre); background: var(--gris); }
.defiler { overflow-x: auto; margin-bottom: 1.5rem; }

/* Grilles de liens (pages hub) */
.grille { display: grid; gap: 1rem 2rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 1rem 0 2rem; }
.grille h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.grille ul { list-style: none; margin: 0; padding: 0; }
.grille li { padding: 0.15rem 0; font-size: 0.97rem; }
.colonnes { columns: 3 220px; column-gap: 2rem; list-style: none; padding: 0; margin: 1rem 0 2rem; }
.colonnes li { break-inside: avoid; padding: 0.15rem 0; }

/* Blocs de section hub sur l'accueil */
.rubriques { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 1.5rem 0; }
.rubrique { border-left: 4px solid var(--bleu); padding: 0.25rem 0 0.25rem 1rem; }
.rubrique.vert { border-left-color: var(--vert); }
.rubrique.jaune { border-left-color: var(--jaune); }
.rubrique h2, .rubrique h3 { margin-top: 0; font-size: 1.15rem; }
.rubrique p { margin-bottom: 0.4rem; font-size: 0.97rem; }

/* FAQ */
details { border-top: 1px solid var(--ligne); padding: 0.5rem 0; }
details:last-of-type { border-bottom: 1px solid var(--ligne); }
summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
details p { margin: 0.25rem 0 0.75rem; }

/* Encadré */
.encadre { background: var(--gris); border-radius: var(--rayon); padding: 1rem 1.25rem; margin: 1.5rem 0; }
.encadre p:last-child { margin-bottom: 0; }

/* Boutons */
.bouton { display: inline-block; background: var(--bleu); color: #fff; text-decoration: none; padding: 0.65rem 1.1rem; border-radius: var(--rayon); font-weight: 600; }
.bouton:hover { background: var(--bleu-fonce); color: #fff; }
.bouton.secondaire { background: var(--gris); color: var(--encre); }

/* Pied de page */
.pied { margin-top: 4rem; border-top: 1px solid var(--ligne); background: var(--gris); padding: 2rem 0; font-size: 0.93rem; color: var(--texte-2); }
.pied .conteneur { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pied h2 { font-size: 1rem; margin: 0 0 0.5rem; color: var(--encre); }
.pied ul { list-style: none; margin: 0; padding: 0; }
.pied li { padding: 0.15rem 0; }
.pied a { color: var(--texte-2); }
.pied .mentions { grid-column: 1 / -1; border-top: 1px solid var(--ligne); padding-top: 1rem; }

/* Leaflet : neutraliser la police et ajuster les contrôles */
.leaflet-container { font-family: var(--police); }
.leaflet-popup-content { font-size: 0.95rem; }
