:root {
  color-scheme: light;
  --plane:#f6f3ec; --surface-1:#fffdf8;
  --text-primary:#1c2833; --text-secondary:#4a5765; --muted:#7f8c9b;
  --border:#e2dac9; --hair:#ece4d6; --grid:#ece4d6; --axis:#d9d0be;
  --gold:#9a8535; --navy:#1a2a5e;
  --series-1:#1a2a5e; --series-2:#b2544a; --series-3:#9a8535;
  --accent-wash:#efe6d2;
  --hit:#f3e9c8;
  --shadow:0 1px 2px rgba(27,58,92,.06), 0 2px 10px rgba(27,58,92,.07);
  --shadow-lift:0 6px 22px rgba(27,58,92,.14);
  --display:"Space Grotesk",Inter,-apple-system,sans-serif;
  --body:Inter,-apple-system,system-ui,"Segoe UI",sans-serif;
  --serif:"Newsreader","Iowan Old Style",Palatino,Georgia,serif;
  --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:#14161a; --surface-1:#1b1e24;
  --text-primary:#e7e3da; --text-secondary:#b3aea3; --muted:#8b8579;
  --border:#2c3037; --hair:#24272d; --grid:#2a2e35; --axis:#3a3f47;
  --gold:#c2a54e; --navy:#7ea3d8;
  --series-1:#7ea3d8; --series-2:#d1786c; --series-3:#c2a54e;
  --accent-wash:#2b3a4a;
  --hit:#3a3620;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 2px 10px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin:0; background:var(--plane); color:var(--text-primary);
  font-family:var(--body); font-size:15.5px; line-height:1.62; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 22px; }
a { color: var(--navy); }
h1,h2,h3 { font-family: var(--display); line-height:1.2; }
h1 { font-size: 34px; margin: 4px 0 8px; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 23px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 26px 0 8px; }
code { font-family: var(--mono); font-size: .92em; }

/* masthead */
.masthead { padding: 34px 0 6px; position: relative; }
.eyebrow { font-family:var(--display); font-size:11px; font-weight:600;
  letter-spacing:.09em; text-transform:uppercase; color:var(--gold); margin:0 0 5px; }
.byline { color: var(--text-secondary); font-size: 14px; margin: 4px 0 0; }
.statline { font-family: var(--mono); font-size: 13px; color: var(--text-secondary);
  margin: 12px 0 0; }
.statline .si { white-space: nowrap; }
.bigsearch { display: block; width: 100%; font-family: var(--body); font-size: 15px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--plane); color: var(--text-primary); }
button.toggle { font-family: var(--display); font-size: 13.5px; padding: 8px 14px;
  border-radius: 99px; border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); cursor: pointer; box-shadow: var(--shadow); }
button.toggle .state { font-family: var(--mono); font-size: 11px; margin-left: 7px;
  padding: 1px 8px; border-radius: 99px; background: var(--hair);
  color: var(--text-secondary); text-transform: uppercase; }
