/* Green and orange, from the logo: green does the work (buttons, links, route lines),
   orange marks what's urgent or yours (Due, late, the stripe under the header, your stop
   on a map). Bright orange is too pale for small text on white, so text uses a burnt
   orange. The dark theme keeps the same hues, lightened for a dark background. */
:root {
  color-scheme: light dark;
  --green: #00703c;
  --orange: #e86a10;
  --orange-ink: #b34700;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eaf0eb;
  --ink: #17201c;
  --muted: #55625b;
  --line: #e1e7e2;
  --signal: var(--green);
  --signal-ink: #ffffff;
  --route-bg: #e3f1e8;
  --route-ink: #0d4a2c;
  --band: var(--surface);
  --band-ink: var(--ink);
  --band-muted: var(--muted);
  --band-warn: var(--warn);
  --warn: #b3261e;
  --danger: #b3261e;
  --focus: var(--orange-ink);
  --on-orange: #17201c;
  --radius: 14px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #5cd394;
    --orange: #ffa95c;
    --orange-ink: #ffa95c;
    --bg: #0f1512;
    --surface: #18211c;
    --surface-2: #22302a;
    --ink: #edf3ee;
    --muted: #a3b3aa;
    --line: #26332b;
    --signal-ink: #0f1512;
    --route-bg: #1f3a2b;
    --route-ink: #bfeed3;
    --warn: #ffb4a2;
    --danger: #ffb4a2;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 calc(var(--gutter) + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}

h1,
h2,
p,
ul,
fieldset {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 calc(-1 * (var(--gutter) + env(safe-area-inset-right))) 12px
    calc(-1 * (var(--gutter) + env(safe-area-inset-left)));
  padding: calc(12px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 10px
    calc(var(--gutter) + env(safe-area-inset-left));
  /* A green stripe with an orange one above it, the logo's two colours. */
  border-bottom: 3px solid var(--green);
  box-shadow: inset 0 -3px 0 var(--orange);
  background: var(--band);
  color: var(--band-ink);
}

.top h1 {
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

/* The logo sits in its own light disc with a green ring, as on the app's icon. */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  flex: none;
  width: 40px;
  height: 40px;
}

.brand-text {
  min-width: 0;
}

/* Set like the logo: the full name won't fit on one line beside the buttons on a phone. */
.brand-city,
.brand-tagline {
  display: block;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-city {
  font-size: 1.1875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-tagline {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
}

/* On the narrowest phones (320 px), the tagline would otherwise run into the buttons. */
@media (max-width: 359px) {
  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-tagline {
    font-size: 0.625rem;
    letter-spacing: 0.04em;
  }
}

.status {
  color: var(--band-muted);
  font-size: 0.8125rem;
  min-height: 1.1em;
}

.warn {
  color: var(--band-warn);
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  flex: none;
  margin-right: -6px;
}

/* The title sits in the middle, clear of the back arrow, with an empty column on the
   right the same width as the arrow so it's truly centred. */
.screen-top {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 4px;
  padding-right: calc(var(--gutter) + env(safe-area-inset-right) - 10px);
  padding-left: calc(var(--gutter) + env(safe-area-inset-left) - 10px);
}

.screen-top h1 {
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
}

.icon-button:disabled {
  opacity: 0.25;
}

.spinning svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-weight: 600;
}

.danger {
  color: var(--danger);
}

.board {
  display: grid;
  gap: 12px;
}

/* White cards on an off-white page need an edge to stand apart. */
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
}

/* The heading around a card's button takes the button's place, in the body's font. */
.card-heading {
  display: flex;
  flex: 1;
  min-width: 0;
  font: inherit;
}

.card-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 56px;
  padding: 10px 14px 8px;
  text-align: left;
}

.card-head > .icon-button:last-child {
  margin-right: 4px;
}

.map-link {
  color: var(--muted);
}

a.route {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Fills the screen below the header; app.js sets top to the header's height. The map
   itself is the inner box, since MapLibre makes its container position: relative. */
.route-map {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--surface-2);
}

#route-map {
  width: 100%;
  height: 100%;
}

