/* ── Design Tokens ─────────────────────────────────────── */

:root {
  --ink: #1a1a2e;
  --paper: #f8f7f4;
  --stone: #e8e6e1;
  --slate: #6b7280;
  --amber: #b45309;
  --amber-hover: #92400e;
  --amber-light: #fef3c7;
  --white: #ffffff;

  --aye: #047857;
  --no: #dc2626;
  --absent: #6b7280;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --site-sticky-offset: 3.55rem;
}

/* ── Base ─────────────────────────────────────────────── */

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

@media (prefers-reduced-motion: no-preference) {
  .aos-ready [data-aos] {
    opacity: 0;
    transform: translateY(0.85rem);
    transition:
      opacity 0.45s ease,
      transform 0.45s ease,
      border-color 0.18s ease,
      background-color 0.18s ease,
      color 0.18s ease,
      box-shadow 0.18s ease;
    transition-delay: var(--aos-delay, 0ms);
    will-change: opacity, transform;
  }

  .aos-ready [data-aos].aos-in {
    opacity: 1;
    transform: translateY(0);
  }

  .aos-ready [data-aos="fade"] {
    transform: none;
  }

  .aos-ready [data-aos="fade-right"] {
    transform: translateX(-0.85rem);
  }

  .aos-ready [data-aos="fade-left"] {
    transform: translateX(0.85rem);
  }

  .aos-ready [data-aos="zoom-in"] {
    transform: scale(0.975);
  }

  .aos-ready [data-aos="zoom-in"].aos-in {
    transform: scale(1);
  }

  .bg-white.border.border-stone.rounded-lg,
  .search-result-card,
  .party-timeline-key,
  .quick-link-list a,
  .topic-tag,
  tbody tr {
    transition:
      transform 0.18s ease,
      box-shadow 0.18s ease,
      border-color 0.18s ease,
      background-color 0.18s ease,
      color 0.18s ease;
  }

  .bg-white.border.border-stone.rounded-lg:hover,
  .search-result-card:hover,
  .party-timeline-key:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(26, 26, 46, 0.08);
  }

  .quick-link-list a:hover,
  .topic-tag:hover {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

.site-header-inner {
  min-width: 0;
}

.site-brand {
  flex-shrink: 0;
}

.site-nav {
  min-width: 0;
}

.site-nav a,
.site-nav button {
  flex: 0 0 auto;
}

.site-nav-group {
  position: relative;
}

.site-nav-group::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  height: 0.45rem;
}

.site-nav-trigger,
.site-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: rgba(26, 26, 46, 0.72);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.site-nav-trigger::after {
  content: 'v';
  width: 0.24rem;
  height: 0.24rem;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  color: var(--slate);
  font-size: 0;
  line-height: 0;
  transform: translateY(-0.12rem) rotate(45deg);
  transition: transform 0.15s ease, color 0.15s ease;
}

.site-nav-group:hover .site-nav-trigger::after,
.site-nav-group:focus-within .site-nav-trigger::after,
.site-nav-group.nav-group-open .site-nav-trigger::after {
  color: var(--amber-hover);
  transform: translateY(0.08rem) rotate(225deg);
}

.site-nav-trigger:hover,
.site-nav-trigger:focus-visible,
.site-nav-link:hover,
.site-nav-link:focus-visible {
  background: var(--amber-light);
  color: var(--amber-hover);
  text-decoration: none;
}

.site-nav-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 60;
  display: none;
  min-width: 14rem;
  padding: 0.4rem;
  border: 1px solid var(--stone);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 30px rgba(26, 26, 46, 0.14);
}

.site-nav-group:hover .site-nav-menu,
.site-nav-group:focus-within .site-nav-menu,
.site-nav-group.nav-group-open .site-nav-menu {
  display: grid;
  gap: 0.1rem;
}

.site-nav-group:hover::after,
.site-nav-group:focus-within::after,
.site-nav-group.nav-group-open::after {
  display: block;
}

.site-nav-menu a,
.site-nav-soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
  padding: 0.48rem 0.55rem;
  border-radius: 0.3rem;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-menu a:hover,
.site-nav-menu a:focus-visible {
  background: var(--amber-light);
  color: var(--amber-hover);
  text-decoration: none;
}

