/* ==========================================================================
   BB2G SOLUTIONS — shared brand system
   One front door, seven surfaces. Documentary / records-room art direction.
   ========================================================================== */

:root {
  /* --- surfaces (documentary dark) --- */
  --ink:        #0B0D0F;
  --ink-1:      #101316;
  --ink-2:      #161A1E;
  --ink-3:      #1E2429;
  --ink-4:      #2A3237;

  /* --- type --- */
  --bone:       #EDE8E0;
  --bone-2:     #C6C0B7;
  --bone-3:     #948E85;
  --bone-4:     #635F59;

  /* --- shared signal --- */
  --amber:      #D9A24B;

  /* --- per-surface accent (overridden per app) --- */
  --accent:     #D9A24B;
  --accent-dim: color-mix(in oklab, var(--accent) 55%, var(--ink));
  --accent-ink: #0B0D0F;

  /* --- evidence status palette (identical on every surface) --- */
  --st-confirmed:  #4F9481;
  --st-reported:   #6683AD;
  --st-contested:  #C98A3C;
  --st-allegation: #B4544A;
  --st-neutral:    #7C8288;

  /* --- election board labels --- */
  --lb-effective: #4F9481;
  --lb-enjoined:  #B4544A;
  --lb-appealed:  #C98A3C;
  --lb-pending:   #6683AD;
  --lb-decided:   #948E85;

  /* --- lines --- */
  --line:      color-mix(in oklab, var(--bone) 12%, transparent);
  --line-soft: color-mix(in oklab, var(--bone) 7%, transparent);
  --line-hard: color-mix(in oklab, var(--bone) 22%, transparent);

  /* --- type families --- */
  --font-display: 'Zodiak', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* --- scale --- */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-xl: clamp(1.4rem, 1.2rem + 0.9vw, 1.75rem);
  --text-2xl: clamp(1.9rem, 1.5rem + 1.9vw, 2.9rem);
  --text-3xl: clamp(2.5rem, 1.7rem + 3.6vw, 4.6rem);

  /* --- rhythm --- */
  --gut: clamp(1.25rem, 4vw, 2.5rem);
  --max: 1240px;
  --max-read: 68ch;

  --radius-sm: 3px;
  --radius: 5px;
  --radius-lg: 10px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

/* The [hidden] attribute only sets display:none at the UA level, so any element given
   display:flex/grid by a class stays visible when toggled hidden from JS. Every surface
   toggles panels, legends and filters this way, so enforce it globally. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, svg { max-width: 100%; display: block; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.75rem 1.25rem; font: 600 var(--text-sm)/1 var(--font-body);
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- typography ---------- */
h1, h2, h3, h4 { color: var(--bone); margin: 0; font-weight: 500; line-height: 1.12; }
h1 { font-family: var(--font-display); font-size: var(--text-3xl); letter-spacing: -0.02em; }
h2 { font-family: var(--font-display); font-size: var(--text-2xl); letter-spacing: -0.015em; }
h3 { font-family: var(--font-body); font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h4 { font-family: var(--font-body); font-size: var(--text-lg); font-weight: 600; line-height: 1.35; }
p { margin: 0 0 1.05em; }
a { color: var(--bone); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
strong { color: var(--bone); font-weight: 600; }

.lede { font-size: var(--text-lg); color: var(--bone-2); max-width: var(--max-read); }
.read { max-width: var(--max-read); }

.kicker {
  font: 500 var(--text-xs)/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.9rem;
}
.kicker-dim { color: var(--bone-4); }

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }
.wrap-wide { max-width: 1560px; }

section { position: relative; }
.band { padding-block: clamp(3.5rem, 7vw, 7rem); border-top: 1px solid var(--line-soft); }
.band-tight { padding-block: clamp(2.25rem, 4vw, 3.5rem); }
.band-tall { padding-block: clamp(5rem, 10vw, 10rem); }
.band-alt { background: var(--ink-1); }

.grid { display: grid; gap: clamp(1.25rem, 2.5vw, 2.25rem); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

.split {
  display: grid;
  gap: clamp(1.5rem, 4vw, 4rem);
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
}
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.sec-head { margin-bottom: clamp(1.75rem, 3.5vw, 3rem); }
.sec-head p { max-width: var(--max-read); }

/* ---------- top bar / front door ---------- */
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in oklab, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-in {
  display: flex; align-items: center; gap: 1rem;
  min-height: 60px;
  width: 100%; max-width: 1560px; margin-inline: auto;
  padding-inline: var(--gut);
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--bone); flex-shrink: 0; }
.brand:hover { color: var(--bone); }
.brand svg { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; }
.brand-txt { display: flex; flex-direction: column; line-height: 1; }
.brand-txt b { font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; }
.brand-txt span { font: 400 0.6rem/1 var(--font-mono); letter-spacing: 0.13em; color: var(--bone-4); margin-top: 3px; text-transform: uppercase; }

.doorwrap { position: relative; margin-left: auto; }
.door {
  display: flex; align-items: center; gap: 0.6rem;
  min-height: 40px; padding: 0 0.9rem;
  background: var(--ink-2); color: var(--bone);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: 500 var(--text-sm)/1 var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.door:hover { border-color: var(--line-hard); background: var(--ink-3); }
.door .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.door .car { color: var(--bone-4); font-size: 0.7rem; }
.door-now { color: var(--bone-4); }
@media (max-width: 620px) { .door-now { display: none; } }

.doormenu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(92vw, 400px);
  background: var(--ink-1);
  border: 1px solid var(--line-hard);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.75);
  padding: 0.45rem;
  display: none;
  max-height: min(72vh, 560px); overflow-y: auto;
}
.doormenu[data-open='true'] { display: block; }
.doormenu-lab {
  font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--bone-4); padding: 0.7rem 0.75rem 0.5rem;
}
.doorlink {
  display: grid; grid-template-columns: 9px 1fr; gap: 0.75rem; align-items: start;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  text-decoration: none; color: var(--bone);
  transition: background 0.15s var(--ease);
}
.doorlink:hover { background: var(--ink-3); color: var(--bone); }
.doorlink[aria-current='page'] { background: var(--ink-3); }
.doorlink i { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; }
.doorlink b { display: block; font: 600 var(--text-sm)/1.3 var(--font-body); }
.doorlink span { display: block; font: 400 var(--text-xs)/1.45 var(--font-body); color: var(--bone-3); margin-top: 2px; }
.doorlink code { display: block; font: 400 0.65rem/1.4 var(--font-mono); color: var(--bone-4); margin-top: 4px; }

