/* The stop list (stops/index) and a stop's departures (stops/show, its card on the home map): what a commuter
   sees after scanning the QR code at a stop, often in sunlight. Large type, plain colours, nothing wider than a 360 px phone. */
.stop {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem;

  h1 { font-size: 1.625rem; line-height: 1.2; margin: 0 0 0.75rem; }
}

.departures { list-style: none; margin: 0; padding: 0; }
.departures > li { border-bottom: 1px solid var(--color-border); }

/* Line | headsign over status | expected time over struck scheduled time. */
.departure {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "line headsign time" "line status scheduled";
  gap: 0.125rem 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
  color: inherit;
  text-decoration: none;
}

.departure-line {
  grid-area: line;
  align-self: start;
  min-width: 3.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.departure-headsign { grid-area: headsign; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }

.departure-time {
  grid-area: time;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.departure-status { grid-area: status; color: var(--color-muted); white-space: nowrap; }
.departure-late { color: var(--color-late); font-weight: 700; }
.departure-on-time { color: var(--color-on-time); font-weight: 600; }
.departure-scheduled { grid-area: scheduled; color: var(--color-muted); font-variant-numeric: tabular-nums; text-align: right; }

.stop-empty { font-size: 1.25rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.stop-next { font-size: 1.125rem; margin: 0 0 1rem; }

/* Stays in view while the list scrolls under it. */
.stops-search {
  position: sticky;
  top: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 3.375rem;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
  border: 2px solid var(--color-text);
  border-radius: 0.875rem;
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 1.125rem;
}

.stops {
  list-style: none;
  margin: 0;
  padding: 0;

  a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.125rem;
    text-decoration: none;
  }
  a > span:first-child { text-decoration: underline; }
}
/* The lines calling at the stop, on the right. */
.stops-lines {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  max-width: 50%;

  .departure-line { min-width: 0; font-size: 1rem; text-align: center; }
}

/* The line list (lines/index): the number, then the route, which wraps. */
.lines a { justify-content: flex-start; }
.lines .departure-line { flex: none; }

/* A line's timetable (lines/show): a day type per <details>; a wide grid scrolls sideways under a stop column
   that stays put. */
.line-service {
  border-bottom: 1px solid var(--color-border);

  summary { padding: 0.875rem 0; font-size: 1.125rem; font-weight: 600; cursor: pointer; }
  strong { color: var(--color-on-time); }
}
.stop .timetable-scroll { overflow-x: auto; margin-bottom: 1rem; }
.stop .timetable {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;

  th, td { padding: 0.375rem 0.5rem; white-space: nowrap; border-bottom: 1px solid var(--color-border); }
  th {
    position: sticky;
    left: 0;
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--color-bg);
    font-weight: normal;
    text-align: left;
    border-right: 1px solid var(--color-border);
  }
}
