/* qipu data: the formal portal. Tokens first; one family (Inter) and one monospace (JetBrains Mono) for identifiers. */
:root {
  --bg: #ffffff; --bg2: #f7f7f5; --bg3: #efefec; --ink: #0b0b0c; --ink2: #545a64; --ink3: #7a808a;
  --rule: #dfe1e5; --rule2: #eef0f2; --link: #2a3680; --link-h: #1e45e4; --focus: #2a3680;
  --ok: #2d6a2a; --no: #a3271c; --warn: #8c5e2a;
  --ui: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --w: 1180px; --r: 4px;
}
/* Dark: qipu.org's dark palette (fusion.css). The theme is set on <html data-theme> by the inline head script before paint;
   light is the default, as on qipu.org; "auto" follows the system and its changes. */
:root[data-theme="dark"] {
  --bg: #111317; --bg2: #15181c; --bg3: #1d2127; --ink: #ecebe6; --ink2: #a3a9b4; --ink3: #8c93a0;
  --rule: #2a2e35; --rule2: #1f2329; --link: #9fb0ff; --link-h: #7d97ff; --focus: #9fb0ff;
  --ok: #8fd49a; --no: #ff7a70; --warn: #d9a468; --field: #171a1f; --field-rule: #6b7280; color-scheme: dark;
}
:root { --field: #ffffff; --field-rule: var(--ink3); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
html, body { margin: 0; background: var(--bg); }
body { font: 14px/1.55 var(--ui); color: var(--ink); font-feature-settings: "tnum", "cv11"; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-h); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p, dl, dd, figure, ul, ol { margin: 0; }
code, .mono, kbd { font-family: var(--mono); font-size: 0.89em; }
.w { max-width: var(--w); margin: 0 auto; padding: 0 32px; }
@media (max-width: 700px) { .w { padding: 0 16px; } }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 6px 10px; z-index: 50; }