/* ---------- full-bleed motion hero ---------- */
.hero { position: relative; min-height: min(88vh, 800px); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero-short { min-height: min(62vh, 560px); }
.hero-bg { position: absolute; inset: 0; z-index: -2; }
.hero-bg video, .hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-veil {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, var(--ink) 2%, color-mix(in oklab, var(--ink) 78%, transparent) 34%, color-mix(in oklab, var(--ink) 30%, transparent) 72%, color-mix(in oklab, var(--ink) 55%, transparent) 100%),
    linear-gradient(to right, color-mix(in oklab, var(--ink) 68%, transparent), transparent 62%);
}
.hero-in { width: 100%; max-width: var(--max); margin-inline: auto; padding: var(--gut) var(--gut) clamp(2.5rem, 6vw, 5rem); }
.hero h1 { max-width: 20ch; }
.hero .lede { margin-top: 1.5rem; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 2rem;
  font: 400 var(--text-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone-3);
}
.hero-meta span { display: flex; align-items: center; gap: 0.5rem; }
.hero-meta span::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.rule { height: 3px; width: 56px; background: var(--accent); margin-bottom: 1.75rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 46px; padding: 0 1.4rem;
  border-radius: var(--radius); border: 1px solid transparent;
  font: 600 var(--text-sm)/1 var(--font-body); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-p { background: var(--accent); color: var(--accent-ink); }
.btn-p:hover { background: color-mix(in oklab, var(--accent) 82%, var(--bone)); color: var(--accent-ink); }
.btn-s { background: transparent; color: var(--bone); border-color: var(--line-hard); }
.btn-s:hover { background: var(--ink-2); color: var(--bone); border-color: var(--bone-4); }
.btnrow { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* ---------- cards ---------- */
.card {
  background: var(--ink-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.2vw, 1.85rem);
}
.card-raised { background: var(--ink-2); }
.card h3, .card h4 { margin-bottom: 0.6rem; }
.card p:last-child { margin-bottom: 0; }

.tile {
  position: relative; display: block;
  background: var(--ink-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.tile:hover { border-color: color-mix(in oklab, var(--tile-accent, var(--accent)) 50%, transparent); transform: translateY(-3px); color: inherit; }
.tile-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink-3); }
/* The hero stills are deliberately dark cinematic frames (mean luminance 15-55).
   At thumbnail size they read as solid black, so lift them here rather than
   brightening the source art, which still needs to sit behind hero text. */
.tile-media img, .tile-media video {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(1.85) saturate(1.12) contrast(0.95);
  transition: transform 0.7s var(--ease), filter 0.4s var(--ease);
}
.tile:hover .tile-media img { transform: scale(1.035); filter: brightness(2.05) saturate(1.2) contrast(0.95); }
/* Only a shallow bottom blend into the card body — the tile text sits below the
   media, not over it, so a full-height scrim buys nothing and costs the image. */
.tile-media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, color-mix(in oklab, var(--ink-1) 88%, transparent), transparent 42%);
}
.tile-body { padding: clamp(1.1rem, 2vw, 1.6rem); }
.tile-body h3 { margin-bottom: 0.45rem; }
.tile-body p { color: var(--bone-3); font-size: var(--text-sm); margin-bottom: 0.9rem; }
.tile-sub { font: 400 var(--text-xs)/1 var(--font-mono); color: var(--bone-4); letter-spacing: 0.04em; word-break: break-all; }
.tile-tag {
  position: absolute; left: 1rem; top: 1rem; z-index: 2;
  font: 500 0.62rem/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase;
  padding: 0.42rem 0.6rem; border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--ink) 82%, transparent);
  border: 1px solid color-mix(in oklab, var(--tile-accent, var(--accent)) 45%, transparent);
  color: var(--tile-accent, var(--accent));
  backdrop-filter: blur(6px);
}

