/* Permitting Reform. Palette and type are borrowed from the Senate EPW
   committee site (see design.md). Every color lives in the two token blocks
   below; nothing else in this file names one. */

@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/Raleway-Roman-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/OpenSans-Roman-latin.woff2") format("woff2");
}

:root {
  --bg: #FFFCF3;
  --surface: #FFFFFF;
  --border: #D5D5D5;
  --rule: #24461E;
  --text: #2B2B2B;
  --text-muted: #5F6068;
  --accent: #205671;
  --accent-weak: #EAF2E3;
  --brand: #24461E;
  --on-brand: #FFFCF3;
  --on-brand-muted: #D3E3C9;
  --mark: #FEE402;
  --on-mark: #2B2B2B;
  --stance-supports: #3B6B33;
  --stance-opposes: #9A2A1F;
  --stance-mixed: #7B5816;
  --stance-neutral: #5F6068;

  --font-head: "Raleway", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: "Charter", "Source Serif 4", "Iowan Old Style", "Palatino", "Georgia", "Times New Roman", serif;
  --measure: 72ch;
}

[data-theme="light"] { color-scheme: light; }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151A16;
  --surface: #202821;
  --border: #71806F;
  --rule: #B2D894;
  --text: #F4F2EC;
  --text-muted: #D0D6CC;
  --accent: #A6DDED;
  --accent-weak: #2B382B;
  --brand: #1B3317;
  --on-brand: #F4F2EC;
  --on-brand-muted: #BFD3B4;
  --mark: #FEE402;
  --on-mark: #1B1B1B;
  --stance-supports: #97C17C;
  --stance-opposes: #F0998C;
  --stance-mixed: #E3B55A;
  --stance-neutral: #D0D6CC;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

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

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; font-weight: 700; font-feature-settings: "lnum" 1; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 10px; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.muted, .na, .label { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* ---------- masthead ---------- */

.masthead { background: var(--brand); color: var(--on-brand); }
.masthead-top, .tabs, main, .footer p { max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; }
.masthead-top { display: flex; align-items: center; gap: 12px; padding-top: 16px; padding-bottom: 8px; }
.brand { text-decoration: none; color: var(--on-brand); display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.brand-name { font-family: var(--font-head); font-size: clamp(1.1rem, 5.4vw, 1.5rem); font-weight: 800; line-height: 1.1; white-space: nowrap; }
.theme-toggle {
  cursor: pointer; background: transparent; color: var(--on-brand);
  border: 0; padding: 0; flex: 0 0 44px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--brand); outline: 1px solid var(--on-brand-muted); }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }

.tabs { display: flex; flex-wrap: wrap; gap: 0 2px; }
.tabs a {
  color: var(--on-brand); text-decoration: none; padding: 8px 12px 7px; font-family: var(--font-head);
  font-size: 0.95rem; font-weight: 600; border-bottom: 4px solid transparent; white-space: nowrap;
}
.tabs a:hover { border-bottom-color: var(--on-brand-muted); }
.tabs a[aria-current="page"] { border-bottom-color: var(--mark); }
.masthead :focus-visible { outline-color: var(--mark); }

/* ---------- page furniture ---------- */

main { padding-top: 22px; padding-bottom: 48px; min-height: 60vh; }
main:focus { outline: none; }
.lede { margin-bottom: 16px; }
.lede p { margin: 6px 0 0; }
.facts { color: var(--text-muted); font-size: 0.95rem; }
.block { margin-top: 28px; padding-top: 14px; border-top: 2px solid var(--rule); }
.block > h2, .two-col h2 { margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 36px; }
.note, .credit { font-size: 0.85rem; color: var(--text-muted); max-width: var(--measure); }
.machine { border-left: 3px solid var(--rule); padding-left: 14px; }
.where, .sources, .sources-inline { font-size: 0.85rem; color: var(--text-muted); }
.unchecked { font-size: 0.8rem; color: var(--text-muted); }
.empty, .loading { color: var(--text-muted); padding: 18px 0; }
.notice { border: 1px solid var(--rule); background: var(--surface); padding: 14px 16px; max-width: var(--measure); }
.notice ul { list-style: disc; padding-left: 20px; }
.prose p { max-width: var(--measure); }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--border); max-width: var(--measure); }