/* header */
.hd { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--rule); }
.hd .w { display: flex; align-items: stretch; gap: 26px; height: 52px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font: 600 15px/1 var(--ui); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand svg { width: 22px; height: 22px; color: #2a3680; } :root[data-theme="dark"] .brand svg { color: #9fb0ff; }
.brand em { font-style: normal; font-weight: 500; color: var(--ink2); padding-left: 9px; border-left: 1px solid var(--rule); }
.hd nav { display: flex; gap: 22px; font-size: 13.5px; }
.hd nav a { display: flex; align-items: center; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.hd nav a:hover { color: var(--ink); text-decoration: none; }
.hd nav a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.hd .sp { flex: 1; }
.hd .city { display: flex; align-items: center; font-size: 13px; color: var(--ink2); }
.hd .ext { display: flex; align-items: center; font-size: 13px; color: var(--ink2); }
.hd .menu { display: none; align-items: center; }
.hd .menu button { font: 500 13px var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r); padding: 5px 10px; cursor: pointer; }
@media (max-width: 860px) {
  .hd .w { gap: 12px; } .hd nav, .hd .ext, .hd .city { display: none; } .hd .menu { display: flex; }
  .hd.open nav { display: flex; flex-direction: column; gap: 0; position: absolute; left: 0; right: 0; top: 52px; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 6px 16px 10px; }
  .hd.open nav a { padding: 9px 0; border: 0; border-bottom: 1px solid var(--rule2); }
}

/* page frame */
main { padding-bottom: 56px; }
.crumb { font-size: 12.5px; color: var(--ink3); padding: 22px 0 8px; }
.crumb a { color: var(--ink2); white-space: nowrap; } .crumb span { margin: 0 7px; color: var(--ink3); }
h1 { font: 600 26px/1.22 var(--ui); letter-spacing: -.018em; max-width: 860px; text-wrap: balance; }
@media (max-width: 700px) { h1 { font-size: 21px; } }
.sub { font-size: 13px; color: var(--ink2); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.lede { font-size: 15px; line-height: 1.6; color: var(--ink); max-width: 760px; margin-top: 12px; }
h2 { font: 600 15px/1.3 var(--ui); margin: 34px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); display: flex; align-items: baseline; gap: 10px; }
h2 .n { font-weight: 400; color: var(--ink3); font-size: 13px; }
h2 .r { margin-left: auto; font-weight: 400; font-size: 12.5px; }
h3 { font: 600 13.5px/1.35 var(--ui); margin: 22px 0 8px; }
p.t { max-width: 760px; margin: 8px 0; }
p.t + p.t { margin-top: 10px; }
ul.t, ol.t { max-width: 760px; margin: 8px 0; padding-left: 20px; } ul.t li + li, ol.t li + li { margin-top: 4px; }
.note { font-size: 12.5px; color: var(--ink2); }
.mut { color: var(--ink2); }
.lay { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.lay > * { min-width: 0; }
.side { padding-top: 2px; }
.side h2:first-child { margin-top: 26px; }
@media (max-width: 960px) { .lay { grid-template-columns: 1fr; gap: 0; } .side { position: static; } }

/* tabs (section links) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-top: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 12px 9px 0; margin-right: 12px; color: var(--ink2); font-size: 13.5px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* field / value lists */
.kv { display: grid; grid-template-columns: 210px minmax(0, 1fr); font-size: 13.5px; border-top: 1px solid var(--rule); }
.kv dt { color: var(--ink2); padding: 7px 14px 7px 0; border-bottom: 1px solid var(--rule2); }
.kv dd { padding: 7px 0; border-bottom: 1px solid var(--rule2); overflow-wrap: anywhere; }
.side .kv { grid-template-columns: 96px minmax(0, 1fr); font-size: 13px; }
@media (max-width: 700px) { .kv { grid-template-columns: 118px minmax(0, 1fr); font-size: 13px; } }

/* tables */
.tw { overflow-x: auto; border-top: 1px solid var(--rule); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { position: sticky; top: 52px; background: var(--bg); text-align: left; font-weight: 600; color: var(--ink2); font-size: 12px; border-bottom: 1px solid var(--rule); padding: 8px 14px 8px 0; white-space: nowrap; vertical-align: bottom; }
.tw thead th { position: static; }
thead th[data-sort] { cursor: pointer; user-select: none; } thead th[data-sort]:hover { color: var(--ink); }
thead th[aria-sort="ascending"]::after { content: " ↑"; } thead th[aria-sort="descending"]::after { content: " ↓"; }
td { border-bottom: 1px solid var(--rule2); padding: 7px 14px 7px 0; vertical-align: top; overflow-wrap: break-word; }
td a.mono, td .mono, td.id { overflow-wrap: anywhere; }
.nw { white-space: nowrap; }
tbody tr:hover td { background: var(--bg2); }
td.n, th.n { text-align: right; white-space: nowrap; overflow-wrap: normal; }
td.id, td.mono { font-family: var(--mono); font-size: 12px; }
td.nw { white-space: nowrap; overflow-wrap: normal; }
tr.g td { background: var(--bg2); font-weight: 600; font-size: 12px; color: var(--ink2); padding-top: 9px; }
tbody tr.g:hover td { background: var(--bg2); }
.tid { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink3); margin-top: 1px; }
.bar { display: inline-block; height: 7px; background: var(--ink2); border-radius: 1px; vertical-align: middle; opacity: .55; }
@media (max-width: 700px) { th.hm, td.hm { display: none; } }   /* hide-on-phone for table columns only: the home page wrapper is also .hm */
.ok { color: var(--ok); } .no { color: var(--no); } .pend { color: var(--warn); }
.more { margin-top: 10px; font-size: 13px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--bg); color: var(--ink); font: 500 13px var(--ui); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink2); text-decoration: none; color: var(--ink); }
.btn.pri { background: var(--ink); color: var(--bg); border-color: var(--ink); } .btn.pri:hover { color: var(--bg); opacity: .9; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.srch { display: flex; margin: 18px 0 6px; max-width: 760px; }
.srch input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--field-rule); border-right: 0; border-radius: var(--r) 0 0 var(--r); padding: 0 12px; font: 14px var(--ui); background: var(--bg); color: var(--ink); }
.srch input:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.srch button { height: 40px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font: 600 13.5px var(--ui); padding: 0 16px; border-radius: 0 var(--r) var(--r) 0; cursor: pointer; }
.filter { height: 32px; width: 260px; max-width: 100%; border: 1px solid var(--rule); border-radius: var(--r); padding: 0 10px; font: 13px var(--ui); background: var(--bg); color: var(--ink); }
.filter:focus { outline: none; border-color: var(--ink2); }
.tool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.cite { position: relative; border: 1px solid var(--rule); background: var(--bg2); border-radius: var(--r); padding: 12px 14px; font: 12px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.cpw { position: relative; }
.cpw > .cite { padding-right: 66px; }
.cpw > .code { padding-right: 66px; }
.copy { position: absolute; right: 8px; top: 8px; font: 500 11.5px var(--ui); border: 1px solid var(--rule); background: var(--bg); color: var(--ink2); border-radius: var(--r); padding: 2px 8px; cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--ink2); }
.code { position: relative; border: 1px solid var(--rule); background: var(--bg2); border-radius: var(--r); padding: 12px 14px; font: 12px/1.6 var(--mono); white-space: pre; overflow-x: auto; }
.q { font-family: Georgia, "Times New Roman", serif; font-size: 14px; color: var(--ink); }
.lab { display: inline-block; font: 600 11px/18px var(--ui); color: var(--ink2); border: 1px solid var(--rule); border-radius: 3px; padding: 0 6px; }
.stat { color: var(--ink2); font-size: 12.5px; }
textarea.sql { width: 100%; min-height: 150px; font: 13px/1.55 var(--mono); color: var(--ink); background: var(--field); border: 1px solid var(--field-rule); border-radius: var(--r); padding: 10px 12px; resize: vertical; }
textarea.sql:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* footer */
.ft { border-top: 1px solid var(--rule); padding: 20px 0 36px; font-size: 12.5px; color: var(--ink2); background: var(--bg); }
.ft .w { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 24px; }
.ft b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.ft a { display: block; color: var(--ink2); line-height: 1.9; } .ft a:hover { color: var(--ink); }
@media (max-width: 700px) { .ft .w { grid-template-columns: 1fr 1fr; } }

