/* Bee Network yellow for trams and anything live; departure boards are black with amber LED text like the ones on the
   platforms; everything else stays quiet so the lines and trams carry the map */
:root {
  --bee: #ffcd00;
  --ink: #222222;
  --muted: #5e5e5e;
  --surface: #ffffff;
  --rule: #e2e2e2;
  --board: #000000;
  --led: #ffa41b;
  --board-label: #a3a3a3;
  --error: #b3261e;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --led-font: "Doto", ui-monospace, monospace;
  --sheet-h: 0px;
  font-family: var(--font);
  color: var(--ink);
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--surface);
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-container {
  font-family: var(--font);
}

/* Map credits fold into an (i) button once the map is used, and the button opens them again */
.credits-button {
  display: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.85);
  color: var(--ink);
  font: italic 600 14px/24px Georgia, "Times New Roman", serif;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
  cursor: pointer;
}

.credits-folded .credits-button {
  display: block;
}

.credits-folded .leaflet-control-attribution {
  display: none;
}

/* Washed out so the coloured lines and yellow trams stand out */
.tiles-greyscale {
  filter: grayscale(1) brightness(1.1) contrast(0.72);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* Panel: a slim column on the right; a bottom sheet on phones */
.panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  box-sizing: border-box;
  width: 288px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 16px 18px 14px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 8px 28px rgba(0, 0, 0, 0.14);
  font-size: 14px;
  line-height: 1.4;
}

.sheet-handle {
  display: none;
}

.panel h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 700;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.live-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bee);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.status.error {
  color: var(--error);
}

.status.error .live-dot,
.status.waiting .live-dot {
  background: #b5b5b5;
}

.find {
  position: relative;
  margin: 14px 0 0;
}

.find input {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  background: #f6f6f6;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}

.find input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 0;
  background: var(--surface);
}

.find-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.find-results li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.find-results li[aria-selected="true"],
.find-results li:hover {
  background: #f1f1f1;
}

.find-results .lines {
  display: flex;
  gap: 3px;
}

.find-results .lines span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.find-results .none {
  color: var(--muted);
  cursor: default;
}

.panel-more {
  margin-top: 16px;
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  flex: none;
  width: 18px;
  height: 5px;
  border-radius: 3px;
}

.key {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.key summary {
  cursor: pointer;
  font-weight: 700;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tip {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.picker {
  margin-top: 10px;
}

.picker select {
  flex: 1;
  font: inherit;
  padding: 3px 4px;
}

/* Map markers */
.tram-icon,
.stop-icon {
  background: none;
  border: none;
}

/* A finger can't hit a 6–12px dot: on touch screens each stop answers taps in an invisible 36px circle around it */
@media (pointer: coarse) {
  .stop-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
  }
}

.stop-dot {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.55);
}

.stop-dot.interchange {
  background: #ffffff;
  border: 2px solid #222222;
}

.tram {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}

.tram::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("tram.png") center / 100% 100% no-repeat;
}

.tram.at-stop {
  filter: drop-shadow(0 0 1px #000000) drop-shadow(0 0 3px #000000) drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));
}

.cluster-icon {
  background: none;
  border: none;
}

/* A group of trams: in the trams' yellow */
.cluster {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #000000;
  background: var(--bee);
  color: #000000;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.legend-cluster {
  flex: none;
  width: 22px;
  height: 22px;
  font-size: 11px;
  margin: 0 9px;
  cursor: default;
}

.cluster-list {
  line-height: 1.5;
}

/* Lying on its side, pointing right */
.legend-tram {
  flex: none;
  width: 40px;
  height: 20px;
}

.legend-tram::before {
  inset: auto;
  left: 16px;
  top: -10px;
  width: 8px;
  height: 40px;
  transform: rotate(90deg);
}

.legend-stop {
  flex: none;
  display: flex;
  justify-content: center;
  width: 40px;
}

.legend-stop .stop-dot {
  width: 10px;
  height: 10px;
}

.legend-double {
  display: flex;
  flex: none;
}

/* Popups */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
}

.leaflet-popup-content {
  font-size: 14px;
  line-height: 1.4;
}

.tram-card {
  min-width: 200px;
}

.tram-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 16px;
}

.tram-card p {
  margin: 0 0 3px;
}

.tram-card .muted {
  color: var(--muted);
  font-size: 13px;
}

/* A stop's departures, as on the platform screens */
.board-popup .leaflet-popup-content-wrapper,
.board-popup .leaflet-popup-tip {
  background: var(--board);
  color: var(--led);
}

.board-popup .leaflet-popup-content-wrapper {
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
}

.board-popup .leaflet-popup-content {
  margin: 14px 18px 16px;
}

.board-popup a.leaflet-popup-close-button {
  color: var(--board-label);
}

.board {
  min-width: 250px;
}

.board h2 {
  margin: 0 22px 2px 0;
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
}

.board h3 {
  margin: 12px 0 4px;
  color: var(--board-label);
  font-size: 12px;
  font-weight: 400;
}

.board ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.board li {
  display: grid;
  grid-template-columns: 4px 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-family: var(--led-font);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.board .bar {
  height: 15px;
  border-radius: 1px;
}

.board .cars {
  font-weight: 600;
  font-size: 14px;
}

.board .wait {
  text-align: right;
  white-space: nowrap;
}

.board .empty {
  margin: 10px 0 0;
  font-family: var(--led-font);
  font-weight: 800;
  font-size: 16px;
}

/* Phones: the panel is a sheet along the bottom; the handle opens the lines and key */
@media (max-width: 640px) {
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 75%;
    padding: 6px 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }

  .sheet-handle {
    display: block;
    width: 100%;
    height: 22px;
    margin: 0 0 4px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
  }

  .sheet-handle::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    margin: 0 auto;
    border-radius: 3px;
    background: #c4c4c4;
  }

  .panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }

  .panel h1 {
    font-size: 18px;
  }

  .find {
    margin-top: 10px;
  }

  .find-results {
    top: auto;
    bottom: calc(100% + 4px);
  }

  .panel:not(.open) .panel-more {
    display: none;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .leaflet-bottom {
    bottom: var(--sheet-h);
  }
}