.site-nav-divider {
  display: block;
  border-top: 1px solid var(--stone);
  margin: 0.35rem 0.75rem;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

.site-nav-soon {
  color: var(--slate);
  cursor: default;
}

.site-nav-soon em {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-menu-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.28rem;
  border: 1px solid var(--stone);
  border-radius: 0.35rem;
  background: var(--white);
  color: var(--ink);
}

.site-menu-toggle span:not(.sr-only) {
  display: block;
  width: 1.1rem;
  height: 2px;
  border-radius: 9999px;
  background: currentColor;
}

.header-search {
  flex: 0 0 12rem;
}

.header-search input {
  width: 100%;
}

.social-link {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stone);
  border-radius: 9999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.social-link:hover {
  border-color: var(--amber);
  background: var(--amber-light);
  color: var(--amber-hover);
  text-decoration: none;
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: 1rem;
}

.search-filters {
  align-self: start;
}

.search-result-card {
  display: block;
  color: var(--ink);
}

.search-result-card:hover {
  border-color: var(--amber);
  background: var(--amber-light);
  color: var(--ink);
  text-decoration: none;
}

.search-checkbox-list {
  max-height: 15rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid #d6d3cd;
  border-radius: 0.25rem;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
}

a.topic-tag:hover {
  border-color: var(--amber);
  background: var(--amber-light);
  color: var(--amber-hover);
  text-decoration: none;
}

.topic-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--stone);
}

.topic-stat-row:last-child {
  border-bottom: 0;
}

.activity-day-heading {
  position: sticky;
  top: var(--site-sticky-offset);
  z-index: 35;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--stone);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
}

.activity-vote-result,
.activity-vote-split {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.activity-vote-split {
  min-width: 0;
}

@media (max-width: 640px) {
  .activity-day-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .activity-vote-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

.compare-panel {
  border: 1px solid var(--stone);
  border-radius: 0.5rem;
  background: var(--paper);
  padding: 1rem;
}

.compare-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
}

.compare-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--stone);
  border-radius: 0.4rem;
  background: var(--white);
}

.compare-card-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.compare-name {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
}

.compare-meta {
  color: var(--slate);
  font-size: 0.78rem;
  line-height: 1.25;
}

.compare-card-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.compare-scan {
  display: grid;
  gap: 0.9rem;
}

.compare-scan-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.compare-scan-label {
  color: var(--slate);
  font-size: 0.78rem;
  font-weight: 700;
}

.compare-scale {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(3.25rem, auto) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}

.compare-scale-side {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.compare-scale-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.compare-scale-side:last-child .compare-scale-value {
  text-align: right;
}

.compare-delta {
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.compare-delta-strong {
  color: var(--amber-hover);
}

.compare-meter {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--stone) 72%, white);
}

.compare-meter span {
  display: block;
  width: var(--meter, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
}

.compare-meter-left span {
  margin-left: auto;
}

.compare-meter-aye span {
  background: var(--aye);
}

.compare-meter-no span {
  background: var(--no);
}

.compare-vote,
.compare-flag {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.compare-vote-aye {
  background: color-mix(in srgb, var(--aye) 12%, white);
  color: var(--aye);
}

.compare-vote-no {
  background: color-mix(in srgb, var(--no) 12%, white);
  color: var(--no);
}

.compare-vote-none {
  background: var(--stone);
  color: var(--slate);
}

.compare-flag {
  background: var(--stone);
  color: var(--slate);
}

.compare-flag-warn {
  background: var(--amber-light);
  color: var(--amber);
}

.compare-remove {
  color: var(--slate);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.compare-remove:hover {
  color: var(--amber-hover);
}

#voters-table tr.compare-selected {
  background: var(--amber-light);
}

.vote-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
}

.timeline-chart {
  width: 100%;
  overflow-x: auto;
}

.chart-panel {
  padding: 1.25rem;
  border: 1px solid var(--stone);
  border-radius: 0.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.94)),
    var(--white);
}