/* documentation */
.doc { max-width: 820px; }
.doc h2 { margin-top: 30px; } .doc h3 { margin-top: 20px; }
.doc p, .doc ul, .doc ol, .doc table, .doc pre { margin: 10px 0; } .doc ul, .doc ol { padding-left: 20px; }
.doc pre { border: 1px solid var(--rule); background: var(--bg2); border-radius: var(--r); padding: 12px 14px; font: 12px/1.6 var(--mono); overflow-x: auto; }
.doc table { display: block; overflow-x: auto; }
.doc code { background: var(--bg2); padding: 1px 4px; border-radius: 3px; }
.toc { font-size: 13px; } .toc a { display: block; padding: 3px 0; color: var(--ink2); } .toc a:hover { color: var(--ink); }

/* states */
.loading { color: var(--ink2); font-size: 13px; padding: 14px 0; }
.err { color: var(--no); font-size: 13px; padding: 10px 0; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { tbody tr td { transition: background-color .12s; } }

#dsets td:first-child, #dsets2 td:first-child { min-width: 180px; }
.tid { overflow-wrap: anywhere; }
.side .note { overflow-wrap: anywhere; }
.fac th:nth-child(2), .fac td:nth-child(2) { width: 96px; }
.fac th:nth-child(3), .fac td:nth-child(3) { width: 72px; }
.fac th:nth-child(4), .fac td:nth-child(4) { width: 136px; }
@media (max-width: 560px) { .fac th:nth-child(4), .fac td:nth-child(4) { width: 64px; } .fac .bar { max-width: 56px; } }
#cols td:nth-child(-n+2) .mono { overflow-wrap: normal; white-space: nowrap; }

/* theme control, as on qipu.org: a moon/sun button in the bar (computer), Light · Dark · Auto in the phone menu and the footer */
.thm-nav { display: flex; align-items: center; justify-content: center; width: 36px; margin: 0 -8px; padding: 0; border: 0; background: none; color: var(--ink2); cursor: pointer; }
.thm-nav:hover { color: var(--ink); }
.thm-nav svg { width: 17px; height: 17px; }
.thm-nav .ic-sun { display: none; }
:root[data-theme="dark"] .thm-nav .ic-sun { display: block; } :root[data-theme="dark"] .thm-nav .ic-moon { display: none; }
.thm { display: inline-flex; align-items: baseline; flex-wrap: wrap; font: 11px/1.9 var(--mono); letter-spacing: .04em; }
.thm .thm-lab { color: var(--ink3); margin-right: 6px; }
.thm button { font: inherit; letter-spacing: inherit; background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--ink3); }
.thm button + button::before { content: "·"; display: inline-block; margin: 0 7px; color: var(--ink3); font-weight: 400; }
.thm button:hover { color: var(--ink); }
.thm button[aria-pressed="true"] { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.thm button[aria-pressed="true"]::before { text-decoration: none; }
.hd nav .thm { display: none; }
@media (max-width: 860px) { .thm-nav { margin-right: 0; } .hd.open nav .thm { display: flex; padding: 12px 0 4px; font-size: 12px; } }
.sub .mono, .kv dd .mono, .kv dd a.mono { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 700px) { .ft .w > div:first-child { grid-column: 1 / -1; } }
.err { overflow-wrap: anywhere; }
/* the catalogue's search box: results as you type */
.qs { max-width: 760px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--bg); padding: 4px 12px 8px; margin: 4px 0 10px; }
.qs ul { list-style: none; margin: 0; padding: 0; }
.qs li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule2); font-size: 13.5px; }
.qs li span { color: var(--ink3); font-size: 12px; white-space: nowrap; }
.qs .note { margin-top: 8px; }
.r { float: right; font-weight: 400; }
/* facts by level on place records */
#levels h3 { margin-top: 26px; }
#levels h3 .n { font-weight: 400; color: var(--ink3); margin-left: 6px; font-size: 12.5px; }
#levels td:last-child { white-space: nowrap; }
/* ask a question (beta) */
.beta { display: inline-block; vertical-align: middle; font: 600 10.5px/1 var(--ui); letter-spacing: .04em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 3px; padding: 3px 5px 2px; margin-left: 4px; }
h1 .beta { font-size: 11px; position: relative; top: -3px; }
.ask-cta { margin-top: 6px; }
.ask-flag { border: 1px solid var(--warn); border-left-width: 3px; border-radius: var(--r); padding: 10px 14px; margin: 18px 0 4px; font-size: 13px; max-width: 860px; }
.ask-flag b { color: var(--warn); }
.ask-ans { font-size: 15px; margin: 6px 0 10px; } .ask-ans .mut { font-size: 12.5px; }
.ask-none { font-size: 14px; max-width: 760px; }
.crumb { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 2px; }
.byplace { margin: 10px 0 0; }
/* result tables become stacked rows on a phone (search) */
@media (max-width: 700px) {
  table.stk thead { display: none; }
  table.stk, table.stk tbody, table.stk tr, table.stk td { display: block; width: 100%; }
  table.stk tr { border-top: 1px solid var(--rule); padding: 8px 0; }
  table.stk td { border: 0; padding: 1px 0; white-space: normal; }
  table.stk td.nw { font-family: var(--mono); font-size: 12.5px; color: var(--ink2); }
  table.stk td.inl { display: inline-block; width: auto; margin-right: 12px; }
  table.stk td.hp { display: none; }
}
.srt { font-size: 12.5px; color: var(--ink2); margin-right: 8px; }
.srt select { font: 12.5px var(--ui); margin-left: 4px; padding: 1px 4px; border: 1px solid var(--field-rule); border-radius: var(--r); background: var(--field); color: var(--ink); }

