/* ==========================================================================
   THE THREE BRANCHES — design system
   Signature: an engraved-document / federal-currency aesthetic. The hero on
   index.html is a "pediment" — three columns holding up an entablature —
   built in pure CSS, doubling as the primary navigation. Everything else
   stays quiet: hairline "certificate" borders, a ledger-style stat strip,
   and a mono type for anything numeric (dates, tallies, vote counts).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,400;0,6..96,500;0,6..96,600;0,6..96,700;0,6..96,900;1,6..96,500;1,6..96,600&family=Public+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* --- color: engraved paper + intaglio ink + brass + wax seal --- */
  --paper: #EAE4D3;
  --paper-alt: #DFD7BF;
  --card: #F5F0E4;
  --ink: #1C2620;
  --ink-soft: #4C5850;
  --ink-faint: #7C8579;
  --blue: #1B3A4B;
  --blue-deep: #0E222B;
  --brass: #8F6D28;
  --brass-light: #C6A85B;
  --red: #7C2A28;
  --line: rgba(28, 38, 32, 0.18);
  --line-soft: rgba(28, 38, 32, 0.1);
  --line-on-dark: rgba(234, 228, 211, 0.22);

  /* --- type --- */
  --font-display: 'Bodoni Moda', 'Didot', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  /* --- spacing scale --- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;
  --sp-9: 6.5rem;

  --max: 1180px;
  --max-read: 700px;
  --radius: 2px;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 var(--sp-4);
  letter-spacing: -0.01em;
}
p { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25em; }
li { margin-bottom: var(--sp-2); }
:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

/* ---------- layout helpers ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--sp-5); }
.read { max-width: var(--max-read); }
.section { padding: var(--sp-8) 0; }
.section--alt { background: var(--paper-alt); }
.section--dark { background: var(--blue-deep); color: var(--paper); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--paper); }
.grid { display: grid; gap: var(--sp-6); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 880px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- eyebrow / kicker ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: var(--sp-3);
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--brass);
}
.section--dark .eyebrow { color: var(--brass-light); }

/* ==========================================================================
   HEADER / NAV
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--blue-deep);
  color: var(--paper);
  border-bottom: 1px solid var(--line-on-dark);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--paper);
  display: flex;
  align-items: baseline;
  gap: 0.5em;
}
.brand small {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--brass-light);
  letter-spacing: 0.14em;
  font-weight: 500;
}
.nav-links {
  display: flex;
  gap: var(--sp-6);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--paper);
  opacity: 0.78;
  position: relative;
  padding: 4px 0;
  transition: opacity 0.15s ease;
}
.nav-links a:hover { opacity: 1; }
.nav-links a.active { opacity: 1; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--brass-light);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-on-dark);
  color: var(--paper);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
}
@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--blue-deep);
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
    gap: var(--sp-4);
    border-bottom: 1px solid var(--line-on-dark);
    display: none;
  }
  .nav-links.open { display: flex; }
}

/* ==========================================================================
   PAGE HERO (interior pages)
   ========================================================================== */
.page-hero {
  background: var(--blue-deep);
  color: var(--paper);
  padding: var(--sp-8) 0 var(--sp-7);
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(198,168,91,0.05) 0 2px, transparent 2px 26px);
  pointer-events: none;
}
.page-hero .wrap { position: relative; }
.page-hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); max-width: 14ch; }
.page-hero .lede { max-width: 62ch; font-size: 1.15rem; color: rgba(234,228,211,0.85); }
.article-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--line-on-dark);
  color: var(--brass-light);
  padding: 3px 10px;
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: var(--sp-4);
}

/* ==========================================================================
   PEDIMENT — homepage signature element
   ========================================================================== */
.pediment-hero { background: var(--blue-deep); color: var(--paper); padding: var(--sp-8) 0 0; position: relative; overflow: hidden; }
.pediment-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(120deg, rgba(198,168,91,0.05) 0 2px, transparent 2px 30px);
}
.pediment-intro { position: relative; text-align: center; max-width: 780px; margin: 0 auto; padding: 0 var(--sp-5); }
.pediment-intro h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
.pediment-intro p { font-size: 1.15rem; color: rgba(234,228,211,0.82); max-width: 56ch; margin-left: auto; margin-right: auto; }

