/* BETro shared styles. Tokens and rules from docs/planning/site-design.md. */

:root {
  --brown: #3A2C26;
  --tan: #FDF7F1;
  --tan-2: #F3E9DE;
  --tan-3: #FBF4EC;
  --line: #D9CCBE;
  --line-soft: #EDE3D8;
  --ink: #1A1A1A;
  --muted: #555555;
  --link: #00539B;
  --link-hover: #003A6C;
  --focus: #009CDE;
  --notice: #FFD100;
  --sample: #FFF6CC;
  --white: #FFFFFF;
  --selected: #E5F1FA;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius-card: 6px;
  --radius-control: 4px;
  --gutter: 24px;
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
}

/* Base */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--tan);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 36px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }

a { color: var(--link); }
a:hover { color: var(--link-hover); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Layout */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

main.page {
  flex: 1 1 auto;
  padding-top: 32px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Main column and side panel; the panel stacks under on narrow screens. */
.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.layout-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.layout-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }

/* Header */

.site-header { background: var(--brown); color: var(--white); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
  min-height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  min-height: 44px;
}
.brand:hover { color: var(--white); }
.brand img { width: 44px; height: 44px; display: block; }
.brand-name { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }

.site-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.site-nav a {
  color: #DADADA;
  text-decoration: none;
  padding: 14px 12px 10px;
  border-bottom: 4px solid transparent;
  min-height: 44px;
}
.site-nav a:hover { color: var(--white); border-bottom-color: #8C7A70; }
.site-nav a[aria-current="page"] {
  color: var(--white);
  font-weight: 700;
  border-bottom-color: var(--focus);
}

.signin-link {
  color: var(--brown);
  background: var(--white);
  text-decoration: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-control);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.signin-link:hover { color: var(--brown); background: var(--tan-2); }

@media (max-width: 640px) {
  .site-header .wrap { padding-top: 8px; padding-bottom: 8px; gap: 4px 16px; }
  .site-nav { order: 3; flex-basis: 100%; }
  .site-nav a { padding: 10px 8px 8px; font-size: 15px; }
  .signin-link { margin-left: auto; }
}

/* Preview banner (markets page) */

.notice-banner { background: var(--notice); color: var(--ink); }
.notice-banner .wrap {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center;
  padding-top: 10px; padding-bottom: 10px; font-size: 15px;
}

/* Footer */

.site-footer { background: var(--tan-2); border-top: 1px solid var(--line); }
.site-footer .wrap { padding-top: 20px; padding-bottom: 20px; font-size: 13px; color: var(--muted); }

/* Page title block */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head-text { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.eyebrow {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.lede { font-size: 16px; color: #444444; }

/* Cards and panels */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-head {
  background: var(--brown); color: var(--white);
  padding: 16px; display: flex; align-items: center; gap: 14px;
}
.panel { background: var(--tan-2); border-radius: var(--radius-control); padding: 14px; }
.note { background: var(--tan-3); }

/* Tabs: real buttons with aria-pressed. Also used for segmented switches. */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 2px solid var(--line); }
.tab {
  font: inherit; font-size: 16px; font-weight: 700;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 6px 6px 0 0;
  background: transparent; color: #333333; cursor: pointer;
}
.tab:hover { background: var(--tan-2); }
.tab[aria-pressed="true"] { background: var(--brown); color: var(--white); }

.segmented { display: inline-flex; flex-wrap: wrap; border: 2px solid var(--brown); border-radius: var(--radius-control); overflow: hidden; }
.segmented .tab { border-radius: 0; min-height: 44px; }

/* Buttons and fields */

.btn {
  font: inherit; font-size: 16px; font-weight: 700;
  min-height: 44px; padding: 10px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--radius-control);
  border: 2px solid var(--brown);
  background: var(--white); color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--tan-2); color: var(--ink); }
.btn-primary { background: var(--link); border-color: var(--link); color: var(--white); }
.btn-primary:hover { background: var(--link-hover); border-color: var(--link-hover); color: var(--white); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: #BDBDBD; border-color: #BDBDBD; color: #4A4A4A; cursor: not-allowed;
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.input, .select {
  font: inherit; font-size: 16px; font-weight: 400;
  min-height: 44px; padding: 10px 14px;
  border: 1px solid #8C8C8C; border-radius: var(--radius-control);
  background: var(--white); color: var(--ink);
}
.input:disabled { background: var(--tan-2); border-color: #BDBDBD; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--link); }

/* Line and station bullets, like the station signs. Colour set inline. */

.bullet {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--bullet-color, var(--line));
  font-variant-numeric: tabular-nums;
}
.bullet-sm { width: 22px; height: 22px; font-size: 11px; box-shadow: none; }
.bullet-lg { width: 52px; height: 52px; font-size: 15px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }

/* Pills (line names in alerts) and chips */

.pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 700;
}
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 700;
  background: var(--white); border: 1px solid var(--line);
}
.chip-sample { background: var(--sample); border-color: var(--ink); }

/* Stat tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile-note { font-size: 14px; color: var(--muted); }

/* Tables: wide ones scroll inside their own box. */

.table-scroll {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.data { width: 100%; border-collapse: collapse; font-size: 16px; }
.data th, .data td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.data thead th {
  background: var(--tan-2);
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #444444; white-space: nowrap;
}
.data-dark thead th { background: var(--brown); color: var(--white); }
.data tbody tr + tr td, .data tbody tr + tr th { border-top: 1px solid var(--line-soft); }
.data .r { text-align: right; font-variant-numeric: tabular-nums; }
.data tr.called-off td { background: var(--tan-3); }
.who { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }

/* Messages */

.unavailable {
  padding: 16px;
  background: var(--tan-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--muted);
}
.notice {
  display: flex; gap: 14px; padding: 16px;
  background: var(--sample);
  border: 2px solid var(--ink);
  border-radius: var(--radius-control);
}
.notice-icon { flex: 0 0 auto; }
.notice-title { display: block; font-size: 18px; font-weight: 700; }
.notice-text { font-size: 15px; color: #333333; }

[hidden] { display: none !important; }
