@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "DM Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --shell: 1328px;
  --gutter: clamp(16px, 3.5vw, 40px);
  --radius: 27px;
  --control-radius: 13px;
  --control-height: 44px;
  --pill: 999px;
  --section-space: clamp(20px, 3.6vw, 46px);
  --card-padding: clamp(15px, 1.7vw, 22px);
  --header-space: calc(72px + env(safe-area-inset-top));
  font: 100%/1.55 var(--font);
  scroll-padding-block-start: calc(var(--header-space) + 12px);
  scroll-padding-block-end: 16px;
}

body {
  color-scheme: light;
  --ink: #292725;
  --muted: #5d5953;
  --accent: #45423e;
  --on-accent: #fff;
  --light: #efede9;
  --bg: #f7f6f3;
  --panel: #fff;
  --surface: #fbfaf8;
  --line: #dedbd5;
  --outline: #827b72;
  --focus: #6e655a;
  --glow: #dcd7cf65;
  --backdrop: #211f1ca8;
  --shadow: 0 16px 48px #28252230;
  --dem: #254aa7;
  --dem-bg: #eef3ff;
  --rep: #972c43;
  --rep-bg: #fceef1;
  --up: #146144;
  --up-bg: #e6f4ec;
  --down: #923e2c;
  --down-bg: #fceeea;
  --party: var(--accent);
  --party-bg: var(--light);
  --glass-tint: rgb(255 255 255 / .79);
  --glass-edge: rgb(94 82 65 / .29);
  --glass-highlight: rgb(255 255 255 / .9);
  --glass-shadow: 0 4px 16px rgb(38 32 23 / .12);
  --lift: 0 1px 3px rgb(38 32 23 / .16);
  --display: var(--font);
  --editorial: var(--font);
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body[data-theme="D"] {
  --accent: var(--dem);
  --light: var(--dem-bg);
  --ink: #172437;
  --muted: #526177;
  --bg: #f5f7fb;
  --surface: #f7f9fc;
  --line: #d9e2ef;
  --outline: #6b7b93;
  --focus: #315cbf;
  --glow: #cbdafb65;
  --backdrop: #101c30a8;
}
body[data-theme="R"] {
  --accent: var(--rep);
  --light: var(--rep-bg);
  --ink: #301820;
  --muted: #6f5057;
  --bg: #fbf4f5;
  --surface: #fcf7f8;
  --line: #ecd9dd;
  --outline: #8a626a;
  --focus: #a83b55;
  --glow: #edb9c465;
  --backdrop: #2b1219a8;
}

@media (prefers-color-scheme: dark) {
  body {
    color-scheme: dark;
    --ink: #f5f2ed;
    --muted: #c4bdb3;
    --accent: #e1d9cc;
    --on-accent: #22201d;
    --light: #34312d;
    --bg: #1a1917;
    --panel: #252320;
    --surface: #2c2926;
    --line: #46413b;
    --outline: #91867a;
    --focus: #ebdec4;
    --glow: #514b405e;
    --backdrop: #0a0908be;
    --shadow: 0 16px 48px #0009;
    --dem: #acc5ff;
    --dem-bg: #263758;
    --rep: #ffadbc;
    --rep-bg: #512c36;
    --up: #a3dfbf;
    --up-bg: #234435;
    --down: #ffb7a7;
    --down-bg: #502f26;
    --glass-tint: rgb(39 36 32 / .84);
    --glass-edge: rgb(230 220 201 / .29);
    --glass-highlight: rgb(255 255 255 / .16);
    --glass-shadow: 0 5px 19px rgb(0 0 0 / .42);
    --lift: 0 1px 3px rgb(0 0 0 / .42);
  }
  body[data-theme="D"] {
    --ink: #f0f4fb;
    --muted: #b9c8df;
    --bg: #141b26;
    --panel: #1d2736;
    --surface: #253145;
    --line: #3f4d65;
    --outline: #8394b0;
    --focus: #acc5ff;
    --glow: #29426775;
    --glass-tint: rgb(29 39 54 / .85);
  }
  body[data-theme="R"] {
    --ink: #fcf0f3;
    --muted: #d8bac2;
    --bg: #24191d;
    --panel: #302126;
    --surface: #3c2a30;
    --line: #563f48;
    --outline: #a88793;
    --focus: #ffadbc;
    --glow: #61334175;
    --glass-tint: rgb(48 33 38 / .85);
  }
}

* { box-sizing: border-box; }
a { color: var(--accent); text-underline-offset: .18em; }
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 5;
  inset-block-start: 0;
  padding-block-start: env(safe-area-inset-top);
  background: linear-gradient(to bottom, var(--bg) 40%, transparent);
}
.site-nav {
  max-width: var(--shell);
  min-height: 72px;
  margin-inline: auto;
  padding: 8px max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: var(--control-height);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 750;
  letter-spacing: -.03em;
  text-decoration: none;
}
.brand-icon {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 30px;
  block-size: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
}
.brand-icon svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.site-links, .glass {
  border: 1px solid var(--glass-edge);
  background: var(--panel);
  box-shadow: inset 0 1px var(--glass-highlight), var(--glass-shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-links, .glass {
    background: var(--glass-tint);
    -webkit-backdrop-filter: blur(24px) saturate(1.25);
    backdrop-filter: blur(24px) saturate(1.25);
  }
}
.site-links {
  display: flex;
  gap: 2px;
  align-items: center;
  padding: 4px;
  border-radius: var(--pill);
}
.site-links a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-block-size: var(--control-height);
  min-inline-size: var(--control-height);
  padding: 4px clamp(9px, 1.45vw, 19px);
  border-radius: var(--pill);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.site-links a[aria-current="page"] {
  background: var(--light);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  font-weight: 750;
}
@media (hover: hover) {
  .site-links a:hover { background: var(--light); text-decoration: none; }
}
@media (max-width: 600px) {
  :root { --header-space: calc(106px + env(safe-area-inset-top)); }
  .site-nav { flex-direction: column; align-items: stretch; gap: 1px; padding-block: 2px 7px; }
  .brand { align-self: center; }
  .site-links { align-self: center; max-inline-size: 100%; }
  .site-links a { flex: 1 1 auto; padding-inline: 12px; }
}
@media (max-height: 440px) {
  :root { --header-space: 0px; }
  .site-header { position: relative; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  body { --glass-edge: var(--outline); --glass-tint: var(--panel); }
  .site-links, .glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .site-header { background: var(--bg); }
}
@media (forced-colors: active) {
  .site-header { background: Canvas; }
  .site-links, .glass { border-color: ButtonText; background: Canvas; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .site-links a[aria-current="page"] { outline: 1px solid Highlight; outline-offset: -2px; }
  .brand-icon { border: 1px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