.pediment { position: relative; margin-top: var(--sp-8); }
.pediment-roof {
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid var(--line-on-dark);
  border-bottom: none;
  padding: var(--sp-3) var(--sp-5);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  color: var(--brass-light);
}
.pediment-columns {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-top: 3px solid var(--brass-light);
}
.column {
  flex: 1;
  text-decoration: none;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-5) var(--sp-2) 0;
  border-left: 1px solid var(--line-on-dark);
  transition: transform 0.2s ease, background 0.2s ease;
  position: relative;
}
.column:first-child { border-left: none; }
.column:hover, .column:focus-visible { transform: translateY(-6px); background: rgba(198,168,91,0.06); }
.column-cap {
  width: 64%;
  height: 14px;
  background: var(--brass-light);
  clip-path: polygon(8% 100%, 92% 100%, 100% 0, 0 0);
  opacity: 0.9;
}
.column-shaft {
  width: 46%;
  min-width: 54px;
  height: clamp(120px, 22vw, 210px);
  background: repeating-linear-gradient(90deg, rgba(234,228,211,0.16) 0 5px, rgba(234,228,211,0.03) 5px 9px);
  border-left: 1px solid var(--line-on-dark);
  border-right: 1px solid var(--line-on-dark);
}
.column-base { width: 70%; height: 10px; background: var(--brass-light); opacity: 0.9; }
.column-art { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em; color: var(--brass-light); margin-top: var(--sp-4); }
.column-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin-top: 2px; }
.column-role { font-size: 0.82rem; color: rgba(234,228,211,0.7); text-align: center; margin: 4px 0 var(--sp-5); max-width: 20ch; }
@media (max-width: 780px) {
  .pediment-columns { flex-direction: column; border-top: none; }
  .column { border-left: none; border-top: 1px solid var(--line-on-dark); width: 100%; padding-top: var(--sp-6); }
  .column:first-child { border-top: none; }
  .column-shaft { height: 70px; width: 30%; }
}

/* ==========================================================================
   STAT LEDGER STRIP
   ========================================================================== */
.ledger {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-on-dark);
  margin-top: var(--sp-7);
}
.ledger-item {
  flex: 1 1 140px;
  padding: var(--sp-5);
  border-left: 1px solid var(--line-on-dark);
  text-align: center;
}
.ledger-item:first-child { border-left: none; }
.ledger-num { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; color: var(--brass-light); display: block; }
.ledger-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(234,228,211,0.65); }

/* ==========================================================================
   DOC-FRAME — certificate-style bordered container (cards, quotes, tables)
   ========================================================================== */
.doc-frame {
  position: relative;
  border: 1px solid var(--line);
  padding: var(--sp-6);
  background: var(--card);
}
.doc-frame::before, .doc-frame::after,
.doc-frame > .corner-a, .doc-frame > .corner-b { content: none; }
.doc-frame {
  outline: 1px solid transparent;
}
.doc-frame::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

/* branch cards on homepage */
.branch-card {
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.branch-card h3 { font-size: 1.3rem; margin-bottom: var(--sp-2); color: var(--blue); }
.branch-card .article-tag { color: var(--brass); border-color: var(--line); margin-bottom: var(--sp-3); }
.branch-card p { color: var(--ink-soft); margin-bottom: var(--sp-3); font-size: 0.97rem; }
.branch-card .read-link { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--blue); }
.branch-card:hover .read-link { color: var(--red); }

/* ==========================================================================
   CHECKS & BALANCES TABLE
   ========================================================================== */
.cb-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.cb-table th, .cb-table td {
  border: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: top;
}
.cb-table thead th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--blue-deep);
  color: var(--paper);
}
.cb-table tbody th {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--paper-alt);
  white-space: nowrap;
}
.cb-table td { background: var(--card); }

/* generic data table (presidents / chief justices / powers) */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table caption { text-align: left; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--brass); text-transform: uppercase; margin-bottom: var(--sp-3); }
.data-table th, .data-table td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line-soft); text-align: left; }
.data-table thead th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 2px solid var(--ink); }
.data-table td.num, .data-table th.num { font-family: var(--font-mono); color: var(--ink-soft); width: 2.5em; }
.data-table tbody tr:hover td { background: var(--paper-alt); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); }
.table-scroll .data-table { min-width: 560px; }
.table-scroll .doc-frame { border: none; }

/* ==========================================================================
   POWERS LIST
   ========================================================================== */
