@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Sans+Devanagari:wght@400;600&family=IBM+Plex+Mono:wght@500&display=swap");

/* Booth By Booth Analytica — brand stylesheet v2 (booth ring). Tokens + components. */

:root, [data-theme="light"] {
  --ink-black: #121212;
  --paper: #FFFFFF;
  --warm-paper: #F7F4EC;
  --ink-violet: #6B3FA0;
  --ink-violet-light: #B48CF0;
  --stone-100: #E6E2D8;
  --stone-300: #B8B2A6;
  --stone-500: #7A756C;
  --stone-700: #5C5850;
  --charcoal: #1E1E1E;
  --surface: #FFFFFF;
  --surface-alt: #F7F4EC;
  --surface-sunken: #EFECE5;
  --ink: #121212;
  --ink-muted: #5C5850;
  --line: #E0DCD2;
  --line-strong: #8C877D;
  --accent: #6B3FA0;
  --action: #121212;
  --action-hover: #2E2E2E;
  --action-ink: #FFFFFF;
  --focus: #6B3FA0;
  --positive: #2E7D5B;
  --negative: #B3261E;
  --caution: #8A5A00;
  --data-1: #121212;
  --data-2: #6B3FA0;
  --data-3: #7A756C;
  --data-muted: #E0DCD2;
  --mark-booth: #121212;
  --mark-voter: #6B3FA0;
  --shadow-1: 0 2px 4px rgba(18,18,18,0.08), 0 8px 24px rgba(18,18,18,0.10);
}
[data-theme="dark"] {
  --surface: #121212;
  --surface-alt: #1E1E1E;
  --surface-sunken: #0A0A0A;
  --ink: #FFFFFF;
  --ink-muted: #A8A399;
  --line: #2E2E2E;
  --line-strong: #6A6A6A;
  --accent: #B48CF0;
  --action: #FFFFFF;
  --action-hover: #E6E2D8;
  --action-ink: #121212;
  --focus: #B48CF0;
  --positive: #6CC49A;
  --negative: #F2A49C;
  --caution: #E8B65A;
  --data-1: #FFFFFF;
  --data-2: #B48CF0;
  --data-3: #A8A399;
  --data-muted: #2E2E2E;
  --mark-booth: #FFFFFF;
  --mark-voter: #B48CF0;
  --shadow-1: 0 2px 4px rgba(0,0,0,0.45), 0 8px 24px rgba(0,0,0,0.45);
}
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --stroke-hairline: 1px;
  --stroke-rule: 2px;
  --stroke-booth: 3px;
  --duration-step: 60ms;
  --duration-move: 300ms;
  --duration-sequence: 1200ms;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "IBM Plex Sans Devanagari", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

.display-xl { font-family: var(--font-display); font-size: 64px; line-height: 68px; font-weight: 700; letter-spacing: -0.02em; }
.display-l { font-family: var(--font-display); font-size: 48px; line-height: 52px; font-weight: 700; letter-spacing: -0.015em; }
.heading-1 { font-family: var(--font-display); font-size: 36px; line-height: 42px; font-weight: 700; letter-spacing: -0.01em; }
.heading-2 { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.01em; }
.heading-3 { font-family: var(--font-display); font-size: 21px; line-height: 28px; font-weight: 600; }
.eyebrow { font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; }
.stat { font-family: var(--font-display); font-size: 44px; line-height: 48px; font-weight: 700; letter-spacing: -0.02em; }
.lead { font-family: var(--font-body); font-size: 20px; line-height: 30px; font-weight: 400; }
.body { font-family: var(--font-body); font-size: 16px; line-height: 26px; font-weight: 400; }
.body-strong { font-family: var(--font-body); font-size: 16px; line-height: 26px; font-weight: 600; }
.small { font-family: var(--font-body); font-size: 14px; line-height: 22px; font-weight: 400; }
.caption { font-family: var(--font-body); font-size: 12px; line-height: 16px; font-weight: 500; }
.figure { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 500; }

/* Booth By Booth Analytica — site stylesheet.
   Load tokens.css first, then this file. Every value comes from a token. */

/* ---------- Base ---------- */
.bbb {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
}
.bbb h1, .bbb h2, .bbb h3 { font-family: var(--font-display); color: var(--ink); margin: 0; }
.bbb p { margin: 0; }
.bbb a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.bbb a:hover { text-decoration-thickness: 2px; }
.bbb :focus-visible { outline: var(--stroke-rule) solid var(--focus); outline-offset: 2px; }
.bbb .muted { color: var(--ink-muted); }
.bbb .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.bbb-container { max-width: 1200px; margin: 0 auto; padding-inline: var(--space-4); }
@media (min-width: 900px) { .bbb-container { padding-inline: var(--space-12); } }
.bbb-section { padding-block: var(--space-16); }
@media (min-width: 900px) { .bbb-section { padding-block: var(--space-24); } }
.bbb-section--alt { background: var(--surface-alt); }
.bbb-section--brand { background: var(--ink-black); color: var(--paper); }
.bbb-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.bbb-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.bbb-rule { border: 0; border-top: var(--stroke-hairline) solid var(--line); margin: var(--space-8) 0; }

/* ---------- Eyebrow + section header ---------- */
.bbb-eyebrow {
  font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-muted);
}
.bbb-header { display: flex; flex-direction: column; gap: var(--space-2); max-width: 720px; }

/* ---------- Logo: the booth ring (inline SVG themes itself) ---------- */
.bbb-mark { display: block; height: auto; flex: none; }
.bbb-mark .m-booth { fill: var(--mark-booth); stroke: var(--mark-booth); stroke-width: 1.5; stroke-linejoin: round; }
.bbb-mark .m-voter { fill: var(--mark-voter); }
.bbb-mark--mono .m-voter { fill: var(--mark-booth); }