.chart-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.chart-kicker {
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.timeline-chart svg {
  display: block;
  width: 100%;
  min-width: 36rem;
  height: auto;
}

.timeline-chart-large svg {
  min-width: 48rem;
}

.chart-axis {
  stroke: color-mix(in srgb, var(--stone) 88%, var(--ink));
  stroke-width: 2;
}

.chart-grid {
  stroke: var(--stone);
  stroke-width: 1;
  opacity: 0.72;
}

.chart-grid-dashed {
  stroke: var(--stone);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.72;
}

.chart-line {
  fill: none;
  stroke: var(--series-colour, var(--amber));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-line-thin {
  fill: none;
  stroke: var(--series-colour, var(--amber));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.chart-area {
  fill: var(--series-colour, var(--amber));
  fill-opacity: 0.12;
  stroke: none;
}

.chart-dot {
  fill: var(--series-colour, var(--amber));
  stroke: #fff;
  stroke-width: 2.5;
}

.chart-bar {
  fill: color-mix(in srgb, var(--amber) 82%, white);
  stroke: var(--amber-hover);
  stroke-width: 0.75;
}
.chart-bar:hover {
  fill: var(--amber);
}

.chart-series-hidden {
  display: none;
}

.chart-legend-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.chart-legend-toggle:hover {
  border-color: var(--stone);
}
.chart-legend-off {
  opacity: 0.35;
}
.chart-legend-off .chart-legend-dot {
  background: var(--slate) !important;
}

.chart-value-label {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.chart-label {
  fill: var(--slate);
  font-family: var(--font-mono);
  font-size: 12px;
}

.chart-axis-label {
  fill: var(--slate);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chart-annotation {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  margin-top: 1rem;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--stone);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.8rem;
  color: var(--ink);
}

.chart-legend-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 9999px;
  background: var(--series-colour, var(--slate));
  flex: 0 0 auto;
}

.chart-empty {
  padding: 2rem;
  border: 1px dashed var(--stone);
  border-radius: 0.5rem;
  color: var(--slate);
  text-align: center;
}

.party-timeline-key {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--stone);
  border-radius: 0.4rem;
  color: var(--ink);
}

.party-timeline-key:hover {
  border-color: var(--amber);
  background: var(--amber-light);
  color: var(--ink);
  text-decoration: none;
}

.party-timeline-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 9999px;
  background: var(--series-colour, var(--slate));
  border: 1px solid rgba(26, 26, 46, 0.15);
  flex: 0 0 auto;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
}

a {
  color: var(--amber);
  text-decoration: none;
}

a:hover {
  color: var(--amber-hover);
  text-decoration: underline;
}

/* Prevent base anchor hover from overriding styled links */
a.no-underline:hover {
  text-decoration: none;
}

.profile-section,
.section-anchor-target {
  scroll-margin-top: calc(var(--site-sticky-offset) + 3.25rem);
}

.section-anchor-nav {
  position: sticky;
  top: var(--site-sticky-offset);
  z-index: 45;
  margin: -0.35rem 0 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--stone) 75%, transparent);
  background:
    linear-gradient(180deg, rgba(248, 247, 244, 0.98), rgba(248, 247, 244, 0.92));
  backdrop-filter: blur(10px);
}

.section-anchor-nav.is-stuck {
  box-shadow: inset 0 -0.35rem 0.55rem -0.55rem rgba(26, 26, 46, 0.22);
}

.section-anchor-nav__inner {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.25rem 0.1rem 0.45rem;
  scrollbar-width: thin;
}

.section-anchor-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--stone);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.section-anchor-nav a:hover,
.section-anchor-nav a:focus-visible {
  border-color: var(--amber);
  background: var(--amber-light);
  color: var(--amber-hover);
  text-decoration: none;
}

.quick-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.quick-link-list a {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--stone);
  border-radius: 0.25rem;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.quick-link-list a:hover {
  border-color: var(--amber);
  color: var(--amber-hover);
  background: var(--amber-light);
  text-decoration: none;
}

.faq-list {
  display: grid;
  gap: 0.5rem;
}

.faq-list details {
  border: 1px solid var(--stone);
  border-radius: 0.35rem;
  background: var(--white);
}

.faq-list summary {
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.faq-list details[open] summary {
  border-bottom: 1px solid var(--stone);
}

.faq-list p {
  margin: 0;
  padding: 0.8rem 0.9rem 0.9rem;
  color: var(--slate);
  font-size: 0.9rem;
  line-height: 1.55;
}

.faq-source {
  display: inline-block;
  margin-left: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ── Leaflet Map Containers ───────────────────────────── */

#constituency-map,
#division-map {
  width: 100%;
  height: 100%;
  min-height: 20rem;
  z-index: 0;
}

.leaflet-popup-content-wrapper {
  font-family: var(--font-body);
  border-radius: 0.35rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 0.65rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
}

.leaflet-popup-content strong {
  font-weight: 700;
}

.leaflet-popup-content a {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.8rem;
}

.leaflet-popup-content a:hover {
  color: var(--amber-hover);
}

.map-shell {
  min-height: calc(100vh - 8rem);
}

.map-fullscreen {
  position: relative;
  width: 100vw;
  height: calc(100vh - 3.6rem);
  min-height: 36rem;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: -1.5rem;
  margin-bottom: -1.5rem;
  overflow: hidden;
}

.map-sidebar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 500;
  width: min(21rem, calc(100vw - 2rem));
  max-height: calc(100% - 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--stone);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(26, 26, 46, 0.12);
  overflow: hidden;
}

.map-panel-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.map-panel-content {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 1.25rem;
}

.map-legend {
  display: grid;
  gap: 0.2rem;
  min-height: 0;
  overflow-y: auto;
}

.map-legend-row {
  display: grid;
  grid-template-columns: 0.8rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.25rem;
  border-radius: 0.25rem;
  color: var(--ink);
}

.map-legend-row:hover {
  background: var(--amber-light);
  color: var(--ink);
}

.map-legend-swatch {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 1px solid rgba(26, 26, 46, 0.15);
}

.map-legend-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
}

.map-legend-count {
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.map-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--white);
  overflow: hidden;
}

.map-empty {
  max-width: 44rem;
  padding: 1rem;
  border: 1px dashed var(--stone);
  border-radius: 0.5rem;
  background: var(--paper);
}

.map-empty-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 450;
  width: min(28rem, calc(100% - 2rem));
  transform: translate(-50%, -50%);
  box-shadow: 0 12px 28px rgba(26, 26, 46, 0.12);
  text-align: center;
}

.division-search-results {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 600;
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid var(--stone);
  border-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  background: white;
  box-shadow: 0 8px 16px rgba(26, 26, 46, 0.1);
}

.division-search-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--stone);
  background: white;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.4;
}

.division-search-item:hover {
  background: var(--amber-light);
}

.division-search-item:last-child {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .map-fullscreen {
    min-height: calc(100vh - 3.6rem);
  }

  .map-sidebar {
    right: 0.75rem;
    left: 0.75rem;
    top: 0.75rem;
    width: auto;
    max-height: calc(100% - 1.5rem);
    padding: 0.85rem;
  }

  .map-panel-toggle {
    display: flex;
  }

  .map-panel-content {
    display: none;
    padding-top: 0.8rem;
    border-top: 1px solid var(--stone);
  }

  .map-sidebar.map-controls-open .map-panel-content {
    display: flex;
  }

  .map-sidebar.map-controls-open .map-legend {
    max-height: 45vh;
  }
}

