:root { --bg: #f6f7f9; --card: #ffffff; --text: #1b2330;
  --muted: #5b6676; --line: #d9dee6; --accent: #1f4e8c;
  --head: #e6eef8; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #12161d; --card: #1a2029; --text: #e7ebf1;
    --muted: #9aa5b5; --line: #2b3441; --accent: #7fb0ee;
    --head: #22304a; }
}
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: Georgia, serif; line-height: 1.5; }
main { max-width: 1000px; margin: 0 auto;
  padding: 1.5rem 1rem 3rem; }
a { color: var(--accent); }
h1 { margin: 0 0 .25rem; }
.sub { color: var(--muted); margin: 0 0 1.5rem; }
.nav { margin: 0 0 1.5rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--line); }
.wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse;
  background: var(--card); border: 1px solid var(--line); }
th, td { padding: .45rem .7rem; text-align: left;
  border-bottom: 1px solid var(--line); font-size: .95rem; }
td.nw, th.nw { white-space: nowrap; }
th { background: var(--head); }
td.n, th.n { text-align: right; white-space: nowrap; }
input[type=text] { width: 100%; max-width: 360px;
  padding: .5rem .7rem; margin-bottom: 1rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card); color: var(--text); }
.opt { margin-left: 1rem; }
.note { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.law { font-weight: 600; }
/* profile */
.profile { display: flex; flex-wrap: wrap; gap: 1.25rem;
  margin: 0 0 1.25rem; align-items: flex-start; }
.profile img { border-radius: 6px; border: 1px solid var(--line);
  object-fit: cover; background: var(--card); }
.profile ul { list-style: none; padding: 0; margin: 0; }
.profile li { margin: .3rem 0; }

/* stories */
.stories { display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.story { background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; padding: 1rem 1.2rem; }
.story h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.story .meta { color: var(--muted); font-size: .88rem; margin: 0 0 .5rem; }
.story p { margin: .3rem 0; }

/* theme */
:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1c2430;
  --muted: #5d6878; --line: #dde2ea; --head: #e9eef6;
  --zebra: #f8f9fb; --accent: #1f4e8c; --bar: #14305a;
  --d: #2b6cb0; --r: #c53030;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318; --card: #171d25; --text: #e6eaf0;
    --muted: #98a3b3; --line: #2a323e; --head: #202a38;
    --zebra: #1b222c; --accent: #7fb0ee; --bar: #0c1a30;
    --d: #6aa6e8; --r: #ef6b6b;
  }
}
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
main { max-width: 1180px; padding: 0 1rem 3rem; }
h1, h2, h3 {
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; margin: 1.5rem 0 .25rem; }
h2 {
  margin: 2.2rem 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--line);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p.nav { font-size: .95rem; color: var(--muted); border: 0; }
main > .nav:first-child {
  font-size: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: var(--bar);
  margin: 0 0 1.5rem;
  padding: .35rem 0;
  border: 0;
  box-shadow: 0 0 0 100vmax var(--bar);
  clip-path: inset(0 -100vmax);
}
main > .nav:first-child::before {
  content: "Congress Stats";
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #ffffff;
  padding: .4rem 1rem .4rem 0;
  margin-right: .5rem;
  border-right: 1px solid rgba(255,255,255,.25);
}
main > .nav:first-child a, main > .nav:first-child strong {
  font-size: .92rem;
  color: #ffffff;
  padding: .45rem .65rem;
  border-radius: 4px;
  text-decoration: none;
}
main > .nav:first-child a:hover { background: rgba(255,255,255,.15); }
main > .nav:first-child strong { background: rgba(255,255,255,.2); }
table { font-size: .93rem; border-radius: 6px; overflow: hidden; }
th, td { padding: .4rem .65rem; }
th {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.asc::after { content: ' \25B2'; font-size: .7em; }
th.desc::after { content: ' \25BC'; font-size: .7em; }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: var(--head); }
.story, .card, .tile, .plot, .map, .profile img {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.pd { color: var(--d); font-weight: 700; }
.pr { color: var(--r); font-weight: 700; }
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  main > .nav:first-child::before { width: 100%; border-right: 0; }
  th, td { padding: .35rem .5rem; }
}
@media print { main > .nav:first-child { display: none; } }
