/* Les Rames. Vocabulaire visuel : la plaque émaillée (bleu nuit, filet blanc), la faïence blanche,
   et le tableau lumineux des quais (chiffres ambre sur fond sombre) pour les prochains départs. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/polices/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/polices/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/polices/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("/polices/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Doto"; font-weight: 900; font-display: swap; src: url("/polices/doto-latin-900-normal.woff2") format("woff2"); }

:root {
  --email: #152a5e;
  --email-fonce: #0c1838;
  --faience: #f6f8f7;
  --blanc: #ffffff;
  --joint: #d6dcda;
  --encre: #18203a;
  --gris: #5b6780;
  --voyant: #ffb300;
  --alerte: #c8102e;
  --calme: #1b8a5a;
  --or: #e7b415;
  --surface: var(--faience);
  --surface-2: var(--blanc);
  --texte: var(--encre);
  --texte-2: var(--gris);
  --filet: var(--joint);
  --ombre: 0 6px 24px rgba(12, 24, 56, .18);
  --haut-sur: env(safe-area-inset-top, 0px);
  --bas-sur: env(safe-area-inset-bottom, 0px);
  --titre: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --corps: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="sombre"] {
  --surface: #101b3d;
  --surface-2: #17244d;
  --texte: #eef1f8;
  --texte-2: #a5b0cc;
  --filet: #2a3966;
  --ombre: 0 6px 24px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font: 400 16px/1.4 var(--corps); color: var(--texte); background: var(--email-fonce); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--voyant); outline-offset: 2px; }
[hidden] { display: none !important; }

#carte, #rames { position: fixed; inset: 0; width: 100%; height: 100%; }
#rames { pointer-events: none; }
.maplibregl-ctrl-bottom-right { bottom: calc(4px + var(--bas-sur)); }
.maplibregl-ctrl-attrib { font: 400 11px/1.3 var(--corps); }

/* ── Haut : la plaque ── */
#haut { position: fixed; top: calc(10px + var(--haut-sur)); left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5; }
#haut > * { pointer-events: auto; }
#plaque { display: flex; align-items: baseline; gap: 12px; padding: 7px 14px 8px; background: var(--email); color: #fff; border-radius: 9px; box-shadow: var(--ombre), inset 0 0 0 2px var(--email), inset 0 0 0 3.5px rgba(255, 255, 255, .85); }
#marque { font: 600 21px/1 var(--titre); letter-spacing: .01em; }
#heure { font: 500 16px/1 var(--corps); font-variant-numeric: tabular-nums; opacity: .92; }
#direct { margin-right: auto; padding: 7px 12px; border-radius: 999px; background: var(--voyant); color: #2a1c00; font-weight: 600; font-size: 14px; box-shadow: var(--ombre); }
#b-menu { margin-left: auto; }

.rond { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--texte); box-shadow: var(--ombre); display: grid; place-items: center; flex: none; }
.rond svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rond svg .plein { fill: currentColor; stroke: none; }
.rond.petit { width: 36px; height: 36px; box-shadow: none; background: transparent; }
.rond.actif { background: var(--email); color: #fff; }
:root[data-theme="sombre"] .rond.actif { background: var(--voyant); color: #2a1c00; }

/* ── Modes et vitesse ── */
#modes { position: fixed; top: calc(62px + var(--haut-sur)); left: 10px; right: 10px; display: flex; gap: 5px; z-index: 4; flex-wrap: wrap; pointer-events: none; }
.mode { pointer-events: auto; }
.mode { display: flex; align-items: center; gap: 5px; padding: 6px 10px 6px 8px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--ombre); font-weight: 500; font-size: 14px; }
.mode .pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--email); }
.mode small { font-size: 13px; color: var(--texte-2); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; }
.mode[aria-pressed="false"] { opacity: .62; }
.mode[aria-pressed="false"] .pastille { background: transparent; box-shadow: inset 0 0 0 1.5px var(--texte-2); }
:root[data-theme="sombre"] .mode .pastille { background: var(--voyant); }

#b-vitesse { font: 600 16px/1 var(--titre); font-variant-numeric: tabular-nums; }

#outils { position: fixed; right: 10px; top: calc(112px + var(--haut-sur)); display: flex; flex-direction: column; gap: 8px; z-index: 4; }