@media (max-width: 999px) {
  .site-header-inner {
    flex-wrap: wrap;
    align-items: center;
  }

  .site-brand {
    margin-right: auto;
  }

  .site-menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    width: 100%;
    order: 3;
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--stone);
  }

  .site-header.menu-open .site-nav {
    display: flex !important;
  }

  .site-nav a {
    width: 100%;
    padding: 0.55rem 0.65rem;
  }

  .site-nav-group {
    width: 100%;
  }

  .site-nav-group::after {
    display: none !important;
  }

  .site-nav-trigger,
  .site-nav-link {
    width: 100%;
    justify-content: space-between;
    min-height: 2.6rem;
    padding: 0.65rem;
    border: 1px solid var(--stone);
    background: var(--white);
    font-size: 0.9rem;
  }

  .site-nav-menu {
    position: static;
    display: none;
    min-width: 0;
    margin: 0.2rem 0 0.45rem;
    padding: 0.25rem 0 0.25rem 0.45rem;
    border: 0;
    border-left: 2px solid var(--stone);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .site-nav-group:hover .site-nav-menu,
  .site-nav-group:focus-within .site-nav-menu {
    display: none;
  }

  .site-nav-group.nav-group-open .site-nav-menu {
    display: grid;
    gap: 0.1rem;
  }

  .site-nav-menu a,
  .site-nav-soon {
    width: 100%;
    min-height: 2.35rem;
    padding: 0.55rem 0.65rem;
    white-space: normal;
  }

  .header-search {
    width: 100%;
    order: 4;
    flex-basis: auto;
    display: none;
  }

  .site-header.menu-open .header-search {
    display: block;
  }

  .search-layout {
    grid-template-columns: 1fr;
  }

  .site-nav a,
  .site-nav button {
    padding-inline: 0.65rem;
  }

  main {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .party-emblem {
    width: 64px;
    height: 64px;
    font-size: 1rem;
  }

  .party-logo-large {
    width: 96px;
    height: 64px;
    padding: 0.5rem;
  }

  .stat-value {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .quick-link-list a,
  .faq-list summary,
  .faq-list p {
    font-size: 0.82rem;
  }

  form.flex {
    flex-wrap: wrap;
  }

  form.flex input[type="text"],
  form.flex input[type="search"],
  form.flex input:not([type]) {
    min-width: 14rem;
  }

  form.flex button,
  form.flex a {
    flex: 0 0 auto;
  }

  table.wide-table {
    min-width: 36rem;
  }

  .vote-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .vote-table-toolbar button {
    width: 100%;
  }

  .map-sidebar {
    padding: 0.8rem;
  }

  .map-stage {
    padding: 0.5rem;
  }

  .source-note {
    overflow-wrap: anywhere;
  }
}

/* ── Toggle Switch ───────────────────────────────────── */

.toggle-track {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--stone);
  transition: background 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-track[data-active="true"] {
  background: var(--amber);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.toggle-track[data-active="true"]::after {
  transform: translateX(1rem);
}

/* ── Party Badge ──────────────────────────────────────── */

.party-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

.party-badge-full {
  gap: 0.5rem;
}

.party-badge-compact {
  gap: 0;
}

.party-badge-compact .party-mark {
  min-width: 2rem;
}

.party-link {
  color: var(--ink);
  text-decoration: none;
}

.party-link:hover {
  color: var(--ink);
  text-decoration: none;
}

.party-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 0.2rem;
  background: var(--party-bg);
  color: var(--party-fg);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.party-logo-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 1.8rem;
  padding: 0.2rem;
  border: 1px solid var(--stone);
  border-radius: 0.25rem;
  background: var(--white);
}

.party-logo-frame img,
.party-logo-large img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ── Party Emblem (party profile header) ──────────────── */

.party-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 0.4rem;
  background: var(--party-bg);
  color: var(--party-fg);
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 800;
}

.party-logo-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 80px;
  padding: 0.75rem;
  border: 1px solid var(--stone);
  border-radius: 0.4rem;
  background: var(--white);
}

/* Vote split bars */

.vote-split {
  display: flex;
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--stone);
}

.vote-split-sm {
  height: 0.35rem;
}

.vote-split-lg {
  height: 0.75rem;
}

.vote-split__aye,
.vote-split__no {
  display: block;
  min-width: 0.15rem;
}

.vote-split__aye {
  background: #2f8f5b;
}

.vote-split__no {
  background: #c94b4b;
}

.vote-summary-cell {
  min-width: 8rem;
}

/* ── Timeline ─────────────────────────────────────────── */

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0 0.65rem 1rem;
  border-left: 2px solid var(--stone);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--stone);
  border: 2px solid var(--paper);
}

.timeline-item:first-child::before {
  background: var(--amber);
}

/* ── Interest List ────────────────────────────────────── */

.interest-list {
  display: grid;
  gap: 0.5rem;
}

.interest-list details {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--stone);
  border-radius: 0.3rem;
  background: var(--white);
}

.interest-list summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.interest-list summary span {
  color: var(--slate);
  font-weight: 400;
  margin-left: 0.25rem;
}

.interest-list p {
  margin: 0.5rem 0 0;
  white-space: pre-line;
  font-size: 0.85rem;
  color: var(--slate);
}

