/* CivicDiff — the federal government, rendered as a git diff. Tokens first; dark theme via prefers-color-scheme or [data-theme]. */
:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-2: #eef1f4;
  --ink: #1f2328;
  --ink-2: #3d444d;
  --muted: #656d76;
  --line: #d1d9e0;
  --line-2: #e6eaef;
  --add-bg: #e6ffec;
  --add-gut: #ccffd8;
  --add-ink: #116329;
  --del-bg: #ffebe9;
  --del-gut: #ffd7d5;
  --del-ink: #a40e26;
  --hunk-bg: #ddf4ff;
  --hunk-gut: #b6e3ff;
  --hunk-ink: #0b4f8a;
  --sq-n: #d1d9e0;
  --D: #1f4fbf;
  --R: #a8201a;
  --I: #7a3ec2;
  --O: #8a929b;
  --focus: #0969da;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151b23; --surface-2: #1c232c; --ink: #e6edf3; --ink-2: #c4ccd5; --muted: #8b949e;
    --line: #30363d; --line-2: #222831;
    --add-bg: rgba(46,160,67,.15); --add-gut: rgba(63,185,80,.32); --add-ink: #56d364;
    --del-bg: rgba(248,81,73,.12); --del-gut: rgba(248,81,73,.32); --del-ink: #ff7b72;
    --hunk-bg: rgba(56,139,253,.12); --hunk-gut: rgba(56,139,253,.3); --hunk-ink: #79c0ff;
    --sq-n: #30363d; --D: #5b8ff5; --R: #f0605a; --I: #b18cf5; --O: #6e7681; --focus: #58a6ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151b23; --surface-2: #1c232c; --ink: #e6edf3; --ink-2: #c4ccd5; --muted: #8b949e;
  --line: #30363d; --line-2: #222831;
  --add-bg: rgba(46,160,67,.15); --add-gut: rgba(63,185,80,.32); --add-ink: #56d364;
  --del-bg: rgba(248,81,73,.12); --del-gut: rgba(248,81,73,.32); --del-ink: #ff7b72;
  --hunk-bg: rgba(56,139,253,.12); --hunk-gut: rgba(56,139,253,.3); --hunk-ink: #79c0ff;
  --sq-n: #30363d; --D: #5b8ff5; --R: #f0605a; --I: #b18cf5; --O: #6e7681; --focus: #58a6ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
code { font-family: var(--mono); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 99; border-radius: 6px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }

/* Header */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font: 700 26px var(--mono); letter-spacing: -.03em; text-decoration: none; }
.logo b { background: var(--add-bg); color: var(--ink); padding: 0 4px; border-radius: 4px; }
.logo.small { font-size: 15px; margin-right: 8px; }
.topnav { display: flex; align-items: center; gap: 16px; font-size: 15px; font-weight: 500; }
.topnav a { text-decoration: none; }
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 15px; }