/* ---------- status pills (shared evidence grammar) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: 500 0.66rem/1 var(--font-mono); letter-spacing: 0.13em; text-transform: uppercase;
  padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-confirmed  { color: var(--st-confirmed); }
.pill-reported   { color: var(--st-reported); }
.pill-contested  { color: var(--st-contested); }
.pill-allegation { color: var(--st-allegation); }
.pill-neutral    { color: var(--st-neutral); }
.pill-effective  { color: var(--lb-effective); }
.pill-enjoined   { color: var(--lb-enjoined); }
.pill-appealed   { color: var(--lb-appealed); }
.pill-pending    { color: var(--lb-pending); }
.pill-decided    { color: var(--lb-decided); }
.pill-plain { border-color: var(--line); color: var(--bone-3); }
.pill-plain::before { display: none; }

/* ---------- legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.legend-item { display: flex; align-items: baseline; gap: 0.5rem; font-size: var(--text-sm); color: var(--bone-3); }

/* ---------- stat blocks ---------- */
.stats { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.stat { background: var(--ink-1); padding: clamp(1.1rem, 2vw, 1.6rem); }
.stat-v { font: 500 clamp(1.85rem, 1.2rem + 2.2vw, 2.9rem)/1 var(--font-mono); color: var(--bone); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; display: block; }
.stat-v em { font-style: normal; font-size: 0.5em; color: var(--bone-3); margin-left: 0.2em; }
.stat-l { display: block; margin-top: 0.6rem; font-size: var(--text-sm); color: var(--bone-3); line-height: 1.4; }
.stat-src { display: block; margin-top: 0.7rem; font: 400 0.66rem/1.3 var(--font-mono); }
.stat-src a { color: var(--bone-4); }
.stat-src a:hover { color: var(--accent); }
.stat-accent .stat-v { color: var(--accent); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--ink-1); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 640px; }
thead th {
  text-align: left; padding: 0.85rem 1rem; background: var(--ink-2);
  font: 500 var(--text-xs)/1.2 var(--font-mono); letter-spacing: 0.11em; text-transform: uppercase; color: var(--bone-3);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--bone-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklab, var(--bone) 3%, transparent); }
