/* XataWorks BC Legislature Explorer. */

:root {
  color-scheme: light;
  --brand-primary: #1F4E79;
  --brand-hover: #173D60;
  --brand-accent: #2B7B78;
  --brand-soft: #E8F0F7;
  --brand-surface: #f8f6f2;
  --brand-ink: #1f2937;
  --on-accent: #ffffff;
  --xw-assistant: #07563f;
  --bg: var(--brand-surface);
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --border: #dadde2;
  --text: var(--brand-ink);
  --text-dim: #56616f;
  --accent: var(--brand-primary);
  --accent-soft: var(--brand-soft);
  --link: var(--brand-primary);
  --hero-art: url("../brand/hero/architecture-light.svg");
  --yea: #1f7a4d;
  --yea-soft: #e3f3ea;
  --nay: #b42318;
  --nay-soft: #fbe9e7;
  --paired: #6b6459;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-primary: #9CC9EB;
    --brand-hover: #ffffff;
    --brand-soft: #192D40;
    --brand-surface: #101923;
    --brand-ink: #f2f4f7;
    --on-accent: #1f2937;
    --bg: var(--brand-surface);
    --surface: #182431;
    --surface-2: #213141;
    --border: #3b4b5b;
    --text: var(--brand-ink);
    --text-dim: #b8c4d0;
    --accent: var(--brand-primary);
    --accent-soft: var(--brand-soft);
    --link: var(--brand-primary);
    --hero-art: url("../brand/hero/architecture-dark.svg");
    --yea: #5cc58f;
    --yea-soft: #17301f;
    --nay: #f0715f;
    --nay-soft: #3a1e1a;
    --paired: #a39d92;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-primary: #9CC9EB;
  --brand-hover: #ffffff;
  --brand-soft: #192D40;
  --brand-surface: #101923;
  --brand-ink: #f2f4f7;
  --on-accent: #1f2937;
  --bg: var(--brand-surface);
  --surface: #182431;
  --surface-2: #213141;
  --border: #3b4b5b;
  --text: var(--brand-ink);
  --text-dim: #b8c4d0;
  --accent: var(--brand-primary);
  --accent-soft: var(--brand-soft);
  --link: var(--brand-primary);
  --hero-art: url("../brand/hero/architecture-dark.svg");
  --yea: #5cc58f;
  --yea-soft: #17301f;
  --nay: #f0715f;
  --nay-soft: #3a1e1a;
  --paired: #a39d92;
  --shadow: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--surface); padding: 6px 10px; border-radius: 6px; }

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 14px max(16px, calc((100vw - 1080px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* Site lockup (brand/svg/logo-header.svg); on narrow screens the tile plus live-text name. */
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; font-weight: 650; }
.brand-full { display: block; line-height: 0; }
.brand-logo { display: block; width: auto; height: 48px; }
.brand-compact { display: none; align-items: center; gap: 10px; }
.brand-mark { display: block; width: 36px; height: 36px; flex: none; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--text-dim); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

.quick-search { margin-left: auto; flex: 1 1 240px; max-width: 360px; }

input[type="search"], input[type="text"], input[type="date"], select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

button, .button {
  font: inherit;
  font-weight: 550;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--brand-hover); color: var(--on-accent); }
button.secondary, button.secondary:hover { background: var(--surface-2); color: var(--text); }

/* -------------------------------------------------------------------- main */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
main:focus { outline: none; }

h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }

.lede { color: var(--text-dim); margin: 0 0 20px; max-width: 70ch; }
.meta { color: var(--text-dim); font-size: 0.9rem; }
.loading, .empty { color: var(--text-dim); }
.error { color: var(--nay); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card h2:first-child { margin-top: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.list li:first-child { border-top: 0; }
.list .title { font-weight: 550; overflow-wrap: anywhere; }

.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; min-width: 120px;
}
.stat .value { font-size: 1.4rem; font-weight: 650; display: block; }
.stat .label { color: var(--text-dim); font-size: 0.85rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 0 0 16px; align-items: end; }
.filters label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--text-dim); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: top; }
thead th { border-top: 0; color: var(--text-dim); font-weight: 550; font-size: 0.85rem; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim); white-space: nowrap;
}
.badge.yea, .badge.agreed { background: var(--yea-soft); color: var(--yea); }
.badge.nay, .badge.negatived, .badge.against { background: var(--nay-soft); color: var(--nay); }

