/* Silk Road 2027 — feuille unique.
   Palette tirée des céramiques de Samarcande et de Boukhara : lapis profond, turquoise des
   coupoles, safran des briques au soleil, garance des tapis pour ce qui alerte. Fond gris
   minéral (pas crème). Typographie système : le site doit s'ouvrir vite sur une eSIM lente,
   et les polices Google ne passent pas en Chine. */

:root {
  --encre: #1B2A44;
  --texte: #1B2A44;
  --texte-doux: #4A586C;
  --lapis: #2B55A3;
  --turquoise: #17877E;
  --safran: #C98A1C;
  --garance: #A83246;
  --papier: #F1F3EF;
  --surface: #FFFFFF;
  --trait: #CDD4D0;
  --trait-fort: #9AA6A0;
  --ombre: 0 1px 2px rgba(27, 42, 68, .08);
  --rayon: 10px;
  --police: "Segoe UI Variable Text", "SF Pro Text", -apple-system, system-ui, "Noto Sans", sans-serif;
  --police-titre: "Segoe UI Variable Display", "SF Pro Display", -apple-system, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --encre: #0F1626;
    --texte: #E5E9EF;
    --texte-doux: #A9B4C3;
    --lapis: #86A8EA;
    --turquoise: #4CC1B5;
    --safran: #E8B24F;
    --garance: #E1677C;
    --papier: #131B2B;
    --surface: #1A2437;
    --trait: #2E3A50;
    --trait-fort: #4A5872;
    --ombre: none;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--texte);
  font: 400 1.0625rem/1.6 var(--police);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--lapis); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--safran); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--police-titre); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); font-weight: 700; margin: .2em 0 .35em; }
h2 { font-size: 1.45rem; font-weight: 650; margin: 1.8em 0 .5em; }
h3 { font-size: 1.15rem; font-weight: 650; margin: 1.4em 0 .4em; }

code { font-size: .9em; }

/* ── En-tête et navigation ─────────────────────────────────────────────── */

.entete {
  background: var(--encre);
  color: #E9EDF3;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem clamp(1rem, 3vw, 2rem);
}