/* ── design r1 (17/10): the type and table pass ("precise"), the search-first home page, the documentation layout ── */
:root { --ink2: #4a505a; --ink3: #737985; --rule: #e3e5e8; --rule2: #f0f1f3; }
body { font-size: 15px; line-height: 1.55; letter-spacing: -0.003em; }
.w { max-width: 1120px; }
.crumb { font-size: 12px; padding: 26px 0 6px; letter-spacing: .01em; }
h1 { font-size: 34px; line-height: 1.12; font-weight: 650; letter-spacing: -.028em; }
@media (max-width: 700px) { h1 { font-size: 26px; } }
.lede { font-size: 16.5px; line-height: 1.55; color: var(--ink2); max-width: 680px; margin-top: 14px; }
h2, .pl-g { font-size: 12px !important; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink2);
  border-bottom: 1px solid var(--ink) !important; padding-bottom: 7px; margin-top: 40px !important; }
h2 .n, .pl-g .n { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink3); font-size: 12px !important; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
p.t, .note { max-width: 720px; }
.note { font-size: 13px; color: var(--ink3); }
/* tables: hairlines, small caps headers, tabular figures, more air per row but smaller type */
table { font-size: 14px; border-collapse: collapse; }
th { font-size: 11px !important; font-weight: 600 !important; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3) !important;
  border-bottom: 1px solid var(--rule) !important; padding: 8px 12px 8px 0 !important; background: none !important; }