.search { display: flex; max-width: 560px; margin: 14px 0 4px; }
.search input, .inline-filter {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--rule); border-right: 0; border-radius: 2px 0 0 2px; padding: 8px 12px;
}
.search button {
  font: inherit; font-family: var(--font-head); font-weight: 700; cursor: pointer; background: var(--brand); color: var(--on-brand);
  border: 1px solid var(--rule); border-radius: 0 2px 2px 0; padding: 8px 16px;
}
.inline-filter { border: 1px solid var(--border); border-radius: 2px; flex: 0 1 220px; padding: 5px 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.filter-wrap > summary { cursor: pointer; font-family: var(--font-head); font-weight: 700; padding: 6px 0; }
.results h1 { margin-top: 14px; }
.filter-gap { flex: 0 0 10px; }
.chip {
  font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px; padding: 4px 10px; text-decoration: none; line-height: 1.4;
  display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--rule); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.chip-count { margin-left: 5px; font-size: 0.78rem; }

.stance { font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.stance-supports { color: var(--stance-supports); }
.stance-opposes { color: var(--stance-opposes); }
.stance-mixed { color: var(--stance-mixed); }
.stance-neutral, .stance-reporting { color: var(--stance-neutral); }
.tag-major { font-size: 0.78rem; font-weight: 700; color: var(--text); border: 1px solid var(--rule); border-radius: 2px; padding: 0 6px; white-space: nowrap; }
.topics { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; }
.topic { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border); }
thead th { font-family: var(--font-head); font-size: 0.86rem; font-weight: 700; border-bottom: 2px solid var(--rule); white-space: nowrap; }
.figure { font-family: var(--font-head); font-weight: 700; white-space: nowrap; }

/* ---------- overview ---------- */

.status-list li { padding: 8px 0; border-bottom: 1px solid var(--border); max-width: 90ch; }
.provisions { counter-reset: prov; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 36px; }
.provisions li { counter-increment: prov; position: relative; padding: 10px 0 10px 46px; border-bottom: 1px solid var(--border); }
.provisions li::before {
  content: counter(prov); position: absolute; left: 0; top: 9px; font-family: var(--font-head);
  font-size: 1.35rem; font-weight: 800; color: var(--text-muted); width: 36px; text-align: right;
}
.provisions h3 a { color: var(--text); }
.provisions p { margin: 3px 0 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.feed-title { font-weight: 600; }
.feed-meta { display: block; font-size: 0.82rem; color: var(--text-muted); margin: 0; }

/* ---------- bill index ---------- */

.index-group { margin-top: 24px; }
.index-group > h2 { font-size: 1.05rem; padding-bottom: 6px; border-bottom: 2px solid var(--rule); }
.index li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.index-head { display: flex; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--font-head); font-size: 1.02rem; font-weight: 600; }
.index-head:hover .index-title { text-decoration: underline; }
.index li.major .index-title { font-weight: 800; }
.index-num { color: var(--accent); min-width: 2.7em; }
.index-pages { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.index-sum { grid-column: 1 / -1; margin: 0; color: var(--text-muted); font-size: 0.92rem; max-width: 100ch; }
.index-tags { grid-column: 1 / -1; margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

/* ---------- section view ---------- */

.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 36px; }
.outline-toggle { cursor: pointer; font-family: var(--font-head); font-weight: 700; padding: 8px 0; border-bottom: 1px solid var(--border); }
.outline details { border-bottom: 1px solid var(--border); }
.outline summary { cursor: pointer; font-size: 0.82rem; font-weight: 700; padding: 8px 0; }
.outline ul { padding-bottom: 8px; }
.outline li a {
  display: block; font-size: 0.85rem; padding: 3px 0 3px 10px; color: var(--text); text-decoration: none;
  border-left: 3px solid transparent; line-height: 1.35;
}
.outline li a:hover { text-decoration: underline; }
.outline li a.major { font-weight: 700; }
.outline li a[aria-current="true"] { border-left-color: var(--rule); background: var(--accent-weak); }
.sec-meta { font-size: 0.88rem; color: var(--text-muted); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.sec-part { margin-top: 26px; }
.sec-part > h2 { margin-bottom: 10px; }
.credit-inline { font-family: var(--font-body); font-size: 0.8rem; font-weight: 400; color: var(--text-muted); margin-left: 8px; }
.summary { font-size: 1.02rem; max-width: var(--measure); }
.points { list-style: disc; padding-left: 20px; max-width: var(--measure); }
.points li { margin-bottom: 5px; }
.points .cite { font-size: 0.85rem; white-space: nowrap; }
.quote { margin: 0; padding: 12px 0; border-top: 1px solid var(--border); max-width: 80ch; }
.quote blockquote { margin: 0 0 6px; font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.5; }
.quote blockquote::before { content: "\201C"; }
.quote blockquote::after { content: "\201D"; }
.quote figcaption { font-size: 0.85rem; color: var(--text-muted); }
.quote.small { border-top: 0; border-left: 2px solid var(--border); padding: 2px 0 2px 12px; margin: 8px 0; }
.quote.small blockquote { font-size: 0.98rem; }
.versus { margin: 0; max-width: var(--measure); }
.versus dt { font-family: var(--font-head); font-weight: 700; font-size: 0.92rem; margin-top: 10px; }
.versus dd { margin: 2px 0 0; }
.versus dd p:last-child { margin-bottom: 0; }

.para, .passages li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 0 14px; }
.gutter { text-align: right; font-size: 0.78rem; color: var(--text-muted); text-decoration: none; padding-top: 5px; white-space: nowrap; }
.gutter:hover { color: var(--accent); text-decoration: underline; }
.para p, .passages p { font-family: var(--font-serif); font-size: 1.02rem; line-height: 1.6; margin: 0 0 8px; max-width: 78ch; }
.para.lvl2 p { padding-left: 0.9em; }
.para.lvl3 p { padding-left: 1.8em; }
.para.lvl4 p { padding-left: 2.7em; }
.para.lvl5 p { padding-left: 3.6em; }
.para.lvl6 p { padding-left: 4.5em; }
.para.target { background: var(--accent-weak); outline: 1px solid var(--rule); outline-offset: 2px; }
mark { background: var(--mark); color: var(--on-mark); padding: 0 1px; border-radius: 1px; }
.pager { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; margin-top: 30px; padding-top: 12px; border-top: 2px solid var(--rule); font-size: 0.9rem; }

/* ---------- search results ---------- */

.result { padding: 14px 0; border-top: 1px solid var(--border); }
.result h2 { font-size: 1.08rem; }
.result-meta { font-size: 0.82rem; color: var(--text-muted); margin: 2px 0 8px; }
.result-sum { color: var(--text-muted); max-width: var(--measure); }
.more { font-size: 0.88rem; margin-left: 66px; }

/* ---------- compare ---------- */

.versions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 28px; margin: 0 0 8px; }
.versions dt { font-family: var(--font-head); font-weight: 700; }
.versions dd { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.compare th[scope="row"] { font-family: var(--font-head); font-size: 0.95rem; width: 15%; min-width: 130px; }
.compare td { width: 21%; min-width: 190px; }
.compare td.col-senate { background: var(--accent-weak); padding-left: 10px; }
.cell-text { display: block; }
.cell-cite { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- timeline ---------- */

.year { font-size: 1.4rem; margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--rule); }
.event { padding: 12px 0 12px 16px; border-left: 2px solid var(--border); margin-left: 4px; max-width: 86ch; }
.event.milestone { border-left-color: var(--rule); border-left-width: 4px; padding-left: 14px; }
.event-meta { font-size: 0.85rem; color: var(--text-muted); margin: 2px 0 6px; }
.signif { color: var(--text-muted); }

/* ---------- people ---------- */

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0 32px; }
.person { padding: 12px 0; border-bottom: 1px solid var(--border); }
.role { font-size: 0.88rem; color: var(--text-muted); margin: 2px 0 4px; }
.party { font-family: var(--font-body); font-weight: 400; font-size: 0.85rem; color: var(--text-muted); }
.person-stance { margin-bottom: 4px; }
.actions { list-style: disc; padding-left: 18px; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px; }
.social { font-size: 0.85rem; }

/* ---------- media ---------- */

.media-item { padding: 12px 0; border-bottom: 1px solid var(--border); max-width: 90ch; }
.media-item h3 { margin: 0 0 2px; font-size: 1.02rem; }
.media-item .feed-meta { margin-bottom: 4px; }
.media-tags { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 4px 0 0; }

/* ---------- footer ---------- */

.footer { border-top: 2px solid var(--rule); font-size: 0.82rem; color: var(--text-muted); }
.footer p { padding-top: 14px; padding-bottom: 28px; margin-top: 0; margin-bottom: 0; }

/* ---------- tablet ---------- */

@media (min-width: 640px) {
  .filter-wrap > summary { display: none; }
  .masthead-top, .tabs, main, .footer p { padding-left: 24px; padding-right: 24px; }
  .brand-name { font-size: 2.1rem; }
  h1 { font-size: 1.6rem; }
  .versions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager a[rel="next"] { text-align: right; }
}

@media (min-width: 900px) {
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col.wide-left { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .provisions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- desktop ---------- */

@media (min-width: 1024px) {
  .masthead-top, .tabs, main, .footer p { padding-left: 32px; padding-right: 32px; }
  .brand-name { font-size: 2.4rem; }
  .bill-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .outline-wrap { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow-y: auto; }
  .outline-toggle { display: none; }
  .versions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- small screens: the comparison stacks ---------- */

@media (max-width: 639px) {
  .data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data, .data tbody, .data tr, .data td { display: block; width: auto; }
  .data tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .data td { border: 0; padding: 1px 0; white-space: normal; }
  .data td.figure { font-size: 1.05rem; }
  .data td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); }
}

/* Five columns need about 900px; below that each subject stacks its four versions. */
@media (max-width: 1023px) {
  .compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .compare, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: auto; min-width: 0; }
  .compare tr { padding: 10px 0; border-bottom: 2px solid var(--rule); }
  .compare th[scope="row"] { border: 0; font-size: 1.05rem; padding-bottom: 2px; width: auto; }
  .compare td { border: 0; padding: 6px 0 6px 10px; width: auto; max-width: var(--measure); }
  .compare td::before { content: attr(data-label); display: block; font-family: var(--font-head); font-size: 0.82rem; font-weight: 700; }
}

@media (max-width: 759px) {
  .para, .passages li { grid-template-columns: 42px minmax(0, 1fr); gap: 0 10px; }
  .para.lvl2 p { padding-left: 0.5em; }
  .para.lvl3 p { padding-left: 1em; }
  .para.lvl4 p { padding-left: 1.5em; }
  .para.lvl5 p { padding-left: 2em; }
  .para.lvl6 p { padding-left: 2.5em; }
  .more { margin-left: 52px; }
}

@media (pointer: coarse) {
  .chip, .tabs a, .theme-toggle, .search button, .search input, .outline summary, .outline-toggle, .filter-wrap > summary { min-height: 44px; }
  .tabs a, .theme-toggle { display: inline-flex; align-items: center; }
  .outline li a { padding-top: 10px; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: no-preference) {
  .chip, .tabs a, .gutter { transition: border-color 120ms, color 90ms, background-color 90ms; }
}

@media print {
  .theme-toggle, .tabs, .filters, .search, .outline-wrap, .pager { display: none; }
  .masthead { background: none; color: inherit; }
  .brand { color: inherit; }
  body { background: none; }
}

/* Compact overview: sources stay available without delaying the provisions. */
.bill-heading { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.bill-details { font-size: 0.85rem; }
.bill-details summary { cursor: pointer; color: var(--accent); padding: 6px 0; }
.bill-details[open] { flex-basis: 100%; max-width: var(--measure); }
.overview-lede + .block { margin-top: 18px; }
input::placeholder { color: var(--text-muted); opacity: 1; }
[data-theme="dark"] .chip[aria-pressed="true"],
[data-theme="dark"] .chip[aria-current="true"],
[data-theme="dark"] .search button { background: var(--rule); color: var(--bg); border-color: var(--rule); }

@media (max-width: 639px) {
  .masthead-top { gap: 6px; padding-top: 6px; padding-bottom: 2px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .tabs a { flex: none; padding: 8px 10px 7px; font-size: 0.88rem; }
  main { padding-top: 16px; }
  .sec-meta .topics, .sec-meta .tag-major, .index-tags { display: none; }
}
