/* ==========================================================================
   Vehicle Explorer: design system
   --------------------------------------------------------------------------
   1. Tokens (light, dark)      6. Controls (buttons, segmented, tabs, chips)
   2. Base and reset            7. Feedback (tooltip, toast, skeleton, states)
   3. Layout primitives         8. Drawer, tables
   4. Site chrome               9. Charts
   5. Cards, stats, plates     10. Page-level blocks (explore, home, prose)

   Rules of the system
   - One accent (Swiss red): brand mark, primary actions, the current selection.
   - Chrome is neutral grey. Data is blue unless it encodes identity.
   - Every colour is a token; charts read the same tokens, so both themes work.
   - Figures use tabular numbers (class .num or the component's own value class).
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* surfaces and ink */
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f6f6f3;
  --surface-3: #ecece8;
  --border: #e2e2dc;
  --border-strong: #c8c8c0;
  --border-control: #8a8c92;
  --text: #17181a;
  --text-2: #4d5056;
  --text-3: #686b71;
  --overlay: rgba(18, 19, 21, 0.45);

  /* accent: derived from Swiss red */
  --accent: #d8232a;
  --accent-strong: #b81d24;
  --accent-text: #c81e25;
  --accent-soft: #fdeceb;
  --accent-ink: #ffffff;
  --focus: #17181a;

  /* status (always paired with an icon and a label) */
  --good: #0a7d0a;
  --warn: #9a6400;
  --bad: #c62f2f;

  /* data: categorical series, fixed order, never cycled */
  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #6250d6; /* violet */
  --series-8: #e34948; /* red */
  --series-other: #9a9891;

  /* data: single series, emphasis and chart furniture */
  --data: var(--series-1);
  --data-dim: #cdd5df;
  --data-sel: var(--accent);
  --grid: #e9e8e2;
  --axis: #c3c2b7;

  /* number plates */
  --plate-bg: #ffffff;
  --plate-ink: #111214;
  --plate-border: #1d1e21;

  /* shape, depth */
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(20, 21, 23, 0.07), 0 1px 1px rgba(20, 21, 23, 0.04);
  --shadow-2: 0 10px 30px rgba(20, 21, 23, 0.12), 0 2px 8px rgba(20, 21, 23, 0.07);

  /* spacing scale (4 px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-plate: "Avenir Next Condensed", "Bahnschrift", "Roboto Condensed", "sans-serif-condensed",
    "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --fs-xs: 0.75rem;
  --fs-s: 0.8125rem;
  --fs-m: 0.9375rem;
  --fs-l: 1.0625rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.6rem, 1.1rem + 2.2vw, 2.5rem);
  --fs-hero: clamp(2.6rem, 1.4rem + 6vw, 4.75rem);

  /* layout */
  --topbar-h: 56px;
  --container: 1360px;
  --gutter: clamp(16px, 4vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f11;
    --surface: #17181b;
    --surface-2: #1e2023;
    --surface-3: #282a2e;
    --border: #2b2d31;
    --border-strong: #42454b;
    --border-control: #70737a;
    --text: #f1f1ee;
    --text-2: #c2c3c0;
    --text-3: #9a9c9f;
    --overlay: rgba(0, 0, 0, 0.6);
    --accent: #d8232a;
    --accent-strong: #e5383b;
    --accent-text: #ff6b66;
    --accent-soft: #3a1b1c;
    --accent-ink: #ffffff;
    --focus: #f1f1ee;
    --good: #2fb52f;
    --warn: #fab219;
    --bad: #f0706b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #0ca30c;
    --series-7: #9085e9;
    --series-8: #e66767;
    --series-other: #77766f;
    --data-dim: #3a3d44;
    --grid: #26282c;
    --axis: #3d4046;
    --plate-bg: #e6e6e1;
    --plate-ink: #111214;
    --plate-border: #e6e6e1;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #17181b;
  --surface-2: #1e2023;
  --surface-3: #282a2e;
  --border: #2b2d31;
  --border-strong: #42454b;
  --border-control: #70737a;
  --text: #f1f1ee;
  --text-2: #c2c3c0;
  --text-3: #9a9c9f;
  --overlay: rgba(0, 0, 0, 0.6);
  --accent: #d8232a;
  --accent-strong: #e5383b;
  --accent-text: #ff6b66;
  --accent-soft: #3a1b1c;
  --accent-ink: #ffffff;
  --focus: #f1f1ee;
  --good: #2fb52f;
  --warn: #fab219;
  --bad: #f0706b;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #0ca30c;
  --series-7: #9085e9;
  --series-8: #e66767;
  --series-other: #77766f;
  --data-dim: #3a3d44;
  --grid: #26282c;
  --axis: #3d4046;
  --plate-bg: #e6e6e1;
  --plate-ink: #111214;
  --plate-border: #e6e6e1;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* 2. Base and reset -------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + var(--s-4));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
}

