@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/vendor/inter/inter-latin.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --text: #14181f;
  --quiet: #4b5563;
  --hair: #dfe3e8;
  --field: #f1f4f8;
  --hover: #f7f9fb;
  --tint: #e9eef6;
  --navy: #12305c;
  --accent: #12305c;
  --thumb: #c3c9d1;

  /* Diagram colours. Kept in step with SEV in app.js. */
  --sev-closed: #8a939e;
  --sev-severe: #f97316;
  --sev-reduced: #8b5cf6;
  --sev-minor: #facc15;
  --sev-info: #0ea5e9;
  --dg-outline: #14181f;

  --pad: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d;
    --text: #eef1f5;
    --quiet: #a3adbb;
    --hair: #2a3342;
    --field: #1a2230;
    --hover: #161d29;
    --tint: #1d2a44;
    --navy: #2a4f8f;
    --accent: #a9c1ea;
    --thumb: #3b4658;
    --sev-closed: #7b8794;
    --dg-outline: #000000;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, p { margin: 0; }

button, input { font: inherit; color: inherit; }
button { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A text-only button, used for every secondary action. */
.link {
  min-height: 44px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
.link[disabled] { opacity: 0.45; cursor: default; text-decoration: none; }

/* A date field laid invisibly over its label, so a tap opens the device's own calendar. */
.pick { position: relative; cursor: pointer; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */

.top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 32px;
  padding: 6px var(--pad);
  border-bottom: 1px solid var(--hair);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  font-size: 18px;
  line-height: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { display: block; flex: none; width: 28px; height: 28px; }

.views { display: none; }
.views button, .views .pick {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--quiet);
  white-space: nowrap;
}
.views button:hover, .views .pick:hover { color: var(--text); }
.views [aria-pressed="true"], .views .pick.active, .switch [aria-pressed="true"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* ---------- list of lines ---------- */

.list-col { padding: 24px 0 32px; }

.list-head { padding: 0 var(--pad); }
.list-head h1 { font-size: 15px; line-height: 20px; font-weight: 600; }
.list-head p { margin-top: 2px; min-height: 20px; color: var(--quiet); font-size: 13px; line-height: 20px; }

.notice {
  margin: 0 var(--pad) 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--field);
  font-size: 14px;
  line-height: 20px;
}

.group-title {
  margin-top: 36px;
  padding: 0 var(--pad) 10px;
  border-bottom: 1px solid var(--hair);
  color: var(--quiet);
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
}
.group-title:first-child { margin-top: 24px; }
/* The heading of the good-service lines is one big button that folds them away. */
.group-title.fold-title { padding: 0; }
.fold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  padding: 0 var(--row-end, 20px) 0 var(--pad);
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}
.fold b { color: var(--accent); font-weight: 600; }
.fold:hover b { text-decoration: underline; text-underline-offset: 4px; }
.fold:focus-visible { outline-offset: -2px; }
.all-good { margin-top: 28px; padding: 0 var(--row-end, 20px) 0 var(--pad); font-size: 17px; line-height: 24px; font-weight: 600; }

.row {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 56px;
  border-bottom: 1px solid var(--hair);
  text-align: left;
}
.row:hover { background: var(--hover); }
.row[aria-current="true"] { background: var(--field); }
.row[aria-current="true"] .row-name { color: var(--accent); }
.row:focus-visible { outline-offset: -2px; }

.row-bar { flex: none; width: 6px; }
.row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px var(--row-end, 20px) 8px 14px;
}
.row-id { flex: none; display: flex; align-items: baseline; gap: 8px; }
.row-name { font-size: 17px; line-height: 1.3; font-weight: 600; }
.row-mode { color: var(--quiet); font-size: 13px; line-height: 1.3; }
.row-status { font-size: 14px; line-height: 1.3; text-align: right; text-wrap: balance; }
.row-status.good { color: var(--quiet); }

/* ---------- saved stations and journeys ---------- */

.group-title.with-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 0; }
.group-title.with-actions > span:first-child { padding-bottom: 10px; }
.group-actions { display: flex; gap: 20px; padding-right: calc(var(--row-end, 20px) - var(--pad)); }
.link.small { min-height: 40px; font-size: 13px; }
#saved .group-title { margin-top: 24px; }
#saved + #list .group-title:first-child { margin-top: 36px; }