td { padding: 11px 12px 11px 0 !important; border-bottom: 1px solid var(--rule2) !important; vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.pl-t .c-y, td.nw { font-variant-numeric: tabular-nums; color: var(--ink2); white-space: nowrap; font-size: 13px; }
.pl-t .sm, .rp-m { font-size: 12px; color: var(--ink3); margin-top: 3px; }
.rt { font: 600 10px/16px var(--ui) !important; text-transform: uppercase; letter-spacing: .07em; color: var(--ink3) !important; margin-right: 4px; }
/* search box and filter bar: flatter */
.srch input { height: 46px; font-size: 15.5px; border-radius: 3px; }
.srch button { height: 46px; padding: 0 22px; border-radius: 3px; }
.pl-f { background: none !important; border: 0 !important; border-top: 1px solid var(--rule) !important; border-bottom: 1px solid var(--rule) !important; border-radius: 0 !important; padding: 12px 0 !important; }
.pl-sum { border: 0 !important; background: var(--bg2); padding: 14px 16px !important; font-size: 13.5px; }
.pl-ord { font-size: 13px; }
.kv { font-size: 14.5px; }
/* home: search first, three plain columns */
.hm h1 { margin-top: 56px; max-width: 780px; }
.hm .srch { margin-top: 22px; max-width: 760px; }
.hm .note { margin-top: 8px; }
.hm-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 40px; margin-top: 44px; }
.hm-c .t { margin: 12px 0 8px; }
.hm-l { list-style: none; padding: 0; margin: 0; line-height: 2; }
@media (max-width: 700px) { .hm h1 { margin-top: 28px; } .hm-cols { margin-top: 20px; } }
/* documentation: left nav, article, "on this page" */
.dl3 { display: grid; grid-template-columns: 210px minmax(0, 1fr) 190px; gap: 44px; align-items: start; margin-top: 8px; }
.dn, .dt { position: sticky; top: 72px; display: flex; flex-direction: column; font-size: 13.5px; }
.dn a, .dt a { color: var(--ink2); padding: 5px 0 5px 10px; border-left: 2px solid transparent; }
.dn a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }
.dn a:hover, .dt a:hover { color: var(--ink); text-decoration: none; }
.dn-h { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink3); margin: 18px 0 6px; }
.dn-h:first-child { margin-top: 0; }
.dd { max-width: 760px; }
.dd h1 { margin: 0 0 6px; }
.dd p, .dd li { font-size: 15px; line-height: 1.65; margin: 12px 0; }
.dd ul { padding-left: 20px; }
.dd h3 { margin-top: 30px; }
.dd pre { background: var(--bg2); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 16px; overflow-x: auto; font: 13px/1.6 var(--mono); margin: 14px 0; }
.dd code { background: var(--bg2); padding: 1px 4px; border-radius: 3px; }
.dd pre code { background: none; padding: 0; }
.dd blockquote { margin: 14px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--rule); color: var(--ink2); font-size: 14.5px; line-height: 1.6; }
.dd table { width: 100%; }
@media (max-width: 1100px) { .dl3 { grid-template-columns: 200px minmax(0, 1fr); } .dt { display: none; } }
@media (max-width: 760px) { .dl3 { grid-template-columns: 1fr; gap: 12px; } .dn { position: static; flex-direction: row; flex-wrap: wrap; gap: 2px 14px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
  .dn a { padding: 3px 0; border-left: 0; } .dn a[aria-current] { text-decoration: underline; } .dn-h { width: 100%; margin: 8px 0 2px; } }
.dd h2 { text-transform: none; font-size: 21px !important; font-weight: 600; letter-spacing: -.015em; color: var(--ink); border-bottom: 0 !important; padding-bottom: 0; margin-top: 38px !important; }
/* folded remainders of long lists (record pages) */
details.fold { margin: 10px 0 4px; }
details.fold > summary { cursor: pointer; color: var(--link); font-size: 13.5px; padding: 6px 0; }
details.fold .fr { font-size: 13px; padding: 3px 0; }
.dl3 > * { min-width: 0; }
.dd pre { max-width: 100%; }
.nm-t td.nm-d { color: var(--ink2); font-size: 13.5px; } @media (max-width: 700px) { .nm-t td.nm-d { font-size: 13px; padding-top: 0 !important; } }
@media (max-width: 700px) { .nm-t td { border-bottom: 0 !important; padding: 1px 0 !important; } .nm-t tr { padding: 9px 0; } }
.dd td code { word-break: break-all; } .dd .tw { overflow-x: auto; }
.dd p, .dd li, .dd td { overflow-wrap: anywhere; }

/* lists: ux agent (capped tables, decade groups, secondary details); the design agent may move these into ds.css */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--link-h); }
.capbar { margin-top: 6px; }
.decades details { border-top: 1px solid var(--rule2); }
.decades details:last-of-type { border-bottom: 1px solid var(--rule2); }
.decades summary, details.tech > summary { cursor: pointer; padding: 7px 2px; font-weight: 500; }
.decades summary .n { color: var(--ink3); font-weight: 400; margin-left: 6px; font-size: 12.5px; }
.decades details[open] > summary { color: var(--ink); }
.decades .tw { margin: 2px 0 10px; }
details.tech { margin-top: 28px; border-top: 1px solid var(--rule); }
details.tech > summary { color: var(--ink2); font-size: 13.5px; }
details.tech[open] > summary { margin-bottom: 4px; }
.lead { font-size: 15px; max-width: 760px; margin: 4px 0 14px; }
.tag { font-size: 11.5px; color: var(--ink3); border: 1px solid var(--rule); border-radius: 3px; padding: 0 5px; margin-left: 6px; cursor: help; white-space: nowrap; }
.idsm { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); }