.power-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.power-list li { background: var(--card); padding: var(--sp-4); display: flex; gap: var(--sp-4); }
.power-list .k { font-family: var(--font-mono); font-size: 0.72rem; color: var(--brass); flex: 0 0 auto; padding-top: 3px; }
.power-list strong { display: block; color: var(--blue); font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.power-list span.desc { color: var(--ink-soft); font-size: 0.93rem; }

/* ==========================================================================
   PULL QUOTE
   ========================================================================== */
.pull-quote {
  border-left: 3px solid var(--brass);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
  margin: var(--sp-6) 0;
}
.pull-quote p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--blue);
  margin-bottom: var(--sp-2);
  line-height: 1.35;
}
.pull-quote cite { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); font-style: normal; }

/* ==========================================================================
   TAGS / BADGES
   ========================================================================== */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
}
.tag--leg { color: var(--blue); }
.tag--exe { color: var(--red); }
.tag--jud { color: var(--brass); }
.tag--amend { color: var(--ink-soft); }

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.timeline-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-7); }
.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius);
}
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.search-input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  width: 100%;
  max-width: 340px;
  margin-bottom: var(--sp-7);
  border-radius: var(--radius);
}
.era-heading {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  border-top: 1px solid var(--line);
  padding-top: var(--sp-2);
  margin: var(--sp-8) 0 var(--sp-5);
}
.tl { position: relative; padding-left: 100px; border-left: 1px solid var(--line); margin-left: 90px; }
.tl-item { position: relative; padding-bottom: var(--sp-7); }
.tl-item:last-child { padding-bottom: 0; }
.tl-year {
  position: absolute;
  left: -190px;
  top: -2px;
  width: 80px;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--blue);
  font-size: 1rem;
}
.tl-dot {
  position: absolute;
  left: -105px;
  top: 3px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--brass);
}
.tl-item h4 { font-size: 1.1rem; margin-bottom: 4px; }
.tl-item p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: var(--sp-2); max-width: 62ch; }
.tl-item .tag { margin-right: 4px; }
@media (max-width: 700px) {
  .tl { margin-left: 0; padding-left: 26px; }
  .tl-year { position: static; text-align: left; display: block; margin-bottom: 4px; width: auto; }
  .tl-dot { left: -26px; }
}

/* ==========================================================================
   FIGURE CARDS (key figures page)
   ========================================================================== */
.figure-card { display: flex; gap: var(--sp-4); padding: var(--sp-4) 0; border-bottom: 1px solid var(--line-soft); }
.figure-mono {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border: 1px solid var(--brass);
  color: var(--brass);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.figure-body h4 { font-size: 1.05rem; margin-bottom: 2px; }
.figure-dates { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); display: block; margin-bottom: 4px; }
.figure-body p { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 0; }

/* ==========================================================================
   STEPS (how a bill becomes law, etc.)
   ========================================================================== */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3.2em;
  margin-bottom: var(--sp-5);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  width: 2.2em; height: 2.2em;
  border: 1px solid var(--blue);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.steps strong { display: block; color: var(--blue); font-family: var(--font-display); font-size: 1.05rem; }
.steps span { color: var(--ink-soft); font-size: 0.94rem; }

/* ==========================================================================
   BUTTONS / LINKS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  padding: 11px 20px;
  border: 1px solid var(--brass-light);
  color: var(--paper);
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--brass-light); color: var(--blue-deep); }
.btn--ink { border-color: var(--blue); color: var(--blue); }
.btn--ink:hover { background: var(--blue); color: var(--paper); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--blue-deep);
  color: rgba(234,228,211,0.72);
  padding: var(--sp-7) 0 var(--sp-6);
  font-size: 0.88rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-5); }
.footer-links { display: flex; gap: var(--sp-5); list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.footer-links a { color: rgba(234,228,211,0.72); text-decoration: none; }
.footer-links a:hover { color: var(--brass-light); }
.footer-note { font-family: var(--font-mono); font-size: 0.76rem; color: rgba(234,228,211,0.45); margin-top: var(--sp-4); }

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */
.back-top {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  width: 42px; height: 42px;
  background: var(--blue-deep);
  color: var(--paper);
  border: 1px solid var(--brass-light);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-size: 1rem;
  z-index: 40;
}
.back-top.visible { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   MISC
   ========================================================================== */
.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--sp-8); align-items: start; }
@media (max-width: 880px) { .two-col { grid-template-columns: 1fr; } }
.divider { border: none; border-top: 1px solid var(--line); margin: var(--sp-7) 0; }
.small-caps { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); }
.today-tag { background: var(--red); color: var(--paper); font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.06em; padding: 2px 7px; border-radius: var(--radius); margin-left: 6px; vertical-align: middle; }