.map-message {
  padding: 24px var(--gutter);
  text-align: center;
}

/* The show-my-location button, at a size a thumb can hit. */
.route-map .maplibregl-ctrl-group button {
  width: 44px;
  height: 44px;
}

.route-map .maplibregl-ctrl-icon {
  background-size: 40px;
}

/* Map popups are white in both themes, like the map. */
.maplibregl-popup-content {
  color: #17201c;
  font: 600 0.875rem/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.note-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.map-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  color: var(--signal);
  font-size: 0.875rem;
  font-weight: 600;
}

.map-text svg {
  width: 18px;
  height: 18px;
}

.form-place .map-text {
  margin-top: 4px;
}

.card-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 700;
}

.card-sub {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

.chevron {
  color: var(--muted);
  flex: none;
  transition: transform 0.15s;
}

[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
}

.route {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--route-bg);
  color: var(--route-ink);
  font-size: 0.875rem;
  font-weight: 750;
  text-overflow: clip;
  white-space: nowrap;
}

.dest {
  min-width: 0;
}

.dest-name,
.note {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dest-name {
  font-weight: 550;
}

.note {
  color: var(--muted);
  font-size: 0.8125rem;
}

.eta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 3px;
  min-width: 3.75rem;
  font-variant-numeric: tabular-nums;
}

.eta-value {
  font-size: 1.625rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--signal);
}

/* Orange for what's urgent: a bus that's due, and how late one is running. */
.eta-value.due {
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--orange);
  color: var(--on-orange);
  font-size: 1.0625rem;
  letter-spacing: 0;
}

.late {
  color: var(--orange-ink);
  font-weight: 600;
}

