/*
 * Trainswap — interface web reprise de l'application Android :
 * monochrome, panneau noir en tête, cartes blanches sur fond gris clair,
 * pastilles et boutons ronds, police Inter. Le rouge ne sert qu'aux retards ;
 * la couleur d'une ligne n'apparaît que dans son pictogramme et sur la desserte du jour.
 */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f1f1f1;
  --card: #ffffff;
  --ink: #0b0b0b;
  --muted: #6e6e6e;
  --faint: #a3a3a3;
  --outline: #e3e3e3;
  --chip: #ededed;
  --panel: #0b0b0b;
  --panel-pill: #262626;
  --on-panel: #ffffff;
  --panel-muted: #9c9c9c;
  --delay: #e5484d;
  --delay-soft: #fdebec;
  --rail: #0b0b0b;
  --rail-off: #d2d2d2;
  --rail-done: #b9b9b9;
  --dot: #5c5c5c;
  --radius: 14px;
  --status-dot: var(--panel);
  --stock-filter: grayscale(1);
  --theme-moon: block;
  --theme-sun: none;
  --wrap: 1180px;
  --gutter: 32px;
  /* Accent : change ces deux valeurs pour changer la couleur de toute l'appli. */
  --accent: #f28c28;
  --accent-hover: #e07b17;
  --on-accent: #0b0b0b;
  color-scheme: light;
}

/* Thème sombre : celui du système, sauf choix manuel (bouton du bandeau, data-theme sur <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050505;
    --card: #141414;
    --ink: #f4f4f4;
    --muted: #9a9a9a;
    --faint: #6a6a6a;
    --outline: #262626;
    --chip: #242424;
    --panel: #181818;
    --panel-pill: #2b2b2b;
    --panel-muted: #9c9c9c;
    --delay: #ff6369;
    --delay-soft: #3a1617;
    --rail: #ededed;
    --rail-off: #333333;
    --rail-done: #5b5b5b;
    --dot: #8a8a8a;
    --status-dot: var(--panel-pill);
    --stock-filter: grayscale(1) invert(.88);
    --theme-moon: none;
    --theme-sun: block;
    --accent: #ff9d45;
    --accent-hover: #ffb06a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050505;
  --card: #141414;
  --ink: #f4f4f4;
  --muted: #9a9a9a;
  --faint: #6a6a6a;
  --outline: #262626;
  --chip: #242424;
  --panel: #181818;
  --panel-pill: #2b2b2b;
  --panel-muted: #9c9c9c;
  --delay: #ff6369;
  --delay-soft: #3a1617;
  --rail: #ededed;
  --rail-off: #333333;
  --rail-done: #5b5b5b;
  --dot: #8a8a8a;
  --status-dot: var(--panel-pill);
  --stock-filter: grayscale(1) invert(.88);
  --theme-moon: none;
  --theme-sun: block;
  --accent: #ff9d45;
  --accent-hover: #ffb06a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 999px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.panel :focus-visible { outline-color: var(--on-panel); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ───── Panneau noir ───── */
.panel { background: var(--panel); color: var(--on-panel); padding-bottom: 36px; }
.topbar { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; font-size: 19px; letter-spacing: -.3px; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--on-panel); color: #0b0b0b; display: grid; place-items: center; }
.brand-mark .icon { width: 19px; height: 19px; }
.topnav { display: flex; gap: 2px; padding: 4px; background: var(--panel-pill); border-radius: 999px; }
.topnav a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-weight: 500; font-size: 14px; padding: 8px 15px 8px 12px; border-radius: 999px; color: var(--panel-muted); }
.topnav .icon { width: 17px; height: 17px; }
.topnav a:hover { color: var(--on-panel); }
.topnav a[aria-current="page"] { background: var(--on-panel); color: #0b0b0b; }
.today-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--panel-muted); font-size: 14px; }
.today-pill .icon { width: 18px; height: 18px; }
.today-pill time { color: var(--on-panel); font-weight: 600; min-width: 5ch; }
.theme-toggle .theme-moon { display: var(--theme-moon); }
.theme-toggle .theme-sun { display: var(--theme-sun); }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; padding-top: 28px; }
.hero-kicker { color: var(--panel-muted); font-size: 15px; margin-bottom: 6px; }
.hero h1 { font-size: 40px; line-height: 46px; font-weight: 600; letter-spacing: -1.2px; }
.hero-side { display: flex; flex-direction: column; gap: 14px; }
.hero-note { color: var(--panel-muted); font-size: 14px; }

