/* ============================================================
   base.css — shared foundation across all three tiers
   ============================================================
   What this file owns:
   - Typography baseline (Calibri stack, sizes, line heights)
   - Page container (8.5×11 letter, 1" margins, drop-shadow on screen)
   - Body element styles (paragraphs, lists, tables, blockquotes,
     horizontal rules, code, links)
   - The shared cross-reference link class (gov-xref)
   - Responsive collapse on narrow screens

   What this file does NOT own:
   - Header layout (each tier has its own; see policy.css, ap.css, wi.css)
   - Tier-specific accent colors (custom properties live in themes)
   - Print rules (see print.css)
   ============================================================ */

:root {
  --accent-primary: #3D7A1C;       /* default to AP green; overridden per tier */
  --accent-light:   #E8F4DD;
  --accent-dark:    #2D5A14;
  --text-body:      #1F1F1F;
  --text-muted:     #555555;
  --text-faint:     #888888;
  --rule-line:      #DDDDDD;
  --table-zebra:    #FAFAFA;
  --page-max-width: 8.5in;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Calibri, "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.55;
  color: var(--text-body);
  background: #F5F5F5;
}

/* -- Page container (8.5×11 letter on screen) ---------------- */
.gov-page {
  max-width: var(--page-max-width);
  margin: 24px auto;
  padding: 1in;
  background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  min-height: calc(11in - 48px);
}

/* -- Headings (tier themes override colors) ------------------ */
h1, h2, h3, h4, h5, h6 {
  font-family: Calibri, "Segoe UI", -apple-system, sans-serif;
  font-weight: 600;
  color: var(--accent-primary);
  page-break-after: avoid;
  line-height: 1.25;
}

h1 { font-size: 17pt; margin: 28px 0 14px 0; }
h2 { font-size: 14pt; margin: 22px 0 10px 0; }
h3 { font-size: 12pt; margin: 18px 0 8px 0; }
h4 { font-size: 11pt; margin: 14px 0 6px 0; font-style: italic; color: var(--text-body); }
h5, h6 { font-size: 11pt; margin: 12px 0 4px 0; color: var(--text-body); }

/* -- Body elements ------------------------------------------ */
p { margin: 0 0 10px 0; }

ul, ol {
  margin: 0 0 12px 0;
  padding-left: 1.5em;
}

li { margin-bottom: 4px; }
li > ul, li > ol { margin-top: 4px; margin-bottom: 0; }

/* Governance clause numbering: each level is classified by its own marker (roman vs
   alpha) and nested by indent depth — no fixed level->kind mapping. Nested lists inherit
   padding-left from the ul,ol rule above, so each depth indents further. */
ol.roman-list  { list-style-type: lower-roman; }
ol.alpha-list  { list-style-type: lower-alpha; }

em { font-style: italic; }
strong { font-weight: 700; }

/* -- Cross-reference links ---------------------------------- */
a.gov-xref {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-primary);
  font-weight: 500;
}

a.gov-xref:hover {
  background: var(--accent-light);
  border-bottom-style: solid;
}

a.gov-xref-broken {
  color: #B22222;
  border-bottom: 1px wavy #B22222;
  cursor: help;
}

/* -- Tables (themes override header colors) ----------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 10.5pt;
  page-break-inside: avoid;
}

th, td {
  border: 0.5px solid var(--rule-line);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--accent-primary);
  color: #FFFFFF;
  font-weight: 500;
}

tbody tr:nth-child(even) { background: var(--table-zebra); }

/* -- Blockquotes -------------------------------------------- */
blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent-primary);
  color: var(--text-body);
}

blockquote p:last-child { margin-bottom: 0; }

/* -- Code (rare in governance) ------------------------------ */
code, pre {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 10pt;
}

code {
  background: #F5F5F5;
  padding: 1px 4px;
  border-radius: 2px;
}

pre {
  background: #F5F5F5;
  padding: 10px;
  border-radius: 3px;
  overflow-x: auto;
  page-break-inside: avoid;
}

pre code {
  background: transparent;
  padding: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule-line);
  margin: 20px 0;
}

/* -- Footer band -------------------------------------------- */
.gov-footer {
  margin-top: 36px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-line);
  font-size: 9pt;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
}

/* -- Responsive: drop chrome on narrow screens -------------- */
@media (max-width: 9in) {
  .gov-page {
    margin: 0;
    padding: 24px 16px;
    box-shadow: none;
    min-height: 100vh;
  }
  body { background: #FFFFFF; }
}