/* place page, story first (ux agent 19/10): lead, graph link, Connected to, What the records say */
.pl-lead { font-size: 16px; line-height: 1.5; max-width: 760px; margin: 6px 0 4px; }
.pl-glink { margin: 14px 0 4px; }
.pl-con, .pl-rec { margin-top: 26px; }
.pl-cgs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 32px; }
@media (max-width: 1400px) { .pl-cgs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .pl-cgs { grid-template-columns: 1fr; } }
.pl-cg h3 { margin: 14px 0 6px; font-size: 14px; }
.pl-cl { list-style: none; margin: 0; padding: 0; }
.pl-cl li { display: grid; grid-template-columns: minmax(0, 1fr) 70px 86px; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--rule2); font-size: 13.5px; line-height: 1.3; }
.pl-cl li a { overflow-wrap: anywhere; }   /* names are the content: they wrap, never cut */
.pl-cl .cn { text-align: right; }
.pl-cl .cb { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.pl-cl .cb span { display: block; height: 100%; background: var(--link); opacity: .55; }
.pl-cl .cn { color: var(--ink2); font-size: 12px; white-space: nowrap; }
.pl-cm > summary { cursor: pointer; color: var(--link); font-size: 13px; padding: 4px 0; }
.pl-rk { border-top: 1px solid var(--rule2); }
.pl-rk:last-of-type { border-bottom: 1px solid var(--rule2); }
.pl-rk > summary { cursor: pointer; padding: 8px 2px; }
.pl-rk > summary .n { color: var(--ink2); margin: 0 6px; }
.pl-rt { margin: 0 0 10px; }
@media (max-width: 640px) { .pl-cl li { grid-template-columns: minmax(0, 1fr) 50px auto; } }
.pl-reps { margin-top: 16px; }
.pl-reps h3 { font-size: 14px; margin: 0 0 4px; }
.pl-rl li { grid-template-columns: minmax(0, 1fr) minmax(120px, auto) 70px; }
.pl-rl .cr-t a { overflow-wrap: anywhere; }
.pl-rl .cr-k { color: var(--ink2); font-size: 12px; }
@media (max-width: 640px) { .pl-rl li { grid-template-columns: minmax(0, 1fr) auto; } .pl-rl .cr-k { grid-column: 1; } }

/* ── 21/10 (mockups_1021, header A): four sections, search in the header (not on Home), the phone menu starts with Home ── */
.brand { border-radius: var(--r); padding: 0 4px; margin-left: -4px; transition: color .12s; }
.brand:hover, .brand:focus-visible { color: var(--link-h); }
.brand:hover svg { color: var(--link-h); }
.hd .w { gap: 28px; }
.hd nav { gap: 24px; font-size: 14px; }
.hd .city { white-space: nowrap; }
.hd .right { display: flex; align-items: center; gap: 14px; }
.hd .hs { display: flex; align-items: center; margin: 0; }
.hd .hs input { width: 300px; height: 32px; border: 1px solid var(--rule); border-radius: var(--r); padding: 0 10px 0 32px; font: 13.5px var(--ui); color: var(--ink); background: var(--field) no-repeat 10px 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a808a' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E"); }
.hd .hs input::placeholder { color: var(--ink3); }
.hd .hs input:focus { outline: none; border-color: var(--ink2); }
body.home .hd .hs, body.home .hd .sb { display: none !important; }
.hd .ib { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; background: none; color: var(--ink2); cursor: pointer; }
.hd .ib svg { width: 18px; height: 18px; } .hd .ib:hover, html.sopen .hd .ib.sb { color: var(--ink); }
.hd .thm-nav { margin: 0 -8px 0 -4px; }
.sbar { display: none; border-bottom: 1px solid var(--rule); background: var(--bg); }
.sbar .w { display: flex; align-items: center; gap: 10px; height: 58px; }
.sbar form { flex: 1; min-width: 0; margin: 0; }
.sbar input { width: 100%; height: 40px; border: 1px solid var(--ink); border-radius: var(--r); padding: 0 12px; font: 15px var(--ui); color: var(--ink); background: var(--field); }
.sbar .x { font: 13px var(--ui); color: var(--ink2); background: none; border: 0; cursor: pointer; padding: 8px 0; }
html.sopen .sbar { display: block; }
.mnav { display: none; }
.hd .menu button { min-width: 64px; }
@media (max-width: 860px) {
  .hd .w { gap: 6px; } .hd .hs, .hd .right .city, .hd .thm-nav { display: none; }
  .hd .right { gap: 6px; } .hd .ib.sb { display: flex; }
  html.mopen .mnav { display: block; border-bottom: 1px solid var(--rule); background: var(--bg); padding: 4px 0 16px; }
  .mnav a.ml { display: block; padding: 12px 0; font-size: 16px; color: var(--ink); border-bottom: 1px solid var(--rule2); }
  .mnav a.ml:hover { text-decoration: none; color: var(--link-h); }
  .mnav a.ml[aria-current] { font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); padding-left: 12px; }
  .mnav a.ml small { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink3); margin-top: 1px; }
  .mnav .mf { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; font-size: 13px; color: var(--ink2); }
  .mnav .mf button { font: 13px var(--ui); color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: var(--r); padding: 6px 10px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
  .mnav .mf svg { width: 14px; height: 14px; }
}
.mnav .ic-sun { display: none; } :root[data-theme="dark"] .mnav .ic-sun { display: block; } :root[data-theme="dark"] .mnav .ic-moon { display: none; }

/* home: headline, intro, stats, search, a few pages with their photos, then the three columns */
body.pt main .hm h1 { margin-top: 40px; }
@media (max-width: 700px) { body.pt main .hm h1 { margin-top: 24px; } }
.hm-stats { margin-top: 10px; font-size: 13.5px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.hm .cards-h { display: flex; justify-content: space-between; align-items: baseline; margin-top: 44px; font-size: 13px; color: var(--ink2); }
.hm .cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-top: 12px; }
.hm .card > a { display: flex; flex-direction: column; color: var(--ink); }
.hm .card > a:hover { text-decoration: none; } .hm .card > a:hover .t { color: var(--link-h); }
.hm .card .im { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: var(--r-l, 6px); background: var(--bg2); }
.hm .card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm .card .k { font-size: 12px; color: var(--ink3); margin-top: 9px; }
.hm .card .t { font-size: 16.5px; font-weight: 650; margin-top: 1px; color: var(--ink); line-height: 1.3; }
.hm .card .l { font-size: 13.5px; color: var(--ink2); margin-top: 3px; line-height: 1.45; }
.hm .card .cr { font-size: 11px; line-height: 1.4; color: var(--ink3); margin-top: 5px; }
.hm .card .cr a { color: var(--ink3); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
.hm .hm-cols { margin-top: 52px; }
.hm-c h2 { margin-top: 0 !important; }
@media (max-width: 860px) { .hm .cards { grid-template-columns: 1fr 1fr; gap: 18px 14px; } }

/* explore: tabs, a filter, the lists */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--rule); margin-top: 26px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: block; padding: 10px 0 9px; font-size: 14px; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.xtool { display: flex; gap: 12px; align-items: center; margin: 22px 0 0; flex-wrap: wrap; }
.xtool input { width: 420px; max-width: 100%; height: 38px; border: 1px solid var(--field-rule); border-radius: var(--r); padding: 0 12px; font: 14px var(--ui); background: var(--field); color: var(--ink); }
.xtool .stat { font-size: 13px; color: var(--ink3); }
.xl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.xl section h2, .xl1 h2 { display: flex; align-items: baseline; gap: 6px; margin-top: 38px !important; }
.xl h2 .more { margin-left: auto; font-weight: 400; font-size: 13px; }
.xl ul, .xl1 ul, .xg { list-style: none; margin: 0; padding: 0; }
.xl li, .xl1 li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule2); font-size: 14px; }
.xl li span, .xl1 li span { color: var(--ink3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.xl1 ul { columns: 2; column-gap: 48px; } .xl1 li { break-inside: avoid; }
.xr { grid-template-columns: 1fr; } .xr ul { columns: 2; column-gap: 48px; } .xr li { break-inside: avoid; }
.xg { margin-top: 18px; max-width: 760px; } .xg li { padding: 12px 0; border-bottom: 1px solid var(--rule2); } .xg li a { font-weight: 600; font-size: 15px; } .xg li span { display: block; color: var(--ink2); font-size: 13.5px; margin-top: 2px; }
@media (max-width: 860px) { .xl { grid-template-columns: 1fr; } .tabs { gap: 20px; } .xl1 ul, .xr ul { columns: 1; } }

/* datasets: release strip, ways to download, tables, files */
.rel { display: flex; flex-wrap: wrap; margin-top: 24px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.rel > div { padding: 10px 26px 10px 0; margin-right: 26px; border-right: 1px solid var(--rule2); }
.rel > div:last-child { border-right: 0; margin-right: 0; }
.rel b { display: block; font-size: 12px; font-weight: 500; color: var(--ink3); }
.rel span { font-size: 15px; color: var(--ink); }
.dd-link { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin-top: 14px; font-size: 14px; } .dd-link .note { margin: 0; }
.ways { width: 100%; } .ways td:first-child { width: 34%; } .ways .f { font-weight: 600; } .ways .f code { font-weight: 500; }
.ways .tid { display: block; font-family: var(--ui); font-size: 12.5px; }
td .dl { white-space: nowrap; }
.dsg tr.g td { padding-top: 22px !important; font-weight: 600; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--rule) !important; }
.dsg tr.g .n { font-weight: 400; color: var(--ink3); }
.dsg td.d { color: var(--ink2); max-width: 560px; }
.ways td:last-child, .dsg td:last-child, .docs td:last-child { white-space: nowrap; }
@media (max-width: 700px) {
  .rel { display: grid; grid-template-columns: 1fr 1fr; } .rel > div { padding: 8px 10px 8px 0; margin-right: 0; border-right: 0; }
  .ways td:first-child { width: auto; }
  table.ph thead { display: none; }
  table.ph, table.ph tbody { display: block; width: 100%; }
  table.ph tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--rule2); }
  table.ph td { display: block; border: 0 !important; padding: 0 !important; text-align: left; }
  table.ph td.hm { display: none; }
  table.ph tr.g { display: block; border-bottom: 1px solid var(--rule); padding: 16px 0 6px; }
  table.dsg td:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
  table.dsg td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; font-size: 12px; color: var(--ink3); }
  table.dsg td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  table.ways td:nth-child(1), table.docs td:nth-child(1) { grid-column: 1; grid-row: 1; }
  table.ways td:nth-child(2), table.docs td:nth-child(2) { display: block !important; grid-column: 1 / span 2; grid-row: 2; font-size: 13px; color: var(--ink2); margin-top: 3px; }
  table.ways td:nth-child(3), table.docs td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; color: var(--ink2); }
  table.ways td:nth-child(4), table.docs td:nth-child(4) { display: none; }
  .xtool input { flex: 1; width: auto; }
}