.saved-row .row-id { flex: 1 1 auto; min-width: 0; flex-direction: column; align-items: flex-start; gap: 2px; }
.saved-row .row-status { flex: none; max-width: 46%; }
.row-status.issue { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-align: left; }
.row-status.issue svg { flex: none; }
.mark-x path { fill: none; stroke: var(--text); stroke-width: 2.2; }
.mark-warn path.dg-warn { stroke: var(--dg-outline); stroke-width: 1.5; stroke-linejoin: round; }
.mark-warn path.dg-bang { fill: none; stroke: #14181f; stroke-width: 1.7; stroke-linecap: round; }
.mark-warn path.dg-bang.light { stroke: #ffffff; }
div.saved-row:hover { background: transparent; }

.saved-hint { padding: 14px var(--row-end, 20px) 0 var(--pad); color: var(--quiet); font-size: 14px; line-height: 20px; }

.saved-form { display: grid; gap: 16px; padding: 20px var(--row-end, 20px) 24px var(--pad); border-bottom: 1px solid var(--hair); }
.field { display: grid; gap: 6px; }
.field span, .pick-lines legend { color: var(--quiet); font-size: 13px; line-height: 20px; font-weight: 500; }
.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--hair);
  border-radius: 4px;
  background: var(--bg);
  font-size: 16px;
}
.field input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.pick-lines { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pick-lines legend { padding: 0; margin-bottom: 2px; }
.pick-line { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; cursor: pointer; }
.pick-line input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); }
.pick-line i { width: 6px; height: 18px; }
.saved-form .note { margin: 0; }
.saved-form .note:empty { display: none; }
.form-actions { display: flex; align-items: center; gap: 24px; }
.solid { min-height: 44px; padding: 0 22px; border-radius: 4px; background: var(--navy); color: #ffffff; font-size: 15px; font-weight: 600; }
.solid:hover { filter: brightness(1.12); }

.skeleton { height: 56px; border-bottom: 1px solid var(--hair); background: linear-gradient(90deg, transparent, var(--field), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.retry { margin: 16px var(--pad) 0; }

.foot { margin-top: 32px; padding: 24px var(--pad) 0; border-top: 1px solid var(--hair); color: var(--quiet); font-size: 13px; line-height: 20px; }
.foot p + p { margin-top: 4px; }

/* ---------- one line, or every affected line ---------- */

.detail { display: none; flex-direction: column; padding: 8px 0 40px; }

.detail-head { padding: 0 var(--pad); }
.back { display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: 4px; }

.eyebrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--quiet); font-size: 15px; line-height: 22px; font-weight: 500; }
.swatch { flex: none; width: 6px; height: 22px; }

.detail-head h2 { margin-top: 12px; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
#d-sub { margin-top: 14px; font-size: 16px; line-height: 24px; }
#d-sub:empty { display: none; }

.switch { display: flex; gap: 0 28px; margin-top: 20px; }
.switch button { min-height: 44px; color: var(--quiet); }
.switch button:hover { color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 12px var(--pad) 0; color: var(--quiet); font-size: 14px; line-height: 20px; }
.legend:empty { display: none; }
.lg { display: inline-flex; align-items: center; gap: 10px; }
.lg i { position: relative; display: block; flex: none; width: 28px; height: 8px; }
.lg i.warn { width: 20px; height: 18px; }
.lg i.warn svg { display: block; }
.lg i.closed { height: 16px; background: linear-gradient(var(--sev-closed), var(--sev-closed)) center / 100% 3px no-repeat; }
.lg i.closed::before, .lg i.closed::after { content: ""; position: absolute; left: 6px; top: 7px; width: 16px; height: 2px; background: var(--text); transform: rotate(45deg); }
.lg i.closed::after { transform: rotate(-45deg); }

.map-wrap { position: relative; z-index: 0; margin-top: 20px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
#map { height: clamp(320px, 56vh, 560px); background: var(--field); }

.map-tools { position: absolute; top: 10px; right: 10px; z-index: 5; display: flex; gap: 8px; }
.map-tools .link { min-height: 36px; padding: 0 12px; background: var(--bg); border: 1px solid var(--hair); }
.map-tools .hint { color: var(--quiet); font-size: 13px; line-height: 20px; }
/* In diagram view the buttons sit in a strip under the line, clear of the station names. */
.map-wrap.as-diagram .map-tools { position: static; align-items: center; justify-content: flex-end; gap: 24px; padding: 0 var(--pad); border-top: 1px solid var(--hair); }
.map-wrap.as-diagram .map-tools .link { min-height: 44px; padding: 0; background: transparent; border: 0; }
.map-wrap.as-diagram .map-tools .hint { flex: 1; min-width: 0; padding: 12px 0; }
.map-wrap.as-diagram .map-tools:not(:has(> :not([hidden]))) { display: none; }

/* ---------- line diagram ---------- */

.diagram { overflow-x: auto; overflow-y: hidden; padding: 8px 0 4px; cursor: grab; overscroll-behavior-x: contain; }
.diagram.dragging { cursor: grabbing; user-select: none; }
.diagram.fit, .diagram.vertical { cursor: default; }
.diagram svg { display: block; }
.diagram.fit svg { width: 100%; height: auto; }
.diagram.scrolls:not(.fit) { -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); }

/* Phones draw the line top to bottom, cut down to the affected stretch until asked for the rest. */
.diagram.vertical { padding: 0; }
.diagram.cut-top { -webkit-mask-image: linear-gradient(transparent, #000 28px); mask-image: linear-gradient(transparent, #000 28px); }
.diagram.cut-bottom { -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
.diagram.cut-top.cut-bottom { -webkit-mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent); }

.diagram path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dg-base { stroke-width: 6; }
.dg-closed { stroke: var(--sev-closed); stroke-width: 3; }
/* Delays and other disruption: a warning triangle in place of each affected station's dot. */
.dg-warn, .lg path.dg-warn { stroke: var(--dg-outline); stroke-width: 1.5; stroke-linejoin: round; }
.diagram path.dg-bang, .lg path.dg-bang { fill: none; stroke: #14181f; stroke-width: 1.7; stroke-linecap: round; }
.diagram path.dg-bang.light, .lg path.dg-bang.light { stroke: #ffffff; }
.dg-rail.dg-base { stroke-width: 4; }
.dg-rail.dg-closed { stroke-width: 2; }
.dg-stop { fill: var(--bg); stroke: var(--text); stroke-width: 2; }
.diagram path.dg-x { stroke: var(--text); stroke-width: 2; stroke-linecap: butt; }
.diagram path.dg-x-back { stroke: var(--bg); stroke-width: 5; stroke-linecap: butt; }
.dg-tap { cursor: pointer; }
.dg-tap-area { fill: transparent; }
.dg-label { font-size: 12px; font-weight: 600; fill: var(--text); }
.dg-label.calm { font-weight: 400; }
.dg-label.quiet { font-weight: 400; fill: var(--quiet); }
.dg-label.end { font-weight: 700; }
.vertical .dg-label { font-size: 15px; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.dg-flash { stroke: #ffc220; stroke-width: 24; opacity: 0; animation: dg-flash 1.8s ease-out; pointer-events: none; }
.dg-flash.dot { stroke: none; fill: #ffc220; }
@keyframes dg-flash {
  0% { opacity: 0.7; }
  20% { opacity: 0.25; }
  40% { opacity: 0.6; }
  60% { opacity: 0.2; }
  80% { opacity: 0.35; }
  100% { opacity: 0; }
}

/* ---------- what TfL says ---------- */

.cards { padding: 0 var(--pad); }
.card { min-width: 0; padding: 28px 0 0; }
.card + .card { margin-top: 28px; border-top: 1px solid var(--hair); }

/* A notice lights up briefly when its mark on the diagram is tapped. */
.card.lit { animation: lit 2s ease-out; }
@keyframes lit {
  0%, 35% { background: var(--tint); box-shadow: 0 0 0 12px var(--tint); }
  100% { background: transparent; box-shadow: 0 0 0 12px transparent; }
}
.card-status { margin-top: 2px; font-size: 15px; line-height: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.card > .chips:first-child { margin-top: 0; }
.chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--hair);
  border-radius: 4px;
  text-align: left;
  font-size: 14px;
  line-height: 20px;
}
.chip:hover { background: var(--field); }
.chip b { font-weight: 600; white-space: nowrap; }
.chip span { color: var(--quiet); }

.when { margin-top: 12px; font-size: 15px; line-height: 22px; }
.card > .when:first-child { margin-top: 0; }
.from { margin-top: 20px; color: var(--quiet); font-size: 13px; line-height: 20px; font-weight: 500; }
.card > .from:first-child { margin-top: 0; }
.reason { margin-top: 8px; max-width: 64ch; font-size: 16px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.note { margin-top: 12px; color: var(--quiet); font-size: 14px; line-height: 20px; }
.empty { color: var(--quiet); }

/* ---------- map furniture ---------- */

.maplibregl-map { font: inherit; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-group { border-radius: 4px; }

.maplibregl-popup.tip { pointer-events: none; }
.maplibregl-popup.tip .maplibregl-popup-content {
  padding: 4px 8px;
  border-radius: 4px;
  background: #14181f;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}
.maplibregl-popup.tip .maplibregl-popup-tip { display: none; }

@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-group { background: #171d27; }
  .maplibregl-ctrl-group button + button { border-top-color: #2a3342; }
  .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
  .maplibregl-ctrl-attrib.maplibregl-compact, .maplibregl-ctrl.maplibregl-ctrl-attrib { background: rgba(16, 21, 29, 0.8); color: #a3adbb; }
  .maplibregl-ctrl-attrib a { color: #c5cdd8; }
}

/* ---------- phones: the list and the line are separate pages, with the days in a bar at the bottom ---------- */

.tabbar { display: none; }

@media (max-width: 899px) {
  body { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
  body.detail-open .list-col { display: none; }
  body.detail-open .detail { display: flex; }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr 1fr 56px 1fr 1fr;
    align-items: center;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--hair);
  }
  .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    height: 48px;
    border-radius: 8px;
  }
  .tabbar b { font-size: 13px; line-height: 16px; font-weight: 600; }
  .tabbar span { color: var(--quiet); font-size: 11px; line-height: 14px; white-space: nowrap; }
  .tabbar button[aria-pressed="true"] { background: var(--tint); }
  .tabbar button[aria-pressed="true"] b { font-weight: 700; }
  .tabbar button[aria-pressed="true"] b, .tabbar button[aria-pressed="true"] span { color: var(--accent); }
  .tabbar .cal {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
  }
  .tabbar .cal.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
}

/* ---------- wide screens: list on the left, the chosen line on the right ---------- */

@media (min-width: 900px) {
  :root { --pad: 48px; }
  body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

  .top { grid-template-columns: 1fr auto 1fr; padding: 10px 40px; }
  .brand img { width: 32px; height: 32px; }
  .views { display: flex; gap: 0 32px; }
  #refresh { justify-self: end; }

  .layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(360px, 432px) 1fr; }
  /* The two panes scroll on their own: a thin line for the bar, nothing behind it. */
  .list-col, .detail { scrollbar-width: thin; scrollbar-color: var(--thumb) transparent; }
  @supports not (scrollbar-color: auto) {
    .list-col::-webkit-scrollbar, .detail::-webkit-scrollbar { width: 6px; }
    .list-col::-webkit-scrollbar-track, .detail::-webkit-scrollbar-track { background: transparent; }
    .list-col::-webkit-scrollbar-thumb, .detail::-webkit-scrollbar-thumb { background: var(--thumb); border-radius: 3px; }
  }
  .list-col { --pad: 0px; --row-end: 24px; overflow: auto; padding: 32px 0 40px 40px; border-right: 1px solid var(--hair); }
  .foot { padding-right: 24px; }
  .notice { margin-right: 24px; }

  .detail { display: flex; overflow: auto; padding: 48px 0 64px; }
  .back { display: none; }
  .eyebrow { margin-top: 0; }
  .detail-head h2 { max-width: 26ch; font-size: 34px; line-height: 1.2; letter-spacing: -0.015em; }
  #d-sub { margin-top: 16px; font-size: 17px; line-height: 26px; }
  .switch { margin-top: 32px; }
  .map-wrap { order: 2; margin-top: 8px; }
  .legend { order: 3; padding-top: 20px; }
  .cards { order: 4; margin-top: 12px; }
  .row-status { font-size: 15px; }
  .reason { font-size: 17px; }
  #map { height: clamp(360px, 58vh, 760px); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}
