:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5b6370;
  --line: #dde1e7;
  --accent: #0b6bcb;
  --accent-text: #ffffff;
  --changed: #fff4cc;
  --step: #eef5fc;
  --error: #b42318;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1e24;
    --text: #e7eaee;
    --muted: #9aa3af;
    --line: #2c323b;
    --accent: #4ea1f3;
    --accent-text: #0b1520;
    --changed: #3a3315;
    --step: #16212e;
    --error: #f97066;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header.site, main, footer.site {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

header.site { padding-top: 24px; }
header.site h1 { margin: 0; font-size: 1.6rem; }
header.site h1 a { color: inherit; text-decoration: none; }
header.site p, footer.site p, .note { color: var(--muted); }
footer.site { padding-bottom: 32px; font-size: 0.875rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin: 16px 0;
}

.card h2 { margin-top: 0; font-size: 1.25rem; }
.card h3 { font-size: 1rem; }

.fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}

.field label { display: block; font-weight: 600; margin-bottom: 4px; }

.field select, .field input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field.invalid select, .field.invalid input { border-color: var(--error); }
.errors { color: var(--error); margin: 4px 0 0; padding-left: 18px; }

button {
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.fare { color: var(--accent); margin-left: 8px; }

dl.timings, dl.facts { margin: 0; }
dl.timings { display: flex; flex-wrap: wrap; gap: 8px 24px; }
dl.timings dt, dl.facts dt { color: var(--muted); font-size: 0.875rem; }
dl.timings dd, dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
dl.facts div { margin-bottom: 8px; }

.scroll { overflow-x: auto; }
table.trace { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
table.trace th, table.trace td { border-top: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
ul.record { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
ul.record li { font-variant-numeric: tabular-nums; }
ul.record li.changed { background: var(--changed); border-radius: 4px; padding: 0 4px; }
ul.record .key { color: var(--muted); }

/* The fitted pipeline, drawn as scikit-learn draws an estimator: a dashed box for the pipeline and one box per
   step, joined by arrows. A step opens with <details>, so the diagram needs no script. */
.pipeline-box { border: 1px dashed var(--muted); border-radius: 8px; padding: 12px; }
.pipeline-box.nested { border-color: var(--line); }
.pipeline-label { margin: 0 0 8px; font-weight: 600; }
.step-kind { margin-left: 8px; color: var(--muted); font: 0.8rem ui-monospace, SFMono-Regular, Menlo, monospace; }
ol.pipeline-steps { list-style: none; margin: 0; padding: 0; }
li.pipeline-step { max-width: 640px; margin: 0 auto; }
li.pipeline-step + li.pipeline-step::before { content: "\2193"; display: block; text-align: center; color: var(--muted); }
li.pipeline-step details { border: 1px solid var(--line); border-radius: 6px; background: var(--step); }
li.pipeline-step summary { padding: 8px 12px; cursor: pointer; font-weight: 600; }
li.pipeline-step details[open] > summary { border-bottom: 1px solid var(--line); }
.step-body { padding: 4px 12px 8px; font-size: 0.875rem; }
.step-body h4 { margin: 8px 0 4px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; }
ul.step-summary { margin: 0; padding-left: 18px; }
dl.step-params { margin: 0; }
dl.step-params div { display: flex; gap: 8px; }
dl.step-params dt { color: var(--muted); min-width: 90px; }
dl.step-params dd { margin: 0; word-break: break-word; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; }
code { font-size: 0.85em; }

/* A priced trip's way through the pipeline: an inline SVG drawn by fare/dataflow_diagram.py, colored here so it
   follows the color scheme. Below 760px it scrolls sideways instead of shrinking its text. */
svg.dataflow { display: block; width: 100%; height: auto; min-width: 760px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.df-heading { font-size: 13px; font-weight: 600; fill: var(--text); }
.df-kind { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--muted); }
.df-label { font-size: 12px; fill: var(--muted); }
.df-input, .df-value { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--text); }
.df-unknown { fill: var(--error); font-weight: 700; }
.df-block { fill: var(--step); stroke: var(--accent); stroke-width: 1.2; }
.df-line { stroke: var(--muted); stroke-width: 1.2; fill: none; }
.df-dropped { stroke-dasharray: 3 3; }
.df-cross { font-size: 14px; fill: var(--error); }
.df-arrowhead { fill: var(--muted); }
.df-network { fill: var(--accent); }
.df-network-text { font-size: 12px; font-weight: 600; fill: var(--accent-text); }
.df-fare { fill: var(--card); stroke: var(--accent); stroke-width: 1.6; }
.df-fare-text { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--accent); }
details.as-table { margin-top: 12px; }
details.as-table summary { cursor: pointer; color: var(--muted); }

