/* Made for AbleSign's sidebar zone: 25% of a 16:9 screen, full height (480 x 1080 on a 1080p TV).
   Every size is in rem, and 1rem = 1/24 of the board's width, so it scales with the zone.
   No CSS grid, flex gap or min() without a fallback: signage players often run old browsers. */

:root {
  --bg: #0f1513;
  --card: #18211d;
  --line: #27332d;
  --text: #f2f5f1;
  --muted: #a3b3a9;
  --due: #8dd65a;
  --warn: #f3bb4f;
  --warn-bg: rgba(243, 187, 79, 0.13);
  --alert: #ff8a7a;
  --alert-bg: rgba(255, 110, 90, 0.15);
  font-size: 4.1667vw; /* fallback: 100vw / 24 */
  font-size: calc(min(100vw, 44.444vh) / 24);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body {
  color: var(--text);
  font-family: Roboto, "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#board {
  width: 100vw;
  width: min(100vw, 44.444vh); /* a normal browser window shows the sidebar's shape */
  height: 100vh;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 1rem;
  display: flex;
  flex-direction: column;
}

/* Header */
header { flex: none; margin-bottom: 0.75rem; }
.row { display: flex; align-items: baseline; justify-content: space-between; }
h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.clock { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sub { margin-top: 0.3rem; font-size: 0.85rem; color: var(--muted); }
#weather { white-space: nowrap; }
#weather b { color: var(--text); font-weight: 600; }

.notice {
  margin-top: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.3;
  background: var(--warn-bg);
  color: var(--warn);
}
.notice.alert { background: var(--alert-bg); color: var(--alert); }

/* Cards: one per route and direction, they share the height left over */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.card {
  flex: 1 1 auto; /* cards share the spare height; one with a detour note is taller */
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  overflow: hidden;
}
.card:last-child { margin-bottom: 0; }
.top, .bottom { display: flex; align-items: center; }
.badge {
  flex: none;
  min-width: 3.3rem;
  margin-right: 0.7rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.45rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.info { flex: 1; min-width: 0; }
.dir { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.towards { font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { flex: none; margin-left: 0.6rem; text-align: right; line-height: 1; }
.when .min { font-size: 2.3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.when .unit { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-left: 0.15rem; }
.when .due { font-size: 1.9rem; font-weight: 800; color: var(--due); }
.when .at { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.when .none { font-size: 0.85rem; color: var(--muted); }
.late { display: block; margin-top: 0.25rem; font-size: 0.72rem; font-weight: 700; color: var(--warn); white-space: nowrap; }
.bottom { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted); }
.stop { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop b { color: var(--text); font-weight: 600; }
.then { flex: none; margin-left: 0.6rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.detour {
  margin-top: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.7rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message { margin: auto 0; text-align: center; color: var(--muted); font-size: 1rem; }

/* Footer */
footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  color: var(--muted);
}
footer .stale { color: var(--warn); font-weight: 600; }
