/* Lyon Roadbook — mobile-first, police système, clair/sombre, contraste AA. */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f1ece4;
  --text: #1d1b19;
  --muted: #5a554f;
  --line: #e2dbd0;
  --accent: #9b2c2c;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3e1;
  --ok: #1f6b3a;
  --ok-soft: #e2f1e6;
  --warn: #8a5300;
  --warn-soft: #fbefd9;
  --late: #a3221c;
  --late-soft: #fbe3e1;
  --info-soft: #e6eef7;
  --info: #23466e;
  --route-a: #2f6f4f;
  --route-b: #345a8c;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 6px 20px rgb(0 0 0 / .06);
  --radius: 14px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --bar-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413;
    --surface: #1e1c1a;
    --surface-2: #2a2724;
    --text: #f2eee8;
    --muted: #bdb5aa;
    --line: #3a3632;
    --accent: #ff8f84;
    --accent-ink: #1a0b0a;
    --accent-soft: #3a2220;
    --ok: #7fd49b;
    --ok-soft: #1c3324;
    --warn: #f3c06b;
    --warn-soft: #3a2c14;
    --late: #ff9a90;
    --late-soft: #3d1f1c;
    --info-soft: #1d2a3a;
    --info: #a9c8ef;
    --route-a: #7fc8a2;
    --route-b: #9dbbf0;
    --shadow: none;
  }
}

*, *::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 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  min-height: 100dvh;
  padding-bottom: calc(var(--bar-h) + var(--safe-b) + 8px);
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--surface); padding: 10px 14px; }
.skip:focus { left: 8px; top: 8px; }

/* En-tête compact */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: var(--tap) 1fr auto; gap: 8px; align-items: center;
  padding: calc(6px + var(--safe-t)) 10px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__center { min-width: 0; }
