:root {
  --repdem-blue: #1C4266;
  --repdem-blue-dark: #12324F;
  --repdem-blue-deep: #0D263C;
  --repdem-blue-soft: #EAF1F7;
  --repdem-blue-pale: #F4F8FB;
  --repdem-accent: #B58A4A;
  --repdem-accent-soft: #F7F0E5;
  --ink: #172331;
  --ink-soft: #425466;
  --muted: #6B7785;
  --line: #DCE4EB;
  --line-soft: #EAF0F4;
  --surface: #FFFFFF;
  --surface-soft: #F7F9FB;
  --page: #F1F5F8;
  --success: #2F6B57;
  --warning: #8A6427;
  --shadow-sm: 0 1px 2px rgba(18, 50, 79, .05), 0 4px 14px rgba(18, 50, 79, .04);
  --shadow-md: 0 14px 36px rgba(18, 50, 79, .09);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html {
  background: var(--page);
  scroll-behavior: smooth;
}

body.repdem-page {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(28,66,102,.08), transparent 34rem),
    var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--repdem-blue);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { color: var(--repdem-blue-dark); text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(220,228,235,.9);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header-inner {
  max-width: 1180px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}
.site-brand:hover { text-decoration: none; }

.site-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--repdem-blue), var(--repdem-blue-dark));
  color: #fff;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 6px 16px rgba(28,66,102,.22);
}

.site-brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.site-brand-name { font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.site-brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.site-nav a:hover {
  background: var(--repdem-blue-pale);
  color: var(--repdem-blue);
}
.site-nav a[aria-current="page"] {
  background: var(--repdem-blue-soft);
  color: var(--repdem-blue);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

h1, h2, h3 {
  color: var(--ink);
  letter-spacing: -.025em;
}
h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 760;
}
h2 {
  margin: 32px 0 12px;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 730;
}
h3 { font-size: 16px; }

label {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

select, input, button {
  font: inherit;
}

select {
  min-height: 44px;
  border: 1px solid #C8D4DE;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(18,50,79,.03);
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:hover { border-color: #9DB1C2; }
select:focus {
  border-color: var(--repdem-blue);
  box-shadow: 0 0 0 3px rgba(28,66,102,.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid #C8D4DE;
  border-radius: 9px;
  background: #fff;
  color: var(--repdem-blue-dark);
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(18,50,79,.03);
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.btn:hover {
  background: var(--repdem-blue-pale);
  border-color: #AFC1D0;
  color: var(--repdem-blue-dark);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  border-color: var(--repdem-blue);
  background: var(--repdem-blue);
  color: #fff;
}
.btn-primary:hover {
  border-color: var(--repdem-blue-dark);
  background: var(--repdem-blue-dark);
  color: #fff;
}

.help {
  margin: 18px 0 24px;
  padding: 15px 18px;
  border: 1px solid #D6E2EC;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #F8FBFD, var(--repdem-blue-pale));
  color: var(--ink-soft);
  line-height: 1.55;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}

.muted { color: var(--muted) !important; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin: 18px 0 4px;
}
.tab-card {
  min-height: 104px;
  padding: 17px 18px;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  text-align: left;
  border-color: var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.84);
}
.tab-card:hover {
  transform: translateY(-1px);
  border-color: #B8C8D5;
  background: #fff;
}
.tab-title {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
}
.tab-desc {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 480;
  line-height: 1.4;
}
.active-tab {
  border-color: var(--repdem-blue) !important;
  background: linear-gradient(145deg, var(--repdem-blue), var(--repdem-blue-dark)) !important;
  box-shadow: 0 10px 24px rgba(28,66,102,.18);
}
.active-tab .tab-title, .active-tab .tab-desc { color: #fff; }
.active-tab .tab-desc { opacity: .78; }

.list {
  margin-top: 14px;
  max-height: 440px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
}
.list::-webkit-scrollbar { width: 10px; }
.list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #BBC8D3;
  background-clip: padding-box;
}

.item {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 7px;
  transition: background .12s ease;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--repdem-blue-pale); }
.item.compact { padding: 8px 10px; }
.item.active {
  background: var(--repdem-blue-soft);
  box-shadow: inset 3px 0 0 var(--repdem-blue);
}
.item a { font-weight: 650; }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 5px 6px 8px;
  color: var(--ink-soft);
}

#details, #summary, #out {
  scroll-margin-top: 95px;
}
#details {
  margin-top: 28px !important;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}
#details > h2 { margin-top: 0; font-size: 26px; }

table {
  width: 100%;
  margin-top: 10px;
  border-spacing: 0;
  border-collapse: separate;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
}
th, td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  text-align: left;
}
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
th {
  color: #405163;
  background: #F8FAFC;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .025em;
}
thead th {
  background: #F0F5F8;
  color: var(--repdem-blue-dark);
  text-transform: uppercase;
  letter-spacing: .055em;
  font-size: 11px;
}
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: #FBFCFD; }