main:focus {
  outline: none;
}

h1,
h2,
h3,
h4,
p,
figure,
dl,
dd,
ol,
ul {
  margin: 0;
}

ol[class],
ul[class] {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

/* long German compounds ("Inverkehrsetzung", "Personenwagen") must never push a layout wider:
   headings and labels may break inside a word, hyphenated by the language in <html lang> */
h1,
h2,
h3,
.card__title,
.stat__label,
.state__title,
.headline__label {
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 10 4 4;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

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

/* utilities */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Scroll containers are the containing block of what they hold: visually hidden helper texts
   (absolutely positioned) then scroll and clip with them instead of widening the page. */
.table-wrap,
.segmented,
.tabs,
.filterbar__chips .chips {
  position: relative;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
}

.nowrap {
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--s-3);
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-s);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--s-3);
}

/* 3. Layout primitives ----------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: 820px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.stack--lg {
  gap: var(--s-6);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}

.section {
  margin-top: var(--s-6);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-4);
  margin-bottom: var(--s-3);
}

.section__title {
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section__note {
  font-size: var(--fs-s);
  color: var(--text-3);
}

/* responsive card grid: cards flow, no holes when one is hidden */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--s-4);
  align-items: start;
}

@media (min-width: 760px) {
  .card--wide {
    grid-column: span 2;
  }
}

.split {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 1100px) {
  .split {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}

/* 4. Site chrome ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--text);
  font-size: var(--fs-l);
  font-weight: 700;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
}

.brand__mark {
  width: 30px;
  height: 22px;
  flex: none;
}

.brand__name span {
  font-weight: 450;
  color: var(--text-2);
}

.topbar__collapse {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex: 1 1 auto;
  min-width: 0;
}

.topbar__collapse > .search {
  margin-left: auto;
  width: min(280px, 100%);
}

/* two classes: .iconbtn (defined further down) sets a display of its own */
.iconbtn.topbar__menu {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav__link {
  position: relative;
  padding: 7px 10px;
  border-radius: var(--r-s);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.nav__link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav__link[aria-current="page"] {
  color: var(--text);
}

.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -11px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.theme-toggle .icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon--sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon--moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon--sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon--moon {
    display: none;
  }
}

/* language switch: "DE | EN" next to the theme toggle, visible at every width */

.langswitch {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 1px;
}

.langswitch__opt {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--r-s);
  color: var(--text-3);
  font-size: var(--fs-s);
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
}

.langswitch__opt:hover {
  background: var(--surface-3);
  color: var(--text);
}

.langswitch__opt[aria-current="true"] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.langswitch__opt:focus-visible {
  outline-offset: 0;
}

.langswitch__sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

@media (pointer: coarse) {
  .langswitch__opt {
    min-width: 40px;
    height: 44px;
  }
}

/* Below 1024 px the navigation and the search live in the menu panel. The longest navigation
   (German) needs about 980 px next to the brand, the language switch and the theme toggle. */
@media (max-width: 1023px) {
  .topbar__inner {
    gap: var(--s-2);
  }

  .langswitch {
    order: 2;
    margin-left: auto;
  }

  .iconbtn.topbar__menu {
    display: inline-grid;
    order: 3;
  }

  .theme-toggle {
    order: 2;
  }

  .topbar__collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
    max-height: calc(100vh - var(--topbar-h));
    max-height: calc(100dvh - var(--topbar-h));
    overflow: auto;
    padding: var(--s-3) var(--gutter) var(--s-4);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-2);
  }

  .topbar__collapse.is-open {
    display: flex;
  }

  .topbar__collapse > .search {
    order: -1;
    width: 100%;
    margin: 0;
  }

  /* inside the scrolling menu panel the suggestions sit in the flow */
  .topbar__collapse .search {
    flex-wrap: wrap;
  }

  .topbar__collapse .search__list {
    position: static;
    width: 100%;
    margin-top: var(--s-2);
    box-shadow: none;
  }

  .nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav__link {
    padding: 12px;
    font-size: 1rem;
  }

  .nav__link[aria-current="page"]::after {
    left: 0;
    right: auto;
    top: 10px;
    bottom: 10px;
    width: 3px;
    height: auto;
  }
}

/* narrow phones: the brand name takes two short lines so the language switch, the theme toggle
   and the menu button still fit next to it */
@media (max-width: 400px) {
  .topbar__inner {
    gap: 6px;
  }

  .brand {
    gap: 8px;
    font-size: 0.9375rem;
  }

  .brand__name {
    line-height: 1.05;
  }

  .brand__name span {
    display: block;
  }
}

/* Wide layout: the search takes the room the navigation leaves (up to 280 px). Where that is too
   little for a field it shrinks to its icon and opens over the navigation while it has focus. */
@media (min-width: 1024px) {
  .topbar__collapse {
    position: relative;
  }

  .topbar__collapse > .search {
    flex: 1 1 0;
    width: auto;
    min-width: 36px;
    max-width: 280px;
    container: topsearch / inline-size;
  }

  .topbar__collapse > .search:focus-within {
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 2;
    width: 280px;
    transform: translateY(-50%);
  }
}

@container topsearch (max-width: 169px) {
  .search--compact .search__input {
    width: 36px;
    margin-left: auto;
    padding: 0;
    cursor: pointer;
  }

  .search--compact .search__input::placeholder {
    color: transparent;
  }

  .search--compact .search__icon {
    left: auto;
    right: 10px;
  }
}

/* on the Explore page the filter bar carries the search */
@media (min-width: 940px) {
  body[data-page="explore"] .topbar__collapse > .search {
    display: none;
  }
}

.footer {
  margin-top: var(--s-8);
  padding-block: var(--s-5);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-s);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
}

/* search box with suggestions (ui.js mountSearch) */

.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search__icon {
  position: absolute;
  left: 11px;
  top: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.search__input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  appearance: none;
  -webkit-appearance: none;
}

.search__input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.search__input:focus-visible {
  outline-offset: 1px;
}

.search--lg .search__input {
  height: 48px;
  padding-left: 44px;
  border-radius: var(--r-m);
  font-size: var(--fs-l);
}

.search--lg .search__icon {
  left: 14px;
  top: 14px;
  width: 20px;
  height: 20px;
}

.search--hero .search__input {
  height: 58px;
  padding-left: 52px;
  border-radius: var(--r-l);
  font-size: 1.1875rem;
  box-shadow: var(--shadow-1);
}

.search--hero .search__icon {
  left: 18px;
  top: 18px;
  width: 22px;
  height: 22px;
}

@media (pointer: coarse) {
  /* 16 px keeps iOS from zooming the page on focus */
  .search__input {
    font-size: 1rem;
  }
}

.search__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  min-width: min(300px, calc(100vw - 2 * var(--gutter)));
  max-height: min(60vh, 460px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-2);
  text-align: left;
}

.search--compact .search__list {
  left: auto;
  width: min(380px, calc(100vw - 2 * var(--gutter)));
}

.search__group + .search__group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.search__group-label {
  padding: 6px 10px 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 8px 10px;
  border-radius: var(--r-s);
  cursor: pointer;
}

.search__option:hover,
.search__option[aria-selected="true"] {
  background: var(--surface-3);
}

.search__option-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.search__option-ctx {
  margin-right: 6px;
  color: var(--text-3);
}

.search__option-n {
  flex: none;
  color: var(--text-3);
  font-size: 0.875em;
  font-variant-numeric: tabular-nums;
}

.search__status {
  padding: 10px;
  color: var(--text-3);
  font-size: 0.9rem;
}

/* 5. Cards, stats, plates -------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2) var(--s-3);
  min-height: 28px;
}

.card__heading {
  min-width: 0;
}

.card__title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.card__sub {
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-s);
}

.card__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  min-width: 0; /* a wide control scrolls inside itself instead of widening the card */
  max-width: 100%;
  margin-left: auto;
}

.card__body {
  min-width: 0;
  container-type: inline-size;
  transition: opacity 0.18s ease;
}

.card.is-refreshing .card__body,
.card.is-waiting .card__body {
  opacity: 0.5;
}

.card__note {
  color: var(--text-3);
  font-size: var(--fs-s);
}

a.card {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

a.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}

/* stat tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: var(--s-3);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
}

.stat__label {
  order: -1;
  min-width: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat__unit {
  margin-left: 2px;
  color: var(--text-2);
  font-size: 0.6em;
  font-weight: 600;
  letter-spacing: 0;
}

.stat__sub {
  min-height: 1.5em;
  color: var(--text-2);
  font-size: var(--fs-s);
  overflow-wrap: anywhere;
}

.stat.is-muted .stat__value {
  color: var(--text-3);
}

/* the one number a page leads with */

.headline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.headline__number {
  font-size: var(--fs-hero);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.headline__label {
  color: var(--text-2);
  font-size: var(--fs-l);
}

/* Swiss number plates: the recurring motif for canton codes */

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 2.2em;
  padding: 0.14em 0.42em 0.1em;
  border: 1.5px solid var(--plate-border);
  border-radius: 0.3em;
  background: var(--plate-bg);
  color: var(--plate-ink);
  font-family: var(--font-plate);
  font-size: 0.875rem;
  font-stretch: condensed;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-decoration: none;
  text-transform: uppercase;
  vertical-align: 0.05em;
  white-space: nowrap;
}

.plate--sm {
  font-size: 0.75rem;
  border-width: 1px;
}

.plate--lg {
  font-size: 1.5rem;
  border-width: 2px;
}

.plate--xl {
  font-size: clamp(2rem, 6vw, 3rem);
  border-width: 3px;
}

/* 6. Controls -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  background: var(--surface-3);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn--sm {
  min-height: 28px;
  padding: 0 10px;
  font-size: var(--fs-s);
}

.btn--lg {
  min-height: 46px;
  padding: 0 20px;
  font-size: 1rem;
}

/* phones: a long label (German compounds, canton names) takes a second line */
@media (max-width: 480px) {
  .btn {
    padding-block: 6px;
    text-align: center;
    white-space: normal;
  }
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.iconbtn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.iconbtn svg {
  width: 18px;
  height: 18px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.4em;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }

  .btn--sm {
    min-height: 36px;
  }

  .iconbtn {
    width: 44px;
    height: 44px;
  }
}

/* segmented control (ui.js segmented): one of several, radio semantics */

.segmented {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: var(--r-m);
  background: var(--surface-3);
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented__opt {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: calc(var(--r-m) - 3px);
  background: transparent;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.segmented__opt:hover {
  color: var(--text);
}

.segmented__opt[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

.segmented--accent .segmented__opt[aria-checked="true"] {
  box-shadow: var(--shadow-1), inset 0 -2px 0 var(--accent);
}

.segmented__opt[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

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

.segmented__n {
  color: var(--text-3);
  font-size: 0.8em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.segmented--sm .segmented__opt {
  min-height: 26px;
  padding: 0 9px;
  font-size: var(--fs-s);
}

/* tabs (ui.js mountTabs) */

.tabs {
  display: flex;
  gap: var(--s-5);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: none;
  margin-bottom: -1px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.tabpanel {
  padding-top: var(--s-4);
}

/* removable filter chips (ui.js renderChips) */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  padding: 0 4px 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--fs-s);
  line-height: 1.2;
  white-space: nowrap;
}

.chip__dim {
  overflow: hidden;
  min-width: 0;
  flex: 0 1 auto;
  color: var(--text-2);
  text-overflow: ellipsis;
}

.chip__label {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  max-width: 28ch;
  font-weight: 650;
  text-overflow: ellipsis;
}

.chip__remove {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.chip__remove:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.chip__remove svg {
  width: 12px;
  height: 12px;
}

.chip--static {
  padding-right: 10px;
  background: var(--surface-3);
}

/* 7. Feedback -------------------------------------------------------------- */

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  max-width: min(320px, calc(100vw - 16px));
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-s);
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.tooltip.is-visible {
  opacity: 1;
}

.tooltip__title {
  margin-bottom: 2px;
  color: var(--text-2);
  font-weight: 600;
}

.tooltip__row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.tooltip__key {
  align-self: center;
  flex: none;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: var(--key, var(--data));
}

.tooltip__val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tooltip__name {
  color: var(--text-2);
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-m);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-2);
  font-size: 0.9rem;
  font-weight: 550;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

.toast svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.toast__action {
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.skeleton {
  display: block;
  border-radius: var(--r-s);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton--text {
  width: 60%;
  height: 0.85em;
  margin: 0.4em 0;
}

.skeleton--row {
  height: 30px;
  margin-bottom: 8px;
}

.skeleton--block {
  height: 180px;
}

.skeleton--map {
  aspect-ratio: 1000 / 641; /* the map's own proportions, so nothing jumps when it arrives */
}

@keyframes shimmer {
  from {
    background-position: 100% 50%;
  }

  to {
    background-position: 0 50%;
  }
}

/* empty and error states (ui.js stateBlock) */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-6) var(--s-4);
  color: var(--text-2);
  text-align: center;
}

.state__icon {
  width: 40px;
  height: 40px;
  color: var(--text-3);
}

.state__title {
  color: var(--text);
  font-size: var(--fs-l);
  font-weight: 650;
}

.state__text {
  max-width: 48ch;
}

.state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.state--error .state__icon {
  color: var(--bad);
}

.state--compact {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-2) var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-m);
  background: var(--surface-2);
  font-size: var(--fs-s);
  text-align: left;
}

.state--compact .state__icon {
  width: 18px;
  height: 18px;
}

.state--compact .state__title {
  font-size: inherit;
}

.state--compact .state__actions {
  margin: 0 0 0 auto;
}

/* 8. Drawer, tables -------------------------------------------------------- */

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(420px, 100vw);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
}

.drawer[open] {
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.2s ease-out;
}

.drawer::backdrop {
  background: var(--overlay);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--border);
}

.drawer__title {
  font-size: var(--fs-l);
  font-weight: 650;
}

.drawer__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--s-5);
  overflow: auto;
  padding: var(--s-4);
}

.drawer__foot {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.drawer__foot .btn {
  flex: 1;
  min-width: 0;
  white-space: normal;
  text-align: center;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

.table-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table .num {
  text-align: right;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* 9. Charts (charts.js) ---------------------------------------------------- */

.chart {
  position: relative;
  min-width: 0;
  margin: 0;
}

.chart__plot {
  position: relative;
  border-radius: 4px;
}

.chart__plot:focus-visible {
  outline-offset: 4px;
}

.chart__svg {
  display: block;
  width: 100%;
  overflow: visible;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.chart text {
  fill: var(--text-3);
  font-family: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart__gridline {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart__baseline {
  stroke: var(--axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart__col {
  fill: var(--data);
  transition: fill 0.12s ease;
}

.chart__col.is-dim {
  fill: var(--data-dim);
}

.chart__col.is-sel {
  fill: var(--data-sel);
}

.chart__band {
  fill: var(--accent);
  opacity: 0.07;
}

.chart__brush {
  fill: var(--accent);
  opacity: 0.16;
}

.chart__cursor {
  fill: var(--text);
  opacity: 0.07;
  pointer-events: none;
}

.chart__crosshair {
  stroke: var(--text-3);
  stroke-width: 1;
  shape-rendering: crispEdges;
  pointer-events: none;
}

.chart__line {
  fill: none;
  stroke: var(--series, var(--data));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__area {
  fill: var(--series, var(--data));
  opacity: 0.1;
}

.chart__dot {
  fill: var(--series, var(--data));
  stroke: var(--surface);
  stroke-width: 2;
}

.chart__seg {
  fill: var(--series, var(--data));
}

.chart text.chart__endlabel {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.chart__leader {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart text.chart__striplabel {
  fill: var(--text-2);
  font-weight: 600;
}

.chart__hit {
  fill: transparent;
  cursor: crosshair;
}

.chart--static .chart__hit {
  cursor: default;
}

.chart__hint {
  margin-top: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-s);
}

.chart__empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--text-3);
  font-size: var(--fs-s);
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 var(--s-2);
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: var(--fs-s);
}

.legend--below {
  margin: var(--s-2) 0 0;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.legend__swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch, var(--data));
}

.legend__swatch--line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.legend__value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.swatch {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--swatch, var(--series-other));
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.55);
}

.swatch--square {
  border-radius: 3px;
  box-shadow: none;
}

/* ranked bar list */

.barlist {
  min-width: 0;
}

.barlist__rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 calc(-1 * var(--s-2));
}

.barlist__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 3.4em;
  grid-template-areas: "label value share" "bar bar bar";
  align-items: baseline;
  gap: 4px 10px;
  width: 100%;
  padding: 6px var(--s-2) 7px;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
}

.barlist--noshare .barlist__row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label value" "bar bar";
}

button.barlist__row,
a.barlist__row {
  cursor: pointer;
}

button.barlist__row:hover,
a.barlist__row:hover {
  background: var(--surface-2);
}

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

.barlist__label {
  grid-area: label;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.barlist__rank {
  flex: none;
  min-width: 1.4em;
  color: var(--text-3);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

.barlist__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.barlist__sub {
  flex: none;
  color: var(--text-3);
  font-size: 0.85em;
  white-space: nowrap;
}

.barlist__value {
  grid-area: value;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.barlist__share {
  grid-area: share;
  color: var(--text-3);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.barlist__bar {
  grid-area: bar;
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 0 3px 3px 0;
  background: var(--surface-3);
}

.barlist__fill {
  display: block;
  width: 0;
  min-width: 1px;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: var(--bar, var(--data));
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.15s ease;
}

.barlist.has-selection .barlist__fill {
  background: var(--data-dim);
}

.barlist__row[aria-pressed="true"] {
  background: var(--accent-soft);
}

.barlist__row[aria-pressed="true"] .barlist__name {
  font-weight: 700;
}

.barlist.has-selection .barlist__row[aria-pressed="true"] .barlist__fill {
  background: var(--data-sel);
}

.barlist__check {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--accent-text);
}

.barlist__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.barlist__empty {
  padding: var(--s-4) 0;
  color: var(--text-3);
  font-size: var(--fs-s);
}

/* Canton map (static/js/core/cantonmap.js): Switzerland by canton with numbers on the map. */

.cmap {
  display: grid;
  gap: var(--s-3);
  min-width: 0;
}

.cmap__stage {
  position: relative;
  width: 100%;
  max-width: 880px; /* beyond this the numbers would look lost in the shapes */
  margin-inline: auto;
}

.cmap__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible; /* outside labels may reach into the card padding */
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.cmap__canton {
  outline: none; /* focus is drawn along the canton outline (.cmap__mark--focus) */
}

.cmap--interactive .cmap__canton,
.cmap--interactive .cmap__hit,
.cmap--interactive .cmap__callout {
  cursor: pointer;
}

.cmap__shape {
  fill: var(--surface-3); /* no data */
  stroke: var(--surface);
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 180ms ease;
}

/* Liechtenstein is on the map but is not a canton */
.cmap__shape--fl {
  stroke: var(--text-3);
  stroke-dasharray: 3 2;
}

.cmap__mark {
  fill: none;
  pointer-events: none;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.cmap__mark--selected {
  stroke: var(--data-sel);
  stroke-width: 2.5px;
}

.cmap__mark--hover {
  stroke: var(--text);
  stroke-width: 1.75px;
}

.cmap__mark--focus {
  stroke: var(--focus);
  stroke-width: 3px;
}

.cmap__label {
  pointer-events: none;
  font-family: var(--font);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
}

.cmap__label--code {
  font-weight: 650;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.cmap__callout {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  dominant-baseline: central;
  fill: var(--text);
}

.cmap__callout-code {
  font-weight: 650;
  letter-spacing: 0.05em;
  fill: var(--text-2);
}

.cmap__callout-value {
  font-weight: 700;
}

.cmap__leader {
  stroke: var(--text-3);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.cmap__leader-dot {
  fill: var(--text-2);
  pointer-events: none;
}

.cmap__hit {
  fill: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .cmap__shape {
    transition: none;
  }
}

.scale {
  display: grid;
  gap: 3px;
  width: min(100%, 260px);
  margin-top: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.scale__title {
  color: var(--text-2);
}

.scale__bar {
  height: 8px;
  border-radius: 4px;
}

.scale__ticks {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

/* stacked share bar */

.sharebar {
  min-width: 0;
}

.sharebar__track {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 28px;
}

.sharebar__seg {
  display: flex;
  align-items: center;
  flex: var(--v, 1) 1 0;
  min-width: 2px;
  overflow: hidden; /* a label that does not fit must not widen the page */
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--seg, var(--data));
  color: var(--seg-ink, #ffffff);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: flex-grow 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

button.sharebar__seg {
  cursor: pointer;
}

.sharebar__seg:hover {
  filter: brightness(1.08);
}

.sharebar__seg-label {
  padding-inline: 7px;
}

.sharebar__seg-label.is-clipped {
  visibility: hidden;
}

.sharebar--thin .sharebar__track {
  height: 8px;
}

.sharebar--thin .sharebar__seg {
  border-radius: 0;
}

.sharebar--thin .sharebar__seg:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.sharebar--thin .sharebar__seg:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.sharebar .legend {
  margin: var(--s-2) 0 0;
}

.spark {
  display: inline-block;
  vertical-align: middle;
}

.spark__line {
  fill: none;
  stroke: var(--series, var(--text-3));
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spark__area {
  fill: var(--series, var(--text-3));
  opacity: 0.1;
}

.spark__dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1.5;
}

/* 10. Page-level blocks ---------------------------------------------------- */

.eyebrow {
  color: var(--accent-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* long titles and buttons wrap instead of widening the page */
  gap: var(--s-4) var(--s-6);
  padding-block: var(--s-6) var(--s-4);
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 750;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 68ch;
  margin-top: var(--s-2);
  color: var(--text-2);
  font-size: var(--fs-l);
}

@media (min-width: 900px) {
  .page-head--split {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .page-head--split .headline {
    align-items: flex-end;
    text-align: right;
  }
}

/* Explore: sticky filter bar */

.filterbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  margin-top: var(--s-4);
  padding-block: 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-block: 1px solid var(--border);
}

.filterbar__inner {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr) auto;
  grid-template-areas: "search cat cat" "chips chips actions";
  align-items: center;
  gap: var(--s-2) var(--s-3);
}

.filterbar__search {
  grid-area: search;
  display: flex;
  gap: var(--s-2);
  min-width: 0;
}

.filterbar__search .search {
  flex: 1 1 auto;
}

.filterbar .search--lg .search__input {
  height: 40px;
  padding-left: 38px;
  font-size: 0.9375rem;
}

.filterbar .search--lg .search__icon {
  left: 12px;
  top: 11px;
  width: 18px;
  height: 18px;
}

.filterbar__open {
  display: none;
}

/* The slot and the panel are layout-transparent: the category control and the actions are placed
   directly on the filter bar grid. In the drawer the same panel node becomes a plain column. */
.filterbar__slot,
.filterbar__panel {
  display: contents;
}

.filterbar__cat {
  grid-area: cat;
  display: flex;
  min-width: 0;
}

.filterbar__cat .segmented {
  flex: 0 1 auto;
  min-width: 0;
}

.filterbar__group-label {
  display: none;
}

.filterbar__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.filterbar__chips {
  grid-area: chips;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 28px;
}

.filterbar__chips .chips {
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filterbar__chips .chips::-webkit-scrollbar {
  display: none;
}

.filterbar__hint {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-s);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 939px) {
  .filterbar__inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "search" "chips";
  }

  .filterbar__open {
    display: inline-flex;
  }

  /* on small screens the panel lives in the drawer (explore.js moves the node) */
  .filterbar__slot {
    display: none;
  }
}

.drawer .filterbar__panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.drawer .filterbar__cat {
  flex-direction: column;
  gap: var(--s-2);
}

.drawer .filterbar__group-label {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer .filterbar__cat .filterbar__group-label {
  margin-bottom: 0;
}

.drawer .segmented {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.drawer .segmented__opt {
  justify-content: space-between;
  min-height: 44px;
}

.drawer .filterbar__actions {
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-2);
}

.drawer .filterbar__actions .btn {
  justify-content: flex-start;
  min-height: 44px;
  border-color: var(--border-control);
}

.drawer .chips {
  flex-wrap: wrap;
}

body[data-page="explore"] {
  scroll-padding-top: calc(var(--topbar-h) + 80px);
}

.results {
  transition: opacity 0.18s ease;
}

.results-banner {
  margin-top: var(--s-4);
}

/* Explore: the "Where" card spans the page: the map of Switzerland beside the ranked list of
   cantons when there is room, above it otherwise. The map gets the larger share so that the
   numbers fit into the cantons. */

.where {
  display: grid;
  gap: var(--s-4) var(--s-6);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@container (min-width: 760px) {
  .where {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    align-items: center;
  }
}

.fuelmix {
  display: grid;
  gap: var(--s-3);
}

/* Home */

.hero {
  padding-block: clamp(32px, 7vw, 88px) var(--s-6);
}

.hero__title {
  max-width: 18ch;
  font-size: clamp(2.2rem, 1.2rem + 5vw, 4.25rem);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.hero__title em {
  color: var(--accent-text);
  font-style: normal;
}

.hero__lead {
  max-width: 56ch;
  margin-top: var(--s-4);
  color: var(--text-2);
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem);
}

.hero__search {
  max-width: 640px;
  margin-top: var(--s-5);
}

.hero__hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-s);
}

.pill-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-s);
  font-weight: 600;
  text-decoration: none;
}

.pill-link:hover {
  border-color: var(--text-3);
  background: var(--surface-2);
}

.teaser {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  height: 100%;
}

.teaser__value {
  font-size: var(--fs-2xl);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.teaser__text {
  color: var(--text-2);
}

.teaser__more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: var(--s-2);
  color: var(--accent-text);
  font-size: var(--fs-s);
  font-weight: 650;
}

.teaser__more svg {
  width: 14px;
  height: 14px;
}

/* long-form text (About) */

.prose {
  max-width: 70ch;
}

.prose > * + * {
  margin-top: var(--s-4);
}

.prose h2 {
  margin-top: var(--s-7);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.prose h3 {
  margin-top: var(--s-5);
  font-size: var(--fs-l);
  font-weight: 650;
}

.prose p,
.prose li {
  color: var(--text-2);
  font-size: var(--fs-l);
  line-height: 1.6;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: var(--s-2);
}

.prose strong {
  color: var(--text);
}

.prose a {
  color: var(--accent-text);
  text-decoration-color: currentColor;
}

.factlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
}

.callout {
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-m);
  background: var(--surface);
}

.callout > * + * {
  margin-top: var(--s-2);
}