.panel-bar { display: flex; align-items: center; gap: 14px; padding-top: 18px; }
.panel-bar-title { flex: 1; min-width: 0; }
.panel-bar-title h1 { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -.6px; }
.panel-bar-title p { color: var(--panel-muted); font-size: 14px; }
.panel-bar-actions { display: flex; gap: 8px; }

/* Boutons ronds */
.circle { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; cursor: pointer; text-decoration: none; flex: none; }
.circle-panel { background: var(--panel-pill); color: var(--on-panel); }
.circle-panel:hover { background: #3a3a3a; }
.circle-light { background: var(--on-panel); color: #0b0b0b; }
.circle-chip { background: var(--chip); color: var(--ink); }

/* Recherche */
.search { position: relative; }
.search-pill { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 8px 0 20px; background: var(--panel-pill); border-radius: 999px; }
.search-pill:focus-within { box-shadow: 0 0 0 2px var(--on-panel); }
.search-pill input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--on-panel); font-size: 17px; padding: 14px 0; }
.search-pill input::placeholder { color: var(--panel-muted); }
.search-pill input::-webkit-search-cancel-button { display: none; }
.search-status { position: absolute; left: -9999px; }
.suggestions { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--card); color: var(--ink); border-radius: var(--radius); border: 1px solid var(--outline); box-shadow: 0 12px 32px rgba(0,0,0,.18); max-height: 420px; overflow: auto; }
.suggestions a { display: grid; grid-template-columns: 64px 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.suggestions a:hover, .suggestions a:focus { background: var(--chip); outline: 0; }
.suggestions .s-time { font-weight: 600; font-size: 17px; grid-row: span 2; }
.suggestions .s-title { font-weight: 600; }
.suggestions .s-route { color: var(--muted); font-size: 13px; grid-column: 2; }
.suggestions .s-status { grid-row: span 2; grid-column: 3; }
.suggestions .s-message { padding: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

/* Choix d'une gare */
.station-field { position: relative; flex: 1; min-width: 0; }
.station-pill input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: inherit; font-size: 15px; padding: 14px 0; }
.station-pill input::placeholder { color: var(--panel-muted); }
.station-field-light .station-pill input::placeholder { color: var(--muted); }
.station-field-light .station-pill { background: var(--chip); color: var(--ink); }
.station-field-light .station-pill:focus-within { box-shadow: 0 0 0 2px var(--ink); }
.station-option { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; font-size: 15px; }
.station-option > span:nth-of-type(1) { flex: 1; }
.station-option .icon { color: var(--muted); width: 18px; height: 18px; }
.station-option:hover, .station-option:focus { background: var(--chip); outline: 0; }
.station-code { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--chip); border-radius: 6px; padding: 2px 6px; }
.station-option:hover .station-code, .station-option:focus .station-code { background: var(--card); }
.station-form { display: flex; gap: 8px; align-items: center; }
.station-pill { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: 999px; background: var(--panel-pill); color: var(--on-panel); }
.station-pill:focus-within { box-shadow: 0 0 0 2px var(--on-panel); }
.circle-dark { background: var(--panel); color: var(--on-panel); }
.station-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.station-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); text-decoration: none; font-weight: 550; }
.station-link > span:nth-child(2) { flex: 1; }
.station-link > .icon { color: var(--faint); }
.station-link:hover { background: color-mix(in srgb, var(--card) 92%, var(--ink)); }
.board-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; }
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--panel-pill); }
.segmented a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--panel-muted); font-weight: 500; font-size: 14px; }
.segmented .icon { width: 17px; height: 17px; }
.segmented a[aria-current="page"] { background: var(--on-panel); color: #0b0b0b; }
.day-nav { display: flex; align-items: center; gap: 8px; }
.day-nav .circle { width: 40px; height: 40px; }
.platform { width: 46px; height: 46px; border-radius: 50%; background: var(--panel); color: var(--on-panel); display: grid; place-items: center; align-content: center; flex: none; align-self: center; font-weight: 650; font-size: 15px; line-height: 1; }
.platform small { font-size: 9px; font-weight: 500; color: var(--panel-muted); margin-bottom: 2px; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.text-link .icon { width: 16px; height: 16px; }
.hero-or { color: var(--panel-muted); font-size: 13px; margin: 2px 0 -4px; }

/* Itinéraire */
.hero-journey { grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.journey-form { display: flex; flex-direction: column; gap: 12px; }
.journey-stations { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.journey-swap .icon { transform: rotate(90deg); }
.journey-options { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.segmented-inputs label { position: relative; }
.segmented-inputs input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-inputs span { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 999px; color: var(--panel-muted); font-weight: 500; font-size: 14px; cursor: pointer; }
.segmented-inputs .icon { width: 17px; height: 17px; }
.segmented-inputs input:checked + span { background: var(--on-panel); color: #0b0b0b; }
.segmented-inputs input:focus-visible + span { outline: 2px solid var(--on-panel); outline-offset: 2px; }
.date-field-compact { flex: 0 0 auto; min-height: 48px; }
.date-field-compact input { width: auto; }
.check-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 999px; background: var(--panel-pill); color: var(--on-panel); font-size: 14px; cursor: pointer; }
.check-pill input { width: 17px; height: 17px; accent-color: var(--on-panel); margin: 0; }
.pill.pill-light { background: var(--on-panel); color: #0b0b0b; margin-left: auto; }
.pill.pill-light .pill-icon { background: #e6e6e6; }
.pill.pill-light:hover { background: #e6e6e6; }
.journey { padding: 0; }
.journey-head { display: flex; align-items: center; gap: 16px; padding: 16px 18px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.journey-head::-webkit-details-marker { display: none; }
.journey-head .chips { flex: 1; }
.journey-times { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 600; letter-spacing: -.4px; min-width: 150px; }
.journey-times .icon { width: 18px; height: 18px; color: var(--muted); }
.journey-legs { border-top: 1px solid var(--outline); padding: 10px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.journey-leg { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 10px; background: var(--chip); text-decoration: none; }
.journey-leg:hover .leg-open { color: var(--ink); }
.leg-row { display: flex; align-items: center; gap: 12px; font-weight: 550; }
.leg-row time { width: 48px; font-weight: 600; }
.leg-row .chip { background: var(--card); height: 26px; }
.leg-row-mid { color: var(--muted); font-weight: 400; font-size: 14px; padding-left: 60px; gap: 8px; }
.leg-row-mid .icon { width: 16px; height: 16px; }
.leg-open { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.leg-open .icon { width: 16px; height: 16px; }
.journey-transfer { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 2px 4px; }
.journey-transfer .icon { width: 17px; height: 17px; }

/* Semaine */
.week { display: flex; align-items: center; gap: 8px; }
.week ol { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.day { display: flex; flex-direction: column; align-items: center; padding: 7px 0; border-radius: 999px; text-decoration: none; color: var(--panel-muted); background: var(--panel-pill); font-size: 12px; }
.day strong { color: var(--on-panel); font-size: 16px; font-weight: 600; }
.day.is-today { box-shadow: inset 0 0 0 1.5px var(--panel-muted); }
.day.is-selected { background: var(--on-panel); color: #555; }
.day.is-selected strong { color: #0b0b0b; }
.date-form { display: flex; gap: 8px; }
.date-field { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; background: var(--panel-pill); border-radius: 999px; color: var(--on-panel); }
.date-field input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--on-panel); color-scheme: dark; }

/* ───── Contenu ───── */
main { padding: 28px 0 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.layout-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.section-head h2 { font-size: 19px; line-height: 25px; font-weight: 600; letter-spacing: -.3px; margin-right: auto; }
.section-head + .section-head { margin-top: 0; }
.stack + .section-head, .card + .section-head { margin-top: 26px; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; }
.card h2 { font-size: 17px; line-height: 23px; font-weight: 600; letter-spacing: -.2px; }
.card p + p { margin-top: 10px; }
.card .lead { margin-top: 8px; }
.inset { background: var(--chip); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip .icon { width: 15px; height: 15px; color: var(--muted); }
.chip b { font-weight: 650; }
.chip-delay { background: var(--delay-soft); color: var(--delay); }
.chip-delay .icon { color: var(--delay); }
.chip-panel { background: var(--panel-pill); color: var(--on-panel); }
.chip-panel .icon { color: var(--panel-muted); }

.iconline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.iconline .icon { width: 16px; height: 16px; }
.iconline-delay { color: var(--delay); font-weight: 600; }
.iconline-strong { color: var(--ink); font-weight: 600; }

.line-badge { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 5px; border-radius: 6px; background: var(--line); color: var(--on-line); font-size: 12px; font-weight: 700; letter-spacing: -.2px; }

/* Bouton « pilule » */
.pill { display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 20px 6px 6px; border-radius: 999px; background: var(--panel); color: var(--on-panel); text-decoration: none; font-weight: 500; border: 0; cursor: pointer; }
.pill .pill-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-pill); display: grid; place-items: center; }
.pill:hover { background: #262626; }

/* Carte de circulation */
.trip { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border-radius: var(--radius); padding: 16px 14px 16px 18px; text-decoration: none; transition: background .15s; }
.trip:hover { background: color-mix(in srgb, var(--card) 92%, var(--ink)); }
.trip-time { width: 66px; flex: none; display: flex; flex-direction: column; }
.trip-time strong { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -.3px; }
.trip-time .is-late { color: var(--delay); }
/* Supprimé : heure barrée en rouge, destination barrée. */
.trip-time .is-struck { text-decoration: line-through; color: var(--delay); }
.trip-title.is-struck { text-decoration: line-through; }
.trip-time del { color: var(--faint); font-size: 12px; }
.delay { color: var(--delay); font-size: 13px; font-weight: 500; }
.trip-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.trip-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.trip-title { font-size: 16px; font-weight: 550; }
.trip .chips { margin-top: 3px; }
.godot { width: 36px; height: 36px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; flex: none; align-self: center; }
.godot .icon { width: 18px; height: 18px; }
.trips-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.service-break { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.service-break::before, .service-break::after { content: ""; flex: 1; height: 1px; background: var(--outline); }
.service-break span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; background: var(--panel); color: var(--on-panel); }
.service-break .icon { width: 16px; height: 16px; }
.more { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }

/* Lignes de raccourcis */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 0; text-decoration: none; border-top: 1px solid var(--outline); }
.row:first-child { border-top: 0; }
.row-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; flex: none; }
.row-text { flex: 1; display: flex; flex-direction: column; }
.row-text strong { font-weight: 550; }
.row-text small { color: var(--muted); font-size: 13px; }
.row > .icon { color: var(--faint); }
a.row:hover .row-text strong { text-decoration: underline; text-underline-offset: 3px; }

/* Information trafic */
.status-card { padding: 14px; }
.status-head { display: flex; align-items: center; gap: 12px; list-style: none; cursor: default; }
details.status-card .status-head { cursor: pointer; }
.status-head::-webkit-details-marker { display: none; }
.status-head > div { flex: 1; min-width: 0; }
.status-head h2 { font-size: 16px; line-height: 22px; }
.status-head h2.is-alert { color: var(--delay); }
.status-head p { font-size: 13px; }
.status-dot { width: 40px; height: 40px; border-radius: 50%; background: var(--status-dot); color: var(--on-panel); display: grid; place-items: center; flex: none; }
.status-dot.is-alert { background: var(--delay); color: #fff; }
.chevron { color: var(--faint); transition: transform .2s; }
details[open] > summary .chevron { transform: rotate(180deg); }
.status-body { padding: 12px 2px 2px; display: flex; flex-direction: column; gap: 10px; }
.status-body .inset { margin-top: 0; display: flex; flex-direction: column; gap: 6px; }

/* Cadres d'information sur la fiche train */
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: var(--radius); padding: 16px; }
.notice > .status-dot { margin-top: 1px; }
.notice h2 { font-size: 16px; line-height: 22px; font-weight: 600; }
.notice h2.is-alert { color: var(--delay); }
.notice p { margin-top: 4px; }
.notice .muted { font-size: 13px; }

/* ───── Desserte ───── */
.chain { position: relative; list-style: none; margin: 0; padding: 12px 16px 12px 18px; background: var(--card); border-radius: var(--radius); --anchor: 30px; --rail-w: 20px; }
.stop { position: relative; display: grid; grid-template-columns: 70px 34px minmax(0, 1fr); min-height: 76px; }
.stop-time { padding-top: calc(var(--anchor) - 13px); display: flex; flex-direction: column; }
.stop-time time { font-size: 18px; line-height: 24px; font-weight: 600; }
.stop-time del { color: var(--faint); font-size: 12px; }
.stop.is-late .stop-time time { color: var(--delay); }
.stop-rail { position: relative; }
.seg { position: absolute; left: 50%; width: var(--rail-w); margin-left: calc(var(--rail-w) / -2); top: var(--anchor); height: 100%; background: var(--rail); }
.seg.is-off { background: var(--rail-off); }
.stop.is-first .seg { top: calc(var(--anchor) - var(--rail-w) / 2); height: calc(100% + var(--rail-w) / 2); border-radius: calc(var(--rail-w) / 2) calc(var(--rail-w) / 2) 0 0; }
.stop.is-last .seg { top: calc(var(--anchor) - var(--rail-w) / 2); height: var(--rail-w); border-radius: 0 0 calc(var(--rail-w) / 2) calc(var(--rail-w) / 2); }
.stop.is-first.is-last .seg { border-radius: 50%; }
.dot { position: absolute; left: 50%; top: var(--anchor); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--dot); }
.dot.is-off { background: var(--card); }
.stop.is-endpoint .dot { width: 16px; height: 16px; margin: -8px 0 0 -8px; background: var(--card); box-shadow: inset 0 0 0 4.5px var(--card), inset 0 0 0 10px var(--rail); }
.stop.is-endpoint .dot.is-off { box-shadow: inset 0 0 0 4.5px var(--card), inset 0 0 0 10px var(--faint); }
.stop.is-cancelled .dot { background: var(--card); box-shadow: inset 0 0 0 2px var(--rail-off); }
.stop-body { padding: calc(var(--anchor) - 14px) 0 22px 12px; display: flex; flex-direction: column; gap: 6px; }
.stop-body h3 { font-size: 17px; line-height: 24px; font-weight: 500; }
.stop.is-endpoint h3 { font-weight: 600; }
.stop.is-cancelled h3, .stop.is-cancelled .stop-time time { color: var(--faint); text-decoration: line-through; }
.stop-meta { color: var(--muted); font-size: 14px; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.stop.is-out .stop-time time, .stop.is-out h3, .stop.is-out .stop-meta { color: var(--faint); }
.stop.is-focus h3 { font-weight: 650; }
/* Desserte du jour : gris derrière le train, couleur de la ligne devant. */
.chain.is-live .dot:not(.is-off) { background: #0b0b0b; }
.chain.is-live .stop.is-endpoint .dot:not(.is-off) { background: #0b0b0b; box-shadow: inset 0 0 0 4.5px #fff; }
.marker { position: absolute; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fff; color: #0b0b0b; border: 1.5px solid #0b0b0b; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 2; pointer-events: none; transition: top .45s cubic-bezier(.4, 0, .2, 1); }
.marker .icon { width: 21px; height: 21px; }
.marker[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .marker { transition: none; } }

/* Résumé et matériel */
.summary-times { display: flex; align-items: baseline; gap: 10px; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.8px; }
.summary-times .icon { width: 22px; height: 22px; color: var(--panel-muted); align-self: center; }
.summary-route { color: var(--panel-muted); font-size: 15px; margin-top: 4px; }
.summary { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 22px; }
.summary del { font-size: 15px; color: var(--panel-muted); font-weight: 400; letter-spacing: 0; }
.summary .is-late { color: #ff8a8e; }
.stock-image { overflow-x: auto; margin: -4px -4px 14px; padding: 4px; }
.stock-image img { height: 54px; width: auto; max-width: none; filter: var(--stock-filter); display: block; }
.facts { margin: 0; display: flex; flex-direction: column; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--outline); }
.facts div:first-child { border-top: 0; padding-top: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }

.only-mobile { display: none; }
.stock-card.only-mobile { margin-top: 10px; }

/* États vides */
.message { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 44px 24px; background: var(--card); border-radius: var(--radius); }
.message-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--panel); color: var(--on-panel); display: grid; place-items: center; }
.message-icon .icon { width: 28px; height: 28px; }
.message h2 { font-size: 19px; font-weight: 600; }
.message p { color: var(--muted); max-width: 46ch; }

.prose p { max-width: 68ch; }
.prose p + p { margin-top: 10px; }
.note { color: var(--muted); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--panel); color: var(--on-panel); padding: 12px 18px; border-radius: 999px; font-size: 14px; z-index: 40; }

/* Pied de page */
.site-footer { border-top: 1px solid var(--outline); padding: 22px 0 28px; color: var(--muted); font-size: 13px; }
.site-footer p + p { margin-top: 4px; }
.site-footer strong { color: var(--ink); font-weight: 600; }
.tabbar { display: none; }

/* ───── Tablette ───── */
@media (max-width: 1024px) {
  :root { --gutter: 24px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
  .trips-grid { grid-template-columns: 1fr; }
  .station-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-pill > span { display: none; }
}

@media (max-width: 1100px) {
  .topnav a { padding: 8px 12px; }
  .topnav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@media (max-width: 860px) {
  .layout, .layout-even { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .only-mobile { display: block; }
  .only-desktop { display: none; }
  .topnav { display: none; }
  .panel { border-radius: 0 0 28px 28px; }
  .tabbar { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--panel); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--panel-muted); text-decoration: none; font-size: 11px; font-weight: 500; border-radius: 12px; }
  .tabbar a[aria-current="page"] { color: var(--on-panel); }
  .tabbar a[aria-current="page"] .icon { background: var(--panel-pill); border-radius: 999px; width: 52px; padding: 2px 0; height: 26px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* ───── Téléphone ───── */
@media (max-width: 560px) {
  :root { --gutter: 16px; }
  body { font-size: 14px; }
  .topbar { min-height: 64px; }
  .panel { padding-bottom: 22px; }
  .hero { padding-top: 10px; }
  .hero h1 { font-size: 29px; line-height: 35px; letter-spacing: -.8px; }
  .panel-bar { padding-top: 6px; gap: 10px; }
  .panel-bar-title h1 { font-size: 22px; line-height: 28px; }
  .panel-bar-actions { gap: 6px; }
  .circle { width: 40px; height: 40px; }
  .summary-times { font-size: 24px; line-height: 30px; }
  main { padding-top: 18px; }
  .chain { padding: 10px 10px 10px 12px; }
  .stop { grid-template-columns: 58px 34px minmax(0, 1fr); }
  .stop-time time { font-size: 16px; }
  .stop-body h3 { font-size: 16px; line-height: 22px; }
  .week { gap: 4px; }
  .week ol { gap: 4px; }
  .week .circle { width: 34px; height: 34px; }
  .suggestions a { grid-template-columns: 52px 1fr; }
  .station-grid { grid-template-columns: 1fr; }
  .journey-stations { grid-template-columns: 1fr; }
  .journey-swap { justify-self: end; margin: -6px 0; width: 36px; height: 36px; }
  .journey-swap .icon { transform: none; }
  .journey-options .segmented-inputs { width: 100%; }
  .segmented-inputs label { flex: 1; }
  .segmented-inputs span { width: 100%; justify-content: center; }
  .date-field-compact { flex: 1; }
  .pill.pill-light { width: 100%; margin-left: 0; }
  .board-controls { padding-top: 14px; }
  .segmented { flex: 1; }
  .segmented a { flex: 1; justify-content: center; }
  .suggestions .s-status { grid-column: 2; grid-row: auto; justify-self: start; }
}

/* ───── Mouvements : chargements, changements d'écran, retours au toucher ───── */
:root { --ease: cubic-bezier(.2, 0, 0, 1); --fast: .16s; }

/* Changement d'écran : fondu court entre deux pages (navigateurs compatibles), le bandeau reste en place. */
@view-transition { navigation: auto; }
.panel { view-transition-name: panel; }
.tabbar { view-transition-name: tabbar; }
::view-transition-old(root) { animation: ts-fade-out .14s var(--ease) both; }
::view-transition-new(root) { animation: ts-fade-in .2s var(--ease) both; }
main { animation: ts-enter .28s var(--ease) both; }
@keyframes ts-enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes ts-fade-in { from { opacity: 0; } }
@keyframes ts-fade-out { to { opacity: 0; } }

/* Barre de chargement en haut de l'écran pendant l'ouverture d'une page. */
.loading-bar { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
.loading-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--on-panel); border-radius: 0 3px 3px 0; animation: ts-bar 1s var(--ease) infinite; }
html.is-loading .loading-bar { opacity: 1; transition-delay: .12s; }
@keyframes ts-bar { from { left: -40%; } to { left: 100%; } }

/* Indicateur rond (suggestions, boutons en cours d'envoi). */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; flex: none; animation: ts-spin .7s linear infinite; }
@keyframes ts-spin { to { transform: rotate(360deg); } }
.is-busy { position: relative; pointer-events: none; }
.is-busy > .icon { opacity: 0; }
.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: ts-spin .7s linear infinite; }
.pill.is-busy .pill-icon > .icon { opacity: 0; }
.pill.is-busy::after { left: 26px; }
.suggestions:not([hidden]) { animation: ts-pop .16s var(--ease) both; transform-origin: top center; }
@keyframes ts-pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
details[open] > .status-body, details[open] > .journey-legs { animation: ts-enter .2s var(--ease) both; }

/* Survol, appui, focus des éléments cliquables. */
.circle, .pill, .trip, .row, .station-link, .station-option, .day, .godot, .platform, .segmented a, .segmented-inputs span, .topnav a, .tabbar a, .check-pill, .chip, .brand-mark, .suggestions a, .text-link, .journey-leg {
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.circle:active, .pill:active, .day:active, .segmented a:active, .segmented-inputs span:active, .topnav a:active, .tabbar a:active, .check-pill:active, .station-option:active { transform: scale(.95); }
.trip:active, .station-link:active, .journey-leg:active, a.row:active { transform: scale(.985); }
.circle-light:hover, .circle-chip:hover { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.circle-dark:hover { background: #262626; }
.trip:hover .godot { transform: translateX(3px); background: var(--panel); color: var(--on-panel); }
.station-link:hover > .icon, a.row:hover > .icon { transform: translateX(3px); color: var(--ink); }
.station-link > .icon, a.row > .icon { transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg); }
.tabbar a:hover, .topnav a:hover { color: var(--on-panel); }
.journey-leg:hover { background: color-mix(in srgb, var(--chip) 80%, var(--ink)); }
:focus-visible { transition: outline-offset var(--fast) var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  @view-transition { navigation: none; }
  .loading-bar::before { animation: none; left: 0; width: 100%; opacity: .6; }
  .spinner, .is-busy::after { animation: ts-spin 1.4s linear infinite !important; animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}

/* ───── Accent orange ─────
 * Bandeau orange foncé (texte blanc lisible, contraste ≥ 5:1) et accent orange vif
 * dans le contenu. Dans le bandeau, l'élément sélectionné passe en blanc, texte orange,
 * pour rester visible sur l'orange. Le rouge reste réservé aux retards.
 */
:root { --panel: #b45309; }
/* Teintes dérivées, posées sur les zones orange pour passer devant celles du thème sombre. */
.panel, .tabbar {
  --panel-pill: color-mix(in srgb, var(--panel) 72%, #000);
  --panel-hover: color-mix(in srgb, var(--panel) 60%, #000);
  --panel-muted: color-mix(in srgb, #fff 78%, var(--panel));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --panel: #9a3f0b; --status-dot: var(--accent); }
}
:root[data-theme="dark"] { --panel: #9a3f0b; --status-dot: var(--accent); }

/* Bandeau : sélection en blanc, survols plus foncés */
.brand-mark,
.topnav a[aria-current="page"],
.segmented a[aria-current="page"],
.segmented-inputs input:checked + span,
.circle-light,
.pill.pill-light { background: var(--on-panel); color: var(--panel); }
.day.is-selected { background: var(--on-panel); color: color-mix(in srgb, var(--panel) 75%, #fff); }
.day.is-selected strong { color: var(--panel); }
.day.is-today { box-shadow: inset 0 0 0 1.5px var(--on-panel); }
.pill.pill-light .pill-icon { background: color-mix(in srgb, var(--panel) 14%, #fff); }
.pill.pill-light:hover { background: color-mix(in srgb, var(--panel) 8%, #fff); }
.circle-panel:hover { background: var(--panel-hover); }
.check-pill input { accent-color: var(--on-panel); }
.panel .is-late, .summary .is-late { color: #fff; background: var(--delay); border-radius: 8px; padding: 0 6px; }
.panel del { color: var(--panel-muted); }
.tabbar a[aria-current="page"] { color: var(--on-panel); }
.loading-bar::before { background: var(--on-panel); }
.toast { background: var(--ink); color: var(--bg); }

/* Contenu : boutons et pastilles en orange vif, texte foncé */
.pill, .circle-dark, .platform, .message-icon, .service-break span { background: var(--accent); color: var(--on-accent); }
.pill .pill-icon { background: color-mix(in srgb, var(--accent) 80%, #000); }
.pill:hover, .circle-dark:hover { background: var(--accent-hover); }
.platform small { color: color-mix(in srgb, var(--on-accent) 65%, var(--accent)); }
.status-dot:not(.is-alert) { background: var(--accent); color: var(--on-accent); }
.trip:hover .godot { background: var(--accent); color: var(--on-accent); }
.station-field-light .station-pill:focus-within { box-shadow: 0 0 0 2px var(--accent); }
