/* civic-us pilot — "the record, not the spin": paper, ink, and ledger rules.
   Party hues appear only as small data marks, never as page chrome. */

:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1a1e27;
  --ink-2: #4c5361;
  --ink-3: #767d8b;
  --rule: #dcd6c8;
  --navy: #172033;
  --brass: #9a6b14;
  --link: #1d4f91;
  --dem: #2b62a8;
  --rep: #b8372c;
  --ind: #7c6a2e;
  --yea-bg: #e2efe3; --yea-fg: #1d5a2b;
  --nay-bg: #f6e1de; --nay-fg: #8c231a;
  --neutral-bg: #ebe7dc; --neutral-fg: #4c5361;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12151c;
    --card: #1a1e28;
    --ink: #e8e4da;
    --ink-2: #b3b8c4;
    --ink-3: #868d9c;
    --rule: #2e3442;
    --navy: #0c0f15;
    --brass: #e0b252;
    --link: #8db8f0;
    --dem: #5b93dc;
    --rep: #e0685c;
    --ind: #c9b566;
    --yea-bg: #1c3524; --yea-fg: #9ad7a7;
    --nay-bg: #40201d; --nay-fg: #f0a59c;
    --neutral-bg: #2a2f3b; --neutral-fg: #b3b8c4;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
}
.wrap { max-width: 68rem; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
main { padding-block: 1.5rem 4rem; min-height: 60vh; outline: none; }
main[aria-busy='true'] { opacity: 0.55; transition: opacity 0.2s 0.15s; }

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0.3em 0 0.4em; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 0.8rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.08rem; margin: 0; }
p { margin: 0.5em 0; }
code { font-size: 0.9em; }

.muted { color: var(--ink-3); }
.small { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 46rem; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 10; background: var(--card); padding: 0.5rem 0.8rem; }
.crumbs { font-size: 0.88rem; color: var(--ink-3); margin: 0; }
.empty, .notice { background: var(--neutral-bg); color: var(--neutral-fg); padding: 0.8rem 1rem; border-radius: 6px; }
.notice { border-left: 3px solid var(--brass); }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }

/* header / footer */
.site-header { background: var(--navy); color: #eee9dc; border-bottom: 3px solid var(--brass); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; padding-block: 0.7rem; }
.brand { font: 700 1.25rem var(--serif); color: #fff; text-decoration: none; letter-spacing: 0.01em; }
.brand span { color: #e0b252; }
.brand em { font: 600 0.62rem var(--sans); text-transform: uppercase; letter-spacing: 0.12em; color: #e0b252; border: 1px solid currentColor; border-radius: 3px; padding: 1px 5px; vertical-align: middle; margin-left: 4px; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; }
.site-header nav a { color: #cfd4df; text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; font-size: 0.95rem; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: #fff; border-bottom-color: #e0b252; }
.search { margin-left: auto; flex: 1 1 14rem; max-width: 22rem; }
.search input { width: 100%; }
.site-header input { background: #232c42; border-color: #38425c; color: #fff; }
.site-header input::placeholder { color: #98a1b5; }
.site-footer { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 0.85rem; padding-block: 1.5rem 2.5rem; }

/* forms */
input, select, button { font: inherit; }
input, select {
  background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.5rem 0.7rem; min-height: 2.5rem; max-width: 100%;
}
.btn {
  display: inline-block; background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.5rem 0.95rem; min-height: 2.5rem; cursor: pointer; text-decoration: none; font-size: 0.92rem;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .btn-primary { background: var(--brass); color: #12151c; border-color: var(--brass); } }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-3); text-decoration: underline; padding-inline: 0; }
.row-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; }
.row-form label { font-weight: 600; flex-basis: 100%; }
.row-form input:not([type='number']) { flex: 1 1 16rem; }
.row-form input[type='number'] { width: 7.5rem; }
.or { color: var(--ink-3); font-size: 0.9rem; }
.form-msg { color: var(--nay-fg); min-height: 1.4em; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.filters input { flex: 1 1 12rem; }

/* layout blocks */
.hero { padding-block: 1rem 0.2rem; }
.hero h1 { max-width: 40rem; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.2rem 1.1rem; margin-top: 1.2rem; }
.panel h2 { margin-top: 0; border: 0; padding: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.5rem 1rem; border-bottom: 1px solid var(--rule); margin: 2.2rem 0 0.8rem; padding-bottom: 0.4rem; }
.section-head h2 { margin: 0; border: 0; padding: 0; }
.section-head input { flex: 0 1 24rem; }
.tabs { display: flex; gap: 0.3rem; }
.tabs a { padding: 0.3rem 0.7rem; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 0.88rem; border: 1px solid transparent; }
.tabs a[aria-current] { background: var(--card); border-color: var(--rule); color: var(--ink); font-weight: 600; }

/* votes */
.feed { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.vote-card { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 0.85rem 1.05rem; }
.vote-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; align-items: center; font-size: 0.84rem; color: var(--ink-2); margin-bottom: 0.3rem; }
.vote-card h3 a { color: var(--ink); text-decoration-color: var(--rule); }
.vote-card h3 a:hover { color: var(--link); }
.desc { color: var(--ink-2); font-size: 0.93rem; margin: 0.25rem 0 0; }
.vote-outcome { display: grid; grid-template-columns: minmax(8rem, 15rem) 1fr; gap: 0.4rem 1.2rem; align-items: center; margin: 0.65rem 0 0.5rem; }
@media (max-width: 560px) { .vote-outcome { grid-template-columns: 1fr; } }
.result { font-weight: 650; }
.chip { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; border: 1px solid var(--rule); border-radius: 4px; padding: 1px 6px; color: var(--ink-2); }
.chip-senate { border-color: var(--brass); color: var(--brass); }
.chip-mine { margin-left: 0.6rem; vertical-align: middle; font-family: var(--sans); border-color: var(--brass); color: var(--brass); }

.split { display: grid; gap: 4px; }
.split-row { display: grid; grid-template-columns: 2.4rem 1fr 2.4rem; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--ink-2); }
.split-track { display: flex; height: 10px; background: var(--neutral-bg); border-radius: 2px; overflow: hidden; }
.split-n { text-align: right; font-weight: 600; color: var(--ink); }
.seg { display: block; height: 100%; }
.seg-D { background: var(--dem); } .seg-R { background: var(--rep); } .seg-I, .seg-\? { background: var(--ind); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.45rem; }

.pos { display: inline-block; font-size: 0.8rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral-fg); white-space: nowrap; }
.pos-yea { background: var(--yea-bg); color: var(--yea-fg); }
.pos-nay { background: var(--nay-bg); color: var(--nay-fg); }
.my-votes { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.88rem; padding: 0.45rem 0; border-top: 1px dashed var(--rule); }
.source { font-size: 0.78rem; color: var(--ink-3); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem 1.5rem; margin: 1rem 0 0.4rem; }
.facts div { border-top: 2px solid var(--ink); padding-top: 0.4rem; }
.facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-3); }
.facts dd { margin: 0; }

.pos-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.5rem 1.5rem; align-items: start; }
.pos-group h3 { font-family: var(--sans); font-size: 0.95rem; padding: 0.4rem 0; border-bottom: 2px solid var(--ink); position: sticky; top: 0; background: var(--paper); }
.pos-group ul { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.pos-group li { padding: 0.22rem 0.3rem; border-bottom: 1px solid var(--rule); }
.pos-group li.mine { background: color-mix(in srgb, var(--brass) 16%, transparent); font-weight: 600; }

/* members */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.6rem; margin: 0.6rem 0; }
.member-card { display: flex; gap: 0.8rem; align-items: center; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--ind); border-radius: 8px; padding: 0.6rem 0.8rem; }
.member-card p { margin: 0.1rem 0 0; font-size: 0.86rem; }
.party-D { border-left-color: var(--dem); } .party-R { border-left-color: var(--rep); }
.portrait { width: 56px; height: 68px; object-fit: cover; border-radius: 4px; background: var(--neutral-bg); flex: none; }
.portrait-lg { width: 112px; height: 137px; border-radius: 6px; }
.portrait-missing { visibility: hidden; }
.profile { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; border-left: 5px solid var(--ind); padding-left: 1rem; margin-top: 0.6rem; }
.profile h1 { margin: 0; }
.profile .lede { margin: 0.2rem 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; font-size: 0.93rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.7rem; margin: 0.8rem 0; }
.tile { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--ink); border-radius: 6px; padding: 0.8rem 1rem; }
.tile-big { font: 700 2rem/1.1 var(--serif); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0.6rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); border-bottom: 2px solid var(--ink); white-space: nowrap; }
tbody th { font-weight: 600; white-space: nowrap; }
tr.total th, tr.total td { border-top: 2px solid var(--ink); font-weight: 700; }
.votes-table td:nth-child(2) { min-width: 16rem; }
.votes-table td:last-child { min-width: 11rem; }