/* ── La feuille (bas d'écran sur téléphone, colonne à gauche sur grand écran) ── */
#feuille { position: fixed; left: 0; right: 0; bottom: 0; max-height: 58vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(12, 24, 56, .22); z-index: 8; padding-bottom: var(--bas-sur); transition: transform .22s ease; }
#feuille.repliee { transform: translateY(calc(100% - 74px - var(--bas-sur))); }
#poignee { height: 18px; flex: none; display: grid; place-items: center; }
#poignee::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--filet); }
#feuille-tete { display: flex; align-items: flex-start; gap: 8px; padding: 0 10px 10px 16px; flex: none; }
#feuille-titre { flex: 1; min-width: 0; font: 600 23px/1.15 var(--titre); padding-top: 4px; }
#feuille-titre .sous { display: block; font: 400 14.5px/1.3 var(--corps); color: var(--texte-2); margin-top: 3px; }
#feuille-corps { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 18px; overscroll-behavior: contain; }
@media (min-width: 900px) {
  #feuille { left: 10px; right: auto; top: calc(112px + var(--haut-sur)); bottom: 10px; width: 400px; max-height: none; border-radius: 16px; box-shadow: var(--ombre); }
  #feuille.repliee { transform: none; }
  #poignee { display: none; }
  #feuille-tete { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) { #feuille { transition: none; } }

/* ── Indices de ligne ── */
.indice { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; font: 600 15px/1 var(--titre); flex: none; vertical-align: middle; }
.indice.rer, .indice.train { border-radius: 6px; }
.indice.tram, .indice.navette { border-radius: 4px; padding: 0 6px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(255, 255, 255, .55); }
.indice.grand { min-width: 34px; height: 34px; border-radius: 17px; font-size: 19px; }
.indice.grand.rer, .indice.grand.train { border-radius: 8px; }
.indice.grand.tram, .indice.grand.navette { border-radius: 5px; }
.indices { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── Boutons et listes ── */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.bouton { padding: 9px 14px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--filet); font-weight: 500; font-size: 15px; }
.bouton.principal { background: var(--email); color: #fff; box-shadow: none; }
.bouton.actif { box-shadow: inset 0 0 0 2px var(--email); }
:root[data-theme="sombre"] .bouton.principal { background: var(--voyant); color: #2a1c00; }
:root[data-theme="sombre"] .bouton.actif { box-shadow: inset 0 0 0 2px var(--voyant); }
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li > button, .liste > li > .rangee { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 2px; border-bottom: 1px solid var(--filet); min-height: 46px; }
.liste .nom { flex: 1; min-width: 0; }
.liste .nom small { display: block; color: var(--texte-2); font-size: 13.5px; }
.liste .droite { color: var(--texte-2); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rubrique { font: 600 16px/1.2 var(--titre); color: var(--texte-2); margin: 18px 0 2px; }
.note { color: var(--texte-2); font-size: 14px; margin: 10px 0 0; }
.vide { color: var(--texte-2); padding: 14px 0; }
.signal { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--alerte); margin-left: 6px; vertical-align: middle; }
.signal.leger { background: var(--voyant); }

/* ── Le tableau des départs ── */
.tableau { background: var(--email-fonce); color: #fff; border-radius: 12px; padding: 4px 12px; margin-top: 4px; }
.tableau .depart { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .11); }
.tableau .depart:last-child { border-bottom: 0; }
.tableau .vers { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tableau .vers small { color: #9fb0d8; font-weight: 400; margin-left: 6px; font-size: 13px; }
.tableau .minutes { display: flex; align-items: baseline; gap: 12px; font: 900 26px/1 "Doto", var(--corps); color: var(--voyant); font-variant-numeric: tabular-nums; text-shadow: 0 0 7px rgba(255, 179, 0, .55); }
.tableau .minutes span + span { opacity: .8; font-size: 22px; }
.tableau .minutes .unite { font: 500 12.5px/1 var(--corps); color: #9fb0d8; opacity: 1; margin-left: -6px; text-shadow: none; }
.tableau .minutes .heure { font: 600 19px/1 var(--titre); text-shadow: none; }
.tableau .retard { color: #ff8a80; font: 500 12.5px/1 var(--corps); margin-left: 6px; }
.source-horaires { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--texte-2); margin: 10px 0 0; }
.source-horaires::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--texte-2); flex: none; }
.source-horaires.reel::before { background: var(--calme); }

/* ── Fiche d'une rame ── */
.etat-rame { font-size: 16px; margin: 0 0 8px; }
.etat-rame b { font-weight: 600; }
.parcours-rame { list-style: none; margin: 8px 0 0; padding: 0; }
.parcours-rame li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 7px 0 7px 22px; }
.parcours-rame li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 4px; background: var(--trait, var(--email)); }
.parcours-rame li:first-child::before { top: 50%; }
.parcours-rame li:last-child::before { bottom: 50%; }
.parcours-rame li::after { content: ""; position: absolute; left: 1px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 3px var(--trait, var(--email)); }
.parcours-rame button { text-align: left; flex: 1; min-width: 0; }
.parcours-rame time { color: var(--texte-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.parcours-rame li.prochain time { color: var(--texte); font-weight: 600; }

/* ── Recherche, itinéraire ── */
.champ { display: flex; align-items: center; gap: 8px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--filet); border-radius: 10px; padding: 0 12px; margin: 6px 0; }
.champ label { color: var(--texte-2); font-size: 14px; white-space: nowrap; }
.champ input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: inherit; padding: 11px 0; outline: none; }
.champ:focus-within { box-shadow: inset 0 0 0 2px var(--email); }
:root[data-theme="sombre"] .champ:focus-within { box-shadow: inset 0 0 0 2px var(--voyant); }
.trajet { background: var(--surface-2); border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--filet); padding: 12px 14px; margin: 10px 0; }
.trajet.choisi { box-shadow: inset 0 0 0 2px var(--email); }
:root[data-theme="sombre"] .trajet.choisi { box-shadow: inset 0 0 0 2px var(--voyant); }
.trajet-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; text-align: left; }
.trajet-tete .heures { font: 600 19px/1.2 var(--titre); font-variant-numeric: tabular-nums; }
.trajet-tete .duree { color: var(--texte-2); white-space: nowrap; }
.trajet .resume { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: var(--texte-2); font-size: 14px; }
.trajet .etapes { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--filet); }
.trajet .etapes li { display: grid; grid-template-columns: 34px 1fr; gap: 4px 8px; padding: 6px 0; font-size: 15px; }
.trajet .etapes small { color: var(--texte-2); display: block; }