.marque {
  display: flex; align-items: center; gap: .55rem;
  color: #fff; text-decoration: none; font-weight: 700; font-family: var(--police-titre);
  font-size: 1.1rem; white-space: nowrap;
}
.marque svg { width: 30px; height: 30px; color: #6FD3C8; }

.nav { display: flex; gap: .25rem; flex: 1; }
.nav a {
  color: #C8D1DE; text-decoration: none; padding: .45rem .7rem; border-radius: 8px;
  font-size: .97rem; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(111, 211, 200, .18); }
.nav .ico { display: none; }

.compte { display: flex; gap: .9rem; align-items: center; font-size: .9rem; color: #AEB9C8; white-space: nowrap; }
.compte a, .compte .lien { color: #C8D1DE; }

/* Mobile : barre d'onglets en bas, au pouce. */
@media (max-width: 760px) {
  .entete { padding: .6rem 1rem; gap: .75rem; justify-content: space-between; }
  .compte span { display: none; }
  .nav {
    position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
    background: var(--encre); justify-content: space-around; gap: 0;
    padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .nav a { display: flex; flex-direction: column; align-items: center; font-size: .72rem; padding: .25rem .4rem; gap: .05rem; }
  .nav .ico { display: block; font-size: 1.25rem; line-height: 1.2; }
  .nav .nav-large { display: none; }
  body { padding-bottom: 4.6rem; }
}

/* ── Mise en page ──────────────────────────────────────────────────────── */

main.page { width: 100%; max-width: 68rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem; flex: 1; }
main.page-dossier { max-width: 78rem; }

.chapeau { font-size: 1.15rem; color: var(--texte-doux); max-width: 44rem; margin-top: 0; }
.vide { color: var(--texte-doux); font-style: italic; }
.note-discrete, .aide { color: var(--texte-doux); font-size: .9rem; }

.pied {
  display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center;
  padding: 1.2rem 1rem; font-size: .85rem; color: var(--texte-doux);
}
.pied a { color: var(--texte-doux); }

/* ── Boutons et formulaires ────────────────────────────────────────────── */

.bouton, .bouton-secondaire {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border-radius: 999px; padding: .65rem 1.3rem; border: 2px solid transparent;
}
.bouton { background: var(--turquoise); color: #fff; }
.bouton:hover { filter: brightness(1.08); }
.bouton-grand { font-size: 1.25rem; padding: 1rem 2rem; width: 100%; margin-top: .8rem; }
.bouton-secondaire { background: transparent; color: var(--lapis); border-color: currentColor; padding: .45rem 1rem; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--lapis); text-decoration: underline; cursor: pointer; }
.compte .lien { font-size: .9rem; }
button:disabled { opacity: .55; cursor: progress; }

.formulaire { display: grid; gap: .35rem; max-width: 34rem; }
.formulaire label { font-weight: 600; font-size: .95rem; margin-top: .6rem; }
.formulaire label.case { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
.formulaire input:not([type="checkbox"]), .formulaire select, .formulaire textarea {
  font: inherit; color: var(--texte); background: var(--surface);
  border: 1.5px solid var(--trait-fort); border-radius: 8px; padding: .6rem .7rem; width: 100%;
}
.formulaire textarea { resize: vertical; }
.formulaire .bouton, .formulaire .bouton-secondaire { justify-self: start; margin-top: .8rem; }
.formulaire .bouton-grand { justify-self: stretch; }
.formulaire-ligne { grid-template-columns: auto 1fr auto; align-items: end; gap: .6rem; }
.formulaire-ligne label { margin: 0 0 .6rem; }
.formulaire-ligne .bouton { margin: 0; }
@media (max-width: 560px) { .formulaire-ligne { grid-template-columns: 1fr; } }
.erreur { color: var(--garance); font-weight: 600; margin: .4rem 0 0; }

.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%);
  background: var(--encre); color: #fff; padding: .7rem 1.2rem; border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0,0,0,.25); z-index: 2000; max-width: 90vw;
}
.toast.erreur-toast { background: var(--garance); }

/* ── Accueil ───────────────────────────────────────────────────────────── */

.hero { padding: 1rem 0 .5rem; }
.hero h1 { max-width: 18ch; }

.statut {
  margin-top: 1.4rem; padding: 1.2rem 1.4rem; background: var(--surface);
  border-left: 5px solid var(--turquoise); border-radius: 0 var(--rayon) var(--rayon) 0;
  box-shadow: var(--ombre); max-width: 46rem;
}
.statut-principal { font-size: 1.3rem; margin: 0; }
.statut-detail { margin: .3rem 0 0; color: var(--texte-doux); }
.statut .bouton { margin-top: 1rem; }

.raccourcis { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 2rem 0 0; }
.raccourci {
  display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem;
  text-decoration: none; color: var(--texte-doux); border: 1.5px solid var(--trait);
  border-radius: var(--rayon); font-size: .95rem;
}
.raccourci:hover { border-color: var(--lapis); }
.r-chiffre { font: 700 2.2rem/1 var(--police-titre); color: var(--safran); }
.r-titre { font-weight: 650; color: var(--texte); font-size: 1.05rem; }

/* La ligne — le parcours dessiné comme une ligne de train, une station par étape. */
.ligne-section h2 { margin-bottom: .2rem; }
.legende { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; color: var(--texte-doux); font-size: .88rem; margin: 0 0 1rem; }
.leg { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--lapis); background: var(--surface); margin-right: -.45rem; vertical-align: -2px; }
.leg-pointee { background: var(--lapis); }
.leg-prochaine { border-color: var(--safran); background: var(--safran); }
.leg-papa { border-radius: 2px; width: 7px; height: 16px; border: 0; background: var(--turquoise); }
.leg-pointage { background: var(--garance); border-color: #fff; }

.ligne { list-style: none; margin: 0; padding: 0; --x: 1.3rem; }
.ligne li { position: relative; padding-left: calc(var(--x) + 1.3rem); }
.ligne li::before { /* le rail */
  content: ""; position: absolute; left: calc(var(--x) - 2px); top: 0; bottom: 0;
  width: 4px; background: var(--trait-fort);
}
.ligne li:first-child::before { top: 50%; }
.ligne li:last-child::before { bottom: 50%; }
.ligne li.avec-papa::before { width: 10px; left: calc(var(--x) - 5px); background: var(--turquoise); }
.ligne-pays {
  font-weight: 650; color: var(--texte-doux); font-size: .9rem; padding-top: 1.1rem; padding-bottom: .2rem;
}
.station { padding-top: .5rem; padding-bottom: .5rem; }
.station .point {
  position: absolute; left: calc(var(--x) - 9px); top: .95rem;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--lapis);
}
.station.est-pointee .point { background: var(--lapis); }
.station.est-prochaine .point { background: var(--safran); border-color: var(--safran); }
.station.est-prochaine .point::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid var(--safran); animation: onde 2.4s ease-out infinite;
}
.station.en-retard .point { border-color: var(--garance); }
@keyframes onde { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .station.est-prochaine .point::after { animation: none; opacity: .6; } }

.station-texte { display: flex; flex-direction: column; }
.station-nom { font-weight: 650; font-size: 1.08rem; }
.station.est-prochaine .station-nom { color: var(--safran); }
.station-meta { color: var(--texte-doux); font-size: .88rem; }
.station-note { font-size: .92rem; color: var(--texte-doux); max-width: 40rem; }
.retard { color: var(--garance); }

/* ── Dossier ───────────────────────────────────────────────────────────── */

.dossier-grille { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.sommaire { position: sticky; top: 1rem; font-size: .92rem; max-height: calc(100vh - 2rem); overflow: auto; }
.sommaire summary { font-weight: 650; cursor: pointer; margin-bottom: .4rem; }
.sommaire ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.sommaire a { color: var(--texte-doux); text-decoration: none; }
.sommaire a:hover { color: var(--lapis); text-decoration: underline; }
@media (max-width: 900px) {
  .dossier-grille { grid-template-columns: 1fr; gap: 1rem; }
  .sommaire { position: static; max-height: none; background: var(--surface); padding: .8rem 1rem; border-radius: var(--rayon); }
  .sommaire details:not([open]) summary { margin: 0; }
}

.prose { max-width: 50rem; min-width: 0; }
.prose h1 { margin-top: 0; }
.prose h2 { border-top: 1px solid var(--trait); padding-top: 1.4rem; }
.prose p, .prose li { max-width: 44rem; }
.prose blockquote {
  margin: 1rem 0; padding: .8rem 1.1rem; background: var(--surface);
  border-left: 4px solid var(--safran); border-radius: 0 8px 8px 0; color: var(--texte-doux);
}
.prose blockquote p { margin: .3rem 0; }
.prose pre {
  overflow-x: auto; background: var(--encre); color: #DDE6F2; padding: 1rem;
  border-radius: var(--rayon); font-size: .8rem; line-height: 1.45;
}
.prose table { border-collapse: collapse; width: 100%; font-size: .93rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--trait); padding: .5rem .6rem; text-align: left; vertical-align: top; }
.prose th { background: var(--surface); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--trait); margin: 2rem 0; }
.hors-ligne-note { font-size: .85rem; color: var(--texte-doux); margin: 0 0 1rem; }