.bbb-lockup { display: inline-flex; align-items: center; gap: 0.6em; text-decoration: none; color: var(--ink); }
.bbb-lockup--stacked { flex-direction: column; gap: 0.75em; }
.bbb-lockup .bbb-mark { width: 2.6em; }
.bbb-lockup--stacked .bbb-mark { width: 5.5em; }
.bbb-wordmark { display: flex; flex-direction: column; gap: 0.32em; }
.bbb-lockup--stacked .bbb-wordmark { align-items: center; }
.bbb-wordmark__name {
  font-family: var(--font-display); font-weight: 700; font-size: 1em; line-height: 1;
  letter-spacing: -0.01em; color: var(--ink); white-space: nowrap;
}
.bbb-wordmark__descriptor {
  font-family: var(--font-display); font-weight: 500; font-size: 0.4em; line-height: 1;
  letter-spacing: 0.62em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap;
}
.bbb-lockup--stacked .bbb-wordmark__descriptor { margin-right: -0.62em; }

/* ---------- Buttons ---------- */
.bbb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md); border: var(--stroke-rule) solid transparent;
  font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 20px;
  text-decoration: none; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease;
}
.bbb-btn--primary { background: var(--action); color: var(--action-ink); }
.bbb-btn--primary:hover { background: var(--action-hover); }
.bbb-btn--secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.bbb-btn--secondary:hover { background: var(--surface-sunken); }
.bbb-btn--ghost { background: transparent; color: var(--accent); padding-inline: var(--space-2); }
.bbb-btn--ghost:hover { text-decoration: underline; text-underline-offset: 3px; }
.bbb-btn:focus-visible { outline: var(--stroke-rule) solid var(--focus); outline-offset: 2px; }
.bbb-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Cards ---------- */
.bbb-card {
  background: var(--surface); border: var(--stroke-hairline) solid var(--line);
  border-radius: var(--radius-lg); padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.bbb-section--alt .bbb-card { background: var(--surface); }

/* ---------- Stat card ---------- */
.bbb-stat { display: flex; flex-direction: column; gap: var(--space-2); }
.bbb-stat__label { font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-muted); }
.bbb-stat__value { font-family: var(--font-display); font-size: 44px; line-height: 48px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.bbb-stat__value--accent { color: var(--accent); }
.bbb-stat__delta { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 500; }
.bbb-stat__delta--up { color: var(--positive); }
.bbb-stat__delta--down { color: var(--negative); }
.bbb-stat__note { font-size: 14px; line-height: 22px; color: var(--ink-muted); }

/* ---------- Tags / status pills ---------- */
.bbb-tag {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); border-radius: var(--radius-sm);
  border: var(--stroke-hairline) solid var(--line-strong);
  font-family: var(--font-display); font-size: 12px; line-height: 18px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink);
}
.bbb-tag--accent { border-color: var(--accent); color: var(--accent); }
.bbb-tag--solid { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.bbb-pill { border-radius: var(--radius-pill); }

/* ---------- Data table ---------- */
.bbb-table-wrap { overflow-x: auto; border: var(--stroke-hairline) solid var(--line); border-radius: var(--radius-lg); }
.bbb-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 22px; }
.bbb-table th {
  background: var(--surface-sunken); color: var(--ink-muted); text-align: left;
  font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; padding: var(--space-3) var(--space-4);
}
.bbb-table td { padding: var(--space-3) var(--space-4); border-top: var(--stroke-hairline) solid var(--line); color: var(--ink); }
.bbb-table td.num, .bbb-table th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bbb-table tr.is-highlight td { background: var(--surface-alt); }
.bbb-table tr.is-highlight td:first-child { color: var(--accent); font-weight: 600; }

/* ---------- Bar (inline data bar) ---------- */
.bbb-bar { height: 8px; border-radius: var(--radius-sm); background: var(--data-muted); overflow: hidden; }
.bbb-bar > span { display: block; height: 100%; background: var(--data-1); }
.bbb-bar--accent > span { background: var(--data-2); }

/* ---------- Booth glyph: the data unit (one glyph = one booth) ---------- */
.bbb-units { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.bbb-unit {
  width: 14px; height: 12px; box-sizing: border-box;
  border: var(--stroke-booth) solid var(--data-1); border-top: 0;
  border-radius: 0 0 2px 2px;
}
.bbb-unit--muted  { border-color: var(--data-muted); }
.bbb-unit--mid    { border-color: var(--data-3); }
.bbb-unit--accent { border-color: var(--data-2); }
.bbb-units--lg .bbb-unit { width: 22px; height: 18px; border-width: 4px; border-top: 0; }

/* ---------- Motion: booths assemble, the voter arrives last ---------- */
@keyframes bbb-booth-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes bbb-voter-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.bbb-assemble .m-booth, .bbb-assemble .bbb-unit {
  opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: bbb-booth-in var(--duration-move) cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(var(--i, 0) * var(--duration-step));
}
.bbb-assemble .m-voter {
  opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: bbb-voter-in var(--duration-move) cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(8 * var(--duration-step) + 120ms);
}
/* Loading: booths light in turn around the ring */
@keyframes bbb-booth-pulse { 0%, 100% { opacity: 0.25; } 12% { opacity: 1; } }
.bbb-loading .m-booth { animation: bbb-booth-pulse 960ms linear infinite; animation-delay: calc(var(--i, 0) * 120ms); }
.bbb-loading .m-voter { opacity: 0.25; }
@media (prefers-reduced-motion: reduce) {
  .bbb-assemble .m-booth, .bbb-assemble .bbb-unit, .bbb-assemble .m-voter, .bbb-loading .m-booth { animation: none; opacity: 1; transform: none; }
}