td .src { display: block; margin-top: 0.35rem; font: 400 0.66rem/1.3 var(--font-mono); }
td .src a { color: var(--bone-4); }
td .src a:hover { color: var(--accent); }
td b { color: var(--bone); }

/* ---------- steps / protocol ---------- */
.steps { counter-reset: s; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; }
.step { counter-increment: s; background: var(--ink-1); padding: clamp(1.2rem, 2.2vw, 1.9rem); display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start; }
.step::before {
  content: counter(s, decimal-leading-zero);
  font: 500 var(--text-sm)/1 var(--font-mono); color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
  border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; flex-shrink: 0;
}
.step h4 { margin-bottom: 0.4rem; }
.step p:last-child { margin-bottom: 0; }
.step p { font-size: var(--text-sm); color: var(--bone-3); }

/* ---------- explainer video block ---------- */
.explainer { background: var(--ink-1); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; }
.explainer video { width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: cover; }
.explainer-body { padding: clamp(1.1rem, 2vw, 1.6rem); border-top: 1px solid var(--line-soft); }
.explainer-body h4 { margin-bottom: 0.4rem; }
.explainer-body p { font-size: var(--text-sm); color: var(--bone-3); margin-bottom: 0; }

/* ---------- plain-language callout ---------- */
.plain {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.2vw, 1.9rem);
}
.plain .kicker { color: var(--bone-4); }
.plain p { color: var(--bone-2); margin-bottom: 0; }
.plain p + p { margin-top: 0.8rem; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); background: var(--ink-1); padding-block: clamp(2.5rem, 5vw, 4rem); margin-top: clamp(3rem, 6vw, 6rem); }
.foot-grid { display: grid; gap: clamp(1.75rem, 4vw, 3.5rem); grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr); }
@media (max-width: 780px) { .foot-grid { grid-template-columns: 1fr; } }
.foot h4 { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--bone-4); margin-bottom: 1.1rem; }
.foot p { font-size: var(--text-sm); color: var(--bone-3); }
.footlinks { display: grid; gap: 0.55rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); list-style: none; margin: 0; padding: 0; }
.footlinks a { display: flex; align-items: center; gap: 0.55rem; font-size: var(--text-sm); text-decoration: none; color: var(--bone-2); }
.footlinks a:hover { color: var(--accent); }
.footlinks i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.foot-base { margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.5rem; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; font: 400 var(--text-xs)/1.5 var(--font-mono); color: var(--bone-4); letter-spacing: 0.04em; }
.foot-base a { color: var(--bone-3); }

/* ---------- misc utility ---------- */
.mono-sm { font: 400 var(--text-xs)/1.5 var(--font-mono); color: var(--bone-4); letter-spacing: 0.06em; }
.muted { color: var(--bone-3); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.srclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.srclist li { font-size: var(--text-sm); padding-left: 1.1rem; position: relative; color: var(--bone-3); }
.srclist li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--bone-4); }

/* reveal on scroll */
.rv { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } }
