/* BC Ministries Through Time
   Colours follow BC government web conventions (navy and gold), with Noto Sans,
   the open font BC Sans is based on. This is an unofficial site: no BC logos or crests. */

:root {
  --navy: #013366;
  --navy-hover: #1E5189;
  --gold: #FCBA19;
  --link: #255A90;
  --text: #2D2D2D;
  --text-2: #474543;
  --text-3: #5A5856;
  --bg: #FAF9F8;
  --surface: #FFFFFF;
  --surface-2: #F3F2F1;
  --border: #D8D8D8;
  --border-soft: #ECEBE9;
  --border-strong: #898785;
  --past: #E3EDF8;
  --past-border: #B6CCE6;
  --past-tint: #F1F6FC;
  --related: #FFE8A3;
  --related-border: #D9A21B;
  --selected-border: #9A6B00;
  --today: #CE3E39;
  --focus: #2E5DD7;
  --notice: #FEF1D8;
  --notice-border: #F8BB47;
  --ok-bg: #E3F1E6;
  --ok: #2E6B37;
  --label-w: 168px;
  --radius: 8px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", "BC Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--link); }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; background: var(--surface); color: var(--navy);
  border: 2px solid var(--focus); border-radius: 6px; font-weight: 600;
}
.skip-link:focus { top: 12px; }
.skip-link--inline { position: absolute; left: -9999px; top: auto; }
.skip-link--inline:focus { position: static; display: inline-block; margin-bottom: 8px; }

/* Header and notice */
.site-header { background: var(--navy); border-bottom: 4px solid var(--gold); }
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 20px; padding-top: 14px; padding-bottom: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: #FFFFFF; text-decoration: none; font-size: 20px; font-weight: 700;
}
.brand:hover { color: #FFFFFF; }
.brand svg { color: var(--gold); flex: 0 0 auto; }
.badge-unofficial {
  border: 1px solid var(--gold); color: var(--gold); border-radius: 999px;
  padding: 3px 12px; font-size: 13px; font-weight: 600;
}
.notice { background: var(--notice); border-bottom: 1px solid var(--notice-border); }
.notice__inner { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
.notice__inner svg { flex: 0 0 20px; margin-top: 1px; color: #7A5A00; }
.notice p { margin: 0; }

/* Hero */
.hero { padding-top: 40px; padding-bottom: 8px; }
.kicker {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--link);
}
.hero h1 { margin: 0; max-width: 820px; font-size: 40px; line-height: 1.15; }
.lede { margin: 16px 0 0; max-width: 760px; font-size: 18px; line-height: 1.6; color: var(--text-2); }
.stats { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat__value { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat__label { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.currency { margin: 16px 0 0; font-size: 14px; color: var(--text-3); }

/* Cards and controls */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.controls { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--grow { flex: 1 1 260px; min-width: 0; }
.field--area { flex: 0 1 280px; min-width: 200px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text); }
.input {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); font-size: 15px;
}
select.input { padding: 0 10px; }

.segmented { display: flex; border: 1px solid var(--navy); border-radius: 6px; overflow: hidden; }
.segmented button {
  min-height: 44px; padding: 0 18px; border: 0; background: var(--surface); color: var(--navy);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--navy); }
.segmented button[aria-pressed="true"] { background: var(--navy); color: #FFFFFF; }
.segmented button:focus-visible { outline-offset: -4px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--navy); border-radius: 6px;
  background: var(--surface); color: var(--navy); font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill:hover { background: var(--past-tint); }
.pill[aria-pressed="true"] { background: var(--navy); color: #FFFFFF; }

.results { margin-top: 12px; padding: 14px 16px; }
.results__summary { margin: 0 0 10px; font-size: 14px; }
.results__list { display: flex; flex-wrap: wrap; gap: 8px; }
.result {
  min-height: 44px; padding: 6px 12px; border: 1px solid var(--past-border); border-radius: 6px;
  background: var(--past-tint); color: var(--navy); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center;
}
.result:hover { border-color: var(--navy); }
.result__name { font-size: 14px; font-weight: 600; }
.result__meta { font-size: 12px; color: var(--text-2); }

/* Sections */
.section { margin-top: 28px; position: relative; }
.section h2 { margin: 0; font-size: 24px; }
.section__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; margin-bottom: 12px; }
.section__head > div { flex: 1 1 420px; min-width: 0; }
.section__head p, .section__sub { margin: 4px 0 0; font-size: 15px; color: var(--text-2); }
.section__sub { margin-bottom: 14px; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 18px; height: 12px; border-radius: 3px; border: 1px solid; }
.swatch--past { background: var(--past); border-color: var(--past-border); }
.swatch--current { background: var(--navy); border-color: var(--navy); }
.swatch--selected { background: var(--gold); border-color: var(--selected-border); }
.swatch--related { background: var(--related); border-color: var(--related-border); }
.swatch--today { width: 3px; height: 14px; border: 0; border-radius: 0; background: var(--today); }

/* Timeline chart */
.chart {
  position: relative; max-height: 680px; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.chart__inner { position: relative; min-width: 100%; }
.chart__status { margin: 0; padding: 24px; color: var(--text-2); }
.chart__head {
  position: sticky; top: 0; z-index: 5; display: flex;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.chart__corner {
  position: sticky; left: 0; z-index: 6; flex: 0 0 var(--label-w); width: var(--label-w);
  padding: 8px 12px; background: var(--surface-2); border-right: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  display: flex; flex-direction: column; justify-content: space-between;
}
.chart__track { position: relative; flex: 0 0 auto; }
.chart__track--head { height: 64px; }
.chart__track--lane {
  background-image: linear-gradient(to right, var(--border-soft) 1px, transparent 1px);
  background-repeat: repeat;
}
.tick {
  position: absolute; top: 8px; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.premier {
  position: absolute; top: 34px; height: 24px; padding: 0 5px; border-radius: 3px;
  background: #D6E2F0; color: var(--navy); font-size: 11px; font-weight: 600; line-height: 24px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.premier--alt { background: #EEF3F9; }
.today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--today); z-index: 2; pointer-events: none; }

.lane { display: flex; border-bottom: 1px solid var(--border-soft); }
.lane:last-child { border-bottom: 0; }
.lane__label {
  position: sticky; left: 0; z-index: 3; flex: 0 0 var(--label-w); width: var(--label-w);
  padding: 8px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.lane__name { display: block; font-size: 13px; font-weight: 700; line-height: 1.25; color: var(--navy); }
.lane__count { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }

.bar {
  position: absolute; height: 30px; margin: 0; padding: 0 6px;
  border: 1px solid var(--past-border); border-radius: 4px; background: var(--past); color: var(--navy);
  font-size: 12px; font-weight: 600; line-height: 28px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: opacity 120ms ease, background-color 120ms ease;
}
.bar:hover { border-color: var(--navy); }
.bar--current { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.bar--current:hover { background: var(--navy-hover); }
.bar.is-related { background: var(--related); border-color: var(--related-border); color: #1A1A1A; }
.bar.is-selected { background: var(--gold); border-color: var(--selected-border); color: #1A1A1A; z-index: 1; }
.bar.is-dim { opacity: 0.22; }
.bar:focus-visible { z-index: 4; }

.hint { margin: 10px 0 0; font-size: 13px; color: var(--text-3); }

/* By year */
.year-controls { display: flex; flex-direction: column; gap: 12px; }
.year-controls__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.year-controls__value {
  min-width: 76px; text-align: center; font-size: 30px; font-weight: 700; color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.year-controls__range { flex: 1 1 280px; min-width: 0; height: 44px; margin: 0; accent-color: var(--navy); }
.icon-btn {
  width: 44px; height: 44px; border: 1px solid var(--navy); border-radius: 6px;
  background: var(--surface); color: var(--navy); font-size: 22px; font-weight: 700; cursor: pointer;
}
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.changes, .groups { margin-top: 14px; display: grid; gap: 12px; }
.changes { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.groups { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.changes h3, .group h3 { margin: 0 0 10px; font-size: 16px; }
.group__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group h3 { font-size: 15px; }
.group__count { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row-btn {
  width: 100%; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--navy); text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.row-btn:hover { border-color: var(--navy); }
.row-btn--stack { display: block; }
.row-btn--current { background: var(--past-tint); border-color: var(--past-border); }
.row-btn.is-selected { background: var(--gold); border-color: var(--selected-border); color: #1A1A1A; }
.row-btn__name { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.row-btn__meta { display: block; font-size: 12px; color: var(--text-2); }
.row-btn.is-selected .row-btn__meta { color: #1A1A1A; }
.tag {
  flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; background: var(--past);
  color: var(--navy); font-size: 12px; font-weight: 600;
}
.tag--muted { background: var(--surface-2); color: var(--text-2); }
.empty { margin: 14px 0 0; font-size: 15px; color: var(--text-2); }
.none { margin: 0; font-size: 14px; color: var(--text-3); }

/* Footer */
.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); }
.site-footer:focus { outline: none; }
.site-footer__cols { display: flex; flex-wrap: wrap; gap: 32px; padding-top: 32px; padding-bottom: 40px; }
.site-footer__cols > div { flex: 1 1 420px; min-width: 0; }
.site-footer h2 { margin: 0 0 10px; font-size: 18px; }
.site-footer ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.6; display: flex; flex-direction: column; gap: 6px; }
.site-footer__bar { background: var(--navy); border-top: 4px solid var(--gold); color: #FFFFFF; font-size: 14px; }
.site-footer__bar .wrap { padding-top: 16px; padding-bottom: 96px; }

/* Detail panel */
.detail {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 400px; max-width: calc(100vw - 32px); max-height: min(640px, calc(100vh - 32px)); overflow-y: auto;
  padding: 18px 20px 20px; background: var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--gold); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(1, 51, 102, 0.2);
}
.detail__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail__kicker {
  margin: 6px 0 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--link);
}
.detail__close {
  flex: 0 0 44px; width: 44px; height: 44px; margin: -8px -10px 0 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.detail__close:hover { background: var(--surface-2); }
.detail__title { margin: 2px 0 0; font-size: 20px; line-height: 1.3; }
.detail__title:focus { outline: none; }
.detail__span { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
.detail__pills { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.status {
  padding: 3px 10px; border-radius: 999px; background: var(--past); color: var(--navy);
  font-size: 13px; font-weight: 600;
}
.status--current { background: var(--ok-bg); color: var(--ok); }
.status--ended { background: var(--surface-2); color: var(--text-2); }
.detail__note { margin: 12px 0 0; font-size: 14px; line-height: 1.55; }
.detail h3 { margin: 18px 0 8px; font-size: 14px; color: var(--text); }
.history-btn {
  width: 100%; min-height: 40px; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px;
  align-items: center; padding: 6px 8px; border: 1px solid #E6E6E6; border-radius: 6px;
  background: var(--surface); color: var(--text); font-size: 13px; text-align: left; cursor: pointer;
}
.history-btn:hover { border-color: var(--navy); }
.history-btn[aria-current="true"] { background: var(--notice); border-color: var(--related-border); font-weight: 700; }
.history-btn__years { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.link-btn {
  width: 100%; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); text-align: left; cursor: pointer;
}
.link-btn:hover { border-color: var(--navy); }
.link-btn__rel { display: block; font-size: 12px; color: var(--text-2); }
.link-btn__name { display: block; font-size: 14px; font-weight: 600; color: var(--navy); }

.noscript { padding: 24px; }

@media (max-width: 640px) {
  :root { --label-w: 116px; }
  .wrap { padding: 0 16px; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 30px; }
  .lede { font-size: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 12px 14px; }
  .stat__value { font-size: 24px; }
  .chart { max-height: 560px; }
  .lane__name { font-size: 12px; }
  .detail { right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  .bar { transition: none; }
}