/* docs landing: the reference as a plain list */
.dl2 { grid-template-columns: 210px minmax(0, 1fr); }
.dk h2 { margin-top: 34px; } .dk > p { max-width: 70ch; margin-top: 10px; } .dk .code { margin-top: 10px; } .dk .btn { margin-top: 4px; }
.dk-l { list-style: none; margin: 10px 0 0; padding: 0 !important; max-width: 760px; }
.dk .code { white-space: pre-wrap; word-break: break-all; padding-right: 70px; }
.dk-l li { margin: 0 !important; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule2); font-size: 14px; }
.dk-l li span { color: var(--ink2); }
@media (max-width: 860px) { .dl2 { grid-template-columns: 1fr; } .dl2 .dn { display: none; } .dk-l li { grid-template-columns: 1fr; gap: 2px; } }

/* datasets: table groups fold (Decisions and votes open); typing in the filter shows every group */
.dsg button.gt { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; font: inherit; color: inherit; }
.dsg button.gt::before { content: "▾"; font-size: 11px; color: var(--ink3); width: 10px; }
.dsg tbody.fold button.gt::before { content: "▸"; }
.dsg button.gt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dsg:not(.filtering) tbody.fold tr:not(.g) { display: none !important; }

/* People: on a phone, name and years on the left, votes on the right */
@media (max-width: 700px) {
  table.sup.ph td:nth-child(n+4) { display: none !important; }
  table.sup.ph td:nth-child(1) { grid-column: 1; grid-row: 1; }
  table.sup.ph td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; color: var(--ink3); }
  table.sup.ph td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; font-size: 13px; }
  table.sup.ph td:nth-child(3)::after { content: " votes"; color: var(--ink3); }
}
/* dataset pages: the column list's labelled cells, and a preview that reads in rows (22/10) */
.coltab td:nth-child(3), .coltab td:nth-child(4), .coltab td:nth-child(5) { font-size: 12.5px; min-width: 64px; max-width: 150px; }
.cvals { margin-top: 4px; font-size: 12.5px; color: var(--ink2); } .cvals .cl { color: var(--ink3); margin-right: 4px; }
table.pv td, table.pv th { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
table.pv td.sum { white-space: normal; min-width: 280px; max-width: 520px; }
table.pv .sid { font-family: var(--mono); font-size: 12px; }
.coltab td:last-child { min-width: 240px; overflow-wrap: anywhere; } .coltab td:last-child code { white-space: normal; overflow-wrap: anywhere; }
.coltab .cmeta { display: none; }
@media (max-width: 760px) { .coltab th:nth-child(n+3):nth-child(-n+5), .coltab td:nth-child(n+3):nth-child(-n+5) { display: none; } .coltab .cmeta { display: block; } .coltab td:last-child { min-width: 200px; } }

/* every place with a page (place/all/, 22/10) */
ul.cols { columns: 15rem; column-gap: 28px; padding-left: 0; list-style: none; }
ul.cols li { break-inside: avoid; padding: 2px 0; }

/* dataset page (mockup 1, 22/10): the About table in plain words; the technical fields folded under it */
.kv.about { font-size: 15px; } .kv.about dd { line-height: 1.5; }
details.techd { margin: 18px 0 8px; }
details.techd > summary { cursor: pointer; font-weight: 600; font-size: 14.5px; padding: 4px 0; }
details.techd[open] > summary { margin-bottom: 10px; }
/* datasets index (mockup 3): Start here first; all tables after the downloads, folded and quieter */
.alltables h2 .n { font-size: 13px; font-weight: 400; color: var(--ink3); }
.alltables .dsg td { font-size: 13.5px; } .alltables .dsg td a { font-weight: 400; }
@media (max-width: 700px) {
  table.start.ph td.d.hm { display: block !important; grid-column: 1 / span 2; grid-row: 3; font-size: 13px; color: var(--ink2); margin-top: 4px; }
  .kv.about { grid-template-columns: 1fr; } .kv.about dt { padding-bottom: 0; border-bottom: 0; font-weight: 500; } .kv.about dd { padding-top: 2px; }
}

/* dataset tabs (22/10, pages too long): one panel at a time; the side blocks that fold */
.tabp > h2:first-child { margin-top: 24px; }
.tabp[hidden] { display: none !important; }
details.sidefold > summary { cursor: pointer; font-size: 19px; font-weight: 600; color: var(--ink); margin: 34px 0 10px; letter-spacing: -.01em; }
details.sidefold:not([open]) > summary { margin-bottom: 0; }
@media (max-width: 960px) {
  .lay > .side { border-top: 1px solid var(--rule); margin-top: 28px; }
  .side h2 { font-size: 16px; margin: 22px 0 8px; }
  details.sidefold > summary { font-size: 16px; margin: 18px 0 6px; }
}
details.docfold { margin: 34px 0 0; border-top: 1px solid var(--rule); }
details.docfold > summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 10px 0; }
details.docfold > summary .n { font-weight: 400; color: var(--ink3); font-size: 13px; margin-left: 6px; }
