/* Muvimu — système visuel commun au site et à l'application
   Direction : posé, précis, insulaire. Surfaces neutres, un seul accent (vert maquis),
   la ligne d'itinéraire et ses points d'arrêt comme signature. Grille de 4 px. */

:root {
  color-scheme: light;
  --bg: #f6f6f7;
  --surface: #ffffff;
  --raised: #f1f1f3;
  --line: rgba(23, 23, 23, 0.08);
  --line-strong: rgba(23, 23, 23, 0.14);
  --text: #171717;
  --text-2: #525252;
  --text-3: #6b6b6b;
  --accent: #1f6f54;
  --accent-hover: #185a44;
  --accent-ink: #17513e;
  --accent-soft: #e8f1ed;
  --pos: #15803d;
  --neg: #c62828;
  --warn-ink: #8a4b08;
  --warn-soft: #fbf1e3;
  --m-bus: #33475b;
  --m-train: #1f6f54;
  --m-boat: #1d5f8a;
  --m-cable: #7a4e2d;
  --m-tad: #6b6b6b;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --r-xl: 20px;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-l: 0 8px 24px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/22px var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { font-weight: 500; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic--s { width: 16px; height: 16px; }
.ic--l { width: 22px; height: 22px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-m);
  font-weight: 500; font-size: 15px; line-height: 20px; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease), opacity 150ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--dark { background: var(--text); color: #fff; }
.btn--dark:hover { background: #2b2b2b; }
.btn--secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--secondary:hover { background: var(--raised); }
.btn--ghost { color: var(--accent-ink); padding: 0 12px; }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--s { height: 36px; padding: 0 12px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* Sélecteur segmenté */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; background: var(--raised); border-radius: var(--r-m); }
.seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; height: 36px; padding: 0 8px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); text-align: center; white-space: nowrap; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-s), inset 0 0 0 1px var(--line); }

/* Champs */
.field { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px 0 16px; background: var(--surface); }
.field input { flex: 1; min-width: 0; height: 52px; border: 0; background: none; outline: none; font-size: 16px; }
.field input::placeholder { color: var(--text-3); }
.field__label { font-size: 12px; line-height: 16px; color: var(--text-3); }
.field__btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-3); transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.field__btn:hover { background: var(--raised); color: var(--text); }
.input, .select {
  width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-m); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 16px; outline: none; appearance: none;
}
.input:focus, .select:focus { box-shadow: inset 0 0 0 2px var(--accent); }
textarea.input { height: auto; padding: 12px; line-height: 22px; resize: vertical; }
.label { display: block; margin-bottom: 8px; font-size: 13px; line-height: 20px; color: var(--text-2); }

/* Cartes et listes */
.card { background: var(--surface); border-radius: var(--r-l); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-s); }
.rows > * + * { border-top: 1px solid var(--line); }
.muted { color: var(--text-3); }
.sec { color: var(--text-2); }
.small { font-size: 13px; line-height: 20px; }
.tiny { font-size: 12px; line-height: 16px; }
.num { font-variant-numeric: tabular-nums; }

/* Pastille de ligne */
.ln { display: inline-flex; align-items: center; gap: 4px; height: 24px; min-width: 24px; padding: 0 8px; border-radius: var(--r-s); font-size: 13px; line-height: 16px; font-weight: 600; color: #fff; background: var(--m-bus); white-space: nowrap; }
.ln .ic { width: 14px; height: 14px; stroke-width: 1.75; }
.ln--walk { background: var(--raised); color: var(--text-2); font-weight: 500; }

/* Moteur de recherche */
.planner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.planner > *, .planner form > *, .stack > * { min-width: 0; }
.planner__od { position: relative; border-radius: var(--r-l); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.planner__od .field { background: none; padding-left: 44px; }
.planner__od .field + .field { border-top: 1px solid var(--line); }
.planner__rail { position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px; background: var(--line-strong); border-radius: 1px; pointer-events: none; }
.planner__rail::before, .planner__rail::after { content: ""; position: absolute; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); }
.planner__rail::before { top: -1px; box-shadow: inset 0 0 0 2px var(--text-3); }
.planner__rail::after { bottom: -1px; background: var(--accent); }
.planner__swap { position: absolute; right: 52px; top: 50%; margin-top: -18px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-2); z-index: 2; transition: background-color 150ms var(--ease); }
.planner__swap:hover { background: var(--raised); }
.planner__when { display: grid; gap: 8px; }
.planner__dt { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.planner__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 14px; color: var(--text-2); transition: background-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px rgba(31, 111, 84, 0.28); }

/* Suggestions */
.ac { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 320px; overflow: auto; padding: 4px; background: var(--surface); border-radius: var(--r-l); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-l); }
.ac button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 4px 12px; border-radius: 12px; }
.ac button:hover, .ac button[aria-selected="true"] { background: var(--raised); }
.ac .ic { color: var(--text-3); }
.ac__t { display: block; font-size: 15px; line-height: 20px; }
.ac__s { display: block; font-size: 13px; line-height: 16px; color: var(--text-3); }

/* Résultats */
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.results__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 4px 0; }
.results__title { font-size: 17px; line-height: 24px; font-weight: 500; }
.jr { display: block; width: 100%; padding: 16px; border-radius: var(--r-l); }
.jr__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.jr__time { font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: 0; }
.jr__time .ic { display: inline-block; vertical-align: -2px; margin: 0 4px; color: var(--text-3); }
.jr__dur { font-size: 15px; color: var(--text-2); white-space: nowrap; }
.jr__chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 12px; }
.jr__chain > .ic { width: 14px; height: 14px; color: var(--text-3); }
.jr__meta { margin-top: 8px; font-size: 13px; line-height: 20px; color: var(--text-2); }
.jr__flags { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; line-height: 20px; color: var(--warn-ink); }
.jr__flags span { display: inline-flex; align-items: center; gap: 6px; }
.card:has(> .jr[aria-expanded="true"]) { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow-s); }
.jr__detail { padding: 0 16px 16px; }

