*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f4f5;
  color: #111;
  min-height: 100vh;
}

header {
  background: #003688;
  color: #fff;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header .roundel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header svg { flex-shrink: 0; }

header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
header .updated { font-size: 0.8rem; opacity: 0.75; margin-left: auto; }

nav {
  background: #002a6e;
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem;
}

nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.6rem 0.85rem;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

nav a:hover { color: #fff; }

nav a.active {
  color: #fff;
  border-bottom-color: #DC241F;
}

main { max-width: 700px; margin: 2rem auto; padding: 0 1rem; }

.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #991b1b;
  margin-bottom: 1.5rem;
}

.empty {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 1.5rem 1.25rem;
  color: #166534;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
}

footer {
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  padding: 2rem 1rem;
}

footer a { color: #888; }

/* ── Shared pill ──────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.line-swatch {
  width: 10px;
  flex-shrink: 0;
}

/* ── Index — line cards ───────────────────────────── */

.lines { display: flex; flex-direction: column; gap: 0.6rem; }

.line-card {
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.line-body {
  flex: 1;
  background: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.line-name {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 160px;
}

.line-name .pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.statuses { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 1; }

.status-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 500;
}

.status-badge.good {
  background: #dcfce7;
  color: #166534;
}

.status-badge.disrupted {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.reason-trigger {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
}

.reason-popover {
  max-width: 380px;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #111;
}

.toggle-link {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 1rem;
  text-decoration: none;
}

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

.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #777;
  margin: 1.25rem 0 0.4rem;
}

.section-heading:first-child { margin-top: 0; }

/* ── Closures — closure cards ─────────────────────── */

.closures { display: flex; flex-direction: column; gap: 0.8rem; }

.closure-card {
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.closure-body {
  flex: 1;
  background: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.closure-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.severity-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 500;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.category-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 500;
}

.category-badge.planned {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.category-badge.unplanned {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.reason {
  font-size: 0.83rem;
  color: #444;
  line-height: 1.55;
}

/* ── Journey planner ──────────────────────────────── */

.journey-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.journey-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.journey-form input[type="text"]:focus {
  outline: none;
  border-color: #003688;
  box-shadow: 0 0 0 2px rgba(0,54,136,.15);
}

.journey-form button {
  padding: 0.5rem 1.1rem;
  background: #003688;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.journey-form button:hover { background: #002a6e; }

.journey-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  margin-bottom: 1rem;
  overflow: hidden;
}

.journey-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: #003688;
  color: #fff;
  flex-wrap: wrap;
}

.journey-summary .time {
  font-weight: 700;
  font-size: 1rem;
}

.journey-summary .arrow { opacity: 0.7; }

.journey-summary .duration {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0.85;
}

.legs { display: flex; flex-direction: column; }

.leg {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid #f0f0f0;
}

.leg-mode {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #555;
  margin-top: 1px;
}

.leg-mode.tube     { background: #DC241F; color: #fff; }
.leg-mode.walking  { background: #6b7280; color: #fff; }
.leg-mode.dlr      { background: #00AFAD; color: #fff; }
.leg-mode.overground { background: #EE7C0E; color: #fff; }
.leg-mode.elizabeth-line { background: #7156A5; color: #fff; }
.leg-mode.bus      { background: #DC241F; color: #fff; }

.leg-detail { flex: 1; }

.leg-summary {
  font-size: 0.88rem;
  color: #222;
  line-height: 1.45;
}

.leg-times {
  font-size: 0.78rem;
  color: #777;
  margin-top: 0.2rem;
}

.leg-disruption {
  font-size: 0.78rem;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  margin-top: 0.35rem;
  line-height: 1.4;
}