.eta-unit {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Timetabled times aren't live, so they mustn't look as certain as those that are. */
.row.timetabled .eta-value {
  color: var(--muted);
  font-weight: 500;
}

.row.timetabled .eta-value.due {
  background: var(--surface-2);
  color: var(--ink);
}

.row.cancelled .dest-name,
.row.cancelled .eta-value,
.row.skipped .eta-value {
  color: var(--muted);
  font-size: inherit;
  font-weight: 500;
  text-decoration: line-through;
}

.row.cancelled .note,
.row.skipped .note {
  color: var(--warn);
  font-weight: 600;
}

.empty {
  padding: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.screen .empty {
  padding: 16px 2px;
  border-top: 0;
}

.welcome {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 28px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.welcome h2 {
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}

.welcome p {
  color: var(--muted);
  margin-bottom: 10px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 700;
}

.foot {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding-top: 8px;
  text-align: center;
}

.support-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}

.credit {
  padding: 4px 2px 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.credit a {
  text-decoration: underline;
}

.built-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

/* The logo's own colours and square ends, not the line-icon style every other svg has. */
.built-by .lv-mark {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}

.tabs button {
  min-height: 44px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
}

.tabs [aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
}

.search,
.field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  /* Below 16px, iOS zooms the page when the field is focused. */
  font: inherit;
  font-size: 1rem;
}

.search {
  margin-top: 12px;
}

.results {
  margin-top: 8px;
}

.result-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.result-row .result {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}

.result-code {
  flex: none;
  min-width: 3.25rem;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--route-bg);
  color: var(--route-ink);
  font-size: 0.875rem;
  font-weight: 750;
  text-align: center;
}

.result-main,
.manage-name {
  min-width: 0;
  flex: 1;
}

.result-name,
.result-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Names wrap rather than lose their ends, which tell stops apart: "Amsterdam, Centraal
   Station (A)" from "(L)". */
.result-name {
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: normal;
}

.result-sub {
  color: var(--muted);
  font-size: 0.8125rem;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.warn-hint {
  color: var(--warn);
  font-weight: 600;
}

.form-place {
  padding: 4px 0 14px;
  color: var(--muted);
}

.form-place strong {
  display: block;
  color: var(--ink);
  font-size: 1.125rem;
}

.field {
  display: block;
  margin-bottom: 20px;
}

.field > span,
.field legend {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

.stop-part {
  padding-bottom: 4px;
}

.stop-remove {
  margin-top: 4px;
  padding-left: 0;
}

.add-stop {
  gap: 6px;
  margin: -8px 0 16px;
  padding-left: 0;
  color: var(--signal);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  min-width: 52px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 650;
}

.chip[aria-pressed="true"] {
  border-color: var(--signal);
  background: var(--signal);
  color: var(--signal-ink);
}

form .primary-button {
  width: 100%;
}

.help-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 4px;
  color: var(--signal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.help-note {
  margin: 4px 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
}

.help section {
  margin: 4px 0 22px;
}

.help h2 {
  margin-bottom: 6px;
  font-size: 1.0625rem;
}

.help p,
.help li {
  line-height: 1.45;
}

.help p + ul,
.help ul + p {
  margin-top: 8px;
}

.help ul {
  padding-left: 20px;
  list-style: disc;
}

.help li {
  margin: 5px 0;
}

.help a {
  text-decoration: underline;
}

.help svg {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
}

.manage-add {
  width: 100%;
  gap: 8px;
  margin-bottom: 8px;
}

.manage li {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  .spinning svg {
    animation-duration: 4s;
  }
  .chevron {
    transition: none;
  }
}

/* Luas rows and search results wear their line's colour. */
.route.line-green,
.result-code.line-green {
  background: #00804a;
  color: #fff;
}

.route.line-red,
.result-code.line-red {
  background: #c8102e;
  color: #fff;
}

/* The Luas's message when a line isn't running normally. */
.alert {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--warn);
  font-size: 0.875rem;
  font-weight: 600;
}

/* A Luas stop's "going to" choice on its edit screen. */
.going-to {
  display: grid;
  gap: 4px;
  margin: 8px 0 4px;
  font-weight: 600;
}

.going-to select {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

/* A row's note can run to three lines, so a train's platform, departure and arrival
   times and lateness, or a "going to" card's arrival time and where a bus stops nearby,
   all fit on a phone. */
.note {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* A journey with a change also says where to change, and to what: four lines. */
.note.note-change {
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

/* What to pick, above the Add a stop tabs. */
.add-intro {
  margin: 0 0 12px;
}

/* "Starting at" on a stop's edit screen, pairing with "Going to" below it. */
.legend-label {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

/* A train station's "Starting at", laid out like a bus stop's. */
.form-start {
  margin: 0 0 4px;
}

/* Read by screen readers but not shown, like the warnings in #announce. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A screen's heading takes focus when the screen opens (focusHeading), for screen
   readers; it isn't a control, so it needs no focus ring. */
h1[tabindex="-1"]:focus {
  outline: none;
}

/* "Link copied", after a share button on a computer with no share menu. */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.9375rem;
  font-weight: 600;
  transform: translateX(-50%);
}

/* Beside the map pin on each card. */
.share-button {
  color: var(--muted);
}

/* Where the bus is, over the top of a route map, clear of the location button. */
.map-note {
  position: absolute;
  top: 10px;
  right: 64px;
  left: 10px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}

.map-note span + span {
  color: var(--muted);
  font-weight: 500;
}

/* On /?demo, above the sample cards: none of it is saved. */
.demo-band {
  padding: 10px 14px;
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9375rem;
  font-weight: 600;
}

.demo-band a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.demo-save {
  margin: -4px 0 10px;
}

/* A card on its own (#card/): how to put it on the home screen. */
.pin-steps {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.pin-steps h2 {
  font-size: 1.125rem;
}

.pin-link {
  margin-top: 12px;
}
