/* Mobile first: one column that fills a phone in portrait. Larger screens only get a wider column. */
:root {
  --bg: #1f2a6b;
  --row: #2c3a8c;
  --row-alt: #25317a;
  --red: #e2001a;
  --yellow: #ffd400;
  --muted: #b4bce6;
  --stale: #f28c00;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

/* SVG elements ignore the hidden attribute without this. */
[hidden] { display: none !important; }

html, body { height: 100%; }

/* No native pull-to-refresh or rubber band: the page has its own (see app.js). */
html { overscroll-behavior-y: none; }

#pull {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  z-index: 1;
  padding: 0.6rem;
  text-align: center;
  color: var(--bg);
  background: var(--yellow);
  transform: translateY(-110%);
  pointer-events: none;
}
#pull.settle { transition: transform 0.2s; }

body {
  background: var(--bg);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* fixed, so the list below the picture scrolls instead of the page */
  max-width: 40rem;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 1rem;
}

h1, #clock { font-size: 1.5rem; font-weight: 500; }
#clock { font-variant-numeric: tabular-nums; }

#scene { display: block; width: 100%; height: auto; }
#scene-msg { font-size: 26px; fill: var(--bg); }

/* Two rows fill the height that is left; further rows are reached by scrolling the list. */
#rows {
  list-style: none;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
}
#rows::-webkit-scrollbar { display: none; }

.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "badge to mins" "sub sub mins";
  align-items: center;
  align-content: center;
  height: 50%;
  min-height: 6.5rem;
  scroll-snap-align: start;
  gap: 0.6rem 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--row);
  border-top: 4px solid var(--bg);
}
.row:nth-child(even) { background: var(--row-alt); }

.badge {
  grid-area: badge;
  background: var(--red);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
}
.bus .badge { background: var(--yellow); color: #1b1f2a; }
.to {
  grid-area: to;
  font-size: clamp(1.4rem, 6.5vw, 2.2rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub { grid-area: sub; color: var(--muted); font-size: 1.05rem; white-space: pre-line; }
.mins {
  grid-area: mins;
  color: var(--yellow);
  font-size: clamp(3rem, 19vw, 6rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stale .mins { color: var(--muted); }

#stale {
  padding: 0.5rem 1rem;
  background: var(--stale);
  color: #000;
  text-align: center;
  font-size: 1.05rem;
}

@media (min-width: 40rem) {
  h1, #clock { font-size: 2rem; }
  .sub, .badge { font-size: 1.3rem; }
}
