:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #63706a;
  --paper: #f4f1e9;
  --panel: #fffdf7;
  --line: #d9d5ca;
  --green: #0c684b;
  --red: #a6382f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 48px 0 80px; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-family: Georgia, serif; font-size: clamp(3rem, 8vw, 6.5rem); font-weight: 500; letter-spacing: -0.06em; line-height: .85; }
h2 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(1.7rem, 4vw, 2.7rem); font-weight: 500; letter-spacing: -.035em; }
.eyebrow { margin-bottom: 13px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.intro, .explanation { max-width: 730px; color: var(--muted); line-height: 1.55; }
.api-link, button { border: 1px solid var(--ink); background: var(--ink); color: white; padding: 11px 16px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.header-links { display: flex; gap: 8px; }
.secondary-link { background: transparent; color: var(--ink); }
.filters { display: flex; align-items: end; gap: 18px; margin: 42px 0 58px; padding: 22px; border: 1px solid var(--line); background: rgba(255,255,255,.45); }
.filters label { display: grid; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 650; }
input { width: 150px; border: 1px solid var(--line); background: var(--panel); padding: 10px; color: var(--ink); font: inherit; }
section { margin-top: 58px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.section-heading > span { color: var(--muted); font-size: .86rem; }
.table-wrap { overflow-x: auto; border-top: 2px solid var(--ink); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 14px 13px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
td { font-variant-numeric: tabular-nums; }
td small { display: block; max-width: 250px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.type { display: inline-block; margin-right: 6px; padding: 3px 5px; background: #e3e7de; color: var(--green); font-size: .68rem; font-weight: 800; }
.below { color: var(--red); font-weight: 750; }
.above { color: var(--green); font-weight: 750; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 13px; }
article { border: 1px solid var(--line); background: var(--panel); padding: 18px; }
.party-row, article li, .sources li { display: flex; justify-content: space-between; gap: 14px; }
.party-row { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.party-row strong { font-size: 1.35rem; }
.party-row span { color: var(--muted); font-size: .8rem; }
article ol { margin: 14px 0 0; padding-left: 22px; }
article li { padding: 7px 0; }
article code { color: var(--green); font-weight: 700; }
.sources ul { margin: 0; padding: 0; border-top: 2px solid var(--ink); list-style: none; }
.sources li { padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--muted); }
.sources em { margin-left: 6px; color: var(--red); font-size: .68rem; font-style: normal; font-weight: 800; }
.empty { border: 1px solid var(--line); background: var(--panel); padding: 30px; }
.empty code { display: block; overflow-x: auto; padding: 14px; background: #e8e5dc; }
.muted { color: var(--muted); }
.data-note { margin-top: 12px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.page-title { max-width: 900px; font-size: clamp(3rem, 7vw, 5.8rem); }
.registry-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 42px; border: 1px solid var(--line); background: var(--panel); }
.registry-summary div { display: grid; gap: 4px; padding: 20px; border-right: 1px solid var(--line); }
.registry-summary div:last-child { border-right: 0; }
.registry-summary strong { font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.registry-summary span { color: var(--muted); font-size: .78rem; }
.party-search { margin-top: 22px; padding: 20px; background: #e7e3d9; }
.party-search label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.party-search div { display: flex; align-items: center; gap: 8px; }
.party-search input { width: min(520px, 100%); }
.party-search a { margin-left: 4px; color: var(--ink); }
.party-registry { margin-top: 52px; }
.registry-cards { display: grid; gap: 12px; }
.registry-card { padding: 0; }
.registry-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 20px; }
.registry-card h3 { margin: 6px 0 2px; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; }
.registry-card-heading p { margin: 0; color: var(--green); font-weight: 800; }
.party-code { color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.area-counts { display: flex; gap: 22px; color: var(--muted); font-size: .76rem; text-align: right; }
.area-counts span { display: grid; }
.area-counts strong { color: var(--ink); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.registry-card details { border-top: 1px solid var(--line); }
.registry-card summary { padding: 13px 20px; color: var(--green); font-weight: 750; cursor: pointer; }
.area-list { columns: 3 220px; margin: 0; padding: 4px 20px 20px; list-style: none; }
.area-list li { break-inside: avoid; padding: 4px 0; color: var(--muted); font-size: .83rem; }
.area-list code { display: inline-block; min-width: 42px; color: var(--ink); font-size: .73rem; }
.registry-card details > .muted { padding: 0 20px 14px; }
.area-map-layout { display: grid; grid-template-columns: minmax(210px, 300px) 1fr; gap: 28px; padding: 6px 20px 22px; }
.area-map-panel { position: relative; display: grid; align-content: start; justify-items: center; gap: 8px; }
.area-map-host { display: grid; width: min(100%, 260px); height: 460px; place-items: center; }
.area-map-host svg { display: block; width: 100%; height: 100%; }
.map-loading { color: var(--muted); font-size: .75rem; text-align: center; }
.area-map-panel a { color: var(--green); font-size: .78rem; font-weight: 750; }
.map-tooltip {
  position: absolute;
  z-index: 2;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: var(--ink);
  color: white;
  box-shadow: 0 3px 12px rgba(23, 34, 29, .22);
  font-size: .75rem;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}
.area-map-layout .area-list { columns: 2 180px; padding: 8px 0 0; }
.registry-source { margin-top: 30px; }

@media (max-width: 720px) {
  main { width: min(100% - 24px, 1180px); padding-top: 28px; }
  header, .filters { align-items: stretch; flex-direction: column; }
  .header-links { align-items: stretch; flex-direction: column; }
  .api-link { align-self: flex-start; }
  .filters input { width: 100%; }
  .sources li { flex-direction: column; }
  .registry-summary { grid-template-columns: 1fr; }
  .registry-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .registry-summary div:last-child { border-bottom: 0; }
  .registry-card-heading { flex-direction: column; }
  .area-counts { text-align: left; }
  .area-map-layout { grid-template-columns: 1fr; }
  .area-map-host { height: min(460px, 120vw); }
}
