:root {
  --ink: #1d1d1f;
  --muted: #5b5b66;
  --line: #d9d9e0;
  --bg: #fafaf7;
  --card: #ffffff;
  --accent: #1f4fd1;
  --yes-bg: #dff3e4; --yes-ink: #145a2a;
  --no-bg: #fbe1e1; --no-ink: #8a1c1c;
  --cand-bg: #e3ebfd; --cand-ink: #1b3a8f;
  --split-bg: #fff1cc; --split-ink: #6b4b00;
  --info-bg: #ecebf7; --info-ink: #40397a;
  --none-bg: #f1f1f3; --none-ink: #6a6a75;
  --contest-w: 17rem;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); padding: 1.25rem 0 1rem; margin-bottom: 1rem; }
.eyebrow { margin: 0; color: var(--muted); font-size: .85rem; letter-spacing: .02em; text-transform: uppercase; }
h1 { margin: .2rem 0 .3rem; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.lede { margin: 0 0 1rem; color: var(--muted); max-width: 60ch; }

.controls { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; }
.ballot-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); }
.ballot-toggle button { border: 0; background: none; font: inherit; font-weight: 600; padding: .4rem 1rem; border-radius: 999px; cursor: pointer; color: var(--muted); }
.ballot-toggle button[aria-checked="true"] { background: var(--ink); color: #fff; }
.filter { color: var(--muted); font-size: .9rem; display: inline-flex; gap: .4rem; align-items: center; }
.ballot-note { margin: .6rem 0 .4rem; font-size: .9rem; color: var(--muted); max-width: 80ch; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: 0; margin: .5rem 0 0; font-size: .82rem; color: var(--muted); }
.legend li { display: inline-flex; gap: .35rem; align-items: center; }

.chip { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-weight: 600; font-size: .85em; }
.stance-yes { background: var(--yes-bg); color: var(--yes-ink); }
.stance-no { background: var(--no-bg); color: var(--no-ink); }
.stance-candidate { background: var(--cand-bg); color: var(--cand-ink); }
.stance-split { background: var(--split-bg); color: var(--split-ink); }
.stance-info { background: var(--info-bg); color: var(--info-ink); }
.stance-none { background: var(--none-bg); color: var(--none-ink); }

.table-scroll { overflow: auto; max-height: calc(100vh - 2rem); border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 820px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; text-align: left; }
.matrix thead th { position: sticky; top: 0; z-index: 3; background: var(--card); font-size: .95rem; border-bottom: 2px solid var(--ink); }
.matrix thead th a { color: var(--ink); text-decoration: none; font-weight: 700; }
.matrix thead th a:hover { text-decoration: underline; }
.guide-sub { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }
.contest-col { position: sticky; left: 0; z-index: 2; background: var(--card); width: var(--contest-w); min-width: var(--contest-w); }
.matrix thead .contest-col { z-index: 4; }
.contest-title { display: block; font-weight: 600; }
.contest-sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.section-row th { position: sticky; left: 0; background: #f0efe9; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: .7rem; }

.agree { display: inline-block; margin-top: .25rem; font-size: .72rem; font-weight: 600; padding: 0 .4rem; border-radius: 4px; }
.agree-agree { background: var(--yes-bg); color: var(--yes-ink); }
.agree-split { background: var(--split-bg); color: var(--split-ink); }

.cell { width: 100%; min-height: 2.4rem; border: 1px solid transparent; border-radius: 8px; padding: .35rem .5rem; font: inherit; font-weight: 600; font-size: .88rem; text-align: left; cursor: pointer; line-height: 1.3; }
.cell:hover { border-color: currentColor; }

.count { color: var(--muted); font-size: .85rem; }
.site-footer { color: var(--muted); font-size: .85rem; padding-bottom: 2rem; }

dialog { width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 14px; padding: 1.4rem 1.5rem 1.2rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(20, 20, 30, .45); }
.modal-close-form { position: absolute; top: .5rem; right: .6rem; margin: 0; }
.modal-close { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .2rem .4rem; }
.modal-eyebrow { margin: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
dialog h2 { margin: .2rem 2rem .5rem 0; font-size: 1.3rem; }
dialog h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1rem 0 .3rem; }
.modal-pick .chip { font-size: 1rem; padding: .15rem .6rem; }
.modal-rating { color: var(--muted); font-size: .85rem; margin-left: .3rem; }
blockquote { margin: .8rem 0; padding: .4rem .9rem; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.detail-list, .cand-list { margin: .2rem 0; padding-left: 1.1rem; font-size: .9rem; }
.modal-contest { border-top: 1px solid var(--line); margin-top: 1rem; font-size: .9rem; }
.contest-desc { color: var(--muted); }
.modal-source { margin: 1rem 0 0; font-weight: 600; }

@media (max-width: 640px) {
  :root { --contest-w: 10.5rem; }
  .matrix { min-width: 640px; }
  .cell { font-size: .8rem; }
}
.not-on-ballot { margin-top: .3rem; }
.not-on-ballot summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.not-on-ballot ul { margin: .3rem 0; padding-left: 1.1rem; }
