/* Paris ⇄ Avon. Layout: one narrow column read on a platform: now, tonight (only when needed), the trains for
   one direction, then the works calendar. Two direction columns side by side from 880px. Look: a scenographer's
   white page (airy, thin geometric type, spaced capitals, navy ink, the line R pink as the line's accent) with
   Fontainebleau's forest and sandstone for the states. Each direction takes its destination's colour:
   pine for Avon, slate roofs for Paris. */
:root {
  --bg: #ffffff;
  --surface: #f6f5f3;          /* a sandstone-tinted grey, for cards */
  --line-soft: #e6e3df;
  --ink: #23283a;              /* navy-charcoal text */
  --ink-2: #5c6172;
  --navy: #293150;
  --rose: #e8879c;             /* line R pink, a touch deeper so it reads on white */
  --rose-ink: #b24a63;
  --ok: #2f6b4f;               /* forest */
  --ok-tint: #e7f0ea;
  --warn: #8f5508;             /* sandstone ochre, darkened for text contrast */
  --warn-fill: #d99a2b;
  --warn-tint: #fbf0dc;
  --bad: #b8302a;
  --bad-tint: #fbe7e5;
  --avon: #1d5c57;             /* pine, towards Avon */
  --avon-ink: #1d5c57;
  --paris: #36498a;            /* slate roofs, towards Paris */
  --paris-ink: #36498a;
  --on-dir: #ffffff;
  --font: "Jost", "Futura", "Avenir Next", "Century Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141826; --surface: #1d2233; --line-soft: #2c3246; --ink: #eef0f5; --ink-2: #a7adbf; --navy: #c9d0ea;
    --rose: #f49fb3; --rose-ink: #f7b3c3; --ok: #7fc29d; --ok-tint: #1b2d26; --warn: #f0b85a; --warn-fill: #d99a2b;
    --warn-tint: #33291a; --bad: #ff8a80; --bad-tint: #3a1f22;
    --avon: #1f4f4b; --avon-ink: #7fd0c6; --paris: #2d3d72; --paris-ink: #a9bbf2; --on-dir: #ffffff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141826; --surface: #1d2233; --line-soft: #2c3246; --ink: #eef0f5; --ink-2: #a7adbf; --navy: #c9d0ea;
  --rose: #f49fb3; --rose-ink: #f7b3c3; --ok: #7fc29d; --ok-tint: #1b2d26; --warn: #f0b85a; --warn-fill: #d99a2b;
  --warn-tint: #33291a; --bad: #ff8a80; --bad-tint: #3a1f22;
  --avon: #1f4f4b; --avon-ink: #7fd0c6; --paris: #2d3d72; --paris-ink: #a9bbf2; --on-dir: #ffffff; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 var(--font);
  font-variant-numeric: lining-nums tabular-nums;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-tap-highlight-color: transparent;
}
/* the notch band above the sticky tabs: painted, so the page does not scroll visibly under the status bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: var(--rose-ink); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rose-ink); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }

.page {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 8px 40px;
  display: flex; flex-direction: column; gap: 18px;
}
@media (min-width: 880px) { .page { max-width: 1040px; } }

.eyebrow, .banner-k, .sec-h, .next-k, .maps-k, .later-k {
  font-family: var(--font); font-weight: 600; text-transform: uppercase; letter-spacing: .14em; font-size: 12px;
}

/* ---------------------------------------------------------------- header */
.top { position: relative; padding-top: 12px; }
.foret { position: absolute; right: 0; top: 0; width: 46%; max-width: 260px; height: auto;
  fill: none; stroke: var(--rose); stroke-width: 1.3; stroke-linecap: round; opacity: .75; }
.eyebrow { margin: 0 0 6px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 62%; }
@media (max-width: 420px) { .foret { width: 36%; } }
.r-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--rose); color: #23283a; font: 600 12px/1 var(--font); letter-spacing: 0; }
h1 { margin: 0; font: 300 clamp(38px, 11vw, 60px)/1 var(--font); letter-spacing: -.01em; color: var(--navy); }
h1 .arrows { color: var(--rose); font-weight: 300; margin: 0 .08em; }
.fresh { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.fresh b { color: var(--ink); font-weight: 500; }

.stale { background: var(--warn-tint); color: var(--ink); border-radius: var(--r); padding: 12px 14px; font-size: 15px; }
.stale strong { color: var(--warn); }

/* ---------------------------------------------------------------- now */
.banner { border-radius: var(--r); padding: 14px 16px; background: var(--surface); }
.banner-k { margin: 0; color: var(--ink-2); }
.banner-word { margin: 2px 0 0; font: 500 clamp(28px, 8.5vw, 36px)/1.1 var(--font); }
.banner-sub { margin: 4px 0 0; font-size: 16px; }
.banner-sub:empty { display: none; }
.banner-line { margin-top: 10px; background: var(--bg); border-radius: 10px; padding: 8px 10px 4px; color: var(--ink); }
.banner[data-level="normal"] { background: var(--ok-tint); }
.banner[data-level="normal"] .banner-word { color: var(--ok); }
.banner[data-level="perturbe"] { background: var(--warn-fill); color: #241a05; }
.banner[data-level="perturbe"] .banner-k { color: #3d2c08; }
.banner[data-level="interrompu"] { background: var(--bad); color: #fff; }
.banner[data-level="interrompu"] .banner-k { color: #ffe1de; }
:root[data-theme="dark"] .banner[data-level="interrompu"] { background: #9e2a25; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner[data-level="interrompu"] { background: #9e2a25; } }

/* tonight: amber, its own block, a link to the day in the calendar */
.tonight { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
  background: var(--warn-tint); border: 1.5px solid var(--warn-fill); border-radius: var(--r); padding: 12px 12px 12px 14px; min-height: 56px; }
.tonight[hidden] { display: none; }
.tn-ico { width: 30px; height: 30px; color: var(--warn); stroke-width: 1.6; }
.tn-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tn-when { font: 400 19px/1.2 var(--font); }
.tn-when b { font-weight: 600; color: var(--warn); }
.tn-what { font-size: 15.5px; }
.tn-bus { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--ink-2); }
.tn-chev { color: var(--warn); }

/* the small line drawing (banner and calendar days) */
.mini-line { display: block; width: 100%; max-width: 420px; height: auto; overflow: visible; }
.mini-line .seg { stroke: var(--rose); stroke-width: 6; stroke-linecap: round; }
.mini-line .seg-perturbe { stroke: var(--warn-fill); stroke-width: 7; }
.mini-line .seg-interrompu { stroke: var(--bad); stroke-width: 7; stroke-dasharray: 8 6; stroke-linecap: butt; }
.mini-line .st { fill: var(--bg); stroke: var(--navy); stroke-width: 3; }
.mini-line text { font: 500 13px var(--font); fill: currentColor; }

/* ---------------------------------------------------------------- tabs */
.trip { display: flex; flex-direction: column; gap: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; box-shadow: 0 0 0 6px var(--bg); }
.tabs button { appearance: none; border: 0; border-radius: 999px; min-height: 46px; padding: 8px 6px; background: transparent;
  color: var(--ink-2); font: 500 16px var(--font); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; }
.tabs button .ico { width: 21px; height: 21px; }
.tabs button b { font-weight: 500; }
.tabs button[data-dir="paris-avon"] { color: var(--avon-ink); }
.tabs button[data-dir="avon-paris"] { color: var(--paris-ink); }
.tabs button[aria-selected="true"] { color: var(--on-dir); }
.tabs button[data-dir="paris-avon"][aria-selected="true"] { background: var(--avon); }
.tabs button[data-dir="avon-paris"][aria-selected="true"] { background: var(--paris); }
@media (min-width: 880px) { .tabs { display: none; } }

.dirs { display: grid; gap: 28px; }
@media (min-width: 880px) { .dirs { grid-template-columns: 1fr 1fr; gap: 36px; } }
@media (max-width: 879.98px) { .dir:not(.on) { display: none; } }
.dir { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dir[data-dir="paris-avon"] { --dir: var(--avon); --dir-ink: var(--avon-ink); }
.dir[data-dir="avon-paris"] { --dir: var(--paris); --dir-ink: var(--paris-ink); }
.dir-h { display: none; margin: 0; font: 400 24px/1.1 var(--font); color: var(--dir-ink); align-items: center; gap: 8px; }
.dir-h b { font-weight: 400; color: var(--rose-ink); }
@media (min-width: 880px) { .dir-h { display: flex; } }

.sec-h { margin: 0 0 4px; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.sec-h::before, .sec-h::after { content: ""; height: 1px; background: var(--line-soft); flex: 1; }
.sec-h::before { flex: 0 0 18px; }

/* ---------------------------------------------------------------- next train */
.next { border-radius: var(--r); background: var(--dir); color: var(--on-dir); padding: 14px 16px 16px; display: grid; gap: 4px; }
.next-k { margin: 0; display: flex; align-items: center; gap: 7px; opacity: .9; }
.next-k .ico { width: 19px; height: 19px; }
.next-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.next .t { font: 300 60px/0.95 var(--font); letter-spacing: -.02em; display: flex; flex-direction: column; }
.next .t s { text-decoration-thickness: 3px; }
.next .t .was { font: 400 14px/1.3 var(--font); letter-spacing: 0; opacity: .8; text-decoration: line-through; margin-top: 4px; }
.next .in { text-align: right; font: 500 20px/1.15 var(--font); white-space: nowrap; }
.next .in small { display: block; font: 400 15px var(--font); opacity: .85; }
.next .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 15px; margin-top: 6px; }
.next .code { color: inherit; opacity: .85; }
.tag { border-radius: 6px; padding: 1px 8px; font-weight: 600; }
.tag-plat { background: var(--rose); color: #23283a; }
.tag-delay { background: var(--warn-fill); color: #241a05; }
.tag-cancel { background: #fff; color: #b8302a; }
.next.cancelled { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- departures board */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 4.1em minmax(0, 1fr) auto; gap: 0 12px; align-items: center;
  padding: 10px 0; min-height: 56px; border-bottom: 1px solid var(--line-soft); }
.board li:last-child { border-bottom: 0; }
.b-time { font: 500 24px/1 var(--font); color: var(--dir-ink); display: flex; flex-direction: column; }
.b-time small { font: 400 13px/1.3 var(--font); color: var(--ink-2); text-decoration: line-through; margin-top: 3px; }
.b-mid { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.b-arr { font-size: 16px; }
.code { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--ink-2); }
.code span { font-weight: 400; letter-spacing: .04em; }
.b-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.b-in { font: 500 16px var(--font); white-space: nowrap; }
.chip { display: inline-block; border-radius: 6px; padding: 1px 7px; font: 600 13px/1.5 var(--font); white-space: nowrap; }
.chip.delay { background: var(--warn-tint); color: var(--warn); }
.chip.cancel { background: var(--bad-tint); color: var(--bad); }
.chip.plat { background: var(--surface); color: var(--ink); }
.board li.cancelled .b-time, .board li.cancelled .b-arr { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.board li.gone { opacity: .45; }
.more-btn { appearance: none; border: 0; background: none; color: var(--dir-ink); font-weight: 500; padding: 10px 0; min-height: 44px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; }
.empty { color: var(--ink-2); background: var(--surface); border-radius: var(--r); padding: 14px; margin: 0; }

/* ---------------------------------------------------------------- open in a maps app */
.maps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.maps-k { color: var(--ink-2); width: 100%; }
.mapbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; font-weight: 500; flex: 1 1 140px; justify-content: center; }
.mapbtn .ico { width: 20px; height: 20px; color: var(--dir-ink); }

/* ---------------------------------------------------------------- alternatives (folded unless the R is cut now) */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.alts { border: 1px solid var(--line-soft); border-radius: var(--r); }
.alts > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; font-weight: 500; }
.alts > summary small { color: var(--ink-2); font-size: 15px; font-weight: 400; display: flex; align-items: center; gap: 6px; }
.alts > summary small::after, .more > summary::after, .official > summary::after {
  content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); margin-left: 4px; }
.alts[open] > summary small::after, .more[open] > summary::after, .official[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.alts.urgent { border-color: var(--bad); }
.alts.urgent > summary { color: var(--bad); }
.alt-list { display: grid; gap: 10px; padding: 0 14px 14px; }
.alt { border-top: 1px solid var(--line-soft); padding-top: 10px; display: grid; gap: 6px; }
.alt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.alt-times { font: 500 20px/1.1 var(--font); }
.alt-times span { color: var(--rose-ink); margin: 0 4px; }
.alt-dur { color: var(--ink-2); font-size: 15px; }
.legs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.pill { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; font: 600 13px/1 var(--font); }
.walk, .leg-sep { color: var(--ink-2); }
.alt-path { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ---------------------------------------------------------------- works calendar */
.travaux { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 12px; }
.travaux .sec-h { margin-bottom: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-grid > span { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .1em; }
.cd { appearance: none; border: 0; border-radius: 10px; background: var(--surface); min-height: 54px; padding: 4px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; cursor: pointer; overflow: hidden; position: relative; }
.cd-n { font: 500 16px/1.1 var(--font); display: flex; flex-direction: column; align-items: center; }
.cd-n small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); line-height: 1; }
.cd-t { width: 100%; font: 600 12px/1.6 var(--font); text-align: center; letter-spacing: 0; }
/* an evening cut is a tinted band with its start time; a whole day cut fills the cell */
.cd.lvl-interrompu .cd-t { background: var(--bad-tint); color: var(--bad); box-shadow: inset 0 2px 0 var(--bad); }
.cd.lvl-perturbe .cd-t { background: var(--warn-tint); color: var(--warn); box-shadow: inset 0 2px 0 var(--warn-fill); }
.cd.allday.lvl-interrompu { background: var(--bad); color: #fff; }
.cd.allday.lvl-interrompu .cd-t { background: transparent; color: #fff; box-shadow: none; }
.cd.allday.lvl-perturbe { background: var(--warn-fill); color: #241a05; }
.cd.allday.lvl-perturbe .cd-t { background: transparent; color: #241a05; box-shadow: none; }
.cd.past { opacity: .4; }
.cd.today { box-shadow: inset 0 0 0 2px var(--rose); }
.cd.today .cd-n { color: var(--rose-ink); font-weight: 600; }
.cd[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--navy); }
.cd.today[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--navy), inset 0 0 0 5px var(--rose); }
.cal-key { margin: 0; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.sw { display: inline-block; width: 14px; height: 9px; border-radius: 2px; }
.sw-interrompu { background: var(--bad-tint); box-shadow: inset 0 2px 0 var(--bad); }
.sw-perturbe { background: var(--warn-tint); box-shadow: inset 0 2px 0 var(--warn-fill); margin-left: 8px; }
.later { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 15px; }
.later-k { color: var(--ink-2); }
.later b { font-weight: 600; }
.day { background: var(--surface); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; }
.day-h { margin: 0; font: 500 18px/1.25 var(--font); color: var(--navy); }
.dd-none { margin: 0; color: var(--ink-2); }
.link-btn { appearance: none; border: 0; background: none; padding: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 4px;
  color: var(--rose-ink); font-weight: 500; text-align: left; cursor: pointer; }
.ev { display: grid; gap: 8px; color: var(--ink); }
.ev + .ev { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.ev p { margin: 0; }
.ev-when { display: flex; align-items: center; gap: 8px; font: 500 22px/1.15 var(--font); }
.ev-when .ico { width: 24px; height: 24px; color: var(--bad); }
.ev[data-level="perturbe"] .ev-when .ico { color: var(--warn); }
.ev-what b { font-weight: 600; }
.ev-bus { display: flex; align-items: center; gap: 8px; }
.ev-bus .ico { width: 22px; height: 22px; color: var(--ink-2); }
.ev-notes { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.official > summary { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; color: var(--rose-ink); font-weight: 500; }
.official p { font-size: 15px; color: var(--ink-2); max-width: 65ch; }
.official .off-t { color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.cal-note { margin: 0; font-size: 13px; color: var(--ink-2); }

/* ---------------------------------------------------------------- other messages + footer */
.more > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 15px; }
.msg-list { display: grid; gap: 10px; margin-top: 6px; }
.msg { border-radius: var(--r); background: var(--surface); padding: 12px 14px; }
.msg h3 { margin: 0 0 4px; font: 500 16px/1.3 var(--font); text-wrap: balance; }
.msg p { margin: 0; font-size: 15px; color: var(--ink-2); max-width: 65ch; }

.foot { color: var(--ink-2); font-size: 13px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.foot p { margin: 0 0 6px; max-width: 65ch; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }

@media (prefers-reduced-motion: no-preference) {
  .banner, .next, .cd { transition: background-color .3s ease; }
}
