:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665d;
  --rule: #e2ddd1;
  --accent: #7a2e1f;
  --accent-soft: #f3e6df;
  --prov-bg: #f4efe3;
  --prov-rule: #b08d57;
  --link: #8a3324;
  --chip: #efeadf;
  --chip-on: #7a2e1f;
  --chip-on-text: #fff;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --caslon: "Libre Caslon Text", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17161a; --surface: #1f1e23; --text: #e7e3da; --muted: #a39d92; --rule: #34323a;
    --accent: #e0a184; --accent-soft: #2e2522; --prov-bg: #24211d; --prov-rule: #a8874f;
    --link: #eba98c; --chip: #2a282f; --chip-on: #e0a184; --chip-on-text: #17161a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17161a; --surface: #1f1e23; --text: #e7e3da; --muted: #a39d92; --rule: #34323a;
  --accent: #e0a184; --accent-soft: #2e2522; --prov-bg: #24211d; --prov-rule: #a8874f;
  --link: #eba98c; --chip: #2a282f; --chip-on: #e0a184; --chip-on-text: #17161a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 11rem; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.0625rem/1.65 var(--serif);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ---------- header + navigation bar */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.bar { display: flex; align-items: center; justify-content: space-between; max-width: 76rem; margin: 0 auto; padding: .55rem 1rem .25rem; }
.brand { font-family: var(--caslon); font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: .01em; }
.brand em { color: var(--accent); }
.theme { border: 1px solid var(--rule); background: var(--surface); color: var(--text); border-radius: 999px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: inline; }
}
nav.crumbs { max-width: 76rem; margin: 0 auto; padding: 0 1rem .45rem; }
.row {
  display: flex; gap: .3rem; align-items: center; overflow-x: auto; scrollbar-width: thin;
  padding: .2rem 0; white-space: nowrap;
}
.row + .row { border-top: 1px dashed var(--rule); }
.row a {
  flex: none; padding: .18rem .55rem; border-radius: .4rem; background: var(--chip);
  color: var(--text); text-decoration: none; font-size: .86rem; line-height: 1.4;
}
.row a:hover { background: var(--accent-soft); color: var(--accent); }
.row a.on { background: var(--chip-on); color: var(--chip-on-text); font-weight: 600; }
.row .grp { flex: none; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 .2rem 0 .5rem; }
.row .grp:first-child { margin-left: 0; }
.r4 a { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }

/* ---------- page body */
main { max-width: 46rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
h1 { font-family: var(--caslon); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 1.2rem 0 1rem; }
h2, h3, h4, h5, h6 { font-family: var(--caslon); font-weight: 700; line-height: 1.3; }
.essay h2 { font-size: 1.5rem; margin-top: 3rem; padding-top: 1rem; border-top: 2px solid var(--rule); }
.essay h3 { font-size: 1.28rem; margin-top: 2.4rem; }
.essay h4 { font-size: 1.12rem; margin-top: 2rem; }
.essay h5 { font-size: 1.02rem; margin-top: 1.8rem; }
.essay.topic + .essay h3, .essay.topic + .essay h4 { margin-top: 1rem; }
.eid { display: block; font-family: var(--sans); font-weight: 600; font-size: .72rem; letter-spacing: .06em; color: var(--muted); margin-bottom: .15rem; }
.sub { font-style: italic; font-weight: 400; }
p { margin: 0 0 1rem; hyphens: auto; }
blockquote { margin: 0 0 1rem 1.5rem; font-size: .96em; }

.provision {
  background: var(--prov-bg); border-left: 4px solid var(--prov-rule); border-radius: 0 .5rem .5rem 0;
  padding: 1rem 1.25rem .4rem; margin: 0 0 1.75rem;
  font-family: var(--caslon); font-size: 1.12rem; line-height: 1.7;
}
.plabel { font-family: var(--sans); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.provision .sn { font-weight: 700; }
.provision.outline { font-family: var(--serif); font-size: 1rem; }
.provision.outline ul { margin: 0 0 .75rem; padding-left: 1.1rem; }

details.toc { font-family: var(--sans); font-size: .92rem; background: var(--surface); border: 1px solid var(--rule); border-radius: .5rem; padding: .5rem .9rem; margin-bottom: 1.5rem; }
details.toc summary { cursor: pointer; font-weight: 600; }
details.toc ul { list-style: none; padding: .5rem 0 0; margin: 0; }
details.toc li { margin: .2rem 0; }
details.toc .d1 { padding-left: 1rem; } details.toc .d2 { padding-left: 2rem; }
details.toc .d3, details.toc .d4 { padding-left: 3rem; }

sup.fnref { line-height: 0; font-family: var(--sans); font-size: .68em; }
sup.fnref a { text-decoration: none; padding: 0 .1em; }
details.notes { margin: 1.25rem 0 0; border-top: 1px solid var(--rule); padding-top: .4rem; font-size: .86rem; line-height: 1.5; color: var(--muted); }
details.notes summary { cursor: pointer; font-family: var(--sans); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
details.notes ol { padding-left: 2rem; margin: .5rem 0 0; }
details.notes li { margin-bottom: .45rem; overflow-wrap: anywhere; }
details.notes li:target, .essay:target > h2, .essay:target > h3, .essay:target > h4, .essay:target > h5 { background: var(--accent-soft); }
a.back { text-decoration: none; font-family: var(--sans); }
a.xref { font-family: var(--sans); font-size: .9em; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; font-family: var(--sans); margin: .5rem 0 1rem; }
.pager a { display: block; padding: .5rem .75rem; border: 1px solid var(--rule); border-radius: .5rem; text-decoration: none; background: var(--surface); font-size: .88rem; line-height: 1.35; }
.pager a small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.pager .next { text-align: right; }
main > .pager:last-child { margin-top: 3rem; }

footer.site { border-top: 1px solid var(--rule); color: var(--muted); font: .85rem/1.5 var(--sans); padding: 1.5rem 1rem 2.5rem; text-align: center; }
footer.site p { max-width: 46rem; margin: 0 auto; }

/* ---------- home page */
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin-top: 2rem; }
.hero h1 span { display: block; font-style: italic; color: var(--accent); font-size: .7em; margin-top: .3rem; }
.lede { font-size: 1.2rem; color: var(--muted); }
a.start { display: inline-block; margin: .3rem .4rem .3rem 0; padding: .55rem 1rem; border-radius: .5rem; background: var(--chip-on); color: var(--chip-on-text); text-decoration: none; font-family: var(--sans); font-weight: 600; }
a.start.alt { background: var(--chip); color: var(--text); }
.about { margin: 2rem 0; }
.outline-tree { padding-left: 1rem; }
.outline-tree > li { margin: .7rem 0; }
.outline-tree ul { padding-left: 1.2rem; font-size: .95rem; }
.outline-tree ul.clauses { display: flex; flex-wrap: wrap; gap: .1rem .9rem; list-style: none; padding-left: 1rem; font-size: .88rem; color: var(--muted); }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  html { scroll-padding-top: 13rem; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .provision { padding: .8rem .9rem .2rem; font-size: 1.04rem; }
}
@media print {
  header.top, .pager, footer.site { display: none; }
  details.notes, details.toc { display: block; }
}