button.toggle[aria-pressed="true"] { border-color: var(--gold); }
button.toggle[aria-pressed="true"] .state { background: var(--gold); color: #fffdf8; }
.tools { position:absolute; top:34px; right:22px; display:flex; gap:6px; }
.tools button { font-size:15px; background:none; border:1px solid var(--hair);
  border-radius:7px; padding:4px 9px; cursor:pointer; color:var(--text-secondary); }
.tools button:hover { border-color: var(--gold); }

/* nav */
nav.site { border-top:1px solid var(--hair); border-bottom:1px solid var(--hair);
  margin: 18px 0 0; }
nav.site .wrap { display:flex; flex-wrap:wrap; gap:2px 20px; padding-top:9px; padding-bottom:9px; }
nav.site a, nav.site .here { font-family:var(--display); font-size:13.5px;
  text-decoration:none; padding:2px 0; }
nav.site a { color: var(--text-secondary); }
nav.site a:hover { color: var(--navy); }
nav.site .here { color: var(--text-primary); font-weight:600;
  border-bottom:2px solid var(--gold); }

.lede { font-size: 18px; color: var(--text-secondary); max-width: 62ch;
  margin: 22px auto 0; font-family: var(--serif); }
.caveat { background: var(--surface-1); border:1px solid var(--hair);
  border-left:3px solid var(--gold); border-radius:8px; box-shadow:var(--shadow);
  padding: 14px 18px; margin: 18px 0 0; font-size: 14px; color: var(--text-secondary); }
.caveat b { color: var(--text-primary); }

section.block { margin: 40px 0 0; }
.rule::before { content:""; display:block; width:46px; height:3px;
  background:var(--gold); margin-bottom:11px; border-radius:1px; }
p { max-width: 74ch; }
.note { font-size: 13.5px; color: var(--muted); }
.unit { display:inline-block; font-family:var(--mono); font-size:11px; font-weight:600;
  letter-spacing:.05em; text-transform:uppercase; background:var(--navy); color:#fffdf8;
  border-radius:4px; padding:2px 8px; margin: 0 0 8px; }
:root[data-theme="dark"] .unit { color:#14161a; }

/* stat pairs */
.statpair { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin: 14px 0; }
.stat { background:var(--surface-1); border:1px solid var(--hair); border-radius:8px;
  box-shadow:var(--shadow); padding: 12px 18px; }
.stat .v { font-family:var(--display); font-size:26px; font-weight:600; }
.stat .v small { font-family:var(--mono); font-size:13px; color:var(--muted); font-weight:400; }
.stat .l { font-size:13px; color:var(--text-secondary); margin-top:2px; }

/* figures and tables */
figure { margin: 18px 0; background:#fff; border:1px solid var(--hair);
  border-radius:8px; box-shadow:var(--shadow); padding: 10px; }
:root[data-theme="dark"] figure { background:#f4f1ea; }
figure img { width:100%; height:auto; display:block; }
figcaption { font-size:13px; color:var(--text-secondary); padding: 8px 6px 2px;
  max-width: none; }
:root[data-theme="dark"] figcaption { color:#4a5765; }
table.gen { border-collapse: collapse; width:100%; margin: 12px 0; font-size:13.5px; }
table.gen th, table.gen td { text-align:left; padding: 6px 10px;
  border-bottom: 1px solid var(--hair); }
table.gen th { font-family:var(--display); font-size:12px; letter-spacing:.04em;
  text-transform:uppercase; color:var(--text-secondary); }
table.gen td.n { font-family:var(--mono); text-align:right; white-space:nowrap; }
table.gen th.n { text-align:right; }

.tablewrap { overflow-x:auto; }
.tablewrap table.gen th:first-child, .tablewrap table.gen td:first-child {
  position:sticky; left:0; background:var(--plane); }
blockquote, .q { border-left:3px solid var(--gold); padding-left:16px; margin:10px 0;
  font-family:var(--serif); font-size:16.5px; line-height:1.55; color:var(--text-primary); }

/* GBV reason list */
.gcase { background:var(--surface-1); border:1px solid var(--hair); border-radius:8px;
  box-shadow:var(--shadow); padding: 14px 18px; margin: 12px 0; }
.gcase .meta { font-family:var(--mono); font-size:12.5px; color:var(--text-secondary); }
.gcase .badge { display:inline-block; font-family:var(--mono); font-size:10.5px;
  border:1px solid var(--gold); color:var(--gold); border-radius:99px;
  padding:1px 8px; margin-left:6px; }

/* decisions browser */
.filters { background:var(--surface-1); border:1px solid var(--hair); border-radius:8px;
  box-shadow:var(--shadow); padding: 14px 18px; margin: 18px 0; }
.filters .frow { display:flex; flex-wrap:wrap; gap:10px 18px; align-items:flex-end; }
.filters label { display:block; font-family:var(--display); font-size:11px;
  font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--gold);
  margin: 0 0 3px; }
.filters select, .filters input[type=search] { font-family:var(--body); font-size:14px;
  padding: 6px 8px; border:1px solid var(--border); border-radius:6px;
  background:var(--plane); color:var(--text-primary); max-width: 100%; }
.filters input[type=search] { width: 320px; }
.filters .fhint { font-size:12.5px; color:var(--muted); margin:8px 0 0; }
.count { font-family:var(--mono); font-size:13px; color:var(--text-secondary); margin:14px 0; }
.count b { color: var(--text-primary); }
.card { background:var(--surface-1); border:1px solid var(--hair); border-radius:8px;
  box-shadow:var(--shadow); padding: 15px 18px; margin: 12px 0; }
.card .meta { font-family:var(--mono); font-size:12.5px; color:var(--text-secondary); }
.card .meta b { color:var(--text-primary); }
.card h4 { font-family:var(--display); font-size:15.5px; margin: 6px 0 2px; }
.card .digest { border-left:3px solid var(--gold); padding-left:14px; margin:10px 0 0;
  font-family:var(--serif); font-size:15.5px; line-height:1.6; }
.card .digest mark { background: var(--hit); padding:0 1px; }
.chips { margin: 10px 0 0; }
.chip { display:inline-block; font-family:var(--mono); font-size:11px;
  background:var(--accent-wash); color:var(--text-primary); border-radius:4px;
  padding:2px 8px; margin: 0 4px 4px 0; }
.chip.dismissal { background: var(--navy); color:#fffdf8; }
:root[data-theme="dark"] .chip.dismissal { color:#14161a; }
.chip.gbv { border:1px solid var(--gold); background:none; color:var(--gold); }
button.more, button.act { font-family:var(--display); font-size:13.5px; padding:8px 16px;
  border-radius:7px; border:1px solid var(--border); background:var(--surface-1);
  color:var(--text-primary); cursor:pointer; box-shadow:var(--shadow); }
button.more:hover, button.act:hover { border-color: var(--gold); }

/* data & code terminal panel (dark in both themes, as on the Hansard site) */
#dl { background: var(--navy); color:#fffdf8; border:none; font-weight:600; }
:root[data-theme="dark"] #dl { color:#14161a; }
#toolspanel { background:#10141a; border:1px solid #222a35; border-radius:10px;
  padding:11px 16px; margin:18px 0 0; box-shadow:var(--shadow); color:#cdd6e3; }
#toolspanel:not([open]) { border-color:#2f5a3c; }
#toolspanel > summary { cursor:pointer; font-family:var(--mono); font-size:13.5px;
  font-weight:500; color:#cdd6e3; display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
#toolspanel .prompt { color:#7ee08a; font-weight:700; margin-right:4px; }
#toolspanel .dim { color:#6b7688; font-weight:400; }
#toolspanel .livebadge { display:inline-flex; align-items:center; padding:2px 9px 2px 7px;
  border-radius:99px; background:#0f2318; border:1px solid #2f5a3c; color:#7ee08a;
  font-size:11px; font-weight:600; }
#toolspanel .livebadge .dot { display:inline-block; width:6px; height:6px; border-radius:50%;
  background:#7ee08a; margin-right:5px; animation:pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.toolbody { margin-top:12px; }
.tabsrow { display:flex; flex-wrap:wrap; gap:4px; align-items:center; margin-bottom:9px; }
.tt { font-family:var(--mono); font-size:11.5px; padding:4px 11px; border-radius:5px;
  border:1px solid #2a3340; background:none; color:#8c97a8; cursor:pointer; }
.tt:hover { color:#cdd6e3; border-color:#3d4a5c; }
.tt[aria-selected="true"] { background:#1d2733; color:#7ee08a; border-color:#35506b; }
.toolnote { font-family:var(--mono); font-size:11px; color:#6b7688; margin-left:auto; }
.tp { background:#0b0e13; border:1px solid #1c232d; border-radius:8px;
  padding:13px 15px; overflow-x:auto; margin:0; }
.tp.hidden { display:none; }
.tp code { font-family:var(--mono); font-size:12px; line-height:1.65; color:#cdd6e3;
  white-space:pre; display:block; }
.tp .cm { color:#6b7688; font-style:italic; }
.tp .st { color:#d7a86e; }
#toolspanel .filelist { margin:0; padding-left:18px; font-size:13px; }
#toolspanel .filelist li { margin-bottom:5px; color:#8c97a8; }
#toolspanel .filelist a { font-family:var(--mono); font-size:12px; color:#7fb3e0; }
#toolspanel p.toolnote { margin:8px 0 0; }
.rnote { font-size:12.5px; color:#8c97a8; margin:0 0 9px; max-width:84ch; line-height:1.6; }
.rnote a { color:#7fb3e0; }
.rnote .ic { font-family:var(--mono); background:#0b0e13; border:1px solid #1c232d;
  border-radius:4px; padding:1px 5px; color:#7ee08a; font-size:12px; }
#rcode { width:100%; min-height:150px; background:#0b0e13; border:1px solid #1c232d;
  border-radius:8px; padding:12px 14px; color:#cdd6e3; font-family:var(--mono);
  font-size:12px; line-height:1.65; resize:vertical; }
.rbar { display:flex; gap:8px; align-items:center; margin:9px 0; }
.rbar button { font-family:var(--mono); font-size:12px; padding:6px 14px; border-radius:6px;
  border:1px solid #2a3340; background:none; color:#cdd6e3; cursor:pointer; }
#rrun { background:#1d3324; border-color:#2f5a3c; color:#7ee08a; font-weight:600; }
#rrun:hover { background:#24422e; }
#rstatus { font-family:var(--mono); font-size:11.5px; color:#6b7688; margin-left:auto; }
#rout { background:#0b0e13; border:1px solid #1c232d; border-radius:8px; padding:12px 14px;
  overflow-x:auto; margin:0; max-height:380px; overflow-y:auto;
  font-family:var(--mono); font-size:12px; line-height:1.6; color:#cdd6e3; white-space:pre; }
.file { background:var(--surface-1); border:1px solid var(--hair); border-radius:8px;
  box-shadow:var(--shadow); padding:11px 16px; margin:9px 0; }
.file .fn { font-family:var(--mono); font-size:13px; }
.file .fm { font-family:var(--mono); font-size:11.5px; color:var(--muted); margin-left:10px; }
.file .fd { font-size:13px; color:var(--text-secondary); margin-top:3px; max-width:74ch; }
.filedetails { margin-top:7px; }
.filedetails > summary { cursor:pointer; font-family:var(--mono); font-size:11.5px;
  color:var(--gold); }
.filedetails[open] > summary { margin-bottom:6px; }
table.dict { border-collapse:collapse; width:100%; font-size:13px; margin:12px 0; }
table.dict th, table.dict td { text-align:left; padding:5px 10px; vertical-align:top;
  border-bottom:1px solid var(--hair); }
table.dict td:first-child { font-family:var(--mono); font-size:12px; white-space:nowrap; }

/* footer */
footer.credit { border-top:1px solid var(--hair); margin: 56px 0 0; padding: 26px 0 40px;
  font-size: 13.5px; color: var(--text-secondary); }
footer.credit p { max-width: 80ch; }

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .tools { position: static; margin-top: 10px; }
  .filters input[type=search] { width: 100%; }
  .filters .frow > div { width: 100%; }
  .filters select { width: 100%; }
  .wrap { padding: 0 14px; }
  .statpair { grid-template-columns: 1fr; gap: 8px; }
  .stat { padding: 10px 14px; }
}