/* ── Carte ─────────────────────────────────────────────────────────────── */

main.page-carte { flex: 1; display: flex; flex-direction: column; width: 100%; }
.carte-entete { padding: 1rem clamp(1rem, 3vw, 2rem) .5rem; }
.carte-entete h1 { margin: 0 0 .3rem; font-size: 1.6rem; }
.carte-entete .legende, .carte-entete .note-discrete { margin: 0; }
.carte { flex: 1; min-height: 70vh; width: 100%; }
.trait { display: inline-block; width: 22px; height: 0; border-top: 4px solid var(--lapis); vertical-align: middle; margin-right: -.45rem; }
.trait-bus { border-top-color: var(--safran); }
.trait-ferry { border-top: 4px dashed var(--turquoise); }
.trait-avion { border-top: 3px dotted var(--garance); }
.trait-papa { border-top: 9px solid rgba(23, 135, 126, .35); }

/* ── Pointages ─────────────────────────────────────────────────────────── */

.pointer { background: var(--surface); padding: 1.3rem 1.4rem 1.5rem; border-radius: var(--rayon); box-shadow: var(--ombre); max-width: 40rem; }
.pointer h1 { margin-top: 0; }
.decalage { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--trait); }
.decalage p { margin: 0 0 .6rem; }
.boutons { display: flex; flex-wrap: wrap; gap: .6rem; }

