:root {
  --bg: #0d1117;
  --bg-alt: #131a24;
  --panel: #171f2b;
  --border: #26303d;
  --text: #e6edf3;
  --text-muted: #9aa7b5;
  --accent: #4a7fb5;
  --accent-light: #6ea3d9;
  --gold: #c8a24a;
  --red: #c15b5b;
  --green: #5b9d78;
  --radius: 10px;
  --maxw: 1180px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ubh-red: #ba2a32;
  --ubh-banner-h: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--ubh-banner-h);
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── UBH SPONSOR BANNER ── */
.ubh-sponsor-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 101;
  height: var(--ubh-banner-h);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(90deg, #0a0f1a 0%, #05070c 100%);
  border-bottom: 1px solid var(--gold);
  color: #ffffff; text-decoration: none;
  padding: 0 1rem; overflow: hidden;
  transition: background 0.2s;
}
.ubh-sponsor-banner:hover { background: linear-gradient(90deg, #0c1526 0%, #070b14 100%); }
.ubh-sponsor-banner:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.ubh-inner {
  display: flex; align-items: center; gap: 0.85rem;
  width: 100%; max-width: 1120px;
}
.ubh-logo { height: 34px; width: 34px; flex: 0 0 auto; display: block; }
.ubh-copy { display: flex; align-items: baseline; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.ubh-sponsored { font-size: 0.85rem; color: #e8edf5; white-space: nowrap; letter-spacing: 0.01em; }
.ubh-sponsored strong { color: #ffffff; font-weight: 700; }
.ubh-sep { color: var(--gold); opacity: 0.75; margin: 0 0.45rem; }
.ubh-tag { font-size: 0.82rem; color: #c9d4e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ubh-cta {
  flex: 0 0 auto; margin-left: auto;
  font-size: 0.78rem; font-weight: 700; color: #ffffff;
  background: var(--ubh-red);
  padding: 0.35rem 0.85rem; border-radius: 4px;
  white-space: nowrap; transition: background 0.2s;
}
.ubh-sponsor-banner:hover .ubh-cta { background: #d23a3a; }
.ubh-cta-compact { display: none; }

/* ── Nav ── */
.site-nav {
  position: sticky;
  top: var(--ubh-banner-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-brand:hover { text-decoration: none; }
.brand-accent { color: var(--accent-light); }
.classify {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.4rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a { color: var(--text-muted); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-separator { width: 1px; height: 18px; background: var(--border); }
.nav-external { color: var(--accent-light) !important; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

/* ── Layout ── */
main { min-height: 60vh; }
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.section-header { margin-bottom: 2rem; }
.section-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.section-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.section-desc { color: var(--text-muted); max-width: 70ch; }

/* ── Hero ── */
.hero {
  background: linear-gradient(160deg, #101826 0%, #0d1117 70%);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3.5rem;
}
.hero-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}
.hero-title {
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  max-width: 20ch;
}
.hero-lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 68ch;
  margin-bottom: 2rem;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent-light); color: var(--accent-light); }
.back-btn { margin-bottom: 1.75rem; }

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.stat-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent-light);
  font-family: var(--mono);
}
.stat-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }
.stat-caption { color: var(--text-muted); font-size: 0.92rem; max-width: 80ch; }

/* ── Package grid ── */
.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}
.package-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.package-card:hover {
  border-color: var(--accent-light);
  text-decoration: none;
  transform: translateY(-2px);
}
.package-count {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--gold);
}
.package-name { font-size: 1.05rem; font-weight: 700; margin: 0.4rem 0 0.6rem; }
.package-blurb { color: var(--text-muted); font-size: 0.9rem; flex: 1; }
.package-meta {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-light);
}

/* ── Agency bars ── */
.agency-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.agency-row {
  display: grid;
  grid-template-columns: 190px 1fr 40px;
  align-items: center;
  gap: 0.8rem;
}
.agency-name { font-size: 0.88rem; color: var(--text-muted); }
.agency-bar-track {
  background: var(--bg-alt);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.agency-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  height: 100%;
}
.agency-val { font-family: var(--mono); font-size: 0.85rem; text-align: right; }

/* ── Context callout ── */
.context-callout {
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
}
.context-callout p { color: var(--text-muted); margin-bottom: 1rem; max-width: 82ch; }

/* ── Archive ── */
.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}
.archive-filters input[type="text"],
.archive-filters select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
}
.archive-filters input[type="text"] { flex: 1; min-width: 220px; }
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}
.archive-count { font-family: var(--mono); font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }
.archive-table-wrap, .analysis-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.archive-table, .analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.archive-table th, .analysis-table th {
  text-align: left;
  padding: 0.75rem 0.9rem;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.archive-table td, .analysis-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.archive-table tr:last-child td, .analysis-table tbody tr:last-child td { border-bottom: none; }
.archive-table tr:hover td { background: rgba(74, 127, 181, 0.06); }
.c-id { font-family: var(--mono); color: var(--text-muted); }
.c-title a { font-weight: 600; }
.c-agency, .c-type { color: var(--text-muted); white-space: nowrap; }
.c-file a { font-family: var(--mono); font-size: 0.8rem; }
.analysis-table tfoot td { font-weight: 700; background: var(--bg-alt); }

/* ── Tags & badges ── */
.pkg-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.pkg-voting-systems { border-color: #4a7fb5; color: #9cc2e8; }
.pkg-china-voter-data { border-color: #c15b5b; color: #e0a0a0; }
.pkg-michigan { border-color: #c8a24a; color: #e0c88a; }
.pkg-noncitizens { border-color: #5b9d78; color: #9dd0b6; }
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  margin: 0.1rem 0.15rem 0.1rem 0;
}
.badge-declass { background: rgba(91, 157, 120, 0.18); color: #7cc79a; }
.badge-release { background: rgba(74, 127, 181, 0.18); color: #7fb0dd; }
.badge-redact { background: rgba(193, 91, 91, 0.18); color: #dd8f8f; }
.badge-dup { background: rgba(154, 167, 181, 0.15); color: var(--text-muted); }
.no-results { padding: 2rem; text-align: center; color: var(--text-muted); }

/* ── Document detail ── */
.doc-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.doc-title { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; margin-bottom: 0.4rem; }
.doc-filename { font-family: var(--mono); font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.75rem; word-break: break-all; }
.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.meta-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.meta-key { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.meta-val { font-weight: 600; font-size: 0.92rem; }
.sub-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.75rem; }
.doc-description { margin-bottom: 2rem; }
.doc-description p { color: var(--text); max-width: 80ch; margin-bottom: 0.75rem; }
.desc-disclaimer { color: var(--text-muted) !important; font-size: 0.88rem; font-style: italic; }
.doc-actions { margin-bottom: 2rem; }
.doc-viewer { margin-bottom: 1.5rem; }
.pdf-frame {
  width: 100%;
  height: 800px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.pdf-fallback { padding: 2rem; color: var(--text-muted); }
.doc-hash { font-family: var(--mono); font-size: 0.72rem; color: var(--text-muted); word-break: break-all; }
.doc-hash code { color: var(--text-muted); }

/* ── Analysis / caveats ── */
.context-block { background: var(--bg-alt); border-radius: var(--radius); border: 1px solid var(--border); }
.caveat {
  border-left: 3px solid var(--gold);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin-bottom: 1.75rem;
}
.caveat h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem; }
.caveat p { color: var(--text-muted); max-width: 84ch; }
.sources { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.sources h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.sources ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.sources li { color: var(--text-muted); font-size: 0.9rem; max-width: 90ch; }
.exec-list { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; margin: 1.25rem 0; }
.exec-list li {
  color: var(--text-muted);
  max-width: 88ch;
  border-left: 3px solid var(--gold);
  padding-left: 1.25rem;
  line-height: 1.6;
}
.exec-list li strong { color: var(--text); }

/* ── Footer ── */
.site-footer {
  max-width: var(--maxw);
  margin: 2rem auto 0;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer p { margin-bottom: 0.6rem; max-width: 95ch; }
.footer-copy { color: var(--text-muted); opacity: 0.7; }

/* ── Error pages ── */
.error-page { text-align: center; padding: 6rem 1.5rem; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--accent-light); font-family: var(--mono); }
.error-msg { color: var(--text-muted); margin-bottom: 2rem; }

/* ── Responsive ── */
@media (max-width: 760px) {
  :root { --ubh-banner-h: 72px; }
  .ubh-inner { gap: 0.5rem; }
  .ubh-logo { height: 30px; width: 30px; }
  .ubh-copy { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 2px; }
  .ubh-sep { display: none; }
  .ubh-sponsored { font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ubh-tag { font-size: 0.72rem; color: #b8c5d6; max-width: 100%; }
  .ubh-cta-full { display: none; }
  .ubh-cta-compact { display: inline-block; font-size: 0.72rem; padding: 0.3rem 0.55rem; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 0.5rem;
  }
  .nav-links.open { display: flex; }
  .nav-separator { display: none; }
  .agency-row { grid-template-columns: 120px 1fr 34px; }
  .agency-name { font-size: 0.78rem; }
  .pdf-frame { height: 500px; }
}
