/* ==========================================================================
   2b or not 2b — Charter rights are for everyone
   Design system: civic, sober, accessible. No external fonts, no trackers.
   WCAG 2.1 AA targets: contrast, focus visibility, reduced motion, zoom.
   ========================================================================== */

:root {
  --paper: #faf8f4;
  --paper-raised: #ffffff;
  --ink: #1c2430;
  --ink-soft: #46505c;
  --rule: #d8d2c6;
  --maple: #9b1c15;          /* accents, borders; 6.8:1 on paper */
  --maple-deep: #7c1410;
  --link: #16498a;           /* 7.5:1 on paper */
  --link-visited: #5b3a86;
  --focus: #0b63ce;
  --good: #1e6b3a;
  --warn-bg: #fdf3e7;
  --warn-border: #c97a1c;
  --quote-bg: #f2efe8;
  --code-bg: #eee9df;
  --max-text: 70ch;
  --radius: 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181e;
    --paper-raised: #1c222b;
    --ink: #e8e4da;
    --ink-soft: #b3aea2;
    --rule: #3a4250;
    --maple: #e2685f;
    --maple-deep: #ef8d85;
    --link: #8ab4ee;
    --link-visited: #c0a6e8;
    --focus: #7fb4f5;
    --good: #7cc794;
    --warn-bg: #2a2118;
    --warn-border: #d99a4e;
    --quote-bg: #1e242e;
    --code-bg: #242b36;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Focus ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, summary:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Header / nav ---------- */
.site-header {
  border-top: 6px solid var(--maple);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raised);
}
.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.wordmark .tb { color: var(--maple); }
.wordmark-tag {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.site-nav { margin-left: auto; }
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--radius);
  font-size: 0.97rem;
}
.site-nav a:hover { background: var(--quote-bg); }
.site-nav a[aria-current="page"] {
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--maple);
}
.lang-switch {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}
.lang-switch:hover { background: var(--ink); color: var(--paper); }

/* ---------- Layout ---------- */
main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
.prose { max-width: var(--max-text); }
.prose-wide { max-width: 60rem; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  line-height: 1.22;
  color: var(--ink);
  margin: 2.2em 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); margin-top: 0.8em; }
h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); border-bottom: 1px solid var(--rule); padding-bottom: 0.3em; }
h3 { font-size: 1.22rem; }
p, ul, ol { margin: 0 0 1.1em; }
li { margin-bottom: 0.45em; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:visited { color: var(--link-visited); }
strong { color: var(--ink); }
.lede {
  font-size: 1.22rem;
  color: var(--ink-soft);
  max-width: var(--max-text);
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* ---------- Hero ---------- */
.hero {
  padding: 2.5rem 0 1.5rem;
}
.hero h1 { margin-top: 0; }
.hero .kicker {
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--maple);
  margin-bottom: 0.6rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--maple);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn:visited { color: #ffffff; }
.btn:hover { background: var(--maple-deep); }
@media (prefers-color-scheme: dark) {
  .btn { color: #14181e; }
  .btn:visited { color: #14181e; }
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:visited { color: var(--ink); }
.btn-secondary:hover { background: var(--quote-bg); }
@media (prefers-color-scheme: dark) {
  .btn-secondary { color: var(--ink); }
  .btn-secondary:visited { color: var(--ink); }
  .btn-secondary:hover { background: var(--quote-bg); }
}

/* ---------- Cards / grids ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.1rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}
.card h3 { margin-top: 0.2em; }
.card p:last-child { margin-bottom: 0; }

/* ---------- Callouts ---------- */
.callout {
  border-left: 5px solid var(--maple);
  background: var(--quote-bg);
  padding: 1rem 1.3rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  max-width: var(--max-text);
}
.callout-honest {
  border-left-color: var(--good);
}
.callout-warn {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
}
.callout h3, .callout h4 { margin-top: 0.1em; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Quotes ---------- */
blockquote {
  font-family: var(--serif);
  font-size: 1.12rem;
  background: var(--quote-bg);
  margin: 1.6rem 0;
  padding: 1.1rem 1.4rem;
  border-left: 5px solid var(--ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: var(--max-text);
}
blockquote p { margin-bottom: 0.5em; }
blockquote footer, .quote-cite {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-style: normal;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.97rem;
  background: var(--paper-raised);
}
caption {
  text-align: left;
  font-weight: 700;
  font-family: var(--serif);
  font-size: 1.08rem;
  padding-bottom: 0.6rem;
}
th, td {
  border: 1px solid var(--rule);
  padding: 0.65rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--quote-bg); }

/* ---------- Details / accordions ---------- */
details {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  margin: 0.8rem 0;
  max-width: var(--max-text);
}
summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.85rem 1.1rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}
summary:hover { background: var(--quote-bg); }
details[open] summary { border-bottom: 1px solid var(--rule); }
details .details-body { padding: 0.9rem 1.2rem 0.4rem; }

/* ---------- Section references ---------- */
.s-ref {
  font-family: var(--sans);
  font-size: 0.85em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.08em 0.45em;
  white-space: nowrap;
}

/* ---------- Forms (Take Action) ---------- */
.form-block {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin: 1.5rem 0;
  max-width: 46rem;
}
label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.hint {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0.2rem 0 0.6rem;
}
input[type="text"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink-soft);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
}
textarea { min-height: 22rem; line-height: 1.55; }
.field { margin-bottom: 1.1rem; }
.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 1rem 0;
}
.status {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--quote-bg);
  max-width: var(--max-text);
}
.status[data-tone="error"] {
  border-color: var(--maple);
  background: var(--warn-bg);
}
.mp-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--quote-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.mp-card img {
  width: 64px;
  height: auto;
  border-radius: 4px;
}
.mp-card h3 { margin: 0 0 0.2em; }
.mp-card p { margin: 0 0 0.3em; font-size: 0.97rem; }

/* ---------- Sources ---------- */
.source-list { padding-left: 1.2rem; }
.source-list li { margin-bottom: 0.9em; }
.source-note { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Footnote-ish citations ---------- */
.cite-inline { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-raised);
  margin-top: 3rem;
}
.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.8rem 1.25rem 2.4rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.footer-inner a { color: var(--link); }
.footer-inner p { max-width: none; }

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.toc {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  margin: 1.5rem 0;
  max-width: var(--max-text);
}
.toc h2 {
  font-size: 1.05rem;
  border: 0;
  margin: 0 0 0.5em;
  padding: 0;
}
.toc ol { margin: 0; padding-left: 1.3rem; }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .btn, .skip-link, .site-nav { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
