/*
  style.css — white background, black text, square corners everywhere
  (no border-radius).

  Colour only ever marks data, never text. All comparisons draw from one
  categorical palette (below). For each bar, the order of its colours was
  checked for colour-blind separation; where a colour is lighter than 3:1
  against white, the legend, the values above the bar and the tooltip carry
  the information as well.

  Font: Inter, served from site/fonts/ (SIL Open Font License, see
  site/fonts/OFL.txt), so every device shows the same font and no request
  goes to Google.
*/

/* Font ------------------------------------------------------------------------------ */
/* One variable font file covers all weights (100–900). Split by character
   range like on Google Fonts: "latin" covers German, French and Italian;
   "latin-ext" is only downloaded if a page shows rarer letters. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Design tokens ------------------------------------------------------------------ */
:root {
  color-scheme: light;

  --bg: #ffffff;
  --ink: #0b0b0b;          /* primary text */
  --ink-2: #52514e;        /* secondary text */
  --ink-3: #6f6e69;        /* muted labels */
  --line: #e6e5e0;         /* hairlines */
  --wash: #f3f3f1;         /* hover background */

  /* Categorical palette for all comparisons */
  --blue: #2a78d6;
  --orange: #eb6834;
  --aqua: #1baf7a;
  --amber: #eda100;
  --green: #008300;
  --violet: #6250d6;
  --magenta: #e87ba4;
  --red: #e34948;
  --other: #c3c2b7;        /* grouped rest: "Übrige Parteien", "Andere Sprachen" */

  /* Ordered categories (age): one hue, light to dark */
  --blue-light: #86b6ef;
  --blue-mid: #3987e5;
  --blue-dark: #184f95;

  --female: var(--orange);
  --male: var(--blue);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --max: 56rem;            /* content width */
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Base --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* Browsers round some form controls by default (e.g. Safari buttons) */
button,
input {
  border-radius: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin: 0;
}

/* Text only for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding-inline: var(--gutter);
  padding-bottom: 3rem;
  padding-top: max(clamp(2.5rem, 8vw, 5rem), env(safe-area-inset-top));
}

/* Header --------------------------------------------------------------------------- */
.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  max-width: 18ch;
  text-wrap: balance;
}

