/* Palette: #ff9900 orange, #00cc99 teal, #597931 olive, #003300 forest
   Type: Sora (headings, names) + Figtree (everything else) */
:root {
  --orange: #ff9900;
  --teal: #00cc99;
  --olive: #597931;
  --forest: #003300;

  --bg: #f5f2e8;
  --surface: #fffdf7;
  --text: #102010;
  --muted: #5f6b55;
  --line: #e2dccb;
  --branch: #b8c59f;
  --dot: #ddd6c2;
  --shadow: 0 1px 2px rgba(0, 51, 0, 0.06), 0 12px 32px -16px rgba(0, 51, 0, 0.25);

  --c-federal: #ff9900;
  --c-state: #597931;
  --c-local: #003300;
  --c-lawmaker: #00cc99;
  --ink-federal: #a35f00;
  --ink-state: #4a6628;
  --ink-local: #003300;
  --ink-lawmaker: #00785a;

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071307;
    --surface: #0d1d0c;
    --text: #f1eedf;
    --muted: #a9b39b;
    --line: #213520;
    --branch: #3a5530;
    --dot: #1a2d18;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -18px rgba(0, 0, 0, 0.8);
    --c-local: #b9e07a;
    --ink-federal: #ffb84d;
    --ink-state: #a9c97a;
    --ink-local: #cdeb9b;
    --ink-lawmaker: #4fe3b8;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; font-family: var(--font-body); font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  background: var(--bg); color: var(--text); line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; margin: 0; }
em { font-family: var(--font-display); font-style: normal; font-weight: 400; }
button { font-family: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--forest) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.place-pill {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  padding: 7px 8px 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06); color: #f1eedf; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  animation: rise 0.4s var(--ease) both;
}
.place-pill[hidden] { display: none; }
.place-pill #place-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-pill svg { color: var(--orange); flex: none; }
.place-change { background: var(--orange); color: var(--forest); padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; flex: none; }
@media (max-width: 480px) { .brand span { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 15; background: var(--forest); color: #f1eedf; padding: clamp(48px, 9vw, 104px) 0 clamp(56px, 9vw, 96px); }
.hero-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-bg::before {
  content: ""; position: absolute; right: -15%; bottom: -70%; width: 75%; height: 160%;
  background: radial-gradient(closest-side, rgba(0, 204, 153, 0.2), transparent);
}
.hero-branches { position: absolute; right: 0; top: 0; height: 100%; width: 58%; opacity: 0.5; }
.hero-branches path { stroke: #2f6b3a; stroke-width: 2.5; stroke-dasharray: 900; stroke-dashoffset: 900; animation: draw 2.4s var(--ease) 0.2s forwards; }
.hero-branches .dots circle { fill: #00cc99; animation: rise 0.8s var(--ease) both; animation-delay: 1s; }
.hero-branches .dots circle:nth-child(3n) { fill: #ff9900; }
.hero-inner { position: relative; }
.hero h1 { font-size: clamp(2.6rem, 1.6rem + 5vw, 5.25rem); }
.hero h1 em { color: var(--orange); display: block; }
.lede { max-width: 44ch; color: #b9c9aa; font-size: clamp(1.05rem, 1rem + 0.35vw, 1.25rem); margin: 20px 0 32px; }

/* Search */
.search { position: relative; max-width: 560px; }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 60px; padding: 0 20px 0 52px; border: 0; border-radius: 999px;
  font: inherit; font-size: 1.05rem; font-weight: 500; color: #102010; background: #fffdf7;
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0), 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.25s var(--ease);
}
.search input::placeholder { color: #7b8571; }
.search input:focus { outline: none; box-shadow: 0 0 0 4px var(--orange), 0 18px 40px -18px rgba(0, 0, 0, 0.6); }
.search-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30; margin: 0; padding: 6px;
  list-style: none; max-height: 320px; overflow-y: auto;
  background: #fffdf7; color: #102010; border-radius: 22px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  animation: rise 0.2s var(--ease) both;
}
.search-list { max-height: min(420px, 60vh); }
.search-list li.group { padding: 12px 14px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #6b7561; cursor: default; display: block; }
.search-list li.group-note { padding: 0 14px 8px; font-size: 0.85rem; color: #6b7561; cursor: default; display: block; }
.search-list li.group:hover, .search-list li.group-note:hover { background: none; }
.search-list li.back { color: #00785a; font-weight: 600; }
.search-list li.person span { font-family: var(--font-display); font-weight: 700; }
.search-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; cursor: pointer; }
.search-list li small { color: #6b7561; font-size: 0.85rem; }
.search-list li[aria-selected="true"], .search-list li:hover { background: #f1ecdc; }
.search-list li.disabled { cursor: default; opacity: 0.55; background: none; }
.search-list li.empty { cursor: default; color: #6b7561; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; color: #8fa98a; font-size: 0.9rem; }
.quick button {
  border: 1px solid rgba(255, 255, 255, 0.18); background: transparent; color: #f1eedf;
  padding: 5px 13px; border-radius: 999px; font-size: 0.9rem; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.quick button:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--orange); }

/* ---------- Sections ---------- */
.section { padding-top: clamp(48px, 7vw, 88px); }
.eyebrow { margin: 0 0 10px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-state); }
.section h2 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); }
.section h2 em { color: var(--ink-federal); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }

.toggle { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.toggle button { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: background 0.25s var(--ease), color 0.25s; }
.toggle button.is-active { background: var(--forest); color: #fff; }

.jump {
  position: sticky; top: 60px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 20px -8px 16px; padding: 10px 8px; background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.jump a {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 600;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.jump a:hover { border-color: var(--branch); transform: translateY(-1px); }
.jump-key { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; font-size: 0.85rem; color: var(--muted); }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.sw.federal { background: var(--c-federal); } .sw.state { background: var(--c-state); }
.sw.local { background: var(--c-local); } .sw.lawmaker { background: var(--c-lawmaker); }

/* ---------- Tree canvas ---------- */
.canvas {
  background-color: var(--surface);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow);
  padding: 40px 8px 48px; overflow-x: auto;
}
.canvas--soft { margin-top: 28px; }
.tap-hint { color: var(--muted); font-size: 0.875rem; text-align: center; }

.tier { display: flex; flex-direction: column; align-items: center; min-width: max-content; margin: 0 auto; scroll-margin-top: 130px; }
.stem { width: 2px; height: 28px; background: var(--branch); transform-origin: top; }
.stem.long { height: 44px; }

.tier-chip {
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.01em;
  padding: 8px 18px; border-radius: 999px; color: #fff; background: var(--chip);
  box-shadow: 0 8px 20px -10px var(--chip);
}
.tier.federal { --chip: #e08600; }
.tier.state { --chip: var(--olive); }
.tier.local { --chip: #003300; }
@media (prefers-color-scheme: dark) { .tier.local { --chip: #2d5a1e; } }

.branch-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-lawmaker); background: var(--surface); border: 1.5px solid var(--c-lawmaker);
  padding: 4px 12px; border-radius: 999px;
}

/* Executive pair */
.pair { display: flex; align-items: stretch; }
.pair-link { position: relative; width: 44px; }
.pair-link::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--branch); }
.pair-link::after { content: ""; position: absolute; left: 0; right: 0; top: 47px; height: 2px; background: var(--branch); }
.pair-link i {
  position: absolute; left: 50%; top: 48px; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--chip); border: 2.5px solid var(--surface); z-index: 1;
}

/* Children bracket */
.branches { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; }
.branches > li { position: relative; padding: 24px 12px 0; display: flex; justify-content: center; }
.branches > li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--branch); }
.branches > li::after { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 24px; margin-left: -1px; background: var(--branch); }
.branches > li:first-child::before { left: 50%; }
.branches > li:last-child::before { right: 50%; }
.branches > li:only-child::before { display: none; }
.split-note { max-width: 320px; text-align: center; font-size: 0.82rem; color: var(--muted); margin: 12px 0 0; }

/* Person node */
.node {
  --ring: var(--c-federal); --ink: var(--ink-federal);
  display: flex; flex-direction: column; align-items: center; width: 132px;
  color: inherit; text-align: center; background: none; border: 0; padding: 0; cursor: pointer;
}
.node.state { --ring: var(--c-state); --ink: var(--ink-state); }
.node.local { --ring: var(--c-local); --ink: var(--ink-local); }
.node.lawmaker { --ring: var(--c-lawmaker); --ink: var(--ink-lawmaker); }
.avatar {
  position: relative; width: 96px; height: 96px; border-radius: 50%; padding: 4px; flex: none;
  border: 3px solid var(--ring); background: var(--surface);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.avatar > span, .avatar > img {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; object-fit: cover; object-position: 50% 22%;
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--ink);
  background: color-mix(in srgb, var(--ring) 16%, var(--surface));
}
.node:hover .avatar, .node:focus-visible .avatar { transform: translateY(-4px) scale(1.03); box-shadow: 0 14px 28px -12px var(--ring); }
.node:focus-visible { outline: none; }
.node:focus-visible .avatar { outline: 3px solid var(--orange); outline-offset: 3px; }
.node-name, .node-role { overflow-wrap: break-word; max-width: 100%; }
.node-name { margin-top: 12px; font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; line-height: 1.2; }
.node-name.long { font-size: 0.86rem; letter-spacing: -0.01em; }
.node-role { margin-top: 4px; font-size: 0.76rem; color: var(--ink); font-weight: 600; line-height: 1.3; }
.node-years { font-size: 0.74rem; color: var(--muted); }
.node.missing .avatar { border-style: dashed; }
.node.missing .avatar > span { background: transparent; color: var(--muted); font-weight: 400; }
.node.missing .node-name { color: var(--muted); font-weight: 400; font-style: italic; }
.node.ghost { opacity: 0.5; }

@media (max-width: 440px) {
  .node { width: 100px; }
  .avatar { width: 74px; height: 74px; }
  .avatar > span, .avatar > img { font-size: 1.2rem; }
  .pair-link::after { top: 36px; } .pair-link i { top: 37px; }
  .pair-link { width: 30px; }
  .branches > li { padding-left: 3px; padding-right: 3px; }
  .canvas { padding-left: 4px; padding-right: 4px; border-radius: 26px; }
  .node-name { font-size: 0.9rem; }
  .node-name.long { font-size: 0.8rem; }
}

/* Growing animation: stems draw down, nodes rise in, staggered by --d */
.canvas .tier > * { animation: rise 0.55s var(--ease) both; animation-delay: calc(var(--d, 0) * 45ms); }
.canvas .stem { animation-name: drawY; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes drawY { from { transform: scaleY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-branches path { stroke-dashoffset: 0; }
}

/* ---------- List mode ---------- */
.list { max-width: 640px; margin: 0 auto; padding: 0 12px; }
.list-tier { position: relative; min-width: 0; padding: 0 0 8px 34px; scroll-margin-top: 130px; }
.list-tier::before { content: ""; position: absolute; left: 11px; top: 32px; bottom: -8px; width: 2px; background: var(--branch); }
.list-tier:last-child::before { display: none; }
.list-tier .tier-chip { position: relative; left: -34px; display: inline-block; margin-bottom: 14px; }
.row {
  display: flex; flex-direction: row; align-items: center; gap: 14px; width: 100%; margin-bottom: 10px; padding: 10px 14px;
  color: inherit; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.row:hover { border-color: var(--branch); transform: translateX(3px); }
.row .avatar { width: 56px; height: 56px; padding: 3px; border-width: 2.5px; }
.row .avatar > span { font-size: 1rem; }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row .node-name { margin: 0; font-size: 1.05rem; }
.row .node-role { margin: 0; }
.row:hover .avatar { transform: none; box-shadow: none; }

/* ---------- Explore ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 1.6rem + 1.2vw, 2.5rem); line-height: 1; color: var(--ink); }
.stat span { display: block; margin-top: 6px; font-size: 0.9rem; color: var(--muted); }
.stat.federal { --ink: var(--ink-federal); } .stat.state { --ink: var(--ink-state); }
.stat.local { --ink: var(--ink-local); } .stat.lawmaker { --ink: var(--ink-lawmaker); }

.states-title { font-size: 1.4rem; margin: 44px 0 14px; }
.states { display: flex; flex-wrap: wrap; gap: 8px; }
.state-chip { font-size: 0.9rem; padding: 7px 14px; border-radius: 999px; border: 1px dashed var(--line); background: transparent; color: var(--muted); }
.state-chip.ready { cursor: pointer; border: 0; background: var(--forest); color: #fff; font-weight: 600; }
.state-chip.ready::after { content: " \2192"; color: var(--orange); }

/* ---------- Footer & sheet ---------- */
.footer { margin-top: 88px; padding: 30px 0 26px; background: var(--forest); color: #b9c9aa; font-size: 0.9rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px 32px; flex-wrap: wrap; }
.footer-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font: 700 1rem var(--font-display); }
.footer-about p { margin: 6px 0 0; }
.footer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-links a { color: #f1eedf; text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16); transition: border-color 0.2s, color 0.2s; }
.footer-links a:hover { border-color: var(--orange); color: var(--orange); }
.footer-base { margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; }
.made-by { margin: 0; font-size: 0.84rem; color: #b9c9aa; }
.made-by b { color: #f1eedf; font-weight: 600; }
.notice { color: #ffd08a; margin: 0; font-size: 0.84rem; }
/* photo credits panel */
.credits-panel h3 { font-size: 1.5rem; margin-bottom: 6px; }
.credits-search { width: 100%; font: 400 1rem var(--font-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.credit-group { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.credit-group summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.credit-group summary::-webkit-details-marker { display: none; }
.credit-group summary::after { content: "\203A"; margin-left: 4px; transition: transform 0.2s; color: var(--muted); }
.credit-group[open] summary::after { transform: rotate(90deg); }
.credit-group summary small { margin-left: auto; color: var(--muted); font-weight: 500; white-space: nowrap; }
.credit-group ul { list-style: none; margin: 0; padding: 4px 14px 12px; max-height: 320px; overflow-y: auto; font-size: 0.86rem; }
.credit-group li { display: flex; flex-direction: column; padding: 6px 0; border-top: 1px solid var(--line); }
.credit-group li:first-child { border-top: 0; }
.credit-group li a { color: var(--text); font-weight: 600; }
.credit-group li span { color: var(--muted); }
@media (max-width: 600px) { .footer-links { width: 100%; } .footer-links a { flex: 1; text-align: center; } }

.sheet {
  width: min(460px, calc(100vw - 24px)); border: 0; border-radius: 30px; padding: 32px 24px 24px;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.sheet[open] { animation: pop 0.35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.sheet::backdrop { background: rgba(0, 25, 0, 0.55); backdrop-filter: blur(4px); }
.sheet-close { position: absolute; right: 16px; top: 12px; font-size: 1.8rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; }
.sheet .node { width: 100%; cursor: default; }
.sheet .node:disabled { opacity: 1; color: inherit; }
.sheet .node:hover .avatar { transform: none; box-shadow: none; }
.sheet .avatar { width: 132px; height: 132px; }
.sheet .avatar > span { font-size: 2.2rem; }
.sheet .node-name { font-size: 1.55rem; }
.sheet .node-role { font-size: 0.92rem; }
.sheet h4 { margin: 22px 0 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sheet p { margin: 0; }
.sheet .credit { margin-top: 18px; font-size: 0.75rem; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.fact { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c-lawmaker) 18%, var(--surface)); color: var(--ink-lawmaker); }
.fact.warn { background: color-mix(in srgb, var(--orange) 20%, var(--surface)); color: var(--ink-federal); }
.sheet a { color: var(--ink-lawmaker); font-weight: 600; }

/* Leader profile extras */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumb { font-size: 0.82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.crumb:last-child { background: var(--forest); color: #fff; border-color: var(--forest); }
.crumb-sep { color: var(--muted); }
.lga-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; }
.lga-chip { font-size: 0.85rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; border: 1.5px solid var(--c-lawmaker); background: transparent; color: var(--ink-lawmaker); transition: background 0.2s; }
.lga-chip:hover { background: color-mix(in srgb, var(--c-lawmaker) 15%, transparent); }
.chip-hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px !important; }

/* ---------- State view ---------- */
.state-link { margin-top: 14px; border: 0; background: none; padding: 0; color: var(--ink-lawmaker); font-weight: 700; font-size: 0.95rem; cursor: pointer; }
.state-link:hover { text-decoration: underline; }
.lga-filter { max-width: 980px; margin: -12px auto 28px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); }
.lga-filter summary { cursor: pointer; font-weight: 700; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.filter-chip { font-size: 0.85rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: background 0.2s, color 0.2s; }
.filter-chip.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.filter-clear { margin-top: 10px; border: 0; background: none; color: var(--ink-federal); font-weight: 700; cursor: pointer; padding: 0; }
.state-tree { min-width: 0; }
.districts { align-items: flex-start; }
.districts > li { flex: 1 1 0; min-width: 0; max-width: 360px; }
.district { display: flex; flex-direction: column; align-items: center; width: 100%; }
.cons-list { position: relative; width: 100%; margin-top: 18px; padding-left: 16px; display: grid; gap: 10px; }
.cons-list::before { content: ""; position: absolute; left: 4px; top: -18px; bottom: 18px; width: 2px; background: var(--branch); }
.cons { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 8px 10px 10px; }
.cons::before { content: ""; position: absolute; left: -12px; top: 30px; width: 12px; height: 2px; background: var(--branch); }
.cons .row { margin: 0; padding: 4px; background: none; border: 0; }
.cons .row:hover { transform: none; }
.cons .row .avatar { width: 44px; height: 44px; }
.cons .row .node-name { font-size: 0.95rem; }
.cons-lgas { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.cons-lgas .lga-chip { font-size: 0.78rem; padding: 3px 10px; }
.lga-chip.dim { opacity: 0.35; }
@media (max-width: 760px) {
  .districts { flex-direction: column; align-items: stretch; }
  .districts > li { max-width: none; padding: 0 0 26px; }
  .districts > li::before { display: none; }
  .districts > li::after { height: 24px; }
  .district { background: var(--surface); position: relative; padding-top: 4px; }
}

/* Visual state tree with zoom */
.zoom-frame { position: relative; }
.zoom-bar { position: sticky; left: 0; display: flex; align-items: center; gap: 6px; margin: -8px 8px 16px; flex-wrap: wrap; }
.zoom-bar button { min-width: 38px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; }
.zoom-bar button:hover { border-color: var(--branch); }
.zoom-pct { min-width: 44px; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.zoom-hint { font-size: 0.8rem; color: var(--muted); margin-left: 6px; }
.zoom-hint-short { display: none; font-size: 0.78rem; color: var(--muted); margin-left: 4px; }
.zoom-viewport { overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
.zoom-sizer { position: relative; margin: 0 auto; }
.zoom-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; width: max-content; }
.zoom-inner .tier { padding: 0 12px; }
.subtree { display: flex; flex-direction: column; align-items: center; }
.lga-stack { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 14px; padding-left: 14px; }
.lga-stack::before { content: ""; position: absolute; left: 4px; top: -14px; bottom: 12px; width: 2px; background: var(--branch); }
.mini-node { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 8px; border-radius: 999px; border: 1.5px solid var(--c-local); background: var(--surface); color: var(--ink-local); font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform 0.2s var(--ease); }
.mini-node::before { content: ""; position: absolute; left: -11px; top: 50%; width: 10px; height: 2px; background: var(--branch); }
.mini-node i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-local); }
.mini-node:hover { transform: translateX(2px); }
.mini-node.dim { opacity: 0.35; }
.zoom-inner .node { width: 120px; }
.zoom-inner .branches > li { padding-left: 8px; padding-right: 8px; }

/* ---------- Navigation: search in the top bar, breadcrumbs, in-place layout ---------- */
.topbar-search { flex: 1; display: flex; justify-content: flex-end; min-width: 0; }
.topbar-search .search { width: 100%; max-width: 440px; }
.topbar-search .search input { height: 42px; font-size: 0.95rem; padding-left: 44px; box-shadow: none; background: rgba(255, 255, 255, 0.95); }
.topbar-search .search input:focus { box-shadow: 0 0 0 3px var(--orange); }
.topbar-search .search-icon { left: 16px; width: 18px; }
.topbar-search .search-list { left: auto; right: 0; width: min(460px, calc(100vw - 24px)); }
@media (max-width: 480px) { .topbar-search .search { max-width: none; } }

.crumbbar { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.crumbbar-inner { display: flex; align-items: center; gap: 6px; height: 42px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.crumbbar-inner::-webkit-scrollbar { display: none; }
.crumbbar-item { flex: none; border: 0; background: none; color: #b9c9aa; font-size: 0.9rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
button.crumbbar-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.crumbbar-item.is-here { color: var(--forest); background: var(--orange); cursor: default; }
.crumbbar-sep { flex: none; color: #6f8a66; }

.in-place .hero, .in-place #explore { display: none; }
.in-place #your-tree { padding-top: clamp(24px, 4vw, 40px); }
.in-place .jump { top: 102px; }
html:has(body.in-place) { scroll-padding-top: 150px; }
.in-place main { min-height: 80vh; }

.tier-chip.is-link { border: 0; cursor: pointer; font-family: var(--font-body); transition: transform 0.2s var(--ease), filter 0.2s; }
.tier-chip.is-link::after { content: " \2197"; opacity: 0.75; }
.tier-chip.is-link:hover { transform: translateY(-2px); filter: brightness(1.08); }

.lga-switch { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; }
.lga-switch button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.lga-switch button:hover { border-color: var(--branch); }
.lga-switch select { height: 38px; max-width: 60vw; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; }

[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.search-list li .opt-photo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; margin-right: -4px; }
.search-list li.person { justify-content: flex-start; }
.search-list li.person small { margin-left: auto; text-align: right; }
/* on a phone the role goes on its own line under the name, so neither is squeezed into a narrow column */
@media (max-width: 600px) {
  .search-list li.person { flex-wrap: wrap; row-gap: 2px; }
  .search-list li.person span { flex: 1 1 0; min-width: 0; }
  .search-list li.person small { flex-basis: 100%; margin-left: 0; text-align: left; }
  .search-list li.person .opt-photo ~ small { padding-left: 36px; }
}

/* ---------- State view: jump to an LGA ---------- */
.lga-jump { max-width: 1000px; margin: -16px auto 18px; }
.lga-jump-label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 4px 8px; }
.lga-jump-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 4px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.jump-chip { flex: none; scroll-snap-align: start; font-size: 0.88rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease); }
.jump-chip:hover { border-color: var(--c-local); transform: translateY(-1px); }
.jump-chip.on { background: var(--orange); border-color: var(--orange); color: var(--forest); }

.focus-card { max-width: 1000px; margin: 0 auto 22px; padding: 18px 20px; border-radius: 22px; background: var(--forest); color: #f1eedf; box-shadow: var(--shadow); animation: rise 0.4s var(--ease) both; }
.focus-card h3 { font-size: 1.35rem; margin-bottom: 10px; }
.focus-sub { margin: -4px 0 10px; color: #b9c9aa; }
.focus-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; }
.focus-facts dt { color: #8fa98a; font-size: 0.85rem; font-weight: 600; }
.focus-facts dd { margin: 0; font-family: var(--font-display); font-weight: 700; }
.focus-facts dd.missing { font-family: var(--font-body); font-weight: 400; font-style: italic; color: #8fa98a; }
.focus-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.focus-open { border: 0; border-radius: 999px; padding: 9px 18px; background: var(--orange); color: var(--forest); font-weight: 700; cursor: pointer; }
.focus-clear { border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 9px 16px; background: transparent; color: #f1eedf; font-weight: 600; cursor: pointer; }
.focus-card .jump-chip { background: transparent; color: #f1eedf; border-color: rgba(255,255,255,0.3); }

/* highlighted path, dimmed rest, pulsing target */
.zoom-inner { transition: transform 0.65s var(--ease); }
.zoom-sizer { transition: width 0.65s var(--ease), height 0.65s var(--ease); }
.zoom-frame.instant .zoom-inner, .zoom-frame.instant .zoom-sizer { transition: none; }
.has-focus .node, .has-focus .mini-node { transition: opacity 0.4s var(--ease), filter 0.4s; }
.has-focus .node:not(.on-path), .has-focus .mini-node:not(.on-path) { opacity: 0.22; filter: grayscale(0.6); }
.has-focus .mini-node.on-path { background: var(--orange); border-color: var(--orange); color: var(--forest); }
.has-focus .mini-node.on-path i { background: var(--forest); }
.mini-node.pulse { animation: pulse 1.2s var(--ease) 2; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,153,0,0.7); } 100% { box-shadow: 0 0 0 16px rgba(255,153,0,0); } }
.cons.on-path { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.lga-chip.on-path { background: var(--orange); border-color: var(--orange); color: var(--forest); }
@media (prefers-reduced-motion: reduce) { .zoom-inner, .zoom-sizer { transition: none; } }
.state-view .jump { display: none; }
/* the focus card floats over the tree so it stays in view while the tree glides */
.focus-card { position: fixed; right: 20px; bottom: 20px; z-index: 25; width: min(400px, calc(100vw - 24px)); max-height: 50vh; overflow-y: auto; margin: 0; box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.55); }
@media (max-width: 700px) { .focus-card { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 14px 16px; } .focus-card h3 { font-size: 1.15rem; } }
/* room for the floating focus card, only while it is open on a state tree */
.in-place.state-view.card-open main { padding-bottom: 120px; }

/* ---------- Home: "how the tree works" dropdown ---------- */
body:not(.in-place) #your-tree > :not(.guide) { display: none; }
.in-place .guide { display: none; }
.guide { border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.guide summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; cursor: pointer; }
.guide summary::-webkit-details-marker { display: none; }
.guide-title { font-size: 1.05rem; color: var(--muted); }
.guide-title strong { color: var(--text); font-weight: 700; }
.guide-arrow { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); position: relative; transition: transform 0.35s var(--ease); animation: nudge 2.4s var(--ease) 1.2s 3; }
.guide-arrow::before { content: ""; position: absolute; left: 50%; top: 45%; width: 9px; height: 9px; margin: -6px 0 0 -5px; border-right: 2.5px solid var(--forest); border-bottom: 2.5px solid var(--forest); transform: rotate(45deg); }
.guide[open] .guide-arrow { transform: rotate(180deg); animation: none; }
@keyframes nudge { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(4px); } }
.guide summary:hover .guide-title strong { color: var(--ink-lawmaker); }
.guide-body { padding: 0 22px 24px; animation: rise 0.4s var(--ease) both; }
.guide-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.guide-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--bg); }
.guide-steps b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--forest); color: #fff; font-size: 0.85rem; }
.guide-caption { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }
.guide-canvas { box-shadow: none; padding: 24px 4px 28px; }
.guide-canvas .node { width: 104px; cursor: pointer; }
.guide-canvas .avatar { width: 64px; height: 64px; }
.guide-canvas .avatar > span { font-size: 1.05rem; }
.guide-canvas .pair-link::after { top: 31px; } .guide-canvas .pair-link i { top: 32px; }
.guide-canvas .pair-link { width: 30px; }
.guide-canvas .node-name { font-size: 0.82rem; }
.guide-canvas .stem { height: 18px; } .guide-canvas .stem.long { height: 26px; }
.guide-canvas .tier-chip.is-link { pointer-events: none; }
.guide-canvas .tier-chip.is-link::after { content: none; }
.guide-cta { display: block; margin: 18px auto 0; border: 0; border-radius: 999px; padding: 11px 22px; background: var(--forest); color: #fff; font-weight: 700; cursor: pointer; }

/* ---------- Animated move into an LGA (View Transitions) ---------- */
.topbar { view-transition-name: topbar; }
::view-transition-group(*) { animation-duration: 0.65s; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
::view-transition-old(root) { animation: vt-out 0.3s ease both; }
::view-transition-new(root) { animation: vt-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both; }
@keyframes vt-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes vt-in { from { opacity: 0; transform: scale(0.97); } }
/* fallback for browsers without View Transitions */
.canvas.zoom-in .tier { animation: zoom-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes zoom-in { from { opacity: 0; transform: scale(0.92); } }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; } }

/* ---------- Phone polish ---------- */
@media (max-width: 480px) { body:not(.in-place) .brand span { display: inline; } }
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { height: 56px; }
  .in-place .jump { top: 98px; }
  .hero { padding: 36px 0 40px; }
  .hero h1 { font-size: 2.7rem; line-height: 1.02; }
  .lede { font-size: 1rem; margin: 14px 0 22px; }
  .search input { height: 54px; font-size: 1rem; }
  .quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .quick::-webkit-scrollbar { display: none; }
  .quick button { flex: none; }

  .section { padding-top: 32px; }
  .in-place #your-tree { padding-top: 18px; }
  .eyebrow { font-size: 0.7rem; margin-bottom: 6px; }
  .section h2 { font-size: 1.65rem; line-height: 1.12; }
  .section-head { gap: 10px; align-items: center; }
  .section-head > div:first-child { width: 100%; }
  .lga-switch { margin-top: 12px; }
  .lga-switch select { max-width: none; flex: 1; min-width: 0; }
  .lga-switch { display: flex; }
  .toggle button { padding: 7px 14px; font-size: 0.88rem; }

  /* legend becomes one compact swipeable row */
  .jump { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 4px; margin: 12px -16px 12px; padding: 8px 16px; }
  .jump::-webkit-scrollbar { display: none; }
  .jump a { flex: none; gap: 6px; padding: 5px 9px; font-size: 0.82rem; }
  .jump-key { flex: none; gap: 6px; margin-left: 2px; font-size: 0.8rem; }

  .canvas { border-radius: 22px; padding-top: 28px; padding-bottom: 32px; }
  .tap-hint { font-size: 0.8rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; border-radius: 18px; }
  .stat b { font-size: 1.8rem; }
  .states-title { font-size: 1.2rem; margin-top: 32px; }
  .guide summary { padding: 14px 16px; }
  .guide-title { font-size: 0.95rem; }
  .guide-body { padding: 0 14px 18px; }

  /* state view */
  .lga-jump { margin: -8px -4px 12px; }
  .lga-jump-label { margin-left: 4px; }
  .zoom-bar { margin: -4px 4px 10px; gap: 4px; }
  .zoom-bar button { height: 32px; min-width: 34px; padding: 0 10px; }
  .zoom-hint { display: none; }
  .zoom-hint-short { display: inline; }

  /* compact floating card */
  .focus-card { left: 10px; right: 10px; bottom: 10px; padding: 12px 14px 14px; border-radius: 20px; max-height: 42vh; }
  .focus-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
  .focus-facts { grid-template-columns: max-content 1fr; gap: 3px 12px; margin-bottom: 10px; }
  .focus-facts dt { font-size: 0.72rem; }
  .focus-facts dd { font-size: 0.9rem; }
  .focus-actions { flex-wrap: nowrap; }
  .focus-open { flex: 1; padding: 9px 12px; font-size: 0.85rem; }
  .focus-clear { padding: 9px 12px; font-size: 0.8rem; white-space: nowrap; }

  /* profile sheet */
  .sheet { padding: 26px 18px 18px; border-radius: 26px; }
  .sheet .avatar { width: 112px; height: 112px; }
  .sheet .node-name { font-size: 1.35rem; }
}
.focus-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.1); color: #f1eedf; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.focus-x:hover { background: rgba(255,255,255,0.2); }
.focus-card h3 { padding-right: 40px; }

/* ---------- LGA tree: executive trunk with lawmakers on side branches ---------- */
.tier-flow { width: 100%; }
.tier-body { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; width: 100%; }
.side { max-width: calc(100% - 34px); box-sizing: border-box; }
.trunk-col { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.trunk-col .stem.grow { flex: 1; min-height: 12px; }
.side { position: relative; justify-self: start; margin-left: 34px; padding: 12px 14px 14px; border: 1.5px dashed color-mix(in srgb, var(--c-lawmaker) 55%, transparent); border-radius: 22px; background: color-mix(in srgb, var(--c-lawmaker) 5%, var(--surface)); }
.side::before { content: ""; position: absolute; left: -36px; top: 46px; width: 34px; height: 2px; background: var(--branch); }
.side::after { content: ""; position: absolute; left: -6px; top: 42px; width: 9px; height: 9px; border-radius: 50%; background: var(--c-lawmaker); }
.side .branch-label { display: inline-block; margin-bottom: 10px; }
.side-nodes { display: flex; gap: 10px; flex-wrap: wrap; }
.side .split-note { margin: 8px 0 0; text-align: left; max-width: 280px; }
.guide-canvas .side { margin-left: 22px; padding: 8px 10px 10px; }
.guide-canvas .side::before { left: -24px; width: 22px; top: 32px; }
.guide-canvas .side::after { top: 28px; }

/* Narrow screens: the trunk runs down the far left; portraits hang off it, lawmaker cards branch further right */
@media (max-width: 860px) {
  .tier-flow { align-items: flex-start; position: relative; }
  .tier-flow > .tier-chip { margin-left: 0; }
  .tier-flow > .stem { margin-left: 13px; }
  .tier-flow .tier-body { display: flex; flex-direction: column; position: relative; }
  .tier-flow .tier-body::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--branch); }
  .tier-flow:last-child .tier-body::before { bottom: auto; height: 40px; }
  .tier-flow .tier-spacer, .tier-flow .trunk-col .stem.grow, .tier-flow .pair-link::before { display: none; }
  .tier-flow .trunk-col { align-items: flex-start; padding-left: 28px; }
  .tier-flow .pair { position: relative; }
  .tier-flow .pair::before { content: ""; position: absolute; left: -14px; top: 47px; width: 16px; height: 2px; background: var(--branch); }
  .tier-flow .side { margin: 12px 0 6px 40px; width: calc(100% - 40px); max-width: none; }
  .tier-flow .side::before { left: -28px; width: 26px; top: 26px; }
  .tier-flow .side::after { top: 22px; }
  .tier-flow .side-nodes { gap: 6px; }
}
@media (max-width: 440px) {
  .tier-flow .trunk-col { padding-left: 24px; }
  .tier-flow .pair::before { top: 36px; left: -10px; width: 12px; }
  .tier-flow .side { margin-left: 32px; width: calc(100% - 32px); padding: 10px 8px 10px; }
  .tier-flow .side::before { left: -20px; width: 18px; }
  .tier-flow .side .node { width: 86px; }
  .tier-flow .side .avatar { width: 58px; height: 58px; }
  .tier-flow .side .avatar > span { font-size: 1rem; }
  .tier-flow .side .node-name { font-size: 0.8rem; }
  .tier-flow .side .node-name.long { font-size: 0.72rem; }
}
.tier-flow { min-width: 0; }
.tier-body > * { min-width: 0; }

/* National overview: the three arms of government */
.arms { min-width: 0; width: 100%; }
.arms-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; max-width: 900px; }
.arm { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 8px; }
/* the horizontal bar: each column draws its share, the outer columns only towards the middle */
.arm::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--branch); }
.arm:first-child::before { left: 50%; }
.arm:last-child::before { right: 50%; }
.arm-stem { width: 2px; height: 22px; background: var(--branch); }
.arm-head {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  padding: 7px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--arm, var(--branch));
}
.arm-head b { font-family: var(--font-body); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--arm-ink, var(--ink)); }
.arm-head span { font-size: 0.78rem; color: var(--muted); }
.arm-executive { --arm: #e08600; --arm-ink: #b86e00; }
.arm-legislature { --arm: var(--c-lawmaker); --arm-ink: var(--ink-lawmaker); }
.arm-judiciary { --arm: var(--olive); --arm-ink: var(--olive); }
@media (prefers-color-scheme: dark) { .arm-executive { --arm-ink: #ffb347; } .arm-judiciary { --arm: #8fb36a; --arm-ink: #a9cc85; } }
.arm-people { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* phones: stack the arms down a trunk on the left */
@media (max-width: 680px) {
  .arms { align-items: flex-start; padding-left: 4px; }
  .arms > .tier-chip { margin-left: 0; }
  .arms > .stem { margin-left: 18px; }
  .arms-row { grid-template-columns: 1fr; gap: 0; }
  .arm { align-items: flex-start; padding: 0 0 0 40px; }
  .arm::before { left: 18px !important; right: auto !important; top: 0; bottom: 0; width: 2px; height: auto; }
  .arm:last-child::before { bottom: auto; height: 40px; }
  .arm-stem { position: absolute; left: 18px; top: 38px; width: 22px; height: 2px; }
  .arm-head { flex-direction: row; gap: 8px; margin-top: 22px; }
  .arm > .stem { margin-left: 24px; height: 18px; }
  .arm-people { justify-content: flex-start; }
}

/* ---------- Spacing polish: heading, LGA strip, zoom bar ---------- */
.in-place .section-head { margin-bottom: 28px; }
.in-place:not(.state-view) .section-head { margin-bottom: 18px; }
.lga-jump { margin: -12px auto 20px; padding: 0 4px 16px; border-bottom: 1px solid var(--line); position: relative; }
.lga-jump-strip {
  padding: 4px 4px 12px; gap: 8px;
  scrollbar-width: thin; scrollbar-color: var(--branch) transparent;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
.lga-jump-strip::-webkit-scrollbar { height: 6px; }
.lga-jump-strip::-webkit-scrollbar-track { background: transparent; }
.lga-jump-strip::-webkit-scrollbar-thumb { background: var(--branch); border-radius: 999px; }
.lga-jump-strip::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.zoom-bar { margin: 0 8px 20px; gap: 8px; }
.zoom-bar span, .zoom-bar p { color: var(--muted); font-size: 0.85rem; }
.crumbbar-inner { gap: 8px; height: 46px; }
.crumbbar-item { padding: 5px 12px; }
@media (max-width: 600px) {
  .in-place .section-head { margin-bottom: 18px; }
  .lga-jump { margin: -8px auto 14px; padding-bottom: 12px; }
  .zoom-bar { margin: 0 4px 14px; gap: 6px; }
}

/* ---------- Report a correction ---------- */
.report-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 20px auto 0; padding: 6px 10px; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font: 500 0.85rem var(--font-body); cursor: pointer; transition: color 0.2s, background 0.2s;
}
.report-btn::before {
  content: ""; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4Zm11-15 4 4' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4Zm11-15 4 4' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.report-btn:hover { color: var(--text); background: var(--bg); }
.sheet .report-btn { display: flex; width: fit-content; }
.report-form h3, .rf-done h3 { font-size: 1.5rem; margin-bottom: 6px; }
.rf-intro { color: var(--muted); margin: 0 0 18px; font-size: 0.95rem; }
.rf-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.rf-label { font-weight: 600; font-size: 0.9rem; }
.rf-hint { color: var(--muted); font-size: 0.78rem; }
.rf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-form input, .report-form select, .report-form textarea {
  width: 100%; font: 400 1rem var(--font-body); color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
.report-form textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.report-form input:focus, .report-form select:focus, .report-form textarea:focus { outline: none; border-color: var(--c-lawmaker); box-shadow: 0 0 0 3px rgba(0, 204, 153, 0.18); }
.rf-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rf-send {
  margin-top: 6px; width: 100%; padding: 13px 18px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 1rem var(--font-body); color: var(--forest); background: var(--orange); transition: filter 0.2s, transform 0.2s var(--ease);
}
.rf-send:hover { filter: brightness(1.06); transform: translateY(-1px); }
.rf-send:disabled { opacity: 0.6; cursor: wait; transform: none; }
.rf-status { min-height: 1.2em; margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); text-align: center; }
.rf-status.err { color: #d0442c; }
.rf-done { text-align: center; padding: 18px 4px 6px; }
.rf-done p { color: var(--muted); margin: 0 0 18px; }
.rf-tick { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: var(--forest); background: var(--c-lawmaker); }
@media (max-width: 560px) { .rf-row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- 2027 ballot ---------- */
.in-place #elections { display: none; }
.ballot-mode .jump { display: none; }
.ballot { max-width: 980px; margin: 0 auto; padding: 0 4px; }
.ballot-intro { margin-bottom: 22px; }
.ballot-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bdate { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.bdate b { font: 700 1.6rem var(--font-display); letter-spacing: -0.02em; color: var(--ink-federal); }
.bdate span { font-weight: 600; }
.bdate small { color: var(--muted); font-size: 0.85rem; }
.ballot-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ballot-link { display: inline-flex; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.ballot-link:hover { border-color: var(--orange); }
.ballot-fine { color: var(--muted); font-size: 0.82rem; margin: 12px 2px 0; line-height: 1.5; }
.ballot-loading { color: var(--muted); text-align: center; padding: 30px 0; }
.ballot-day { font-size: 1.05rem !important; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 26px 2px 10px; font-family: var(--font-body) !important; font-weight: 700; }
.race { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; margin-bottom: 14px; }
.race-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.race-head h3 { font-size: 1.2rem; margin: 0; }
.race-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.race-count { flex: none; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 4px 10px; }
.race-note { color: var(--muted); font-size: 0.88rem; margin: -4px 0 12px; }
.race-empty .race-note { margin: 0; }
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 10px 12px; border-radius: 18px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; min-width: 0;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s; }
.cand:hover { transform: translateY(-2px); border-color: var(--branch); box-shadow: 0 10px 24px -16px rgba(0, 40, 0, 0.45); }
.cand:focus-visible { outline: 2px solid var(--c-lawmaker); outline-offset: 2px; }
.cand-av { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  border: 2px solid var(--line); font: 700 1.1rem var(--font-display); color: var(--muted); }
.cand-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cand.is-inc .cand-av { border-color: var(--c-lawmaker); }
.cand.is-now .cand-av { border-color: var(--orange); }
.cand-dot { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.7rem; font-style: normal; color: #fff; background: var(--orange); border: 2px solid var(--bg); }
.cand.is-inc .cand-dot { background: var(--c-lawmaker); }
.cand h4 { margin: 0; font: 500 0.92rem/1.25 var(--font-display); letter-spacing: -0.01em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cand h4 b { font-weight: 700; }
.party { font: 700 0.7rem var(--font-body); letter-spacing: 0.05em; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.ctag { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ctag.inc { background: rgba(0, 204, 153, 0.16); color: var(--ink-lawmaker); }
.ctag.now { background: rgba(255, 153, 0, 0.14); color: var(--ink-federal); }
.ctag.note { background: rgba(200, 68, 44, 0.12); color: #c8442c; }
/* candidate pop-up */
.cand-sheet { text-align: center; }
.cand-sheet-av { width: 112px; height: 112px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--bg); border: 3px solid var(--line); font: 700 2rem var(--font-display); color: var(--muted); }
.cand-sheet-av img { width: 100%; height: 100%; object-fit: cover; }
.cand-sheet h3 { font-size: 1.5rem; line-height: 1.2; margin: 0; font-weight: 500; }
.cand-sheet h3 b { font-weight: 700; }
.cand-sheet-race { color: var(--muted); margin: 6px 0 12px; }
.cand-sheet .facts { justify-content: center; }
.fact.ok { background: rgba(0, 204, 153, 0.16); color: var(--ink-lawmaker); }
.cand-facts { text-align: left; margin: 18px 0 6px; display: grid; grid-template-columns: fit-content(150px) 1fr; gap: 10px 16px; }
.cand-facts dt { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.cand-facts dd { margin: 0; overflow-wrap: anywhere; }
.cand-sheet .ballot-fine { text-align: left; }
.ballot-lgas { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }

/* home panel */
.elections .lede-dark { color: var(--muted); max-width: 640px; margin: 8px 0 20px; }
.elections .ballot-dates { max-width: 640px; }
.elections .ballot-fine { max-width: 640px; }
.pres-list { margin-top: 18px; }
.pres-list > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 10px 18px; border-radius: 999px; background: var(--forest); color: #fff; font-weight: 700; }
.pres-list > summary::-webkit-details-marker { display: none; }
.pres-list > summary::after { content: "\203A"; transition: transform 0.2s; }
.pres-list[open] > summary::after { transform: rotate(90deg); }
.pres-list .cand-grid { margin-top: 14px; }

@media (max-width: 600px) {
  .ballot-dates { gap: 8px; }
  .bdate { padding: 12px; border-radius: 14px; }
  .bdate b { font-size: 1.3rem; }
  .bdate small { font-size: 0.78rem; }
  .race { padding: 12px; border-radius: 18px; }
  .cand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cand-av { width: 48px; height: 48px; font-size: 0.95rem; }
  .cand { padding: 10px 8px; gap: 4px; border-radius: 14px; }
  .cand h4 { font-size: 0.86rem; }
  .cand-facts { grid-template-columns: 1fr; gap: 2px; }
  .cand-facts dd { margin-bottom: 8px; }
  .toggle button { padding: 8px 13px; }
}

/* ---------- ward picker and polling units ---------- */
.ward-switch { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ward-switch label { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em; color: var(--muted); }
.ward-switch select { font: 500 1rem var(--font-body); color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; max-width: 100%; cursor: pointer; }
.ward-switch select:focus { outline: none; border-color: var(--c-lawmaker); }
.pu-race { border-color: var(--c-lawmaker); }
.pu-pick { font-weight: 600; color: var(--text); }
.pu-search { width: 100%; font: 400 1rem var(--font-body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.pu-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; }
.pu-list li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 0.92rem; }
.pu-list li:first-child { border-top: 0; }
.pu-code { font: 600 0.85rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-federal); }
.pu-none { display: block !important; color: var(--muted); }
@media (max-width: 600px) { .pu-list li { grid-template-columns: 1fr; gap: 2px; } .ward-switch select { width: 100%; } }
.ballot-fine a { color: var(--ink-lawmaker); font-weight: 600; }
.pu-map { height: 320px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 10px; z-index: 0; }
.pu-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pu-tools .ballot-link { cursor: pointer; font-family: var(--font-body); }
.pu-tools .ballot-link:disabled { opacity: 0.6; cursor: wait; }
.pu-near-list { max-height: none; margin-bottom: 12px; }
@media (min-width: 601px) { .pu-near-list li { grid-template-columns: 64px 1fr; } }
.pu-list li.has-gps { cursor: pointer; }
.pu-list li.has-gps:hover { background: var(--bg); }
.pu-list li.has-gps:focus-visible { outline: 2px solid var(--c-lawmaker); outline-offset: -2px; background: var(--bg); }
.pu-nogps { color: var(--muted); }
.pu-pop { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-body); }
.pu-pop b { font-family: ui-monospace, Menlo, monospace; color: #a35f00; }
.pu-pop small { color: #5f6b55; }
.pu-pop a { margin-top: 6px; font-weight: 700; color: #00805f; }
.leaflet-container { font-family: var(--font-body); }
@media (max-width: 600px) { .pu-map { height: 260px; } }
.pu-list a { color: var(--ink-lawmaker); font-weight: 600; }
.cand-sheet .cand-edu-key { margin: 4px 2px 0; padding-bottom: 12px; border-bottom: 1px solid var(--line, rgba(127,127,127,.25)); }
