/* Human-facing rendering of index.md.
 * Paper and pine: warm off-white, deep green ink, brass accents.
 * Dark mode follows the visitor's system setting. */

:root {
  --bg: #f4efe6;
  --surface: #fbf8f2;
  --fg: #26302d;
  --fg-strong: #1d3b34;
  --fg-muted: #66706c;
  --accent: #2f6b58;
  --accent-ink: #1d4d3f;
  --brass: #b0873d;
  --rule: #ddd4c4;

  --measure: 68ch;
  --font-body: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a18;
    --surface: #18221f;
    --fg: #d9dfdb;
    --fg-strong: #eef2ef;
    --fg-muted: #93a09a;
    --accent: #7cc3a8;
    --accent-ink: #a6dcc6;
    --brass: #d2ab62;
    --rule: #2b3834;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Top bar: tells both audiences what this page is ------------------ */

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.bar-file { color: var(--fg-muted); }
.bar-file::before { content: "● "; color: var(--brass); }

.bar-link {
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
}
.bar-link:hover { text-decoration: underline; }

/* ---- Document --------------------------------------------------------- */

.doc {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5.5rem) clamp(1rem, 5vw, 2rem) clamp(3rem, 8vw, 5rem);
}

.doc > :first-child { margin-top: 0; }

h1, h2, h3 {
  color: var(--fg-strong);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 3.6rem);
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 3.25rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* Markdown heading marker, shown faintly: a nod to the source format. */
h2::before {
  content: "##";
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--brass);
}

h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.4rem;
}

p, ul, ol { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--brass); }

strong { color: var(--fg-strong); font-weight: 600; }

/* The summary directly under the name reads as a standfirst. */
h1 + blockquote {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
  line-height: 1.45;
  color: var(--fg-strong);
  text-wrap: pretty;
}

blockquote {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--brass);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
blockquote p:last-child { margin-bottom: 0; }

/* "Last updated" line under the standfirst. */
h1 + blockquote + p {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}
h1 + blockquote + p em { font-style: normal; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

/* ---- Tables ----------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 0.55rem 0.85rem; text-align: left; vertical-align: top; }
th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--rule);
}
tr + tr td { border-top: 1px solid var(--rule); }
td:first-child { white-space: nowrap; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

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

.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 5vw, 2rem) 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.foot a { color: inherit; }

@media print {
  .bar, .foot { display: none; }
  body { background: #fff; }
}
