/* Europe of the Regions — table + representation model page.
   Table-scoped styles only. Shared header/body styling (background,
   font-family, .site-header layout) comes from site.css, loaded before
   this file — do not redeclare bare `body` or `.site-header` selectors
   here, as that would override site.css's cascade. */

:root {
  --edr-bg: #0b0b0f;
  --edr-bg-raised: #16161d;
  --edr-fg: #eee;
  --edr-fg-dim: rgba(238, 238, 238, 0.65);
  --edr-fg-dimmer: rgba(238, 238, 238, 0.45);
  --edr-border: rgba(238, 238, 238, 0.14);
  --edr-accent: #8ab4ff;
  --edr-accent-2: #ffb37d;
  --edr-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app, .site-footer {
  font-family: var(--edr-font);
  background: var(--edr-bg);
  color: var(--edr-fg);
}

.site-nav a {
  color: var(--edr-fg-dim);
  text-decoration: none;
  margin-right: 0.4rem;
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--edr-fg);
  text-decoration: underline;
}

.site-nav span {
  color: var(--edr-fg-dimmer);
  margin-right: 0.4rem;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.intro h1 {
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.lede {
  color: var(--edr-fg-dim);
  max-width: 70ch;
  line-height: 1.5;
}

.section-note {
  color: var(--edr-fg-dimmer);
  font-size: 0.88rem;
  max-width: 80ch;
  line-height: 1.4;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.5rem;
  border-top: 1px solid var(--edr-border);
  padding-top: 1.5rem;
}

h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-top: 1.75rem;
}

/* Controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.controls label {
  font-size: 0.85rem;
  color: var(--edr-fg-dim);
}

#filter-input {
  flex: 0 1 320px;
  background: var(--edr-bg-raised);
  border: 1px solid var(--edr-border);
  color: var(--edr-fg);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
}

#filter-input:focus {
  outline: 1px solid var(--edr-accent);
}

.counts-line {
  flex-basis: 100%;
  color: var(--edr-fg-dimmer);
  font-size: 0.85rem;
  margin: 0;
}

/* Table */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--edr-border);
  border-radius: 8px;
  max-width: 100%;
}

#regions-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1400px;
  font-size: 0.82rem;
}

#regions-table th,
#regions-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--edr-border);
  white-space: nowrap;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

#regions-table td:nth-child(6),
#regions-table td:nth-child(7) {
  white-space: normal;
  max-width: 32ch;
}

#regions-table thead th {
  position: sticky;
  top: 0;
  background: var(--edr-bg-raised);
  color: var(--edr-fg);
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

#regions-table th.sortable {
  cursor: pointer;
}

#regions-table th.sortable:hover {
  color: var(--edr-accent);
}

#regions-table th.sort-asc::after {
  content: " \25B2";
  font-size: 0.7em;
}

#regions-table th.sort-desc::after {
  content: " \25BC";
  font-size: 0.7em;
}

#regions-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#regions-table tbody tr:hover {
  background: rgba(125, 184, 255, 0.06);
}

/* Extremes */

.extremes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.extreme-card {
  background: var(--edr-bg-raised);
  border: 1px solid var(--edr-border);
  border-radius: 8px;
  padding: 1rem;
}

.extreme-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--edr-fg-dimmer);
}

.extreme-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.extreme-stat {
  font-weight: 400;
  color: var(--edr-fg-dim);
  font-size: 0.85rem;
}

.extreme-reasoning {
  color: var(--edr-fg-dim);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
}

/* Representation tables */

.seat-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
}

.seat-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 420px;
}

.seat-table caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 0.5rem;
  color: var(--edr-fg-dimmer);
  font-size: 0.8rem;
}

.seat-table th,
.seat-table td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--edr-border);
  text-align: left;
}

.seat-table td.num,
.seat-table th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.seat-table tfoot td {
  border-top: 1px solid var(--edr-border);
  border-bottom: none;
  font-weight: 600;
  color: var(--edr-fg-dim);
}

/* Bar chart (pure CSS, no chart library) */

.bar-chart-legend {
  font-size: 0.8rem;
  color: var(--edr-fg-dim);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 2px;
  margin-left: 0.6rem;
}

.legend-flat { background: var(--edr-accent); }
.legend-bundesrat { background: var(--edr-accent-2); }

.bar-chart-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bar-label {
  flex: 0 0 3ch;
  font-size: 0.72rem;
  color: var(--edr-fg-dim);
  font-variant-numeric: tabular-nums;
}

.bar-tracks {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.bar-track {
  background: rgba(238, 238, 238, 0.06);
  border-radius: 3px;
  height: 0.55rem;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 3px;
  min-width: 1px;
}

.bar-flat { background: var(--edr-accent); }
.bar-bundesrat { background: var(--edr-accent-2); }

.analysis {
  max-width: 78ch;
  margin-top: 1.5rem;
  line-height: 1.55;
  color: var(--edr-fg);
}

.error {
  color: #ff8a8a;
}

.site-footer {
  border-top: 1px solid var(--edr-border);
  padding: 1rem 1.5rem;
  color: var(--edr-fg-dimmer);
  font-size: 0.8rem;
}

.site-footer code {
  color: var(--edr-fg-dim);
}
