:root {
  --navy: #00263a;
  --navy-2: #06354f;
  --red: #cc1f2c;
  --red-dark: #a31621;
  --amber: #ffbf47;
  --amber-dark: #8a6d1e;
  --board-amber: #ffb400;
  --green: #00703c;
  --ink: #1c1c1c;
  --muted: #5a5f63;
  --line: #d8dcde;
  --bg: #f0f2f3;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 12px;
}

a { color: #1d70b8; }

/* ---------- Header ---------- */

.site-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--red);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 30px;
  flex: none;
  color: #fff;
}

.brand-name {
  font-weight: bold;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.brand-sub {
  display: block;
  font-weight: normal;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.site-nav {
  display: flex;
  gap: 16px;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--amber);
}

/* ---------- Banners ---------- */

.banner { color: #fff; padding: 14px 0; }

.banner-severe { background: var(--red); }

.banner-label {
  display: inline-block;
  background: var(--red-dark);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
}

.banner h1 {
  margin: 8px 0 6px;
  font-size: 1.3rem;
  line-height: 1.3;
}

.banner-meta { margin: 0; font-size: 0.82rem; }
.banner-meta a { color: #fff; }

.banner-amber {
  background: #fff7e6;
  color: var(--ink);
  border-bottom: 1px solid var(--amber);
  border-top: 4px solid var(--amber);
}

.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
}

.pill-red { background: #fff; color: var(--red); }
.pill-delayed { background: var(--red); color: #fff; }

/* ---------- Cards ---------- */

main { padding-bottom: 32px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin: 16px 0;
}

.card h2 {
  font-size: 1.05rem;
  margin: 18px 0 6px;
  color: var(--navy);
}

.card h2:first-child { margin-top: 0; }

.card ul, .card ol { margin: 6px 0 12px; padding-left: 22px; }
.card li { margin: 4px 0; }
.card p { margin: 6px 0 12px; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.card-flush { padding: 0; overflow: hidden; }

.card-info { border-left: 6px solid var(--amber); }

.info-flag {
  display: block;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber-dark);
  margin-bottom: 2px;
}

.cta-row { margin: 20px 0; }

.chevron-link {
  font-weight: bold;
  text-decoration: none;
}

.chevron-link::after {
  content: "\203A";
  margin-left: 6px;
  font-weight: bold;
}

.chevron-link:hover { text-decoration: underline; }

/* ---------- Departure board ---------- */

.board {
  background: #0b0b0d;
  color: var(--board-amber);
  font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  padding: 10px 10px 0;
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid #2a2a20;
}

.board-title { font-weight: bold; letter-spacing: 0.08em; }

.board-clock { font-variant-numeric: tabular-nums; }

.board-table {
  width: 100%;
  border-collapse: collapse;
  text-shadow: 0 0 6px rgba(255, 180, 0, 0.45);
}

.board-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: normal;
  color: #b98a10;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 4px 4px;
  text-shadow: none;
}

.board-table td {
  padding: 7px 4px;
  border-top: 1px solid #1c1c16;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.board-dest {
  max-width: 0;
  width: 60%;
  overflow-wrap: break-word;
}

.board-via {
  display: block;
  font-size: 0.7rem;
  opacity: 0.75;
}

.board-status-col { white-space: nowrap; text-align: right; }

td.board-status-col { color: var(--board-amber); }

td.board-status-col.is-ontime {
  color: #3ddc66;
  text-shadow: 0 0 6px rgba(61, 220, 102, 0.45);
}

.board-ticker {
  overflow: hidden;
  border-top: 1px solid #2a2a20;
  padding: 8px 0;
  white-space: nowrap;
}

.board-ticker span {
  display: inline-block;
  padding-left: 100%;
  animation: ticker 26s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .board-ticker span { animation: none; padding-left: 0; white-space: normal; }
}

/* ---------- Planner ---------- */

.planner-title {
  font-size: 1.3rem;
  margin: 0 0 14px;
  color: var(--navy);
}

.field { margin-bottom: 12px; flex: 1; min-width: 0; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.field input {
  width: 100%;
  min-width: 0;
  font: inherit;
  padding: 10px;
  border: 2px solid var(--navy);
  border-radius: 3px;
  background: #fff;
  min-height: 44px;
}

.field-row { display: flex; gap: 10px; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: bold;
  border: none;
  border-radius: 3px;
  padding: 12px 20px;
  cursor: pointer;
  min-height: 44px;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  width: 100%;
}

.btn-primary:active { background: var(--red-dark); }

.btn-secondary {
  background: var(--navy);
  color: #fff;
  width: 100%;
}

/* ---------- Results ---------- */

.results-summary {
  margin: 18px 2px 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.itinerary { padding: 0; }

.itin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.itin-times { font-size: 1.1rem; font-weight: bold; color: var(--navy); }

.itin-meta { font-size: 0.8rem; color: var(--muted); }

.legs { list-style: none; margin: 0; padding: 8px 16px 12px; }

.leg {
  position: relative;
  padding: 8px 0 8px 22px;
  margin: 0;
}

.leg::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: -8px;
  width: 2px;
  background: var(--line);
}

.leg:last-child::before { display: none; }

.leg::after {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--navy);
  background: #fff;
}

.leg-change::after { border-color: var(--red); }

.leg-main { font-weight: bold; font-size: 0.92rem; }

.leg-detail {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
  margin-top: 2px;
}

.leg-change .leg-main { color: var(--red); }

.walk-steps li { margin: 8px 0; }

.alt-routes { text-align: center; }

.alt-status {
  margin: 12px 0 0;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.alt-status.is-final { font-weight: bold; color: var(--navy); }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid var(--line);
  border-top-color: var(--navy);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.72rem;
  padding: 16px 0;
  margin-top: 24px;
}

.site-footer p { margin: 0; }

/* ---------- Wider screens ---------- */

@media (min-width: 480px) {
  .banner h1 { font-size: 1.5rem; }
  .board { font-size: 0.92rem; padding: 14px 14px 0; }
  .btn-primary, .btn-secondary { width: auto; }
}