.topbar__route { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__step { margin: 0; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: 6px; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.clock { margin: 0; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.clock time { font-weight: 700; font-size: 16px; }
.chip { display: inline-block; font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.chip[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.chip[data-tone="late"] { background: var(--late-soft); color: var(--late); }

.icon-btn {
  width: var(--tap); height: var(--tap); display: inline-grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--info-soft); color: var(--info); font-size: 15px; }
.banner--muted { background: var(--surface-2); color: var(--text); }

/* Fiche */
main { outline: none; }
.viewport { overflow: hidden; touch-action: pan-y; }
.card { max-width: 640px; margin: 0 auto; padding: 0 0 12px; outline: none; will-change: transform; }
.card.is-dragging { transition: none; user-select: none; -webkit-user-select: none; }
.card.is-animating { transition: transform .22s ease, opacity .22s ease; }

.photo { margin: 0; position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo figcaption { position: absolute; right: 0; bottom: 0; max-width: 100%; padding: 3px 8px; font-size: 11.5px; line-height: 1.3; color: #fff; background: rgb(0 0 0 / .62); border-top-left-radius: 8px; }
.photo figcaption a { color: #fff; }
.photo--fallback { display: grid; place-items: center; background:
  radial-gradient(120% 90% at 10% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
  linear-gradient(135deg, var(--surface-2), var(--bg)); }
.photo--fallback .fallback { text-align: center; color: var(--muted); padding: 12px; }
.photo--fallback .fallback strong { display: block; font-size: 44px; line-height: 1; color: var(--accent); font-weight: 750; }

.card__body { padding: 16px 16px 0; }
.eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card h1 { font-size: 27px; font-weight: 750; letter-spacing: -.01em; outline: none; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 15px; }
.meta strong { color: var(--text); font-variant-numeric: tabular-nums; }
.summary { margin: 12px 0 0; font-size: 17px; }

.block { margin: 16px 0 0; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.block h2 { font-size: 15px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.block ul { margin: 0; padding-left: 20px; }
.block li + li { margin-top: 4px; }

.anecdote { margin: 0; }
.anecdote + .anecdote { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.anecdote p { margin: 0; }
.source { margin-top: 6px !important; font-size: 13.5px; color: var(--muted); }

.notice { display: flex; gap: 10px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 15px; background: var(--info-soft); color: var(--info); }
.notice[data-level="warn"] { background: var(--warn-soft); color: var(--warn); }
.notice[data-level="late"] { background: var(--late-soft); color: var(--late); }
.notice p { margin: 0; }
.notice a { color: inherit; }
.notice .btn { margin-top: 8px; }

/* Vers la prochaine étape */
.next { background: var(--accent-soft); border-color: transparent; }
@media (prefers-color-scheme: dark) { .next { border-color: var(--line); } }
.next h2 { color: var(--accent); }
.next__to { margin: 0; font-size: 19px; font-weight: 700; }
.block .facts, .facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; padding: 0; list-style: none; }
.facts li { margin: 0 !important; padding: 4px 10px; border-radius: 999px; background: var(--surface); font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts .unverified { background: var(--warn-soft); color: var(--warn); }
.facts .verified { color: var(--ok); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding: 0 0 0 40px; min-height: 30px; counter-increment: s; }
.steps li + li { margin-top: 10px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: 14px; }
details { margin-top: 12px; }
details summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 650; }
details .steps { margin-top: 6px; }
.verif { font-size: 14px; color: var(--muted); }
.verif p { margin: 6px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn--ghost { background: transparent; color: var(--accent); }
.btn--small { min-height: 36px; padding: 6px 12px; font-size: 15px; }
.btn--block { display: flex; width: 100%; margin-top: 12px; }
.btn[aria-disabled="true"] { opacity: .55; }
.hint { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }

/* Choix A / B */
.choices { display: grid; gap: 10px; margin-top: 10px; }
.choice { display: block; width: 100%; text-align: left; padding: 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); cursor: pointer; min-height: var(--tap); }
.choice strong { display: block; font-size: 17px; }
.choice span { display: block; color: var(--muted); font-size: 15px; }
.choice[aria-pressed="true"] { border-color: var(--accent); }
.choice[data-suggested="true"]::after { content: "Conseillé"; display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--warn-soft); color: var(--warn); }
.choice-block.nudge { animation: nudge .4s ease; }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Barre de navigation */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav-btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; cursor: pointer; }
.nav-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nav-btn--toc { min-width: 72px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nav-btn:disabled { opacity: .4; cursor: default; }

/* Feuilles (sommaire, gare) */
.sheet { width: min(640px, 100%); max-width: 100%; max-height: 100dvh; margin: 0 auto; margin-top: auto; padding: 0; border: 0; border-radius: 18px 18px 0 0; background: var(--bg); color: var(--text); }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet[open] { display: flex; flex-direction: column; height: 92dvh; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { font-size: 20px; }
.sheet__body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(24px + var(--safe-b)); }
.toc-route { margin-top: 14px; }
.toc-route h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.toc-route h3 .tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 650; }
.toc-route p.desc { margin: 4px 0 6px; color: var(--muted); font-size: 15px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.toc-list li + li { border-top: 1px solid var(--line); }
.toc-list button { width: 100%; min-height: 48px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.toc-list button[aria-current="step"] { background: var(--accent-soft); font-weight: 700; }
.toc-list .t { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; }
.toc-list .v { font-size: 13px; color: var(--ok); }
.map { margin: 8px 0 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.map svg { width: 100%; height: auto; }
.map figcaption { padding: 6px 10px 8px; font-size: 12.5px; color: var(--muted); }
.settings { margin-top: 20px; }
.settings .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.settings input[type="date"] { min-height: var(--tap); padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.status { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; font-size: 15px; }
.status[data-ok="true"] { color: var(--ok); }
.credits { font-size: 13.5px; color: var(--muted); }
.credits li + li { margin-top: 4px; }
.timeline { list-style: none; margin: 12px 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline time { font-weight: 750; font-variant-numeric: tabular-nums; }

.state { max-width: 560px; margin: 40px auto; padding: 0 16px; text-align: center; }
.state h1 { font-size: 22px; margin-bottom: 8px; }

@media (min-width: 700px) {
  .card__body { padding-inline: 0; }
  .photo { border-radius: 0 0 var(--radius) var(--radius); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
