/* Stylesheet for pre-rendered HTML pages (build_html.py output).
 * Kept separate from the SPA's style.css so the two surfaces can evolve
 * independently. Goals: readable legal text, fast first paint, no JS required.
 */

:root {
  --fg: #1a1a1a;
  --fg-muted: #555;
  --link: #0b5fff;
  --link-visited: #6442b4;
  --bg: #fff;
  --bg-soft: #f7f7f5;
  --border: #e3e3df;
  --accent: #0b5fff;
  --serif: Georgia, "Iowan Old Style", "Source Serif Pro", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max: 760px;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

/* ───── header / footer ───── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  font-family: var(--sans);
  background: var(--bg-soft);
}
.site-header .brand {
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.25rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-align: center;
}

/* ───── main column ───── */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

/* ───── breadcrumb ───── */
.breadcrumb {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
  word-wrap: break-word;
}
.breadcrumb a { color: var(--fg-muted); }
.breadcrumb a:hover { color: var(--link); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.6; }

/* ───── article ───── */
article h1 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0.25rem 0 1rem;
  letter-spacing: -0.005em;
}
article .cite {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
article .meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 1rem 0 0;
}
article .source { font-family: var(--sans); font-size: 0.85rem; }

/* ───── legal body text ───── */
.body p {
  margin: 0.85rem 0;
}
.legal-text p {
  /* Preserve indented sub-clauses from the source text. Tab-size of 2 keeps
   * the original (a)/(b)/(i) indent visible without ballooning the line. */
  white-space: pre-wrap;
  -moz-tab-size: 2;
  tab-size: 2;
  font-family: var(--serif);
}

/* ───── subsections (IRS forms, publications, IRC sub-parts) ───── */
.body .subsection {
  margin: 1.75rem 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1rem;
}
.body .subsection:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.body .subsection h2 {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.005em;
  line-height: 1.35;
  margin: 0 0 0.5rem;
}
.body .subsection h2 .anchor {
  color: var(--fg-muted);
  font-weight: 400;
  font-size: 0.85em;
  text-decoration: none;
  margin-right: 0.35rem;
  opacity: 0.35;
  transition: opacity 0.1s, color 0.1s;
}
.body .subsection h2:hover .anchor {
  opacity: 1;
  color: var(--accent);
}
.body .subsection h2 .anchor:focus {
  opacity: 1;
  color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.body .subsection p:first-of-type {
  margin-top: 0;
}
.body .subsection p:last-of-type {
  margin-bottom: 0;
}

/* Stronger emphasis when source text uses inline strong/em */
.body strong, .body b {
  font-weight: 700;
  color: var(--fg);
}
.body em, .body i {
  font-style: italic;
}

/* Section H1 — make the primary heading stand out cleanly */
article > h1 {
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
  margin-bottom: 1.25rem;
}

/* ───── repealed banner ───── */
.banner {
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.banner.repealed {
  background: #fff3cd;
  border: 1px solid #ffe69c;
  color: #6b4f00;
}

/* ───── section nav (prev/next) ───── */
.section-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.9rem;
  gap: 1rem;
}
.section-nav a[rel="next"] { margin-left: auto; text-align: right; }

/* ───── TOC list (corpus index) ───── */
.toc {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.toc li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--bg-soft);
}
.toc li.repealed .heading { color: var(--fg-muted); text-decoration: line-through; }
.toc a { display: flex; gap: 0.75rem; align-items: baseline; }
.toc .num {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--fg);
  min-width: 5rem;
}
.toc .heading { color: var(--fg); }
.toc a:hover .heading { color: var(--link); }

/* ───── corpora cards (jurisdiction landing) ───── */
.corpora, .jurisdictions {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: 0.75rem;
}
.corpora a, .jurisdictions a {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
}
.corpora a:hover, .jurisdictions a:hover {
  border-color: var(--accent);
  background: var(--bg-soft);
  text-decoration: none;
}
.corpora h2, .jurisdictions h2 {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
  font-weight: 600;
}
.corpora .count, .jurisdictions .count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ───── homepage hero ───── */
.hero h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0.5rem 0;
}
.hero .lede {
  font-size: 1.05rem;
  color: var(--fg-muted);
  max-width: 60ch;
}

/* ───── small-screen tweaks ───── */
@media (max-width: 540px) {
  html { font-size: 16px; }
  main { padding: 1rem; }
  article h1 { font-size: 1.35rem; }
  .toc a { flex-direction: column; gap: 0.1rem; }
  .toc .num { min-width: 0; }
}