.pill, .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
  padding: 4px 9px;
  border: 1px solid #CAD8E3;
  border-radius: 999px;
  background: #F8FBFD;
  color: var(--repdem-blue-dark);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}
a.pill:hover {
  border-color: #AFC3D4;
  background: var(--repdem-blue-soft);
  text-decoration: none;
}

.party-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.alliance-row td { background: #F5F8FB; font-weight: 700; }
.member-row td:first-child { padding-left: 28px; }

.notice {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  margin: 12px 0 20px;
  padding: 14px 16px;
  border: 1px solid #D7E2EA;
  border-radius: 11px;
  background: #F8FBFD;
  color: var(--ink-soft);
}
.notice-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--repdem-blue-soft);
  color: var(--repdem-blue);
  font-weight: 800;
}
.notice strong {
  display: block;
  margin: 1px 0 3px;
  color: var(--ink);
  font-size: 13px;
}
.notice p { margin: 0; }

pre {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #F7F9FB;
  color: #33475B;
  overflow: auto;
}

canvas {
  max-width: 100%;
}

#election-chart-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.section-title { margin-top: 28px; margin-bottom: 6px; }

/* Party detail header and navigation area */
#page-meta, #meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

/* Home */
.home-page {
  background:
    radial-gradient(circle at 80% 0%, rgba(28,66,102,.12), transparent 38rem),
    var(--page) !important;
}
.home-page .page-shell { padding-top: 34px; }
.home-page .wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
}
.home-page .hero {
  position: relative;
  overflow: hidden;
  padding: 42px;
  border: 0;
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% -15%, rgba(255,255,255,.22), transparent 23rem),
    linear-gradient(135deg, var(--repdem-blue), var(--repdem-blue-deep));
  color: #fff;
  box-shadow: 0 24px 60px rgba(18,50,79,.20);
}
.home-page .hero::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -70px;
  bottom: -110px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
}
.home-page .hero h1 { color: #fff; font-size: clamp(38px, 6vw, 62px); }
.home-page .hero .subtitle { color: rgba(255,255,255,.78); }
.home-page .hero .subtitle a { color: #fff; text-decoration: underline; }
.home-page .hero img {
  width: 92px !important;
  height: 92px !important;
  border: 1px solid rgba(255,255,255,.35) !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.home-page .actions { margin-top: 24px; }
.home-page .hero .btn-primary {
  border-color: #fff;
  background: #fff;
  color: var(--repdem-blue-dark);
}
.home-page .hero .btn-primary:hover { background: #F2F6F9; color: var(--repdem-blue-dark); }
.home-page .hero .btn:not(.btn-primary) {
  border-color: rgba(255,255,255,.32);
  background: rgba(255,255,255,.08);
  color: #fff;
}
.home-page .hero .btn:not(.btn-primary):hover { background: rgba(255,255,255,.15); }

.home-page .content {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
}
.home-page .card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.home-page .card h2:first-child { margin-top: 0; }
.home-page .card p { color: var(--ink-soft); }
.home-page .list { max-height: none; padding: 0 0 0 18px; border: 0; box-shadow: none; background: transparent; }
.home-page .list li { margin: 8px 0; }
.home-page footer {
  margin-top: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 900px) {
  .tabs { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .home-page .content { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header-inner {
    min-height: 64px;
    padding: 0 16px;
  }
  .site-brand-subtitle { display: none; }
  .site-nav a { padding: 8px 9px; font-size: 13px; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 28px; }
  .tabs { grid-template-columns: 1fr; }
  .tab-card { min-height: auto; }
  h1 { font-size: 32px; }
  #details { padding: 16px; }
  th, td { padding: 9px 10px; }
  table { display: block; overflow-x: auto; white-space: normal; }
  .home-page .hero { padding: 28px 22px; }
}

@media (max-width: 520px) {
  .site-brand-subtitle { display: none; }
  .site-nav a:first-child { display: none; }
}


/* Landing-page data navigation */
.home-data-section {
  margin-top: 24px;
}
.home-data-section > h2 {
  margin: 0 0 6px;
  font-size: 24px;
}
.home-data-lead {
  margin: 0 0 16px;
  color: var(--muted);
}
.home-data-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.home-data-card {
  position: relative;
  min-height: 158px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.home-data-card:hover {
  transform: translateY(-2px);
  border-color: #AFC3D4;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.home-data-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--repdem-blue-soft);
  color: var(--repdem-blue);
  font-size: 12px;
  font-weight: 800;
}
.home-data-title {
  display: block;
  margin-bottom: 5px;
  color: var(--repdem-blue-dark);
  font-size: 17px;
  font-weight: 780;
}
.home-data-copy {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.home-data-arrow {
  position: absolute;
  right: 18px;
  top: 18px;
  color: #8299AC;
  font-size: 18px;
}
.acknowledgements {
  margin-top: 20px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}
.acknowledgements h2 {
  margin-top: 0;
}

/* Overview tables used before opening an individual record */
.overview-panel {
  margin-top: 14px;
}
.overview-panel table {
  margin-top: 0;
}
.overview-table td:first-child a:not(.pill) {
  font-weight: 700;
}
.overview-table .pill {
  white-space: nowrap;
}
.overview-meta {
  color: var(--muted);
  font-size: 12px;
}
.quick-switcher {
  margin-top: 14px;
}
.quick-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 8px;
}
.quick-switcher .list {
  margin-top: 0;
  max-height: 250px;
}
.quick-switcher .item.active {
  font-weight: 700;
}
.table-scroll {
  overflow-x: auto;
  border-radius: 11px;
}

/* Party name-history table */
.name-history-intro {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.name-history-table td {
  vertical-align: top;
}
.name-history-primary {
  font-weight: 700;
  color: var(--ink);
}
.name-history-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.change-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--repdem-blue-soft);
  color: var(--repdem-blue-dark);
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 980px) {
  .home-data-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .home-data-grid { grid-template-columns: 1fr; }
  .home-data-card { min-height: 132px; }
}


/* Unified section navigation: matches the Legislature layout */
.section-switcher {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(3, auto);
  gap: 16px;
  align-items: end;
  margin-top: 18px;
}
.section-country { min-width: 0; }
.section-country select { width: 100%; padding: .5rem .75rem; }
.section-switcher .btn,
.section-nav-btn {
  min-width: 96px;
  min-height: 44px;
  white-space: nowrap;
}

/* More compact landing navigation cards */
.home-data-card {
  min-height: 104px !important;
  padding: 16px 17px !important;
}
.home-data-title { margin-bottom: 4px; }

/* Party history is part of Party information rather than a separate table */
.name-history-list {
  display: grid;
  gap: 10px;
}
.name-history-entry {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.name-history-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.name-history-date {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.name-history-entry .name-history-secondary {
  display: block;
}

@media (max-width: 820px) {
  .section-switcher {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .section-country { grid-column: 1 / -1; }
  .section-switcher .btn { width: 100%; }
}
@media (max-width: 540px) {
  .section-switcher { grid-template-columns: 1fr; }
  .section-country { grid-column: auto; }
}


/* ================================================================
   Election results: separate electoral alliances from party rows
   ================================================================ */
.election-result-section {
  margin-top: 32px;
}
.result-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 12px;
}
.result-section-heading h2 {
  margin: 0 0 4px;
}
.result-section-intro {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.table-scroll table {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 980px;
}
.results-table th {
  white-space: nowrap;
}
.results-table td {
  vertical-align: top;
}
.results-table .numeric-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Alliance rows use hierarchy and spacing rather than full-row bolding. */
.alliance-summary-table tbody tr {
  background: #fbfcfd;
}
.alliance-summary-table tbody tr:hover {
  background: #f6f9fb;
}
.entity-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  margin-bottom: 6px;
  border: 1px solid #cbd8e2;
  border-radius: 999px;
  background: #eef4f8;
  color: var(--repdem-blue-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.alliance-primary {
  font-weight: 650;
  color: var(--ink);
  line-height: 1.35;
}
.alliance-secondary {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}
.entity-id {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}
.party-chip-list,
.alliance-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.party-chip,
.alliance-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
}
.party-chip {
  border: 1px solid #d4dde5;
  background: #fff;
  color: var(--repdem-blue-dark);
}
a.party-chip:hover {
  background: #f3f7fa;
  text-decoration: none;
}
.alliance-chip {
  border: 1px solid #cbd8e2;
  background: #eef4f8;
  color: var(--repdem-blue-dark);
  font-weight: 600;
}
.party-results-table tbody tr {
  background: #fff;
}
.party-results-table tbody tr:hover {
  background: #fbfcfd;
}

@media (max-width: 720px) {
  .result-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ================================================================
   Persistent download action
   ================================================================ */
.header-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid #C9D5DE;
  border-radius: 9px;
  background: rgba(244,248,251,.92);
  color: var(--repdem-blue-dark);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(18,50,79,.025);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.header-download:hover {
  border-color: #AFC0CE;
  background: #EAF1F7;
  color: var(--repdem-blue-dark);
  text-decoration: none;
  transform: translateY(-1px);
}
.header-download-icon {
  font-size: 14px;
  line-height: 1;
  opacity: .72;
}
.header-download-short { display: none; }

.home-hero-layout {
  position: relative;
  z-index: 1;
}

/* ================================================================
   Compact rotating parliament image at the bottom of the landing page
   ================================================================ */
.parliament-carousel-section {
  width: min(720px, 100%);
  margin: 34px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
.parliament-carousel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 9px;
}
.parliament-carousel-heading h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.parliament-carousel-kicker {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.parliament-carousel-controls {
  display: flex;
  gap: 5px;
}
.carousel-control {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #D5DEE6;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.carousel-control:hover {
  border-color: #BCCAD5;
  background: var(--surface-soft);
  color: var(--repdem-blue);
}
.carousel-control:focus-visible {
  outline: 3px solid rgba(28,66,102,.13);
  outline-offset: 2px;
}
.parliament-carousel {
  margin: 0;
}
.parliament-carousel-frame {
  height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #E3E9EE;
  box-shadow: 0 1px 3px rgba(18,50,79,.04);
}
.parliament-carousel-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .92;
  filter: saturate(.82) contrast(.96);
  transition: opacity .32s ease;
}
.parliament-carousel.is-changing .parliament-carousel-frame img {
  opacity: 0;
}
.parliament-carousel-caption {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 2px 0;
  color: var(--muted);
  line-height: 1.35;
}
.parliament-carousel-location {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
}
.parliament-carousel-credit {
  font-size: 9.5px;
  text-align: right;
}
.parliament-carousel-credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #C7D0D8;
  text-underline-offset: 2px;
}
.parliament-carousel-credit a:hover {
  color: var(--repdem-blue);
}

@media (max-width: 720px) {
  .header-download {
    min-height: 34px;
    padding: 7px 9px;
  }
  .header-download-full { display: none; }
  .header-download-short { display: inline; }

  .parliament-carousel-section {
    margin-top: 28px;
  }
  .parliament-carousel-frame {
    height: 118px;
  }
  .parliament-carousel-caption {
    flex-direction: column;
    gap: 2px;
  }
  .parliament-carousel-credit {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-download,
  .parliament-carousel-frame img {
    transition: none;
  }
  .header-download:hover {
    transform: none;
  }
}

/* ================================================================
   REPDEM identity + header actions (2026.09 feedback refresh)
   ================================================================ */
.site-brand-logo {
  width: 46px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
}

.site-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 0 0 auto;
}

.header-acknowledgements {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.header-acknowledgements:hover {
  border-color: #D6E0E7;
  background: var(--surface-soft);
  color: var(--repdem-blue-dark);
}

.header-acknowledgements:focus-visible,
.header-download:focus-visible {
  outline: 3px solid rgba(28,66,102,.14);
  outline-offset: 2px;
}

/* The full REPDEM logo is intentionally presented on a quiet light panel
   so its original blue/black artwork remains legible inside the dark hero. */
.home-page .hero {
  padding: 34px 38px;
}

.home-page .home-hero-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.home-page .hero-logo-panel {
  display: inline-flex;
  align-items: center;
  width: min(360px, 100%);
  padding: 11px 16px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 15px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 28px rgba(6,24,39,.12);
}

.home-page .hero .hero-brand-logo {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 300px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.home-page .hero-supporting-copy {
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.home-page .hero-supporting-copy a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.45);
  text-underline-offset: 3px;
}

/* ================================================================
   Acknowledgements dialog
   ================================================================ */
.ack-dialog {
  width: min(620px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: var(--shadow-md);
}

.ack-dialog::backdrop {
  background: rgba(13,38,60,.38);
  backdrop-filter: blur(2px);
}

.ack-dialog-card {
  padding: 24px 26px 25px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}

.ack-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.ack-dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.ack-dialog-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.ack-dialog-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.ack-dialog-close:hover {
  background: var(--repdem-blue-pale);
  color: var(--repdem-blue-dark);
}

/* Aggregate/non-party election result rows are hidden from the ordinary
   party table and remain available in a compact disclosure for transparency. */
.aggregate-results {
  margin-top: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255,255,255,.66);
}

.aggregate-results > summary {
  padding: 10px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.aggregate-results[open] > summary {
  border-bottom: 1px solid var(--line-soft);
}

.aggregate-results .table-scroll {
  padding: 0 10px 10px;
}

.compact-results-table {
  margin-top: 8px;
}

@media (max-width: 720px) {
  .site-header-inner {
    gap: 10px;
  }

  .site-brand {
    gap: 7px;
  }

  .site-brand-logo {
    width: 39px;
    height: 27px;
  }

  .site-brand-name {
    font-size: 13px;
  }

  .site-header-actions {
    gap: 4px;
  }

  .header-acknowledgements,
  .header-download {
    min-height: 33px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .home-page .hero {
    padding: 24px 20px;
  }

  .home-page .home-hero-layout {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-page .hero-logo-panel {
    width: min(320px, 100%);
  }

  .home-page .hero-supporting-copy {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .site-brand-copy {
    display: none;
  }

  .header-acknowledgements {
    font-size: 10.5px;
  }

  .header-download {
    font-size: 10.5px;
  }
}

/* ================================================================
   Election results: multiple valid-vote totals
   ================================================================ */
.vote-share-context-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #D7E1E8;
  border-radius: 9px;
  background: #F7FAFC;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.vote-share-context-note strong {
  color: var(--ink);
  font-weight: 720;
}

.valid-vote-summary-row td {
  background: #FAFBFC;
}

.valid-vote-others-row td {
  border-top: 1px solid #D7E1E8;
}

.valid-vote-total-row td {
  border-top: 1px solid #E6EDF2;
  border-bottom: 2px solid #C9D6DF;
  background: #F4F7F9;
}

.valid-vote-summary-row strong {
  color: var(--ink);
  font-weight: 740;
}


/* ================================================================
   2026.10 feedback: DEMSCORE header link + simplified home
   ================================================================ */
.header-demscore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.header-demscore:hover {
  border-color: #D6E0E7;
  background: var(--surface-soft);
  color: var(--repdem-blue-dark);
  text-decoration: none;
}

.header-demscore:focus-visible {
  outline: 3px solid rgba(28,66,102,.14);
  outline-offset: 2px;
}

.home-page .home-data-section {
  margin-top: 0;
}

@media (max-width: 720px) {
  .header-demscore {
    min-height: 33px;
    padding: 6px 8px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .header-demscore {
    font-size: 10.5px;
  }
}


/* ================================================================
   Launch navigation: data home, main-site brand, contextual datasets
   ================================================================ */
.site-header-leading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.data-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  flex: 0 0 auto;
  border: 1px solid #C8D4DE;
  border-radius: 9px;
  background: #fff;
  color: var(--repdem-blue-dark);
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(18,50,79,.03);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.data-home-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--repdem-blue);
}

.data-home-link:hover {
  border-color: #AFC1D0;
  background: var(--repdem-blue-pale);
  color: var(--repdem-blue-dark);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.data-home-link[aria-current="page"] {
  border-color: #B8C8D5;
  background: var(--repdem-blue-soft);
}

.data-home-link:focus-visible,
.dataset-source-link:focus-visible {
  outline: 3px solid rgba(28,66,102,.14);
  outline-offset: 2px;
}

.page-heading-row,
.detail-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.page-heading-row {
  margin-bottom: 2px;
}

.page-heading-row h1,
.detail-heading-row h2 {
  margin-top: 0;
}

.detail-heading-row {
  align-items: center;
  margin-bottom: 10px;
}

.detail-heading-row h2 {
  margin-bottom: 0;
}

.page-heading-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.dataset-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid #B8C8D5;
  border-radius: 9px;
  background: var(--repdem-blue-pale);
  color: var(--repdem-blue-dark);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(18,50,79,.03);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.dataset-source-link:hover {
  border-color: var(--repdem-blue);
  background: var(--repdem-blue-soft);
  color: var(--repdem-blue-dark);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.dataset-source-link:active {
  transform: translateY(1px);
}

.dataset-source-link-compact {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12.5px;
}

.external-link-mark {
  font-size: .95em;
  line-height: 1;
}

@media (max-width: 760px) {
  .site-header-inner {
    padding-top: 9px;
    padding-bottom: 9px;
    gap: 9px 12px;
    flex-wrap: wrap;
  }

  .site-header-leading {
    gap: 9px;
  }

  .site-header-actions {
    margin-left: auto;
  }

  .data-home-link {
    min-height: 33px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .page-heading-row,
  .detail-heading-row {
    align-items: stretch;
  }

  .page-heading-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .site-header-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .dataset-source-link {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .data-home-link,
  .dataset-source-link {
    transition: none;
  }
}


/* ================================================================
   Header consistency fix — 2026-10-15
   Brand first, Data home second, identical global actions on all pages.
   ================================================================ */
.site-header-leading {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.site-header-leading .site-brand {
  flex: 0 1 auto;
}

.site-header-leading .data-home-link {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .site-header-leading {
    gap: 10px;
  }
}