/* Hero */
.hero { padding: 56px 0 8px; }
.hero h1 { font: 800 clamp(30px, 5vw, 50px)/1.12 var(--sans); letter-spacing: -.03em; max-width: 20ch; }
.pill { font: 600 .82em var(--mono); letter-spacing: -.02em; padding: 0 .22em; border-radius: 6px; white-space: nowrap; }
.pill-a { background: var(--del-bg); color: var(--del-ink); }
.pill-b { background: var(--add-bg); color: var(--add-ink); }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); max-width: 58ch; margin: 18px 0 30px; }
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 12px; align-items: end; max-width: 780px; }
.cf { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf span { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.cf input { font: 500 18px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; line-height: 26px; width: 100%; min-width: 0; display: block; -webkit-appearance: none; appearance: none; text-align: left; }
/* iOS Safari gives date inputs an intrinsic width, centers the value horizontally, and pins it to the top of a
   fixed-height box. Sizing by line-height + padding (no fixed height) keeps the text vertically centered. */
.cf input::-webkit-date-and-time-value { text-align: left; margin: 0; line-height: inherit; min-height: 0; }
.cf input::-webkit-datetime-edit { padding: 0; }
.cf-a input { border-left-color: var(--del-ink); }
.cf-b input { border-left-color: var(--add-ink); }
.cf input:focus { outline: none; border-color: var(--focus); }
.swap { display: grid; place-items: center; width: 52px; height: 50px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 20px; color: var(--muted); }
.swap:hover { color: var(--ink); border-color: var(--ink-2); }
.btn-go { display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 28px; border-radius: 8px; border: 0; background: var(--ink); color: var(--bg); font: 700 17px var(--sans); cursor: pointer; text-decoration: none; }
.btn-go:hover { background: color-mix(in srgb, var(--ink) 85%, var(--focus)); }
@media (max-width: 640px) {
  .cmp { grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); gap: 8px; }
  .btn-go { grid-column: 1 / -1; height: 48px; }
  .swap { width: 36px; height: 46px; font-size: 17px; }
  .cf input { font-size: 14px; padding: 10px 8px; line-height: 22px; border-left-width: 3px; }
  .cf span { font-size: 11px; }
  /* Quick picks become one swipeable row instead of four stacked rows. */
  .hero .chips { flex-wrap: nowrap; overflow-x: auto; margin: 16px -16px 0; padding: 0 16px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .hero .chips::-webkit-scrollbar { display: none; }
  .hero .chip { font-size: 14px; padding: 6px 13px; }
  .hero { padding-top: 32px; }
  .lede { margin: 14px 0 22px; }
  .logo { font-size: 22px; }
  .cmdline { font-size: 13px; margin-top: 22px; }
  .topnav { gap: 10px; font-size: 14px; }
}
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font-size: 15px; font-weight: 500; text-decoration: none; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips.wide .chip { white-space: normal; }
.cmdline { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 30px 0 0; font-size: 15px; }
.cmdline code { color: var(--ink-2); }
.cmdline .cm { color: var(--muted); }
.cmd-tools { display: flex; gap: 12px; font: 500 13px var(--mono); }
.cmd-tools button, .cmd-tools a { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; text-decoration-color: var(--line); }
.cmd-tools button:hover, .cmd-tools a:hover { color: var(--ink); }

/* Stats grid */
.results { padding-bottom: 72px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 20px 0 0; background: var(--line); gap: 1px; }
.stat { background: var(--bg); padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-l { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.sv { font: 700 clamp(28px, 4vw, 40px)/1.1 var(--mono); letter-spacing: -.03em; margin-top: 8px; }
.sv-none { font: 700 34px var(--mono); color: var(--muted); margin-top: 8px; }
.st-s { font-size: 15px; color: var(--ink-2); }
.c-a { color: var(--add-ink); } .c-d { color: var(--del-ink); }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } .stat { padding: 16px; } }
.summary { font-size: 17px; color: var(--ink-2); max-width: 78ch; margin: 22px 0 0; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; font: 500 14px var(--mono); }
.jump a { color: var(--muted); text-decoration: none; }
.jump a::before { content: '#'; opacity: .5; }
.jump a:hover { color: var(--ink); }

/* Groups and files */
.grp { margin-top: 48px; }
.grp-h { font: 700 15px var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); margin: 0 0 14px; }
.file { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; background: var(--bg); scroll-margin-top: 80px; }
.fh { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 22px 12px; }
.fh-1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.fpath { font: 700 17px var(--mono); }
.ftitle { font-size: 17px; color: var(--ink-2); }
.fh-2 { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 16px; margin-top: 6px; font-size: 14px; }
.fsrc { color: var(--ink-2); text-decoration: none; }
.fsrc:hover { text-decoration: underline; }
.dstat { display: inline-flex; align-items: center; gap: 10px; font: 700 14px var(--mono); }
.n-a { color: var(--add-ink); } .n-d { color: var(--del-ink); }
.sq { display: inline-flex; gap: 2px; }
.sq i { width: 11px; height: 11px; border-radius: 2px; display: block; }
.sq-a { background: #1a7f37; } .sq-d { background: #cf222e; } .sq-n { background: var(--sq-n); }

/* Diff lines */
.fb { font-size: 15px; }
.ln { display: grid; grid-template-columns: 44px 1fr; border-top: 1px solid transparent; }
.ln + .ln { border-top-color: color-mix(in srgb, var(--line-2) 60%, transparent); }
.gut { font: 700 14px var(--mono); color: var(--muted); text-align: center; padding: 10px 0; user-select: none; }
.lc { padding: 9px 22px 9px 4px; font: 400 15.5px/1.5 var(--mono); min-width: 0; overflow-wrap: anywhere; }
.lc a { text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }
.ls { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.ln-add { background: var(--add-bg); }
.ln-add .gut { background: var(--add-gut); color: var(--add-ink); }
.ln-del { background: var(--del-bg); }
.ln-del .gut { background: var(--del-gut); color: var(--del-ink); }
.ln-hunk { background: var(--hunk-bg); }
.ln-hunk .gut { color: var(--hunk-ink); font-weight: 500; }
.ln-hunk .lc { color: var(--hunk-ink); font-size: 14.5px; }
.ln-hunk .lc .muted { color: inherit; opacity: .75; }
.ln-note .lc { font: italic 400 15px/1.55 var(--sans); color: var(--ink-2); }
.ln-viz .lc { padding: 16px 22px 14px 4px; font-family: var(--sans); }
.pl { font: 700 .95em var(--mono); margin-left: .35em; }
.pl-D { color: var(--D); } .pl-R { color: var(--R); } .pl-I { color: var(--I); } .pl-O { color: var(--O); }
.num { font-weight: 700; }
.tag { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); vertical-align: 2px; white-space: nowrap; }
.tag.lm { background: var(--ink); color: var(--bg); }
@media (max-width: 640px) { .ln { grid-template-columns: 30px 1fr; } .lc { padding-right: 12px; font-size: 14px; } .fh { padding: 12px 14px; } .fpath, .ftitle { font-size: 15px; } }

details.more { border-top: 1px solid var(--line-2); }
details.more > summary { cursor: pointer; list-style: none; padding: 9px 22px 9px 48px; font: 500 14px var(--mono); color: var(--hunk-ink); background: var(--surface); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '⋯ '; }
details.more[open] > summary::before { content: '▾ '; }
details.more > summary:hover { text-decoration: underline; }

/* Control strip */
.ctrl { display: flex; flex-wrap: wrap; gap: 6px; }
.ctrl-c { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.ctrl-c i { width: 44px; height: 16px; border-radius: 3px; display: block; }
.ctrl-c span { font: 500 12.5px var(--mono); color: var(--muted); margin-top: 3px; }
.ctrl:has(.ctrl-c:nth-child(31)) .ctrl-c i { width: 12px; height: 12px; }
.ctrl-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }
.ctrl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ctrl-legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.cs-D { background: var(--D); } .cs-R { background: var(--R); } .cs-O { background: var(--O); }
.cs-D-t { color: var(--D); } .cs-R-t { color: var(--R); } .cs-O-t { color: var(--O); }

/* Hemicycles */
.hemis { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.hemis figure { margin: 0; }
.hemis figcaption { font: 500 13px var(--mono); color: var(--muted); margin-bottom: 4px; }
@media (max-width: 640px) { .hemis { grid-template-columns: 1fr; } }
.hemicycle { width: 100%; height: auto; display: block; }
.hemicycle .seat { stroke: var(--bg); stroke-width: .6; }
.hemicycle .seat.hl { stroke: var(--ink); stroke-width: 1.4; }
.p-D { fill: var(--D); background: var(--D); } .p-R { fill: var(--R); background: var(--R); } .p-I { fill: var(--I); background: var(--I); }
.p-W { fill: #c98a0b; } .p-F { fill: #0f8a7e; } .p-DR { fill: #5a8f1c; } .p-O { fill: var(--O); background: var(--O); }

/* Diverging bars (budget, rule-writing agencies) */
.dbars { display: grid; gap: 2px; }
.dbar-row { display: grid; grid-template-columns: minmax(140px, 250px) 1fr minmax(160px, 230px); gap: 14px; align-items: center; padding: 3px 0; font-size: 13.5px; }
.dbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbar-track { position: relative; height: 14px; }
.dbar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; }
.dbar.up { background: #1a7f37; }
.dbar.down { background: #cf222e; }
.dbar-zero { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.dbar-val { font: 500 12px var(--mono); color: var(--ink-2); text-align: right; white-space: nowrap; }
.fr-agencies .dbar-row { grid-template-columns: minmax(140px, 260px) 1fr 70px; }
.fr-agencies .mini-h { font: 500 13px var(--mono); color: var(--muted); margin: 0 0 8px; }
@media (max-width: 700px) { .dbar-row { grid-template-columns: 1fr 1fr; } .dbar-val { grid-column: 1 / -1; text-align: left; margin-top: -4px; } }

/* Log */
.tlstrip { width: 100%; height: 72px; display: block; }
.tl-bg { fill: var(--surface); stroke: var(--line); }
.tl-mark { fill: var(--ink-2); opacity: .8; }
.tl-mark.k-executive_order { fill: var(--D); }
.tl-mark.k-scotus_decision, .tl-mark.k-judicial_appointment { fill: #0f8a7e; }
.tl-mark.k-agency_created { fill: #1a7f37; } .tl-mark.k-agency_abolished { fill: #cf222e; }
.tl-mark.k-amendment, .tl-mark.k-state_admitted { fill: var(--R); }
.tl-inaug { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.tl-tick { stroke: var(--muted); }
.tl-year { font: 500 12px var(--mono); fill: var(--muted); text-anchor: middle; }
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 22px 12px 48px; border-top: 1px solid var(--line-2); }
.tl-f { font: 500 13px var(--mono); border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.tl-f b { font-weight: 700; margin-left: 4px; color: var(--muted); }
.tl-f[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.log { list-style: none; margin: 0; padding: 0 0 8px; max-height: 640px; overflow-y: auto; border-top: 1px solid var(--line-2); }
.tl-i { display: grid; grid-template-columns: 112px 90px 1fr; gap: 12px; padding: 5px 22px 5px 48px; font: 400 14px/1.45 var(--mono); }
.tl-i:nth-child(odd) { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.tl-i time { color: var(--muted); }
.tl-k { color: var(--hunk-ink); }
.tl-i.k-inauguration { font-weight: 700; }
.tl-i.k-agency_created .tl-k { color: var(--add-ink); } .tl-i.k-agency_abolished .tl-k { color: var(--del-ink); }
.tl-t a { text-decoration: none; } .tl-t a:hover { text-decoration: underline; }
.tl-i[hidden] { display: none; }
@media (max-width: 640px) { .tl-i { grid-template-columns: 92px 1fr; padding-left: 14px; } .tl-k { display: none; } .tl-filters { padding-left: 14px; } }

/* Static pages */
.page { padding: 48px 24px 80px; }
.page h1 { font: 800 clamp(32px, 5vw, 46px) var(--sans); letter-spacing: -.03em; margin-bottom: 14px; }
.prose { max-width: 780px; }
.prose h2 { font: 700 22px var(--sans); margin: 34px 0 10px; }
.prose li { margin-bottom: 8px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: 10px; overflow-x: auto; }
.tscroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.dtable th, .dtable td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line-2); }
.dtable thead th { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--surface); }
.dtable tr:last-child th, .dtable tr:last-child td { border-bottom: 0; }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.sources td a { text-decoration: none; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 28px 0 44px; font-size: 14px; color: var(--muted); }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot p { margin: 0; max-width: 60ch; }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-links a { color: var(--ink-2); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; }
@media print { .top, .cmp, .chips, .cmd-tools, .foot, .tl-filters { display: none; } details.more { display: block; } }

.tl-mark.k-conflict_began, .tl-mark.k-conflict_ended, .tl-mark.k-war_authorization { fill: #9a6700; }
.tl-i.k-conflict_began .tl-k, .tl-i.k-conflict_ended .tl-k, .tl-i.k-war_authorization .tl-k { color: #9a6700; }
