/* simczech.cz, round 2: the look of the election site (v2-release: home.css, layouts/karty.css, footer.css,
   signup.css): one typeface, the page's plate by day and black with neutral greys by night, grey and black
   rounded panels, pill controls. The first screen is a glass box over the panelák photo (day / night). */

@font-face {
  font-family: Archivo;
  src: url('/s/fonts/archivo-wght-1.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f7f5;
  --ink: #1b191f;
  --muted: #59575b;
  --subtle: #747376;
  --surface-2: #ebebe8;
  --line: #d6d6d2;
  --line-soft: #e4e4e0;
  --card: #e4e4e2;
  --float: #f7f7f5;
  --field: #ffffff;
  --glass-fill: rgba(247, 247, 245, 0.5);
  --glass-edge: rgba(255, 255, 255, 0.8);
  --glass-inner: rgba(240, 242, 237, 0.88);
  --glass-bar: rgba(247, 247, 245, 0.84);
  --glass-shadow: 0 10px 30px rgba(22, 27, 28, 0.14);
  --float-shadow: 0 6px 22px rgba(22, 27, 28, 0.14);
  --gutter: clamp(20px, 3.2vw, 40px);
  --top-pad: max(16px, env(safe-area-inset-top));
  --header-h: calc(64px + var(--top-pad));
  --radius: 20px;
  --radius-small: 14px;
  --page-max: 1360px;
  font-family: Archivo, Arial, sans-serif;
  font-synthesis: none;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #000;
  --ink: #f7f7f5;
  --muted: #b3b3b1;
  --subtle: #8c8c8a;
  --surface-2: #1c1c1c;
  --line: #333;
  --line-soft: #242424;
  --card: #1c1c1c;
  --float: #141414;
  --field: #1c1c1c;
  --glass-fill: rgba(24, 24, 24, 0.55);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-inner: rgba(8, 8, 8, 0.84);
  --glass-bar: rgba(16, 16, 16, 0.82);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --float-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

@media (max-width: 959px) {
  :root {
    --top-pad: max(10px, env(safe-area-inset-top));
    --header-h: calc(56px + var(--top-pad));
  }
}

@media (max-width: 599px) {
  :root {
    --gutter: 16px;
    --radius: 16px;
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

h1,
h2,
h3 {
  font-weight: 480;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

b,
strong {
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

svg {
  display: block;
  flex: none;
}

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

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

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus {
  top: 12px;
}

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

/* ---------- header: the wordmark and the menu in one bar; a phone keeps a plain full-width header ---------- */

.top {
  position: relative;
  z-index: 20;
  height: var(--header-h);
  padding-top: var(--top-pad);
  background: var(--bg);
}

.top-inner {
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.wordmark {
  display: block;
  flex: none;
  width: 140px;
  aspect-ratio: 253.32 / 43.52;
  background: currentColor;
  color: var(--ink);
  -webkit-mask: url('/s/wordmark-ink.svg') center / 100% 100% no-repeat;
  mask: url('/s/wordmark-ink.svg') center / 100% 100% no-repeat;
}

.pills {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.pills a {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 520;
  white-space: nowrap;
}

.pills a[aria-current='page'] {
  background: var(--ink);
  color: var(--bg);
}

@media (hover: hover) {
  .pills a:not([aria-current='page']):hover {
    color: var(--ink);
  }
}

/* desktop: a rounded bar as wide as the content column; on the home page as wide as the glass box,
   standing on the photo like the box itself */
@media (min-width: 721px) {
  :root {
    --top-pad: max(14px, env(safe-area-inset-top));
    --header-h: calc(var(--top-pad) + 60px);
  }

  .top {
    background: transparent;
  }

  .top-bar {
    height: 60px;
    padding: 0 10px 0 24px;
    border-radius: var(--radius);
    background: var(--card);
  }

  .top-bar .pills {
    background: var(--bg);
  }

  .home .top-inner {
    max-width: none;
    padding: 0;
  }

  .home .top-bar {
    width: min(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)), max(80vw, 980px), var(--page-max));
    margin: 0 auto;
    background: var(--glass-bar);
    box-shadow: var(--glass-shadow), inset 0 0 0 1px var(--glass-edge);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);
  }

  .home .top-bar .pills {
    background: var(--surface-2);
  }
}

@media (max-width: 959px) {
  .pills a {
    height: 34px;
    padding: 0 12px;
    font-size: 14px;
  }
}

@media (max-width: 599px) {
  .top .wordmark {
    width: 96px;
  }

  .pill-contact {
    display: none !important;
  }

  .pills a {
    height: 32px;
    padding: 0 11px;
    font-size: 13.5px;
  }
}

@media (max-width: 374px) {
  .top .wordmark {
    width: 84px;
  }

  .pills a {
    padding: 0 9px;
    font-size: 13px;
  }
}

/* ---------- the language and the light switch (in the footer) ---------- */

.langs {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.langs a {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.langs a[aria-current='true'] {
  background: var(--ink);
  color: var(--bg);
}

/* the light switch of the election site */
.lights {
  display: flex;
  border-radius: 999px;
}

.lights-track {
  position: relative;
  display: block;
  width: 60px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}

.lights-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.45s cubic-bezier(0.5, 0, 0.2, 1);
}

[data-theme='dark'] .lights-thumb {
  transform: translateX(26px);
}

.lights-track svg {
  position: absolute;
  z-index: 1;
  top: 8px;
  width: 16px;
  height: 16px;
}

.lights-sun {
  left: 8px;
  color: var(--bg);
}

.lights-moon {
  right: 8px;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
}

[data-theme='dark'] .lights-sun {
  color: color-mix(in srgb, var(--ink) 50%, transparent);
}

[data-theme='dark'] .lights-moon {
  color: var(--bg);
}

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

/* ---------- the first screen: a glass box over the panelák photo ---------- */

.stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 520px;
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  padding: 8px max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}

/* The election site's panelák: the day photo by day, the night photo by night. Only the active theme's
   file is fetched (a background image loads when its rule applies); phones get a 1024 px copy. */
.stage-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #b9b6ae;
  background-position: 50% 42%;
  background-size: cover;
  background-repeat: no-repeat;
}

:root:not([data-theme='dark']) .stage-photo {
  background-image: url('/s/img/panelak-day.webp');
}

[data-theme='dark'] .stage-photo {
  background-color: #23262c;
  background-image: url('/s/img/panelak-night.webp');
}

@media (max-width: 720px) {
  :root:not([data-theme='dark']) .stage-photo {
    background-image: url('/s/img/panelak-day-1024.webp');
  }

  [data-theme='dark'] .stage-photo {
    background-image: url('/s/img/panelak-night-1024.webp');
  }
}

/* a veil of the page's own colour keeps the photo calm behind the box */
.stage-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(247, 247, 245, 0.3);
}

[data-theme='dark'] .stage-photo::after {
  background: rgba(0, 0, 0, 0.3);
}

@media (min-width: 721px) {
  .stage {
    padding-top: 12px;
  }

  /* the photo runs up behind the header's bar, to the top of the window */
  .home .stage-photo {
    top: calc(-1 * var(--header-h));
  }
}

.glass {
  position: relative;
  z-index: 1;
  width: min(100%, max(80vw, 980px), var(--page-max));
  height: min(80vh, calc(100% - 24px));
  height: min(80svh, calc(100% - 24px));
  padding: 5px;
  border-radius: 20px;
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow), inset 0 0 0 1px var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

@media (max-width: 599px) {
  .glass {
    width: 100%;
    height: min(80svh, calc(100% - 16px));
    border-radius: 18px;
  }
}

.hero {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 15px;
  background: var(--glass-inner);
  --dock-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  --panel-space: 0px;
  --edge: 16px;
}

@media (min-width: 720px) {
  .hero {
    --dock-bottom: 20px;
    --edge: 20px;
  }
}

@media (max-width: 599px) {
  .hero {
    border-radius: 13px;
  }
}

.hero-map {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.hero-map .simhero {
  background: transparent;
}

/* ---------- the question form ---------- */

.dock {
  position: absolute;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: var(--dock-bottom);
}

@media (min-width: 720px) {
  .dock {
    left: 50%;
    right: auto;
    width: min(700px, 100% - var(--panel-space) - 40px);
    transform: translateX(calc(-50% - var(--panel-space) / 2));
  }
}

.idle-example {
  display: block;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 0 2px;
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ie-short {
  display: none;
}

@media (max-width: 599px) {
  .ie-long {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ie-short {
    display: inline;
  }
}

@media (hover: hover) {
  .idle-example:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

.chips {
  display: flex;
  gap: 6px;
  margin: 0 -12px 8px;
  padding: 2px 12px 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

@media (min-width: 720px) {
  .chips {
    flex-wrap: wrap;
    margin: 0 0 8px;
    padding: 0;
    overflow: visible;
  }
}

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 34px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}

@media (hover: hover) {
  .chip:hover {
    background: var(--card);
  }
}

/* the election site's search field: a grey pill, the arrow in a black circle */
.ask {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 7px 0 18px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 0 4px 16px rgba(22, 27, 28, 0.1), inset 0 0 0 1px color-mix(in srgb, var(--ink) 9%, transparent);
}

[data-theme='dark'] .ask {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
}

.ask:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.ask input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  letter-spacing: -0.01em;
  outline: none;
}

.ask input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
}

.send svg {
  width: 19px;
  height: 19px;
}

/* one of: the form / the e-mail card / the status card / the error card */
.hero:not([data-state='idle']):not([data-state='done']) :is(.chips, .ask, .idle-example) {
  display: none;
}

.hero[data-state='done'] .chips {
  display: none;
}

/* ?og=1: the link-preview picture shows only the map and the question bar */
.og .chips,
.og .idle-example {
  display: none;
}

/* ---------- cards over the map ---------- */

.float {
  position: relative;
  border-radius: var(--radius);
  background: var(--float);
  box-shadow: var(--float-shadow);
  padding: 20px;
}

@media (min-width: 720px) {
  .float {
    padding: 24px;
  }
}

.card-q {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.float .card-q,
.float .error-text {
  padding-right: 40px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: inherit;
}

@media (hover: hover) {
  .icon-btn:hover {
    background: color-mix(in srgb, currentColor 10%, transparent);
  }
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.float > .icon-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

@media (min-width: 560px) {
  .email-form {
    flex-direction: row;
  }

  .email-form .field {
    flex: 1;
    min-width: 0;
  }
}

.field {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 4%, var(--float));
  font-size: 16px;
  letter-spacing: -0.01em;
}

.field::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.field[aria-invalid='true'] {
  border-color: var(--ink);
}

.form-error {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
}

.btn-ink {
  background: var(--ink);
  color: var(--bg);
}

.btn-ink[disabled] {
  cursor: progress;
  opacity: 0.6;
}

.btn-grey {
  background: var(--surface-2);
  color: var(--ink);
}

@media (hover: hover) {
  .btn-ink:hover {
    opacity: 0.88;
  }

  .btn-grey:hover {
    background: var(--card);
  }
}

.fine {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.fine a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.float .fine {
  margin-top: 14px;
}

.float .fine + .fine {
  margin-top: 6px;
}

.status-line {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

.progress {
  height: 6px;
  margin-top: 14px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--ink);
  transition: width 0.8s ease;
}

.status-mail {
  margin-top: 12px;
}

.link-btn {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.error-text {
  font-size: 16px;
  line-height: 1.45;
}

.error-text + .fine {
  margin-top: 8px;
}

.thanks {
  display: flex;
  align-items: center;
  min-height: 46px;
  font-size: 15px;
  font-weight: 600;
}

.thanks a {
  text-decoration: underline;
}

/* ---------- the result ---------- */

.result {
  position: absolute;
  z-index: 4;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dock-bottom) + var(--dock-h, 52px) + 8px);
  display: flex;
  flex-direction: column;
  max-height: calc(100% - var(--dock-h, 52px) - var(--dock-bottom) - 40px);
  padding: 0;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .result {
    left: auto;
    right: var(--edge);
    top: var(--edge);
    bottom: auto;
    width: 360px;
    max-height: calc(100% - 2 * var(--edge));
  }
}

.result-top {
  flex: none;
  padding: 16px 12px 18px 20px;
  background: var(--ink);
  color: var(--bg);
}

@media (min-width: 720px) {
  .result-top {
    padding: 20px 14px 20px 24px;
  }
}

.result-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.result-title {
  flex: 1;
  padding-top: 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  outline: none;
}

.result-big {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
}

.result-big-value {
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.result-big-label {
  font-size: 17px;
  font-weight: 560;
}

.result-big-note {
  margin-top: 6px;
  font-size: 12.5px;
  color: color-mix(in srgb, var(--bg) 70%, transparent);
}

.result-summary {
  flex: none;
  padding: 16px 20px 0;
}

@media (min-width: 720px) {
  .result-summary {
    padding: 18px 24px 0;
  }
}

.result-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 20px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 720px) {
  .result-body {
    padding: 0 24px 24px;
  }
}

.result-toggle svg {
  transition: transform 0.2s ease;
}

.result[data-collapsed='true'] .result-toggle svg {
  transform: rotate(180deg);
}

.result-cta {
  margin-top: 16px;
}

/* short screens: a tighter header, so the map keeps its room above the sheet on phones and the age groups
   stay in view on a laptop */
@media (max-height: 780px) {
  .result-top {
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .result-title {
    padding-top: 7px;
    font-size: 15.5px;
  }

  .result-big {
    margin-top: 4px;
  }

  .result-big-value {
    font-size: 34px;
  }

  .result-big-label {
    font-size: 15px;
  }

  .result-big-note {
    margin-top: 2px;
    font-size: 12px;
  }

  .result-summary {
    padding-top: 12px;
  }

  .legend {
    margin-top: 8px;
    font-size: 13.5px;
  }

  .result-cta {
    margin-top: 12px;
  }

  .result-cta .btn {
    height: 42px;
  }

  .result[data-collapsed='true'] .result-summary {
    padding-bottom: 16px;
  }
}

@media (max-width: 1023.98px) {
  .result[data-collapsed='true'] .result-body {
    display: none;
  }

  .result[data-collapsed='true'] .result-summary {
    padding-bottom: 20px;
  }

  .result[data-collapsed='false'] {
    max-height: calc(100% - var(--dock-h, 52px) - var(--dock-bottom) - 24px);
  }

  .result-cta .full-btn {
    width: 100%;
  }

  .result-foot .full-btn,
  .result-foot .full-thanks {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .result-toggle,
  .result-cta {
    display: none !important;
  }

  .result-body {
    padding-bottom: 0;
  }

  .result-foot {
    position: sticky;
    bottom: 0;
    margin-top: 6px;
    padding: 16px 0 24px;
    background: var(--float);
  }

  /* the answers above scroll under the buttons: a short fade says there is more */
  .result-foot::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 20px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--float) 0%, transparent), var(--float));
    pointer-events: none;
  }
}

.sharebar {
  display: flex;
  gap: 2px;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
}

.sharebar span {
  display: block;
  height: 100%;
  min-width: 2px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.legend li {
  position: relative;
  padding-left: 16px;
}

.legend li .dot {
  position: absolute;
  left: 0;
  top: calc((1.4em - 9px) / 2);
}

.legend b {
  margin-left: 0.35em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.block-label {
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.groups {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-top: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.groups dt {
  color: var(--muted);
}

.groups .bar {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.groups .bar span {
  display: block;
  height: 100%;
}

.quotes {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.quote {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  background: var(--surface-2);
  text-align: left;
}

@media (hover: hover) {
  .quote:hover {
    background: var(--card);
  }
}

.quote-text {
  display: block;
  font-size: 14.5px;
  line-height: 1.4;
}

.quote-who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.quote-who .answer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.quote-who .dot {
  width: 8px;
  height: 8px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}

.actions .full-btn,
.actions .thanks {
  grid-column: 1 / -1;
}

.actions .btn {
  padding: 0 12px;
}

/* ---------- a character's card ---------- */

.person {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 12px;
  right: 12px;
  padding: 14px 52px 16px 16px;
}

@media (min-width: 720px) {
  .person {
    top: var(--edge);
    left: var(--edge);
    right: auto;
    width: 340px;
    padding: 18px 56px 20px 20px;
  }
}

.person-who {
  font-size: 13px;
  color: var(--muted);
}

.person-q {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.4;
}

.person[data-mode='plain'] .person-who {
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
}

.person[data-mode='plain'] .person-q {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.person-a {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- panels ---------- */

.panel {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}

.panel-strong {
  background: var(--ink);
  color: var(--bg);
}

.panel-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

@media (max-width: 599px) {
  .panel {
    padding: 20px;
  }
}

/* ---------- home, under the glass box ---------- */

.intro {
  max-width: 980px;
  padding: 72px 0 40px;
}

.statement {
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.sub {
  max-width: 36em;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.45;
}

.nums {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .nums {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .nums {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

.num {
  display: flex;
  flex-direction: column;
  min-height: 210px;
}

.num-icon svg {
  width: 40px;
  height: 40px;
}

.num-value {
  margin-top: auto;
  padding-top: 24px;
  font-size: clamp(36px, 4.2vw, 52px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.num-label {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.4;
}

/* phones: the icon beside the figure, so six panels stay short */
@media (max-width: 599px) {
  .num {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 16px;
    min-height: 0;
  }

  .num-icon {
    grid-row: span 3;
    padding-top: 2px;
  }

  .num-value {
    margin-top: 0;
    padding-top: 0;
    font-size: 34px;
  }

  .num-label {
    margin-top: 6px;
  }
}

.block {
  padding-top: 72px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.h2 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.more-link {
  font-size: 15px;
  font-weight: 520;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.uses {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 24px;
}

@media (min-width: 900px) {
  .uses {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

.use {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: 16px;
  align-items: start;
}

.use-icon {
  grid-row: span 2;
}

.use-icon svg {
  width: 48px;
  height: 48px;
}

.use h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.use p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

@media (min-width: 900px) {
  .use {
    grid-template-columns: minmax(0, 1fr);
  }

  .use-icon {
    grid-row: auto;
    margin-bottom: 28px;
  }
}

/* ---------- case cards: small, coloured, clickable ---------- */

.cards {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.cards-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.cards-strip {
  grid-auto-flow: column;
  grid-auto-columns: 200px;
  margin-inline: calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.cards-strip::-webkit-scrollbar {
  display: none;
}

.cards-strip li {
  scroll-snap-align: start;
}

@media (min-width: 900px) {
  .cards-strip {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-inline: 0;
    padding: 0;
    overflow: visible;
    gap: 16px;
  }
}

.cc {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 204px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--cc);
  color: var(--cc-ink);
  transition: transform 0.15s ease;
}

@media (hover: hover) {
  .cc:hover {
    transform: translateY(-3px);
  }
}

.cc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.cc-flag svg {
  border-radius: 3px;
}

.cc-icon {
  margin-left: auto;
}

.cc-icon svg {
  width: 36px;
  height: 36px;
}

.cc-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.cc-when {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.82;
}

.cc-value {
  margin-top: auto;
  padding-top: 14px;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.cc-label {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.88;
}

/* ---------- study pages ---------- */

.page-top {
  padding-top: 32px;
  padding-bottom: 24px;
}

.page-title {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-intro {
  max-width: 38em;
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.page-intro a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 520;
}

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

.case-hero {
  margin-top: 16px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--cc);
  color: var(--cc-ink);
}

.case-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.case-hero .cc-icon svg {
  width: 48px;
  height: 48px;
}

.case-title {
  margin-top: 28px;
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.case-when {
  margin-top: 8px;
  font-size: 15px;
  opacity: 0.85;
}

.case-nums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px 24px;
  margin-top: 20px;
}

.case-num-value {
  display: block;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.case-num-label {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: color-mix(in srgb, currentColor 72%, transparent);
}

.lines p {
  font-size: 15px;
  line-height: 1.55;
}

.lines p + p {
  margin-top: 8px;
}

.lines + .case-nums,
.lines + .pairs {
  margin-top: 18px;
}

/* estimate and result: the estimate in the case's colour, the official result in full ink; a row with its own
   colour (a party, a series) shows the estimate light and the result full, as the election site did */
.pairs {
  --est: var(--est-day, #2f6fb0);
  --res: var(--ink);
  --track: color-mix(in srgb, var(--ink) 7%, transparent);
}

[data-theme='dark'] .pairs {
  --est: var(--est-night, #6f9fd8);
}

.pairs-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 520;
}

.pairs-key span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  display: inline-block;
  width: 18px;
  height: 10px;
  border-radius: 5px;
}

.swatch.est {
  background: var(--est);
}

.swatch.res {
  background: var(--res);
}

.swatch-set {
  display: inline-flex;
  gap: 2px;
}

.swatch-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--row);
}

.swatch-set.est .swatch-dot {
  background: color-mix(in srgb, var(--row) 45%, var(--card));
}

[data-theme='dark'] .swatch-set.est .swatch-dot {
  background: color-mix(in srgb, var(--row) 58%, var(--card));
}

.pair-rows {
  display: grid;
  gap: 16px;
}

.pair {
  display: block;
}

.pair-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.pair-source {
  color: var(--muted);
  font-weight: 400;
}

.pair-line {
  display: grid;
  grid-template-columns: 1fr 4.6em;
  align-items: center;
  gap: 12px;
  margin-top: 5px;
}

.pair-line + .pair-line {
  margin-top: 4px;
}

.pair-track {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: var(--track);
}

.pair-bar {
  display: block;
  height: 10px;
  min-width: 3px;
  border-radius: 5px;
}

.pair-bar.est {
  background: var(--est);
}

.pair-bar.res {
  background: var(--res);
}

.pair[style] .pair-bar.est {
  background: color-mix(in srgb, var(--row) 45%, var(--card));
}

[data-theme='dark'] .pair[style] .pair-bar.est {
  background: color-mix(in srgb, var(--row) 58%, var(--card));
}

.pair[style] .pair-bar.res {
  background: var(--row);
}

.pair-value {
  font-size: 14px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted);
}

.pair-value.res {
  color: var(--ink);
  font-weight: 650;
}

.crisis-map {
  position: relative;
  height: min(78vh, 760px);
  min-height: 420px;
}

@media (max-width: 599px) {
  .crisis-map {
    height: 85svh;
  }
}

.crisis-note {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- privacy, 404 ---------- */

.prose {
  max-width: 820px;
  margin-top: 24px;
}

.prose h2 {
  margin-top: 28px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose ul {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.55;
}

.prose ul {
  padding-left: 1.1em;
  list-style: disc;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose .updated {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

.notfound {
  display: grid;
  gap: 40px;
  min-height: 50vh;
}

/* ---------- footer: the e-mail line, who runs the site, and the large wordmark ---------- */

.foot {
  margin-top: 96px;
}

.foot-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

.foot-signup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 40px;
  row-gap: 12px;
  padding-bottom: 40px;
}

.foot-signup-label {
  font-size: 15px;
  line-height: 1.55;
}

.signup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 370px;
  --signup-line: color-mix(in srgb, var(--ink) 28%, transparent);
  --signup-ground: color-mix(in srgb, var(--ink) 7%, transparent);
  --signup-dim: color-mix(in srgb, var(--ink) 50%, transparent);
  --signup-ok: #34c759;
}

[data-theme='dark'] .signup {
  --signup-ok: #30d158;
}

.signup-field {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--signup-line);
  border-radius: 999px;
  background: var(--signup-ground);
  font-size: 16px;
  letter-spacing: -0.01em;
  -webkit-appearance: none;
  appearance: none;
}

.signup-field::placeholder {
  color: var(--muted);
  opacity: 1;
}

.signup[data-state='invalid'] .signup-field,
.signup[data-state='error'] .signup-field {
  border-color: var(--ink);
}

.signup-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.signup-send {
  display: flex;
  border-radius: 999px;
}

.signup-track {
  position: relative;
  display: block;
  width: 60px;
  height: 34px;
  border: 1px solid var(--signup-line);
  border-radius: 999px;
  background: var(--signup-ground);
}

.signup-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.45s cubic-bezier(0.5, 0, 0.2, 1);
}

.signup-arrow,
.signup-check {
  position: absolute;
  top: 8px;
  z-index: 1;
}

.signup-arrow svg,
.signup-check svg {
  width: 16px;
  height: 16px;
}

.signup-arrow {
  left: 8px;
  color: var(--bg);
}

.signup-check {
  right: 8px;
  color: var(--signup-dim);
}

.signup[data-state='sending'] .signup-track {
  opacity: 0.5;
}

.signup[data-state='done'] .signup-thumb {
  transform: translateX(26px);
  background: var(--signup-ok);
}

.signup[data-state='done'] .signup-arrow {
  color: var(--signup-dim);
}

.signup[data-state='done'] .signup-check {
  color: #fff;
}

.signup-status {
  position: absolute;
  top: calc(100% + 6px);
  left: 15px;
  right: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.foot-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 40px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.foot-who {
  display: grid;
  color: var(--ink);
  font-size: 15px;
}

.foot-who span + span {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
}

.foot-links a {
  color: var(--ink);
}

.foot-social svg {
  width: 16px;
  height: 16px;
}

.foot-small {
  display: grid;
  align-self: start;
  justify-items: end;
  text-align: right;
}

.foot-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.foot-small a {
  color: var(--ink);
}

@media (hover: hover) {
  .foot a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }

  .foot-social:hover {
    color: var(--muted);
  }
}

.foot-band {
  margin-top: 48px;
  padding: 24px 0 clamp(56px, 8vw, 120px);
  background: linear-gradient(to bottom, var(--bg), #d3d3cf);
}

[data-theme='dark'] .foot-band {
  background: linear-gradient(to bottom, var(--bg), #262626);
}

.wordmark-large {
  width: 100%;
}

@media (max-width: 959px) {
  .foot {
    margin-top: 72px;
  }

  .foot-signup-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .signup {
    width: 100%;
  }

  .foot-top {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 20px;
  }

  .foot-links {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- pills: the status of a case ---------- */

.cc-pills,
.case-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cc-pills {
  margin-top: 10px;
}

.cc-pills:empty {
  display: none;
}

.case-pills {
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink);
}

/* on a coloured card or case header: a pill in the card's own ink */
.cc .pill,
.case-hero .pill {
  background: color-mix(in srgb, var(--cc-ink) 18%, transparent);
  color: var(--cc-ink);
}

.case-hero .pill {
  height: 28px;
  padding: 0 12px;
  font-size: 13px;
}

.pill-so-far {
  /* still counting: the pill says so in full ink */
  background: var(--cc-ink, var(--ink)) !important;
  color: var(--cc, var(--bg)) !important;
}

.pill-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0453a;
  animation: pill-pulse 1.6s ease-in-out infinite;
}

@keyframes pill-pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------- a case: prediction → result ---------- */

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: stretch;
  margin-top: 16px;
}

.compare-side {
  min-width: 0;
}

.compare-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* the result's tag in full ink: prediction on the left, what happened on the right */
.compare-result .compare-tag {
  background: var(--ink);
  color: var(--bg);
}

.compare-title {
  margin-top: 14px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.compare-tag svg {
  width: 20px;
  height: 20px;
}

.compare-side .lines {
  margin-top: 16px;
}

.compare-side .lines p {
  font-size: 16px;
}

.compare-side .case-nums {
  margin-top: 18px;
}

.compare-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.compare-arrow svg {
  width: 26px;
  height: 26px;
}

@media (max-width: 959px) {
  .compare {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 36px auto;
  }

  .compare-arrow svg {
    transform: rotate(90deg);
  }
}

/* ---------- a case: the interactive map (the election app's embed) ---------- */

.interactive {
  display: grid;
  gap: 16px;
}

.embed-frame {
  display: block;
  width: 100%;
  border: 0;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-small);
  background: var(--bg);
}

.interactive-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-big {
  height: 52px;
  padding: 0 22px;
  font-size: 16px;
  white-space: normal;
  text-align: left;
}

.btn-big svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 599px) {
  .interactive-links .btn-big {
    width: 100%;
    justify-content: space-between;
  }
}

.panel-unit {
  color: var(--muted);
  font-weight: 400;
}

/* ---------- the full-simulation form: a card over the dimmed page, a sheet from the bottom on a phone ---------- */

.modal {
  width: min(460px, 100vw - 32px);
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--radius);
  background: var(--float);
  color: var(--ink);
  box-shadow: var(--float-shadow);
  overscroll-behavior: contain;
}

/* the page behind is dimmed with its own ink by day and its ground by night, as on the election site */
.modal::backdrop {
  background: rgba(27, 25, 31, 0.45);
}

[data-theme='dark'] .modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

html.modal-open {
  overflow: hidden;
}

.modal-card {
  position: relative;
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.modal-title {
  margin-right: 44px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.modal-form {
  display: grid;
  margin-top: 16px;
}

.modal-label {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.modal-label:first-child {
  margin-top: 0;
}

.field-area {
  height: auto;
  min-height: 116px;
  padding: 12px 18px;
  border-radius: 18px;
  line-height: 1.45;
  resize: vertical;
}

.modal-form .form-error {
  margin-top: 10px;
}

.modal-send {
  justify-self: start;
  margin-top: 16px;
}

.modal-thanks {
  margin-top: 14px;
  font-size: 17px;
  font-weight: 600;
  outline: none;
}

.modal-done .btn {
  margin-top: 16px;
}

@media (max-width: 599px) {
  .modal {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }

  .modal-card {
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .modal-send {
    justify-self: stretch;
  }
}

/* ---------- the live list of visitors' questions, right under the first screen ---------- */

.recent {
  padding-top: 24px;
}

.recent-panel {
  padding: 18px 24px 10px;
}

.recent-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.recent-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.pill-live {
  background: var(--ink);
  color: var(--bg);
}

.recent-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.recent-list {
  margin: 8px -12px 0;
}

.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 11.5em 7.5em;
  align-items: center;
  column-gap: 20px;
  width: 100%;
  height: 52px;
  padding: 0 12px;
  border-radius: var(--radius-small);
  text-align: left;
}

@media (hover: hover) {
  .recent-row:hover {
    background: var(--bg);
  }
}

.recent-q {
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 520;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.recent-bar span {
  display: block;
  height: 100%;
  min-width: 2px;
}

.recent-top {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
}

.recent-top b {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.recent-top span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-time {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* "show all": one quiet pill under the list */
.recent-more {
  display: inline-flex;
  align-items: center;
  height: 34px;
  margin: 6px 0 12px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 560;
}

@media (hover: hover) {
  .recent-more:hover {
    background: var(--surface-2);
  }
}

.recent-item.is-new .recent-row {
  animation: recent-in 0.5s ease both;
}

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

@media (max-width: 719px) {
  .recent-panel {
    padding: 16px 20px 8px;
  }

  .recent-count {
    flex-basis: 100%;
    margin-left: 0;
  }

  .recent-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'q q' 'top time';
    row-gap: 4px;
    height: auto;
    min-height: 62px;
    padding: 10px 12px;
  }

  .recent-q {
    grid-area: q;
    display: -webkit-box;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .recent-bar {
    display: none;
  }

  .recent-top {
    grid-area: top;
    font-size: 13.5px;
  }

  .recent-time {
    grid-area: time;
  }
}

/* ---------- a case page, read in ten seconds: key numbers, one comparison, one chart, a few panels ---------- */

.case-page > * + * {
  margin-top: 20px;
}

@media (min-width: 960px) {
  .case-page > * + * {
    margin-top: 28px;
  }
}

.case-page > .back + .case-hero {
  margin-top: 16px;
}

.case-intro {
  max-width: 46em;
}

.case-intro .lines p {
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
}

.case-intro .lines p + p {
  margin-top: 10px;
}

/* the key numbers: up to three tiles, the first in the case's own colour, the others in a tint of it */
.keys {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: 16px;
}

.key {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 216px;
  padding: 24px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cc) 14%, var(--card));
  color: var(--ink);
}

[data-theme='dark'] .key {
  background: color-mix(in srgb, var(--cc) 24%, var(--card));
}

.key-main,
[data-theme='dark'] .key-main {
  background: var(--cc);
  color: var(--cc-ink);
}

.key-icon svg {
  width: 48px;
  height: 48px;
}

.key-value {
  margin-top: auto;
  padding-top: 28px;
  font-size: clamp(40px, 4.4vw, 64px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  text-wrap: balance;
}

.key-label {
  margin-top: 10px;
  max-width: 24em;
  font-size: 16px;
  line-height: 1.4;
}

.key-note {
  max-width: 60em;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* one chart */
.case-chart .pairs {
  max-width: 880px;
}

/* the compact panels: an icon, a title, two short lines */
.minis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mini {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 18px;
  align-items: start;
  padding: 26px;
}

.mini-icon svg {
  width: 44px;
  height: 44px;
}

.mini-title {
  padding-top: 9px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.mini .lines {
  margin-top: 10px;
}

.mini .case-nums {
  margin-top: 16px;
}

.case-stamp-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.case-stamp-line svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 959px) {
  .keys,
  .minis {
    grid-template-columns: minmax(0, 1fr);
  }

  /* a key number reads across the tile: the icon beside the figure */
  .key {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 16px;
    min-height: 0;
    padding: 20px;
  }

  .key-icon {
    grid-row: span 2;
  }

  .key-value {
    margin-top: 0;
    padding-top: 2px;
    font-size: clamp(34px, 8vw, 44px);
  }

  .key-label {
    margin-top: 6px;
  }
}

@media (max-width: 599px) {
  .mini {
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 14px;
    padding: 20px;
  }

  .mini-icon svg {
    width: 36px;
    height: 36px;
  }

  .mini-title {
    padding-top: 5px;
  }
}

/* the US races' dotted map (MAP's SimUSRaces): at most 1000 px, on the panel's left line like its text */
.usa-dotmap {
  max-width: 1000px;
}

/* ---------- the "ladder" chart (case pages): the share who would buy at each price, per simulated group ---------- */

.ladder {
  --s0: var(--s0-day, #2f6fb0);
  --s1: var(--s1-day, #c08a2e);
  --s2: var(--s2-day, #2f7d5b);
  --s3: var(--s3-day, #b0446a);
  --band: 0.18;
  margin: 0;
}

[data-theme='dark'] .ladder {
  --s0: var(--s0-night, #6f9fd8);
  --s1: var(--s1-night, #c08a2e);
  --s2: var(--s2-night, #2f7d5b);
  --s3: var(--s3-night, #b0446a);
  --band: 0.3;
}

.ladder .s0 {
  --c: var(--s0);
}

.ladder .s1 {
  --c: var(--s1);
}

.ladder .s2 {
  --c: var(--s2);
}

.ladder .s3 {
  --c: var(--s3);
}

/* the key: each group's line and its band, the ring at its majority price, the measured fact */
.ladder-key {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-bottom: 8px;
}

.lk {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.4;
}

.lk-label {
  font-weight: 560;
}

.lk-sub {
  color: var(--muted);
}

.lk-line {
  position: relative;
  display: block;
  width: 26px;
  height: 12px;
}

.lk-line::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: var(--c);
  opacity: var(--band);
}

.lk-line::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 5px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--c);
}

.lk-ring {
  justify-self: center;
  width: 13px;
  height: 13px;
  border: 2.5px solid var(--c);
  border-radius: 50%;
}

.lk .nowrap {
  white-space: nowrap;
}

/* a measured fact: its price in bold, then what it is */
.lk-fact .lk-label {
  font-weight: 400;
}

.lk-price {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* the ring's own line in the key belongs to no group: a neutral ring */
.lk-major {
  --c: var(--muted);
}

.lk-tick {
  justify-self: center;
  width: 2px;
  height: 16px;
  border-radius: 1px;
  background: var(--ink);
}

.ladder-plot svg {
  display: block;
  overflow: visible;
  font-family: inherit;
}

.lc-grid line {
  stroke: color-mix(in srgb, var(--ink) 10%, transparent);
  stroke-width: 1;
}

.lc-threshold {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.lc-ylab,
.lc-xlab,
.lc-th-label {
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lc-th-label {
  font-weight: 560;
}

.lc-band {
  fill: var(--c);
  opacity: var(--band);
}

.lc-line {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lc-dot {
  fill: var(--c);
}

.lc-ring {
  fill: var(--card);
  stroke: var(--c);
  stroke-width: 2.5;
}

.lc-bar {
  fill: var(--c);
  opacity: calc(var(--band) + 0.12);
}

.lc-fact {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.lc-fact-tag {
  fill: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* without the drawing, the data table carries the prices and their caption */
.ladder:not(.is-drawn) .ladder-axis {
  display: none;
}

.ladder-axis {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

/* the data table: shown where the chart cannot be drawn, read by screen readers where it is */
/* (a wrapper, not the table itself, is hidden: a table never shrinks below its content's width) */
.ladder-table {
  margin-top: 14px;
  overflow-x: auto;
}

.ladder-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.ladder-table th,
.ladder-table td {
  padding: 4px 12px 4px 0;
  vertical-align: top;
}

.ladder-table thead th {
  font-weight: 600;
}

.ladder-table .lt-range {
  color: var(--muted);
  white-space: nowrap;
}

.ladder.is-drawn .ladder-table {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}