/* ── Source Note ───────────────────────────────────────── */

.source-note {
  color: var(--slate);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.section-source-note {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--stone);
}

.source-context-box {
  padding: 0.85rem 1rem;
  border: 1px solid var(--stone);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--paper) 72%, white);
}

.source-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.8rem 1.25rem;
}

.source-context-grid > div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  color: var(--slate);
  font-size: 0.82rem;
  line-height: 1.45;
}

.source-context-label {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-context-grid a {
  overflow-wrap: anywhere;
  font-weight: 700;
}

/* ── Stat Card ────────────────────────────────────────── */

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.metric-grid {
  display: grid;
  gap: 0.75rem;
}

.metric-card {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--stone);
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--paper) 55%, white);
}

.metric-card-center {
  text-align: center;
}

.metric-card .stat-value {
  margin-bottom: 0.25rem;
}

/* Data tables */

.data-table {
  width: 100%;
  font-size: 0.9rem;
}

.data-table thead tr {
  border-bottom: 1px solid var(--stone);
}

.data-table th {
  padding: 0.65rem 1rem 0.65rem 0;
  color: var(--slate);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  padding: 0.7rem 1rem 0.7rem 0;
  vertical-align: top;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 1rem;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 1rem;
}

.data-table tbody {
  border-color: color-mix(in srgb, var(--stone) 60%, white);
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--amber-light) 24%, white);
}

.data-table .numeric,
.data-table th.numeric {
  text-align: right;
  font-family: var(--font-mono);
}

.data-table .nowrap {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .data-table-wrap {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  .data-table-card {
    display: block;
  }

  .data-table-card thead {
    display: none;
  }

  .data-table-card tbody {
    display: grid;
    gap: 0.75rem;
    border: 0;
  }

  .data-table-card tbody tr {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
    border: 1px solid var(--stone);
    border-radius: 0.5rem;
    background: var(--white);
  }

  .data-table-card tbody tr:hover {
    background: var(--white);
    box-shadow: 0 8px 20px rgba(26, 26, 46, 0.08);
  }

  .data-table-card td:not(.hidden) {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0;
    text-align: right;
  }

  .data-table-card td:first-child:not(.hidden),
  .data-table-card td[data-primary="true"] {
    display: block;
    text-align: left;
  }

  .data-table-card td:not(.hidden)[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--slate);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
  }

  .data-table-card td[data-primary="true"]::before {
    display: none;
  }
}

/* ── Sortable Table ───────────────────────────────────── */

.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.4rem !important;
}

.sortable::after {
  content: '⇅';
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.sortable:hover::after {
  opacity: 0.7;
}

.sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--amber);
}

.sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--amber);
}

/* ── Aye Percentage Cell ──────────────────────────────── */

.aye-pct-cell {
  display: inline-block;
  min-width: 4.4rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  background: linear-gradient(90deg,
    rgba(4, 120, 87, 0.10) var(--pct, 0%),
    transparent var(--pct, 0%));
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Heatmap Table ────────────────────────────────────── */

.heatmap-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 0.35rem 0.5rem;
  min-width: 3.5rem;
}

.heatmap-cell a {
  display: block;
  padding: 0.1rem 0;
}

.heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--stone);
  border-radius: 0.5rem;
  background: var(--white);
}

.heatmap-ramp {
  display: flex;
  height: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--stone);
  border-radius: 999px;
}

.heatmap-ramp span {
  width: 2rem;
}

.heatmap-table th:first-child,
.heatmap-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: white;
}

.heatmap-table thead th:first-child {
  z-index: 2;
}

/* ── Stat Card ────────────────────────────────────────── */

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}

/* ── Bill Type Badge ─────────────────────────────────── */

.bill-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}

.bill-type-government-bill {
  background: #dbeafe;
  color: #1e40af;
}

.bill-type-private-members-bill {
  background: #fef3c7;
  color: #92400e;
}

.bill-type-opposition {
  background: #fce7f3;
  color: #9d174d;
}

.bill-type-procedural {
  background: #f1f5f9;
  color: #475569;
}

.bill-type-other {
  background: #f1f5f9;
  color: #475569;
}