/* Sections ------------------------------------------------------------------------- */
.block {
  margin-top: clamp(3rem, 8vw, 4.5rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.subtitle {
  margin-top: 0.35rem;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

.warning,
.load-error {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--ink);
  background: var(--wash);
}

/* Colour keys & legend --------------------------------------------------------------- */
.key {
  display: inline-block;
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.45rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.legend li {
  display: flex;
  align-items: center;
}

/* Federal Council panel: navigation head + the 7 seats, one element ------------- */
.council-panel {
  border: 1px solid var(--ink);
  border-top: none; /* the panel head above draws the top edge */
  /* "clip" (unlike "hidden") keeps the sticky head working */
  overflow: clip;
}

.council {
  list-style: none;
  padding: 0;
  /* Hairline grid: each card draws its right/bottom edge; the negative
     margins push the outermost edges under the panel border. */
  margin: 0 -1px -1px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.member {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  padding: 1.125rem 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar-female { background: var(--female); }
.avatar-male { background: var(--male); }

/* Portrait photo, shown as it is. The box is portrait-shaped (3:4) so
   photos need little cropping; faces are usually in the upper part. */
.portrait {
  flex: none;
  display: block;
  width: 3rem;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 20%;
  background: var(--wash); /* while loading */
}

.member-body {
  min-width: 0;
}

.member-name {
  font-weight: 600;
  line-height: 1.3;
}

.member-meta {
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.45;
}

.member-name + .member-meta {
  margin-top: 0.2rem;
}

/* Panel head: period, dates, buttons, slider. Sticks to the top of the
   screen while scrolling through the whole page. */
.panel-head {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  margin-top: 1.5rem;
  padding: 1rem 1rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--ink);
  border-bottom-color: var(--line);
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-period {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.panel-dates {
  flex: 1;
  min-width: 0;
  margin-top: 0.15rem;
  font-size: 0.875rem;
  color: var(--ink-3);
}

.nav-buttons {
  display: flex;
  gap: 0.375rem;
}

.nav-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.nav-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.nav-btn:hover:not(:disabled) {
  background: var(--ink);
  color: #fff;
}

.nav-btn:disabled {
  border-color: var(--line);
  color: var(--line);
  cursor: default;
}

/* Sliders (timeline, age in the editor): thin black track, square black
   thumb (1rem wide) */
.range {
  display: block;
  width: 100%;
  height: 1.5rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.range::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--ink);
}

.range::-moz-range-track {
  height: 2px;
  background: var(--ink);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: calc(-0.5rem + 1px);
  border: 2px solid var(--bg);
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.range::-moz-range-thumb {
  border-radius: 0; /* Firefox rounds the thumb by default */
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--bg);
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.range:focus-visible {
  outline-offset: 2px;
}

.nav-range {
  margin-top: 0.75rem;
}

/* Year labels under the slider. --at (0..1) is set in app.js; the thumb's
   centre travels from 0.5rem to (100% - 0.5rem), so the labels do too. */
.nav-ticks {
  position: relative;
  height: 1.25rem;
  font-size: 0.75rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tick {
  position: absolute;
  top: 0;
  left: calc(0.5rem + (100% - 1rem) * var(--at));
  transform: translateX(-50%);
  white-space: nowrap;
}

.tick-start {
  left: 0;
  transform: none;
}

/* Score in the head: only shown while the big number is off screen */
.nav-score {
  display: none;
  font-weight: 700;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel-head.show-score .nav-score {
  display: block;
}

/* Replacing a member --------------------------------------------------------------------- */

/* Small text buttons on the cards ("Ersetzen", "Bearbeiten", "Rückgängig") */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-button:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

.member-actions {
  display: flex;
  gap: 0.875rem;
  margin-top: 0.4rem;
}

/* A person created by the user */
.member.is-new {
  background: var(--wash);
}

.avatar-new {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Below the cards: invitation, or what has been replaced */
.panel-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* The editor */
.editor {
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--ink);
  scroll-margin-top: 11rem; /* keep it clear of the sticky panel head */
}

.editor-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  line-height: 1.2;
}

.editor-fields {
  display: grid;
  gap: 1.25rem;
}

.editor-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.editor-field legend,
.editor-label {
  padding: 0;
  font-weight: 600;
}

.editor-note {
  margin-top: 0.35rem;
  font-size: 0.9375rem;
  color: var(--ink-3);
}

/* The three ways to replace a member */
.modes {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border: 1px solid var(--ink);
}

.mode-button {
  flex: 1 1 auto;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-right: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button:hover {
  background: var(--wash);
}

.mode-button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

/* Narrow screens: the three modes stacked (the two views stay side by side) */
@media (max-width: 36rem) {
  .modes:not(.view-switch) {
    flex-direction: column;
  }

  .modes:not(.view-switch) .mode-button {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .modes:not(.view-switch) .mode-button:last-child {
    border-bottom: 0;
  }
}

/* Switch between "Ausgewählter Bundesrat" and "Verlauf seit 1848" */
.view-switch {
  margin: 1.25rem 0 0;
}

.view-switch .mode-button {
  flex: 1 1 0;
}

/* History view ------------------------------------------------------------------------ */
.history {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
}

.history .legend {
  margin-top: 1rem;
}

/* Legend key for a line: a short stroke */
.key-line {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 2px;
  margin-right: 0.45rem;
}

.key-line-strong {
  height: 3px;
}

.chart {
  position: relative;
  margin-top: 1rem;
}

.chart-svg {
  display: block;
  max-width: 100%;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.chart-label {
  fill: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-band {
  fill: var(--wash);
}

.chart-band-hover {
  fill: rgba(11, 11, 11, 0.05);
}

.chart-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot {
  stroke: var(--bg);
  stroke-width: 2;
}

/* Catches the pointer over the plot area; clicking selects a Council */
.chart-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  min-width: 12rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-size: 0.875rem;
  color: var(--ink-2);
}

.chart-tooltip-title {
  font-weight: 600;
  color: var(--ink);
}

.chart-tooltip-rows {
  display: grid;
  gap: 0.15rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.chart-tooltip-rows li {
  display: grid;
  grid-template-columns: auto 7ch 1fr; /* line key, value ("100.0 %"), label */
  align-items: center;
  gap: 0.5rem;
}

.chart-tooltip-rows strong {
  color: var(--ink);
  text-align: right;
}

.chart-tooltip-rows .key-line {
  margin-right: 0;
}

/* "Werte als Tabelle" */
.history-table {
  margin-top: 1.25rem;
  font-size: 0.875rem;
}

.history-table summary {
  cursor: pointer;
  color: var(--ink-2);
}

.table-wrap {
  max-height: 24rem;
  margin-top: 0.75rem;
  overflow: auto;
}

.history-table table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.history-table th,
.history-table td {
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.history-table th:first-child {
  text-align: left;
  font-weight: 400;
}

.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  font-weight: 600;
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.editor-fields > .link-button {
  justify-self: start;
}

/* "Aus Liste wählen": one row per person */
.person-list {
  max-height: 22rem;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.person {
  position: relative;
  display: block;
  cursor: pointer;
}

.person input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.person-text {
  display: grid;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}

.person:hover .person-text {
  background: var(--wash);
}

.person input:checked + .person-text {
  border-left-color: var(--ink);
  background: var(--wash);
}

.person input:focus-visible + .person-text {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.person-name {
  font-weight: 600;
}

.person-meta {
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* "Bestmögliche Person": the profile found */
.best-profile {
  padding: 0.875rem 1rem;
  background: var(--wash);
}

.best-variant {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.best-text {
  margin-top: 0.15rem;
  font-size: 1.125rem;
  font-weight: 600;
}

/* Options as "chips": radio buttons styled as small toggles */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.chip {
  position: relative;
  cursor: pointer;
}

/* The real radio sits invisibly on top of its label: clickable and
   keyboard-accessible (arrow keys move between options). */
.chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip > span {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover > span {
  border-color: var(--ink);
}

.chip input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.chip input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.editor-age-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.editor-age-value {
  font-variant-numeric: tabular-nums;
}

/* Live result inside the editor */
.editor-result {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.editor-result-label {
  font-weight: 600;
}

.editor-score {
  margin-top: 0.25rem;
  font-size: clamp(2.25rem, 8vw, 3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.editor-delta {
  margin-top: 0.5rem;
  font-weight: 600;
}

.editor-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.editor-actions {
  margin-top: 1.25rem;
}

/* Main button: black, white text */
.button {
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  background: var(--ink-2);
}

/* Score -------------------------------------------------------------------------------- */
.score {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
}

.score-label {
  font-weight: 600;
}

/* Title with "Was bedeutet das?" and its explanation box */
.score-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.875rem;
}

/* Round "i" icon button; the hit area (2rem) is larger than the icon */
.info-button {
  display: inline-grid;
  place-items: center;
  align-self: center;
  width: 2rem;
  height: 2rem;
  margin: -0.375rem 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.info-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.info-button:hover,
.info-button[aria-expanded="true"] {
  color: var(--ink);
}

.info-box {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 6;
  display: grid;
  gap: 0.6rem;
  width: min(28rem, 100%);
  padding: 0.875rem 1rem;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* Invisible bridge over the gap between button and box, so the box stays
   open while the mouse moves from one to the other */
.info-box::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.75rem;
}

.info-title {
  font-weight: 600;
  color: var(--ink);
}

.info-rows {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.info-sum {
  font-weight: 600;
  color: var(--ink);
}

.info-method {
  color: var(--ink-3);
}

.score-value {
  font-size: clamp(4rem, 17vw, 8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums; /* no jitter while the number counts */
}

.score-caption {
  font-size: 0.9375rem;
  color: var(--ink-3);
}

/* Comparison sections (gender, party, language, age) ------------------------------- */
.comparison {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.comparison-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.comparison h3 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  line-height: 1.2;
}

.comparison-score {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.comparison-note {
  font-size: 0.9375rem;
  color: var(--ink-3);
}

.comparison-note:empty {
  display: none;
}

/* No data for this time: only the note is shown */
.comparison.is-unavailable .legend,
.comparison.is-unavailable .bars {
  display: none;
}

.comparison .legend {
  margin-top: 0.75rem;
}

/* Comparison bars --------------------------------------------------------------------- */
.bars {
  margin-top: 1.25rem;
  display: grid;
  gap: 1.75rem;
}

.bar-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.5rem;
}

.bar-name {
  font-weight: 600;
}

.bar-values {
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.bar {
  display: flex;
  gap: 2px;                 /* white gap between segments */
  height: 1.5rem;           /* 24px */
}

.seg {
  flex-basis: 0;            /* width comes from flex-grow = share */
  min-width: 2px;
  cursor: default;
  transition: flex-grow 0.6s var(--ease), opacity 0.15s;
}


.bar:hover .seg:not(:hover) {
  opacity: 0.55;            /* the hovered segment stands out */
}

/* Tooltip ------------------------------------------------------------------------------ */
.tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  display: grid;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-size: 0.875rem;
  color: var(--ink-2);
  max-width: 20rem;
}

.tooltip strong {
  font-size: 1.125rem;
  color: var(--ink);
}

.tooltip-detail {
  color: var(--ink-3);
}

.tooltip-detail:empty {
  display: none;
}

/* Names of the Council members in a segment, in one line */
.tooltip-names {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

/* What a grouped segment contains ("Übrige Parteien", "Andere Sprachen") */
.tooltip-breakdown {
  list-style: none;
  margin: 0.4rem 0 0.2rem;
  padding: 0.4rem 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.1rem;
  font-variant-numeric: tabular-nums;
}

.tooltip-breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Footer ------------------------------------------------------------------------------- */
.footer {
  margin-top: clamp(4rem, 12vw, 6rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-3);
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-title {
  font-size: 0.875rem;
  letter-spacing: 0;
  color: var(--ink-2);
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.25rem;
}

/* Picture credits: collapsed by default */
.credits {
  margin-top: 1rem;
}

.credits summary {
  cursor: pointer;
  color: var(--ink-2);
}

.credits ul {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

/* Small screens --------------------------------------------------------------------------- */
@media (max-width: 30rem) {
  .member {
    padding: 0.875rem;
  }
}

/* Motion ---------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .seg,
  .nav-btn,
  .chip > span,
  .mode-button {
    transition: none;
  }
}
