/* ==========================================================================
   tufte-brill.css
   BRILL.health published policies — Tufte-aligned typography + BRILL palette
   Version: 1.0 · 2026-04-22

   Design principles:
   - Serif body (Charter → Palatino → Georgia), no webfonts — system fonts only
   - System sans for UI chrome (buttons, nav, form elements)
   - Palette leads with teal + navy + green; ph-blue demoted (too AI-adjacent)
   - Hairline borders only; no shadows, gradients, heavy frames
   - Real typography: em-dashes, curly quotes, tabular-lining numerals
   - Left-aligned text within centered container (standard document pattern)
   - Dark mode via prefers-color-scheme
   - Color encodes state, not decoration
   ========================================================================== */

/* ---------- Custom properties: palette + state tokens ---------- */

:root {
  /* Type scale anchors */
  --body-size: 17px;
  --body-lh: 1.6;
  --small-size: 0.88rem;

  /* Content width — matches .health-container-document in base_health.html */
  --content-width: 800px;

  /* Palette — BRILL identity (2026-04-22 direction) */
  --ph-teal:       #2AA198;   /* lead accent + "committed" color */
  --ph-teal-dark:  #1F8C82;
  --ph-navy:       #1A3A5C;   /* authority / headings / wordmark BRILL */
  --ph-green:      #48B07A;   /* success + wordmark . */
  --ph-green-dark: #3A9665;

  /* Retired from primary use — kept for legacy compatibility */
  --ph-blue:       #4A90D9;

  /* Text / surface */
  --ink:       #1a1d24;       /* primary body text */
  --muted:     #5a6270;       /* secondary, captions, metadata */
  --surface:   #FBF8F1;       /* warm off-white paper — Tufte-ish */
  --surface-raised: #FFFFFF;  /* TOC + table headers subtle shift */
  --hairline:  #E0DCCF;       /* rules, dividers, borders */
  --hairline-strong: #B8B3A3;

  /* State tokens — color encodes commitment / hierarchy */
  --state-composing: var(--muted);
  --state-committed: var(--ph-teal);
  --state-authority: var(--ph-navy);
  --state-success:   var(--ph-green);

  /* Accent applications */
  --link-color:       var(--ph-teal-dark);
  --link-underline:   var(--ph-teal);
  --heading-color:    var(--ph-navy);
  --code-bg:          #F1EEE3;

  /* Type stacks — NO WEBFONTS */
  --serif-body: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif Pro", Georgia, Cambria, "Times New Roman", serif;
  --sans-chrome: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono-code: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* ---------- Base reset / document ---------- */
/* NOTE: dark mode intentionally NOT supported. These documents are meant to look
   like documents — paper + ink aesthetic, consistent rendering regardless of
   OS theme. `color-scheme: light` tells the browser not to auto-invert form
   fields or scrollbars to match OS dark preference. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }

body {
  font-family: var(--serif-body);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  text-align: left;
  padding: 2.5rem 1.5rem 5rem;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  text-align: left;
}

/* ---------- Header + wordmark ---------- */

header.doc-header {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.wordmark {
  font-family: var(--sans-chrome);
  letter-spacing: 0.01em;
  font-size: 1.1rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}
.wordmark .brand-bril  { color: var(--ph-navy); font-weight: 700; }
.wordmark .brand-dot   { color: var(--ph-green); font-weight: 900; font-size: 1.5em; line-height: 1; margin: 0 0.12em; vertical-align: baseline; }
.wordmark .brand-health { color: var(--ph-teal); font-weight: 600; }

h1 {
  font-family: var(--serif-body);
  font-weight: 600;
  color: var(--heading-color);
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0.5rem 0 0.25rem;
}

.meta {
  font-family: var(--sans-chrome);
  color: var(--muted);
  font-size: var(--small-size);
  font-variant-numeric: tabular-nums lining-nums;
  margin: 0.2rem 0;
  line-height: 1.4;
}

/* ---------- Draft notice — Tufte-style italic paragraph, not warning box ---------- */

.draft-notice {
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 0.9rem 0;
  margin: 2rem 0 2.5rem;
  font-size: 0.95rem;
}
.draft-notice strong {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
}

/* ---------- Summary callout (non-warning, minimal) ---------- */

.doc-summary {
  font-size: 0.95rem;
  color: var(--muted);
  border-left: 2px solid var(--hairline-strong);
  padding: 0.3rem 0 0.3rem 1rem;
  margin: 1.5rem 0 2rem;
  font-style: italic;
}
.doc-summary em { font-style: normal; }

/* ---------- Table of contents — minimal list, not boxed ---------- */

nav.toc {
  font-family: var(--sans-chrome);
  font-size: 0.9rem;
  margin: 2rem 0 3rem;
  padding: 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 1rem 0;
}
nav.toc strong {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
nav.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2rem;
  font-variant-numeric: tabular-nums lining-nums;
}
nav.toc li { margin: 0.2rem 0; break-inside: avoid; }
nav.toc a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
nav.toc a:hover { border-bottom-color: var(--link-underline); }

@media (max-width: 600px) {
  nav.toc ol { columns: 1; }
}

/* ---------- Headings ---------- */

h2 {
  font-family: var(--serif-body);
  font-weight: 600;
  color: var(--heading-color);
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 3rem 0 0.75rem;
  scroll-margin-top: 1rem;
  letter-spacing: -0.005em;
}

h3 {
  font-family: var(--serif-body);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.1rem;
  font-style: italic;
  margin: 1.8rem 0 0.5rem;
  letter-spacing: 0;
}

/* ---------- Prose ---------- */

p { margin: 0.8rem 0; }

p + p { margin-top: 1rem; }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

/* ---------- Lists ---------- */

ul, ol {
  padding-left: 1.5rem;
  margin: 0.6rem 0 1.2rem;
}
li {
  margin: 0.35rem 0;
  padding-left: 0.15rem;
}
li > ul, li > ol { margin: 0.35rem 0 0.5rem; }

/* ---------- Links ---------- */

a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid var(--link-underline);
  padding-bottom: 1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
a:hover {
  color: var(--ph-teal-dark);
  border-bottom-color: var(--ph-teal-dark);
}

a.back-to-top {
  font-family: var(--sans-chrome);
  font-size: 0.8rem;
  color: var(--muted);
  border: none;
  margin: 1rem 0 0;
  display: inline-block;
}
a.back-to-top:hover { color: var(--ink); }

/* ---------- Tables — Tufte-style: horizontal rules only, generous padding ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  margin: 1.5rem 0 2rem;
  font-variant-numeric: tabular-nums lining-nums;
}
th {
  font-family: var(--sans-chrome);
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--hairline-strong);
  vertical-align: bottom;
}
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }

/* ---------- Code ---------- */

code {
  font-family: var(--mono-code);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  color: var(--ink);
}

/* ---------- Appendix sections ---------- */

.appendix {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline-strong);
}

/* ---------- Footer ---------- */

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.88rem;
  font-family: var(--sans-chrome);
}
footer p { margin: 0.4rem 0; }
footer em { color: var(--muted); }
footer a { color: var(--link-color); }

/* ---------- Document list on index.html ---------- */

ul.doc-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
ul.doc-list li {
  border-top: 1px solid var(--hairline);
  padding: 1.25rem 0 1rem;
  margin: 0;
}
ul.doc-list li:last-child { border-bottom: 1px solid var(--hairline); }
ul.doc-list a {
  font-size: 1.15rem;
  color: var(--heading-color);
  font-weight: 600;
  border: none;
}
ul.doc-list a:hover {
  color: var(--ph-teal);
  text-decoration: none;
}
ul.doc-list .doc-meta {
  font-family: var(--sans-chrome);
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums lining-nums;
}
ul.doc-list .doc-desc {
  font-family: var(--serif-body);
  color: var(--ink);
  font-size: 0.98rem;
  margin: 0.5rem 0 0;
  line-height: 1.5;
}
ul.doc-list .pending {
  color: var(--muted);
  font-weight: 600;
  font-size: 1.1rem;
}

/* ---------- Print ---------- */

@media print {
  body {
    padding: 0.5in;
    background: white;
    color: black;
  }
  a {
    color: black;
    border-bottom: none;
    text-decoration: underline;
  }
  .back-to-top, nav.toc, .draft-notice { display: none; }
}

/* ---------- Accessibility: reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
