/* Layout: a single reading column (~68ch) under an icon-style monogram header;
   wide components (tables, matrices) break out to a 72rem frame. */
:root {
  --ground: #eef1f6;
  --paper: #f9fafc;
  --ink: #18203a;
  --muted: #4d5872;
  --lapis: #1e3d8c;
  --maphorion: #7b1f2e;
  --gold: #9c7a2b;
  --rule: #d2d8e4;
  --tint: #e3e8f2;
  --f-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-body: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 68ch;
  --wide: 72rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0c1222; --paper: #131a2e; --ink: #e6e8f0; --muted: #a5adc2;
    --lapis: #94adf0; --maphorion: #e48896; --gold: #d9b862; --rule: #29334f; --tint: #1a2340;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0c1222; --paper: #131a2e; --ink: #e6e8f0; --muted: #a5adc2;
  --lapis: #94adf0; --maphorion: #e48896; --gold: #d9b862; --rule: #29334f; --tint: #1a2340;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.125rem;
  line-height: 1.65;
}
a { color: var(--lapis); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--maphorion); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.gutter {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-head { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-head .inner {
  max-width: var(--wide); margin: 0 auto; padding-block: 1rem 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.mark { width: 3.4rem; height: 3.4rem; flex: none; display: block; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--f-display); font-size: 1.45rem; letter-spacing: 0.08em; }
.brand-sub { font-family: var(--f-ui); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.site-nav { width: 100%; overflow-x: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.15rem; white-space: nowrap; }
.site-nav a {
  display: block; padding: 0.7rem 0.75rem 0.65rem; font-family: var(--f-ui); font-size: 0.86rem;
  color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--maphorion); }

/* Page head */
.page-head { padding-block: 3.5rem 2.25rem; }
.page-head .inner, main .inner { max-width: var(--measure); margin: 0 auto; }
.eyebrow {
  font-family: var(--f-ui); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--maphorion); margin: 0 0 0.9rem;
}
h1, h2 { font-family: var(--f-display); font-weight: 600; text-wrap: balance; line-height: 1.2; letter-spacing: 0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); margin: 3.25rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
h3 { font-family: var(--f-body); font-size: 1.25rem; font-weight: 700; margin: 2.25rem 0 0.6rem; text-wrap: balance; line-height: 1.3; }
h4 { font-family: var(--f-ui); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 1.6rem 0 0.4rem; }
.lede { font-size: 1.3rem; line-height: 1.55; color: var(--muted); margin: 0; }
p { margin: 0 0 1.1rem; }
main { padding-bottom: 4rem; }
main ul, main ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
main li { margin-bottom: 0.45rem; }
strong { font-weight: 700; }

/* Scripture references and quotes */
.ref {
  font-family: var(--f-ui); font-size: 0.78em; font-weight: 600; letter-spacing: 0.04em;
  color: var(--maphorion); white-space: nowrap;
}
blockquote {
  margin: 1.5rem 0; padding: 0.2rem 0 0.2rem 1.25rem; border-left: 2px solid var(--gold);
  font-style: italic; color: var(--ink);
}
blockquote p:last-of-type { margin-bottom: 0.4rem; }
blockquote cite { display: block; font-style: normal; font-family: var(--f-ui); font-size: 0.8rem; color: var(--muted); }
blockquote cite::before { content: "— "; }

/* Callouts */
.aside {
  background: var(--paper); border: 1px solid var(--rule); padding: 1.1rem 1.3rem; margin: 1.75rem 0;
}
.aside > :last-child { margin-bottom: 0; }
.aside .label { font-family: var(--f-ui); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lapis); margin: 0 0 0.4rem; }

/* Pathway cards on home */
.paths { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.paths a { background: var(--paper); padding: 1.4rem 1.4rem 1.5rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.paths a:hover { background: var(--tint); color: var(--ink); }
.paths .t { font-family: var(--f-display); font-size: 1.15rem; letter-spacing: 0.03em; }
.paths .d { font-size: 0.98rem; color: var(--muted); line-height: 1.5; }
.paths .k { font-family: var(--f-ui); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--maphorion); }
.band { padding-block: 0 3rem; }

/* Weight pills for typology */
.pill {
  display: inline-block; font-family: var(--f-ui); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 0.15rem 0.5rem; border: 1px solid currentColor; border-radius: 2px; vertical-align: 0.15em;
}
.pill.nt { color: var(--lapis); }
.pill.fa { color: var(--gold); }
.pill.dv { color: var(--muted); }
.type { padding: 1.2rem 0 0.4rem; border-top: 1px solid var(--rule); }
.type h3 { margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: baseline; }
.type dl { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.35rem 1rem; margin: 0.6rem 0 1rem; }
.type dt { font-family: var(--f-ui); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 0.3rem; }
.type dd { margin: 0; min-width: 0; }
@media (max-width: 560px) { .type dl { grid-template-columns: 1fr; } .type dt { padding-top: 0.5rem; } }

/* Doctrine weighing */
.weigh { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.weigh section { background: var(--paper); border: 1px solid var(--rule); padding: 1rem 1.1rem; min-width: 0; }
.weigh h4 { margin-top: 0; }
.weigh p:last-child, .weigh ul:last-child { margin-bottom: 0; }
.weigh .room { border-color: var(--lapis); }
.weigh .room h4 { color: var(--lapis); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; border: 1px solid var(--rule); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-family: var(--f-ui); font-size: 0.86rem; line-height: 1.45; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); background: var(--tint); }
tbody th { font-weight: 600; color: var(--ink); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
.y { color: var(--lapis); font-weight: 600; }
.n { color: var(--maphorion); font-weight: 600; }
.m { color: var(--gold); font-weight: 600; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 1.25rem 0 2rem; }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--rule); margin: 0; }
.timeline .when { font-family: var(--f-ui); font-size: 0.85rem; font-weight: 600; color: var(--maphorion); font-variant-numeric: tabular-nums; padding-top: 0.2rem; }
.timeline .what { min-width: 0; }
.timeline .what strong { display: block; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 0.2rem; } }

/* Figure-style person blocks on the Reformers page */
.person { border-top: 1px solid var(--rule); padding-top: 0.5rem; }
.person .dates { font-family: var(--f-ui); font-size: 0.85rem; color: var(--muted); font-weight: 400; }

/* Prev / next */
.pager { max-width: var(--measure); margin: 3rem auto 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-family: var(--f-ui); font-size: 0.9rem; }
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: 0.15rem; }
.pager .lbl { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pager .next { margin-left: auto; text-align: right; }

.toc { font-family: var(--f-ui); font-size: 0.9rem; background: var(--paper); border: 1px solid var(--rule); padding: 1rem 1.25rem; margin: 0 0 2rem; }
.toc p { margin: 0 0 0.4rem; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2 14rem; column-gap: 2rem; }
.toc li { margin-bottom: 0.25rem; break-inside: avoid; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); background: var(--paper); padding-block: 2rem; font-family: var(--f-ui); font-size: 0.82rem; color: var(--muted); }
.site-foot .inner { max-width: var(--wide); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; }
.site-foot p { margin: 0; }

@media (max-width: 600px) {
  body { font-size: 1.05rem; }
  .page-head { padding-block: 2.25rem 1.5rem; }
  .lede { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); color: var(--ink); padding: 0.5rem 1rem; z-index: 20; font-family: var(--f-ui); }
.skip:focus { left: max(16px, env(safe-area-inset-left, 0px)); }
.type dd.full { grid-column: 1 / -1; }
