/* The "How late is my bus?" pages (story #907), over site.css. */

:root {
  --grade-a: #067647;
  --grade-b: #3f8f2a;
  --grade-c: #b88300;
  --grade-d: #d4610f;
  --grade-f: #c0281b;
  --early: #6b8bd6;
  --on-time: #2f9e5b;
  --late: #e8902a;
  --very-late: #cf3a2b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grade-a: #3fcf8e;
    --grade-b: #8bd35b;
    --grade-c: #f2c335;
    --grade-d: #ff9a4d;
    --grade-f: #ff6b5e;
    --early: #8aa6ef;
    --on-time: #3fcf8e;
    --late: #ffad55;
    --very-late: #ff6b5e;
  }
}

.lateness h1 {
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 4px 0 12px;
}

.lateness h2 {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lede { font-size: 20px; color: var(--muted); max-width: 46em; }
.lede strong { color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; margin-top: 28px; }

.crumbs { font-size: 15px; margin: 4px 0 12px; }

/* Search */

.hero { padding: 24px 0 8px; }

.search {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  max-width: 560px;
}

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}

.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.search button {
  font: inherit;
  font-weight: 700;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

/* Grades */

.grade {
  display: inline-grid;
  place-items: center;
  flex: none;
  font-weight: 900;
  color: #fff;
  border-radius: 10px;
  background: var(--line);
  line-height: 1;
}

.grade-sm { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; }
.grade-md { width: 48px; height: 48px; font-size: 26px; }
.grade-lg { width: 112px; height: 112px; font-size: 68px; border-radius: 24px; }
.grade-a { background: var(--grade-a); }
.grade-b { background: var(--grade-b); }
.grade-c { background: var(--grade-c); }
.grade-d { background: var(--grade-d); }
.grade-f { background: var(--grade-f); }
.grade-none { color: var(--muted); }

.card-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 12px 0 8px;
}

.card-hero h1 { margin-bottom: 4px; }
.card-hero p { margin: 0; }
.verdict { font-size: 19px; font-weight: 600; margin-top: 8px !important; }

@media (max-width: 560px) {
  .card-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .grade-lg { width: 84px; height: 84px; font-size: 50px; border-radius: 18px; }
}

/* Facts */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.fact {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.fact b { display: block; font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
.fact span { color: var(--muted); font-size: 15px; }

.predictions, .empty, .how, .pitch {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 20px 12px;
  margin-top: 28px;
}

.predictions h2, .how h2, .pitch h2 { margin-top: 18px; }
.predictions .facts { margin-top: 8px; }
.predictions .fact { background: var(--bg); }

.pitch { border-color: var(--blue); }
.pitch .button { margin: 4px 0 12px; }

/* The early / on time / late split */

.split-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--line);
}

.split-early { background: var(--early); }
.split-on-time { background: var(--on-time); }
.split-late { background: var(--late); }
.split-very-late { background: var(--very-late); }

.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.split-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

.split-legend b { color: var(--ink); margin-left: 4px; }

/* Lists of routes and stops */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 28px;
}

@media (max-width: 760px) { .columns { grid-template-columns: 1fr; } }

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.row:hover .row-name { color: var(--accent); }
.row-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-name b { margin-right: 4px; }
.row-fig { color: var(--muted); font-size: 15px; white-space: nowrap; text-align: right; }
.row-bar { width: 120px; flex: none; }

@media (max-width: 560px) { .row-bar { display: none; } }

.ranked { counter-reset: rank; }
.ranked .row::before {
  counter-increment: rank;
  content: counter(rank);
  width: 1.4em;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.line .row { position: relative; }

.route-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.route-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.route-tile:hover { border-color: var(--accent); }
.route-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Direction tabs */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.tab {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  font-weight: 600;
  font-size: 15px;
}

.tab-on { background: var(--blue); border-color: var(--blue); color: #fff; }

.callout {
  background: var(--card);
  border-left: 4px solid var(--very-late);
  padding: 10px 14px;
  border-radius: 8px;
}