/* Ligne d'itinéraire — signature */
.route { position: relative; display: grid; gap: 0; padding: 4px 0; }
.route__leg { position: relative; display: grid; grid-template-columns: 48px 20px 1fr; column-gap: 8px; }
.route__time { font-size: 13px; line-height: 20px; color: var(--text-2); text-align: right; padding-top: 2px; }
.route__axis { position: relative; }
.route__axis::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: var(--c, var(--m-bus)); }
.route__leg--walk .route__axis::before { background: none; border-left: 2px dotted var(--line-strong); left: 9px; width: 0; }
.route__dot { position: absolute; left: 4px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--c, var(--m-bus)); z-index: 1; }
.route__dot--end { top: auto; bottom: 2px; }
.route__dot--walk { box-shadow: inset 0 0 0 2px var(--text-3); }
.route__dot--dest { background: var(--accent); box-shadow: none; }
.route__body { padding: 2px 0 20px; min-width: 0; }
.route__stop { font-size: 15px; line-height: 20px; font-weight: 500; }
.route__info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; font-size: 13px; line-height: 20px; color: var(--text-2); }
.route__stops { margin-top: 8px; font-size: 13px; line-height: 20px; color: var(--text-2); }
.route__stops summary { cursor: pointer; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.route__stops summary::-webkit-details-marker { display: none; }
.route__stops li { display: grid; grid-template-columns: 44px 1fr; padding: 2px 0; }
.route__end { display: grid; grid-template-columns: 48px 20px 1fr; column-gap: 8px; }

/* Avis */
.notice { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--r-m); background: var(--raised); font-size: 14px; line-height: 20px; color: var(--text-2); }
.notice .ic { margin-top: 1px; color: var(--text-3); }
.notice--warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice--warn .ic { color: var(--warn-ink); }
.notice--accent { background: var(--accent-soft); color: var(--accent-ink); }
.notice--accent .ic { color: var(--accent-ink); }
.notice a { text-decoration: underline; text-underline-offset: 2px; }

/* Jours suivants */
.days { display: grid; }
.day { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; width: 100%; padding: 12px 16px; text-align: left; transition: background-color 150ms var(--ease); }
.day:hover { background: var(--raised); }
.day__d { font-weight: 500; }
.day__j { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13px; color: var(--text-2); }
.day .ic { grid-row: 1 / span 2; grid-column: 2; color: var(--text-3); }

/* À proximité */
.near__bar { display: grid; gap: 12px; }
.nl { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 4px 12px; width: 100%; padding: 12px 16px; text-align: left; transition: background-color 150ms var(--ease); }
.nl:hover { background: var(--raised); }
.nl__name { font-weight: 500; line-height: 20px; }
.nl__sub { grid-column: 2; font-size: 13px; line-height: 20px; color: var(--text-2); }
.nl__next { grid-column: 2; font-size: 13px; line-height: 20px; color: var(--text); }
.nl__dist { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.week { display: inline-flex; gap: 2px; vertical-align: middle; }
.week i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; font-style: normal; font-size: 10px; line-height: 1; color: var(--text-3); background: var(--raised); }
.week i.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 12px; line-height: 16px; background: var(--raised); color: var(--text-2); }
.tag--warn { background: var(--warn-soft); color: var(--warn-ink); }

/* Panneau (feuille) */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(23, 23, 23, 0.32); opacity: 0; transition: opacity 200ms var(--ease); }
.sheet-back.on { opacity: 1; }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; padding: 8px 20px calc(24px + var(--safe-b)); background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-l); transform: translateY(12px); opacity: 0; transition: transform 300ms var(--ease), opacity 300ms var(--ease); }
.sheet.on { transform: none; opacity: 1; }
.sheet__grip { width: 36px; height: 4px; margin: 4px auto 12px; border-radius: 2px; background: var(--line-strong); }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet__title { font-size: 20px; line-height: 28px; font-weight: 500; }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: 84vh; border-radius: var(--r-xl); transform: translate(-50%, calc(-50% + 12px)); }
  .sheet.on { transform: translate(-50%, -50%); }
  .sheet__grip { display: none; }
  .sheet { padding-top: 24px; }
}

/* Carte */
.mapbox { position: relative; overflow: hidden; border-radius: var(--r-l); background: #eef0ee; box-shadow: inset 0 0 0 1px var(--line); }
.mapbox .maplibregl-map { position: absolute; inset: 0; font: inherit; }
.mapbox .maplibregl-ctrl-attrib { font-size: 11px; }
.pin { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2.5px var(--text), 0 1px 3px rgba(0, 0, 0, 0.3); }
.pin--dest { background: var(--accent); box-shadow: 0 0 0 2.5px #fff, 0 1px 3px rgba(0, 0, 0, 0.3); }
.pin--me { background: #2563eb; box-shadow: 0 0 0 3px #fff, 0 0 0 9px rgba(37, 99, 235, 0.18); }
.pin--bus { width: 28px; height: 28px; display: grid; place-items: center; background: var(--text); color: #fff; box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0, 0, 0, 0.3); }
.pin--bus .ic { width: 16px; height: 16px; }

/* Bandeau discret */
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translate(-50%, 8px); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--r-m); background: var(--text); color: #fff; font-size: 14px; line-height: 20px; opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease), transform 200ms var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.empty { padding: 24px 16px; text-align: center; color: var(--text-2); }
.empty .ic { margin: 0 auto 12px; width: 24px; height: 24px; color: var(--text-3); }
.linkish { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stack--l { gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