/* ── Jeu ── */
.jeu-score { display: flex; gap: 18px; align-items: baseline; margin: 6px 0 10px; }
.jeu-score .chrono { font: 600 38px/1 var(--titre); color: var(--email); font-variant-numeric: tabular-nums; }
:root[data-theme="sombre"] .jeu-score .chrono { color: var(--voyant); }
.indices-jeu { margin: 0; padding-left: 20px; }
.indices-jeu li { margin: 4px 0; }

/* ── Vue embarquée, attente, bulle ── */
#embarque { position: fixed; left: 10px; right: 10px; bottom: calc(14px + var(--bas-sur)); z-index: 9; background: var(--email-fonce); color: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--ombre); display: flex; align-items: center; gap: 12px; }
#embarque .texte { flex: 1; min-width: 0; }
#embarque .texte b { display: block; font: 600 18px/1.2 var(--titre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#embarque .texte span { color: #b9c5e6; font-size: 14.5px; }
#embarque .compte { font: 600 28px/1 var(--titre); color: var(--voyant); white-space: nowrap; font-variant-numeric: tabular-nums; }
#embarque .bouton { background: rgba(255, 255, 255, .12); box-shadow: none; color: #fff; }
@media (min-width: 900px) { #embarque { left: 50%; right: auto; width: 520px; transform: translateX(-50%); } }

#attente { position: fixed; inset: 0; z-index: 20; background: var(--email-fonce); color: #fff; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px; text-align: center; transition: opacity .35s ease; }
#attente.fini { opacity: 0; pointer-events: none; }
.attente-plaque { padding: 14px 26px 16px; background: var(--email); border-radius: 12px; box-shadow: inset 0 0 0 3px var(--email), inset 0 0 0 5px rgba(255, 255, 255, .85); font: 600 38px/1 var(--titre); }
#attente-texte { margin: 0; color: #c3cdea; max-width: 30em; }

#bulle { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--bas-sur)); z-index: 30; background: var(--email-fonce); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--ombre); max-width: calc(100vw - 40px); text-align: center; font-size: 15px; }

/* ── Textes longs (à propos) ── */
.prose p { margin: 10px 0; max-width: 62ch; }
.prose a { color: inherit; }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--filet); }
.segments { display: flex; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--filet); border-radius: 999px; padding: 3px; }
.segments button { padding: 5px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 500; color: var(--texte-2); }
.segments button.actif { background: var(--email); color: #fff; }
