/* BVG house colours, sampled from their own print PDFs -- the same palette the
   timetable sheets use, so the site and the sheet look like one thing. */
:root {
  --yellow: #FDE103;
  --bus: #A0148E;
  --ubahn: #1565AF;
  --sbahn: #008D4F;
  --tram: #ED1C24;
  --rail: #555150;
  --ferry: #0B7285;
  --ink: #242021;
  --band: #ECEBEB;
  --quiet: #605D5E;
  --ground: #FDFDFC;
  --hairline: #C9C7C7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font: 15px/1.45 "Fira Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
}

a { color: var(--bus); }

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

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--band);
  border-left: 8px solid var(--bus);
}

.stop-sign {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--bus);
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
}

header h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
header .validity { margin-left: auto; font-size: 12px; color: var(--quiet); text-align: right; }

/* ---- layout ---------------------------------------------------------- */

main {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100% - 48px);
}

@media (max-width: 760px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
  #panel { max-height: 46vh; }
  #map { height: 54vh; }
}

#panel {
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#q {
  margin: 12px;
  padding: 9px 11px;
  font: inherit;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: #fff;
}
#q:focus { outline: 3px solid var(--yellow); outline-offset: 0; }

#count { padding: 0 14px 8px; font-size: 12px; color: var(--quiet); }

#results { overflow-y: auto; flex: 1; min-height: 0; }

.hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--hairline);
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.hit:hover, .hit:focus { background: var(--band); }
.hit strong { display: block; font-weight: 600; }
.hit .lines { margin-top: 3px; }

/* ---- line badges ----------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 1px 4px;
  margin: 1px 2px 1px 0;
  border-radius: 2px;
  background: var(--bus);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}
.badge.ubahn { background: var(--ubahn); }
.badge.sbahn { background: var(--sbahn); }
.badge.tram  { background: var(--tram); }
.badge.rail  { background: var(--rail); }
.badge.ferry { background: var(--ferry); }

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

#map { height: 100%; }
.maplibregl-popup-content {
  font: inherit;
  padding: 10px 12px;
  border-radius: 2px;
  border-left: 5px solid var(--bus);
}
.popup-name { font-weight: 700; margin-bottom: 5px; }
.sheet {
  display: inline-block;
  margin-top: 7px;
  padding: 5px 10px;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border-radius: 2px;
}
.sheet:hover { background: var(--bus); color: #fff; }

/* ---- station page ---------------------------------------------------- */

.station { max-width: 1000px; margin: 0 auto; padding: 16px 14px 40px; }
.station table { border-collapse: collapse; width: 100%; font-size: 13px; }
.station th {
  text-align: left;
  background: var(--yellow);
  font-weight: 800;
  font-size: 12px;
  padding: 4px 6px;
}
.station th:first-child, .station th:nth-child(2) { background: var(--band); }
.station td { padding: 3px 6px; vertical-align: top; border-top: 1px solid var(--hairline); }
.station td.hour { background: var(--band); font-weight: 800; text-align: right; width: 1%; white-space: nowrap; }
.station sup { color: var(--bus); font-weight: 700; font-size: 9px; }
footer { padding: 14px; font-size: 12px; color: var(--quiet); }

/* ---- footer & legal pages -------------------------------------------- */

footer {
  padding: 14px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--quiet);
  border-top: 1px solid var(--hairline);
}
footer p { margin: 0 0 5px; }
footer a { color: var(--quiet); }

/* the panel scrolls, so its footer sits under the results rather than fixed */
.map-page #panel footer { border-top: 1px solid var(--hairline); flex: none; }

.prose { max-width: 42em; }
.prose h2 { font-size: 15px; margin: 18px 0 6px; }
.prose p, .prose li { font-size: 14px; }