.historique { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; max-width: 46rem; }
.historique li { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px solid var(--trait); }
.h-quand { color: var(--texte-doux); font-size: .88rem; min-width: 11rem; }
.h-ou { font-weight: 650; }
.h-message { flex-basis: 100%; }
.historique-compact li { padding: .2rem 0; font-size: .85rem; }

/* ── Journal ───────────────────────────────────────────────────────────── */

.nouveau-billet { margin: 1rem 0 2rem; }
.nouveau-billet summary { list-style: none; }
.nouveau-billet summary::-webkit-details-marker { display: none; }
.nouveau-billet[open] summary { margin-bottom: 1rem; }
.billet { padding: 1.4rem 0 1.8rem; border-bottom: 1px solid var(--trait); max-width: 52rem; }
.billet h2 { margin: 0; }
.billet-meta { color: var(--texte-doux); margin: .2rem 0 .8rem; font-size: .92rem; }
.billet-texte p { max-width: 42rem; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; margin: 1rem 0; }
.galerie img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }

/* ── Veille ────────────────────────────────────────────────────────────── */

.veille { list-style: none; padding: 0; display: grid; gap: 1.2rem; max-width: 52rem; }
.point-veille { background: var(--surface); border-radius: var(--rayon); padding: 1.1rem 1.3rem; border-left: 6px solid var(--trait-fort); box-shadow: var(--ombre); }
.crit-rouge { border-left-color: var(--garance); }
.crit-orange { border-left-color: var(--safran); }
.crit-jaune { border-left-color: var(--lapis); }
.statut-ok { opacity: .75; }
.pv-tete { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.pv-tete h2 { margin: 0; font-size: 1.18rem; }
.pastille { font-size: .8rem; font-weight: 650; white-space: nowrap; padding: .15rem .6rem; border-radius: 999px; background: var(--papier); }
.crit-rouge .pastille { color: var(--garance); }
.crit-orange .pastille { color: var(--safran); }
.point-veille dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: .6rem 0; }
.point-veille dt { font-weight: 650; color: var(--texte-doux); }
.point-veille dd { margin: 0; }
.pv-statut { font-weight: 600; }
.statut-probleme .pv-statut { color: var(--garance); }
.pv-maj { font-size: .82rem; color: var(--texte-doux); margin: .5rem 0 0; }
@media (max-width: 560px) { .point-veille dl { grid-template-columns: 1fr; } }

/* ── Réglages ──────────────────────────────────────────────────────────── */

.tableau { border-collapse: collapse; font-size: .9rem; width: 100%; max-width: 52rem; }
.tableau th, .tableau td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--trait); }

/* ── Connexion ─────────────────────────────────────────────────────────── */

.page-connexion { background: var(--encre); color: #E9EDF3; justify-content: center; }
.connexion { width: 100%; max-width: 24rem; margin: 0 auto; padding: 2rem 1.2rem; }
.connexion-trace { width: 100%; color: #6FD3C8; margin-bottom: 1rem; }
.connexion h1 { margin: 0; color: #fff; }
.connexion p { color: #AEB9C8; margin-top: .2rem; }
.connexion .formulaire input { background: #fff; color: #1B2A44; border-color: transparent; }
.connexion .formulaire .bouton { justify-self: stretch; margin-top: 1.2rem; }
.connexion .erreur { color: #FF9AAB; }
