:root {
  --lime: #ace053;      /* CycleWR brand */
  --black: #111;
  --green: #2f6f1a;     /* lime darkened for text/links on white (AA contrast) */
  --green-dark: #24570f;
  --green-tint: #f0f8e2;
  --ink: #1d2320;
  --muted: #5b6660;
  --line: #d9e0dc;
  --bg: #f7f9f8;
  --card: #fff;
  --yes: #1f7a4d;   --yes-bg: #dff1e6;
  --no: #a8322a;    --no-bg: #f8e1df;
  --unsure: #8a5a00; --unsure-bg: #fbeecb;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.55;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--green-dark); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 2000; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-style: italic; }

/* Header / footer */
.site-header { background: var(--black); color: #fff; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { display: block; height: 47px; width: auto; }
.brand-sub { font-weight: 700; font-size: 1.1rem; }
.site-header nav { display: flex; gap: 20px; }
.site-header nav a { color: #fff; text-decoration: none; opacity: .85; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.site-footer { margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* Home */
.hero { background: var(--green-tint); border-top: 6px solid var(--lime); padding: 40px 0 32px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.15; margin: 0 0 12px; }
.lede { font-size: 1.1rem; max-width: 60ch; margin: 0 0 12px; }
.election-date { margin: 0; }
h2 { margin-top: 36px; }
#map { height: 520px; border-radius: var(--radius); border: 1px solid var(--line); background: #e9eeeb; }
.map-help { color: var(--muted); font-size: .92rem; margin: 0 0 8px; }
.map-help + #map { margin-top: 14px; }
.ward-finders { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 8px; font-size: .92rem; }
.ward-finders a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; text-decoration: none; }
.ward-finders a:hover, .ward-finders a:focus-visible { text-decoration: underline; }
.notice { background: var(--unsure-bg); color: var(--unsure); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: .92rem; }

.directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.muni-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.muni-card h3 { margin: 0 0 8px; }
.race-links { list-style: none; padding: 0; margin: 0 0 8px; }
.race-links a { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.race-links a:hover { text-decoration: underline; }
.count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ward-label { margin: 12px 0 6px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ward-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.ward-grid a { display: block; text-align: center; padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: var(--bg); }
.ward-grid a:hover, .ward-grid a:focus { background: var(--black); color: var(--lime); border-color: var(--black); }

/* Race page */
.race-page { padding-top: 20px; }
.breadcrumb { font-size: .9rem; color: var(--muted); }
.race-page h1 { margin: 8px 0 4px; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.race-summary { color: var(--muted); margin: 0 0 12px; }
.ballot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; }
.ballot-label { font-size: .9rem; color: var(--muted); }
.pill { border: 1px solid var(--green); border-radius: 999px; padding: 3px 12px; font-size: .9rem; text-decoration: none; }
.pill:hover { background: var(--black); color: var(--lime); border-color: var(--black); }

.view-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); scrollbar-width: thin; }
.tab { flex: none; padding: 10px 12px; font-size: .97rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--black); border-bottom-color: var(--lime); }
.panel { outline: none; }
.topic-desc { color: var(--muted); margin-top: -8px; }

.question { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0; }
.question h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 650; }
@media (max-width: 640px) { .question h3 { font-size: 1rem; font-weight: 600; } }
.tally { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
.answers { list-style: none; padding: 0; margin: 0; }
.answer { border-top: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: 200px 1fr; gap: 4px 16px; }
.answer .cand-name { font-weight: 700; grid-row: span 2; }
.answer .comment p:first-child { margin-top: 0; }
.answer .comment p:last-child { margin-bottom: 0; }
@media (max-width: 640px) { .answer { grid-template-columns: 1fr; } .answer .cand-name { grid-row: auto; } }

.chip { display: inline-block; width: fit-content; padding: 1px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: #eceff0; color: var(--ink); }
.chip-yes { background: var(--yes-bg); color: var(--yes); }
.chip-no { background: var(--no-bg); color: var(--no); }
.chip-unsure { background: var(--unsure-bg); color: var(--unsure); }

.nonresponders { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 16px; color: var(--muted); }

.cand-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.cand-pick { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; }
.cand-pick.is-selected { background: var(--black); color: var(--lime); border-color: var(--black); }
.cand-pick.no-response { color: var(--muted); background: transparent; border-style: dashed; cursor: default; }
.cand-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 24px 16px; }
.cand-topic h3 { border-bottom: 3px solid var(--lime); padding-bottom: 4px; margin-top: 28px; }
.qa { margin-bottom: 18px; }
.qa .q { font-weight: 600; margin: 0 0 6px; }

.prose { max-width: 760px; padding-top: 20px; }
.survey-section { border-top: 3px solid var(--lime); margin-top: 28px; }
.survey-section h3 { margin: 14px 0 8px; }
.survey-section ol li { margin-bottom: 10px; }
.q-type { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--green-tint); font-size: .8rem; font-weight: 600; color: var(--green-dark); white-space: nowrap; }
.q-audience { font-weight: 400; font-size: .95rem; color: var(--muted); }

:focus-visible { outline: 3px solid #f0b400; outline-offset: 2px; }

.mode-toggle { display: inline-flex; align-items: center; gap: 0; margin-bottom: 16px; }
.mode-label { font-size: .9rem; color: var(--muted); margin-right: 10px; }
.mode { padding: 6px 16px; border: 1px solid var(--black); color: var(--black); text-decoration: none; font-weight: 600; background: var(--card); }
.mode:first-of-type { border-radius: 999px 0 0 999px; }
.mode:last-of-type { border-radius: 0 999px 999px 0; border-left: 0; }
.mode.is-active { background: var(--black); color: var(--lime); }

/* Wider screens: topics as wrapping pills, since there are too many for one row of tabs. */
@media (min-width: 700px) {
  .view-tabs { flex-wrap: wrap; overflow: visible; gap: 8px; border-bottom: 0; }
  .tab { margin: 0; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
  .tab:hover { border-color: var(--black); }
  .tab.is-active { background: var(--black); color: var(--lime); border-color: var(--black); }
}

/* "All topics": separate each topic's block clearly. */
.all-topic + .all-topic { border-top: 3px solid var(--lime); margin-top: 32px; }
.tab-all { font-style: italic; }
