/* ---------- Design tokens ---------- */
:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1d2433;
  --muted: #5a6172;
  --line: #e2ddd1;
  --navy: #1f3a5f;
  --forest: #2f5d46;
  --red: #a32020;
  --red-soft: #f6e3e1;
  --gold: #8a5a00;
  --gold-soft: #f7ecd3;
  --masthead: #16263d;
  --masthead-ink: #f6f3ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 36, 51, 0.06), 0 4px 14px rgba(29, 36, 51, 0.06);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Source Sans 3", system-ui, "Segoe UI", sans-serif;
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161f;
    --card: #1b2130;
    --ink: #e8e6e1;
    --muted: #a9b0bf;
    --line: #2c3446;
    --navy: #8fb3e8;
    --forest: #8cc7a6;
    --red: #f08a80;
    --red-soft: #3a2224;
    --gold: #e8c170;
    --gold-soft: #3a3020;
    --masthead: #0c1018;
    --shadow: none;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; }
a { color: inherit; }

/* ---------- Masthead ---------- */
.masthead {
  background: var(--masthead);
  color: var(--masthead-ink);
  border-bottom: 6px solid var(--red);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
}

.masthead h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tagline { margin: 0; max-width: 34rem; font-size: 1.15rem; opacity: 0.9; }

.legend {
  display: flex;
  gap: 1.25rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.legend li { display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid var(--masthead-ink); }
.dot.city { background: #4f7cb8; }
.dot.county { background: #4f9a73; }

/* ---------- County map ---------- */
.county-map {
  flex-shrink: 0;
  width: clamp(130px, 20vw, 220px);
  height: auto;
  overflow: visible;
}

.county-shape {
  fill: rgba(246, 243, 236, 0.07);
  stroke: var(--masthead-ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
  opacity: 0.9;
}

.city-dot {
  fill: var(--red);
  stroke: var(--masthead-ink);
  stroke-width: 3;
}

.city-pulse {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
  transform-origin: 71.1px 106.2px;
  animation: ping 2.4s ease-out infinite;
}

.city-label {
  fill: var(--masthead-ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@keyframes ping {
  from { transform: scale(1); opacity: 0.9; }
  to   { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .city-pulse { animation: none; opacity: 0; }
}

@media (max-width: 540px) {
  .masthead-inner { gap: 1rem; }
  .county-map { width: 96px; }
  .city-label { display: none; }
}

/* ---------- Two-column layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 2.5rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 0;
  align-items: start;
}

main { min-width: 0; } /* lets long text wrap instead of stretching the grid */

main h2 {
  margin: 2rem 0 1rem;
  padding-bottom: 0.4rem;
  font-size: 1.6rem;
  border-bottom: 2px solid var(--ink);
}

main section:first-of-type h2 { margin-top: 0.5rem; }

.result-count {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.last-checked {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.last-checked.stale {
  color: var(--red);
  font-weight: 700;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar h2 { margin: 0 0 0.75rem; font-size: 1.35rem; }

.search { margin-bottom: 1.25rem; }

.search label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.search input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
}

.search input:focus-visible { border-color: var(--ink); }

.search-hint { margin: 0.3rem 0 0; font-size: 0.8rem; color: var(--muted); }

mark {
  padding: 0 0.1em;
  background: var(--gold-soft);
  color: inherit;
  border-bottom: 2px solid var(--gold);
  border-radius: 2px;
}

fieldset {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.options { display: flex; flex-direction: column; gap: 0.2rem; }

.option { position: relative; }

/* Hide the native circle but keep the input focusable and readable by screen readers. */
.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.option label {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.option label:hover { background: var(--paper); }

.option input:checked + label {
  background: var(--ink);
  color: var(--paper);
}

.option input:focus-visible + label {
  outline: 3px solid #e0a526;
  outline-offset: 2px;
}

.reset {
  width: 100%;
  padding: 0.55rem;
  font: inherit;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.reset:hover { border-color: var(--ink); }

/* ---------- Alerts signup (Kit form) ---------- */
.alerts {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.alerts h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.alerts > p { margin: 0 0 0.75rem; font-size: 0.95rem; }

.alert-form label[for="alert-email"] {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.alert-form .formkit-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
}

.alert-form .formkit-input:focus-visible { border-color: var(--ink); }

.alert-bodies { margin: 0.9rem 0; padding: 0; border: 0; }

.alert-form .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

.alert-form .check input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.alert-form .check label { font-weight: 600; cursor: pointer; }

.alert-form .formkit-submit {
  position: relative;
  width: 100%;
  padding: 0.6rem;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}

.alert-form .formkit-submit:hover { opacity: 0.9; }

/* Kit's script adds data-active to the button while it's sending. */
.alert-form .formkit-spinner {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.alert-form .formkit-submit[data-active] .formkit-spinner { display: flex; }
.alert-form .formkit-submit[data-active] > span:last-child { visibility: hidden; }

.alert-form .formkit-spinner span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--paper);
  animation: alert-bounce 1.4s infinite ease-in-out both;
}

.alert-form .formkit-spinner span:nth-child(1) { animation-delay: -0.32s; }
.alert-form .formkit-spinner span:nth-child(2) { animation-delay: -0.16s; }

@keyframes alert-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .alert-form .formkit-spinner span { animation: none; opacity: 0.7; }
}

/* Messages from Kit's script */
.alerts .formkit-alert {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  list-style: none;
  border-radius: 0 6px 6px 0;
  font-weight: 600;
}

.alerts .formkit-alert:empty { display: none; }

.alerts .formkit-alert-error {
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  color: var(--red);
}

.alerts .formkit-alert-success {
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  color: var(--ink);
}

.alert-fineprint { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--muted); }
.alert-fineprint a { color: inherit; }

/* ---------- Meeting cards ---------- */
.meeting {
  --accent: var(--navy);
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.meeting.county { --accent: var(--forest); }

.date-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  padding: 0.5rem 0;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
}

.date-tile .month {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.date-tile .day {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.meeting h3 { margin: 0; font-size: 1.35rem; color: var(--accent); }
.meta { margin: 0.2rem 0 1rem; color: var(--muted); }

.participate {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
}

.participate h4 { color: var(--accent); }

.participate dl { display: grid; gap: 0.4rem; margin: 0; }

.participate dl div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.75rem;
}

.participate dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.15rem;
}

.participate dd { margin: 0; }

.participate a { color: var(--accent); font-weight: 600; }

@media (max-width: 540px) {
  .participate dl div { grid-template-columns: 1fr; gap: 0.1rem; }
}

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 4px;
  background: var(--red);
  color: var(--card);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.meeting h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}

.flagged { margin: 0 0 1rem; padding: 0; list-style: none; }

.flagged li {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  border-radius: 0 6px 6px 0;
}

.tags { margin-top: 0.35rem; }

.tag {
  display: inline-block;
  margin: 0.15rem 0.35rem 0 0;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag.reading {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

details { margin: 0.5rem 0 1rem; }

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

details ol { padding-left: 1.25rem; }
details li { margin: 0.5rem 0; }

.source-link {
  display: inline-block;
  font-weight: 700;
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.quiet { color: var(--muted); font-style: italic; }

.toggle-older {
  display: block;
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem;
  font: inherit;
  font-weight: 700;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.toggle-older:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Site nav ---------- */
.site-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.site-nav a {
  padding: 0.35rem 0.9rem;
  border: 1.5px solid rgba(246, 243, 236, 0.4);
  border-radius: 999px;
  color: var(--masthead-ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover { border-color: var(--masthead-ink); }

.site-nav a[aria-current="page"] {
  background: var(--masthead-ink);
  border-color: var(--masthead-ink);
  color: var(--masthead);
}

/* ---------- Vote pills ---------- */
.vote {
  display: inline-block;
  margin: 0.15rem 0.35rem 0 0;
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--muted);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.vote.split {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.vote.failed {
  border-color: var(--red);
  color: var(--red);
}

.source-links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0.5rem 0 0; }

.copy-link {
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent, var(--ink));
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.meeting { scroll-margin-top: 1rem; }

.meeting.highlight { box-shadow: 0 0 0 4px #e0a526; }

@media (prefers-reduced-motion: no-preference) {
  .meeting { transition: box-shadow 0.4s; }
}

/* ---------- Voting record page ---------- */
.record-page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 0;
}

.record-summary {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
}

.section-note { margin-top: -0.5rem; color: var(--muted); }

.split-vote {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--ink);
  border-radius: var(--radius);
}

.split-meta { margin: 0; color: var(--muted); font-weight: 600; }
.split-meta .vote { margin-right: 0.5rem; }
.split-text { margin: 0.4rem 0; }
.split-who { margin: 0; }
.split-note {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 6px 6px 0;
}

.officials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.official {
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.official-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.official h3 { margin: 0.15rem 0 0.75rem; font-size: 1.3rem; color: var(--navy); }

.official h4 { margin: 0.15rem 0 0.75rem; font-family: var(--serif); font-size: 1.3rem; color: var(--navy); }

.official.county { border-top-color: var(--forest); }
.official.county h4 { color: var(--forest); }

.record-body { margin-bottom: 3rem; }

.subhead {
  margin: 1.75rem 0 0.75rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 0.75rem; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 800; }
.stats small { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; color: var(--muted); }

.dissent-list { padding-left: 1.1rem; }
.dissent-list li { margin-bottom: 0.5rem; font-size: 0.95rem; }
.dissent-date { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); }

/* ---------- Ordinance history link (Agendas page) ---------- */
.tag-link {
  display: inline-block;
  margin: 0.15rem 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  text-underline-offset: 2px;
}

/* ---------- Ordinances page ---------- */
.ord-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
}

.ord-filters fieldset { margin: 0; }
.ord-filters .options { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }

.ord-filters .option label {
  padding: 0.35rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
}

.ord-filters .option input:checked + label { border-color: var(--ink); }

.ord-filters .check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.ord-filters .check input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }

.ordinance {
  --accent: var(--navy);
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 1rem;
}

.ordinance.county { --accent: var(--forest); }
.ordinance.highlight { box-shadow: 0 0 0 4px #e0a526; }

.ordinance-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.ordinance h2 {
  margin: 0.2rem 0 0.5rem;
  padding: 0;
  border: 0;
  font-size: 1.3rem;
}

.ordinance-status { margin: 0 0 0.5rem; }

.status {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status.adopted { background: var(--ink); color: var(--paper); }
.status.upcoming { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold); }
.status.pending { border: 1px solid var(--muted); color: var(--muted); }
.status.failed { border: 1px solid var(--red); color: var(--red); }

.timeline {
  margin: 0.75rem 0 0;
  padding: 0 0 0 1rem;
  list-style: none;
  border-left: 2px solid var(--line);
}

.timeline li { position: relative; margin-bottom: 0.6rem; }

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1rem - 6px);
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-date { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.timeline-link { margin-left: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max);
  margin: 3rem auto 0;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Accessibility helpers ---------- */
:focus-visible { outline: 3px solid #e0a526; outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; padding: 0.5rem 1rem; background: var(--card); color: var(--ink); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Tablet and phone: sidebar moves above the list ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; }

  .sidebar { position: static; max-height: none; }

  .options { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }

  .option label {
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: 999px;
  }

  .option input:checked + label { border-color: var(--ink); }
}

@media (max-width: 540px) {
  .meeting { grid-template-columns: 1fr; }
  .date-tile { flex-direction: row; gap: 0.4rem; align-self: auto; justify-self: start; padding: 0.25rem 0.75rem; }
  .date-tile .day { font-size: 1.25rem; }
}

/* ---------- County map ---------- */
.county-map {
  flex-shrink: 0;
  width: clamp(72px, 9vw, 110px);
  height: auto;
  overflow: visible;
}

.city-pulse {
  transform-origin: 71.1px 106.2px;
  animation: ping 2.4s ease-out infinite;
}

@keyframes ping {
  from { transform: scale(1); opacity: 0.9; }
  to   { transform: scale(2.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .city-pulse { animation: none; opacity: 0; }
}

@media (max-width: 540px) {
  .county-map { width: 64px; }
}

/* ---------- Collapsible filter groups ---------- */
.filter-group { margin: 0; border-top: 1px solid var(--line); }
.filter-group:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }

.filter-group summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.25rem;
  cursor: pointer;
  list-style: none; /* hides the default triangle */
}
.filter-group summary::-webkit-details-marker { display: none; } /* Safari */

.filter-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.filter-group summary:hover .filter-name { color: var(--ink); }

.filter-current {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
}

.filter-group fieldset { margin: 0 0 0.75rem; }

/* ---------- Collapsible sections ---------- */
.collapsible { margin-bottom: 1rem; }
/* Undo the older "main h2" underline and spacing for the collapsible headings. */
main .collapsible .toggle-heading {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
  font-size: 1.35rem;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.25rem;
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.section-toggle:hover { border-color: var(--ink); }

.toggle-count {
  margin-left: auto;
  font-family: var(--sans, "Source Sans 3", sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.section-panel { margin-top: 1rem; }

/* ---------- Chevrons: down when closed, up when open ---------- */
.filter-group summary::after,
.chevron {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s;
}
.filter-group summary::after { color: var(--muted); }
.filter-group[open] summary::after,
.section-toggle[aria-expanded="true"] .chevron {
  transform: translateY(2px) rotate(-135deg);
}

.filter-group summary:focus-visible,
.section-toggle:focus-visible {
  outline: 3px solid #e0a526;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .filter-group summary::after,
  .chevron { transition: none; }
}

/* The sign-up toggle looks like the sidebar's other buttons, not a card. */
.alerts-toggle {
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  border-width: 1.5px;
  border-radius: 6px;
  box-shadow: none;
}
.alerts-toggle + .section-panel { margin-top: 0.75rem; }

/* ---------- Phones ---------- */
@media (max-width: 540px) {
  .masthead-inner { position: relative; padding: 1.25rem 1rem; }
  .masthead-text { min-width: 0; }
  .eyebrow { padding-right: 4.5rem; font-size: 0.7rem; }
  .masthead h1 { font-size: 2.25rem; }
  .tagline { font-size: 1rem; }
  .legend { margin-top: 0.75rem; font-size: 0.85rem; }
  .county-map { position: absolute; top: 1rem; right: 1rem; width: 56px; }

  .site-nav { margin-top: 1rem; gap: 0.35rem; }
  .site-nav a { padding: 0.3rem 0.7rem; font-size: 0.85rem; white-space: nowrap; }

  .layout { padding: 1rem 1rem 0; gap: 1rem; }
  .sidebar { padding: 1rem; }
  .section-toggle { padding: 0.85rem 1rem; }
  main .collapsible .toggle-heading { font-size: 1.15rem; }
}

/* ---------- Tablet and phone: filters fold into one row ---------- */
.filters-toggle { display: none; }

@media (max-width: 860px) {
  #filters-heading { display: none; }

  .filters-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.25rem 0;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .filters-toggle[aria-expanded="true"] .chevron { transform: translateY(2px) rotate(-135deg); }

  #filters { margin-top: 0.75rem; }
  #filters.is-collapsed { display: none; }
}

@media (max-width: 540px) {
  .alerts { margin-top: 1rem; padding-top: 1rem; }
  .alerts h2, .alerts > p { display: none; }
}

@media (max-width: 540px) {
  .section-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 0.75rem;
    row-gap: 0.1rem;
  }
  .section-toggle .toggle-count { grid-row: 2; grid-column: 1; margin-left: 0; }
  .section-toggle .chevron { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}