.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin: 6px 0 10px; }
.bar span { display: block; height: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.9rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 6px 0; }
.timeline .when { width: 7.5em; flex: none; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.timeline .pending { color: var(--text-dim); }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }

details summary { cursor: pointer; font-weight: 550; margin: 18px 0 8px; }

code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ----------------------------------------------------------------- debates */

.speech-hit { margin-bottom: 14px; }
.speaker { font-weight: 600; margin: 6px 0; }
blockquote { margin: 8px 0; padding: 0 0 0 14px; border-left: 3px solid var(--border); color: var(--text); }
blockquote p, .speech p { margin: 0 0 10px; max-width: 75ch; overflow-wrap: anywhere; }
.speech { padding: 10px 0 6px; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ footer */

.footer {
  color: var(--text-dim);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  padding: 18px max(16px, calc((100vw - 1080px) / 2)) 28px;
}
.footer p { margin: 4px 0; }

@media (max-width: 640px) {
  .brand-full { display: none; }
  .brand-compact { display: flex; }
  h1 { font-size: 1.4rem; }
  .quick-search { max-width: none; margin-left: 0; flex-basis: 100%; }
  th, td { padding: 7px 8px; }
  .hide-narrow { display: none; }
}

/* Search by meaning, up front (home hero, examples, match choice) */
.hero { padding: 22px 20px; margin-bottom: 20px; }
/* Text-free architecture art beside the live hero copy on wide screens; hidden on mobile. */
@media (min-width: 721px) {
  .hero {
    background: var(--brand-surface) var(--hero-art) no-repeat right center / auto 100%;
    padding-right: calc(min(38%, 300px) + 24px);
    min-height: 240px;
  }
}
.hero h1 { margin-top: 0; }
.hero-lede { color: var(--text-dim); margin: 0 0 14px; }
.hero-label { display: block; font-weight: 600; margin: 0 0 -4px; }
.hero-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.hero-form input { flex: 1 1 220px; min-width: 0; font-size: 1.05rem; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
  color: var(--text); text-decoration: none; font-size: 0.92rem;
}
.chip:hover, .chip:focus-visible { border-color: var(--accent); }
@media (pointer: coarse) { .chip { min-height: 44px; } }
fieldset.mode { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; min-width: 0; }
fieldset.mode legend { font-size: 0.85rem; color: var(--text-dim); padding: 0; width: 100%; }
.filters fieldset.mode label { display: inline-flex; gap: 6px; align-items: center; color: var(--text); font-size: 0.92rem; }
.tag-meaning {
  display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.78rem;
  background: var(--accent-soft); color: var(--text);
}

/* Debate filters: the less-used ones fold away */
.more-filters { grid-column: 1 / -1; }
.more-filters summary { cursor: pointer; color: var(--text-dim); font-size: 0.9rem; }
.more-filters .filters { margin: 10px 0 0; }

/* How each party talks about a topic */
.party-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.party-col h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 0; }

/* XataWorks: BC Legislature Explorer AI, Pro, and the Platform line. */
.xw-card { border-left: 4px solid var(--accent); margin: 0 0 20px; }
.xw-card p { max-width: 70ch; }
.xw-prompts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.xw-prompt {
  font: inherit; font-size: 0.92rem; font-weight: 400; text-align: left; white-space: normal; cursor: pointer;
}
.xw-prompt:hover, .xw-prompt:focus-visible { background: var(--accent-soft); color: var(--text); }
.xw-pro { margin: 20px 0 0; }
.xw-pro p { max-width: 70ch; }
.xw-platform { margin: 16px 0 0; }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; margin-left: 4px; }
