/* The MO shelf site - "the registry" direction.
   Paper + ink + stamp-pad red; Source Serif 4 for the books, IBM Plex Mono
   for the registry voice (codes, stamps, eyebrows, the tree). Calm: no
   motion, boldness spent once (the inked stamp). */
:root {
  --paper: #FAF9F5;
  --ink: #1C1E20;
  --ink-soft: #55595E;
  --rule: #DCD8CF;
  --rule-dark: #B9B4A7;
  --stamp-red: #93402F;
  --settled: #2E6E42;
  --settled-bg: #E9F2EB;
  --provisional: #9A7B1C;
  --provisional-bg: #F7EFD8;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.72;
}
a { color: var(--stamp-red); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--stamp-red); outline-offset: 2px; }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }
.wrap-wide { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }

/* chrome */
.topbar {
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em;
}
.topbar-inner {
  max-width: 68rem; margin: 0 auto; padding: 0.65rem 1.25rem;
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
}
.topbar a { color: var(--ink-soft); }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .ver { color: var(--ink-soft); }

footer {
  border-top: 1px solid var(--rule); margin-top: 5rem;
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-soft);
}
footer .inner { max-width: 68rem; margin: 0 auto; padding: 1rem 1.25rem 2.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* masthead (root) */
.masthead { padding: 4.5rem 0 1.5rem; position: relative; }
.masthead h1 {
  font-size: clamp(2rem, 5.5vw, 3.1rem); line-height: 1.08;
  margin: 0 0 0.6rem; font-weight: 650; letter-spacing: -0.015em;
}
.masthead .mantra {
  font-style: italic; font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 0.4rem;
}
.masthead .sub { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }

/* the inked stamp - the signature, used once */
.stamp {
  position: absolute; right: 0; top: 4.2rem; transform: rotate(-7deg);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--stamp-red);
  border: 2.5px solid var(--stamp-red); border-radius: 4px;
  padding: 0.5rem 0.8rem; line-height: 1.5; text-align: center;
  opacity: 0.82;
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.92 0'/></filter><rect width='120' height='120' fill='white' filter='url(%23n)'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0.92 0'/></filter><rect width='120' height='120' fill='white' filter='url(%23n)'/></svg>");
}
@media (max-width: 40rem) { .stamp { position: static; display: inline-block; margin-top: 1rem; transform: rotate(-4deg); } }

/* the shelf - ledger rows */
.shelf { margin: 2.5rem 0 0; border-top: 2px solid var(--ink); }
.shelf-row {
  display: grid; grid-template-columns: 11rem 1fr auto; gap: 1.25rem;
  padding: 1.15rem 0.25rem; border-bottom: 1px solid var(--rule);
  align-items: baseline; color: inherit;
}
a.shelf-row:hover { text-decoration: none; background: #F3F1EA; }
a.shelf-row:hover .book-name { text-decoration: underline; text-underline-offset: 3px; }
.book-name { font-weight: 650; font-size: 1.08rem; color: var(--stamp-red); }
.book-job { margin: 0; font-size: 0.95rem; color: var(--ink); }
.book-job small { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--ink-soft); margin-top: 0.2rem; }
.book-meta { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-soft); text-align: right; white-space: nowrap; }
@media (max-width: 40rem) {
  .shelf-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .book-meta { text-align: left; }
}

.shelf-note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 1rem; }

/* eyebrows */
.eyebrow {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft); margin: 3rem 0 0.6rem;
}

/* epistemic chips */
.chip {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.05em;
  border-radius: 3px; padding: 0.08em 0.45em; vertical-align: 0.12em; white-space: nowrap;
}
.chip.set { background: var(--settled-bg); color: var(--settled); }
.chip.prov { background: var(--provisional-bg); color: var(--provisional); }

/* the tree (root teaser + canon sidebar) */
.tree { font-size: 0.86rem; }
.tree h3 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding-bottom: 0.25rem; margin: 1.4rem 0 0.4rem; }
.tree h4 { font-size: 0.82rem; margin: 0.7rem 0 0.15rem; font-weight: 650; }
.tree ul { list-style: none; margin: 0.15rem 0; padding-left: 0.1rem; }
.tree li { margin-bottom: 0.12rem; line-height: 1.5; }
.tree .pt { font-family: var(--mono); font-size: 0.62rem; color: var(--rule-dark); }
.tree a { color: var(--ink); }
.tree a:hover { color: var(--stamp-red); }

.tree-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
@media (max-width: 40rem) { .tree-cols { grid-template-columns: 1fr; } }

/* reading pages */
.reading { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 3.5rem; padding-top: 2.5rem; }
.reading > nav { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; padding-bottom: 2rem; }
@media (max-width: 56rem) { .reading { grid-template-columns: 1fr; gap: 1rem; } .reading > nav { position: static; max-height: none; } }

.doc h1 { font-size: 2rem; line-height: 1.15; margin: 0.5rem 0 1rem; letter-spacing: -0.01em; }
.doc h2 { font-size: 1.45rem; margin-top: 2.8em; padding-bottom: 0.2em; border-bottom: 2px solid var(--ink); letter-spacing: -0.005em; }
.doc h3 { font-size: 1.15rem; margin-top: 2em; }
.doc p, .doc li { font-size: 1rem; }
.doc li { margin-bottom: 0.3em; }
.doc table { border-collapse: collapse; font-size: 0.85rem; width: 100%; margin: 1.2em 0; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--rule); padding: 0.5em 0.65em; text-align: left; vertical-align: top; }
.doc th { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; background: #F3F1EA; }
.doc code { font-family: var(--mono); font-size: 0.82em; background: #F1EFE8; padding: 0.1em 0.3em; border-radius: 3px; }
.doc blockquote { margin: 1em 0; padding: 0.2em 1.2em; border-left: 3px solid var(--rule-dark); color: var(--ink-soft); }
.doc hr { border: none; border-top: 1px solid var(--rule); margin: 3em 0; }
.doc strong { letter-spacing: 0.002em; }

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

/* the canon sidebar is narrow: its tree stacks single-column */
.reading > nav .tree-cols { grid-template-columns: 1fr; gap: 0; }

/* canon head: slim meta + standfirst; governance folded */
.canon-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); margin: 0.2rem 0 1rem; }
.standfirst { font-size: 1.1rem; line-height: 1.65; color: var(--ink); }
details.governance { margin: 1.2rem 0 0; border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: var(--ink-soft); }
details.governance summary { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; color: var(--ink-soft); }
details.governance[open] summary { margin-bottom: 0.6rem; }
details.governance p { margin: 0.5rem 0; }

/* v3.3.2 readability edition: law headings wear chips, hover # hands out the
   deep link, provenance lines (a law's closing stamps/receipts) step back */
.doc h2 .hlink, .doc h3 .hlink { opacity: 0; margin-left: 0.35rem; font-family: var(--mono); font-size: 0.8em; font-weight: 400; text-decoration: none; color: var(--ink-soft); transition: opacity 0.12s; }
.doc h2:hover .hlink, .doc h3:hover .hlink, .doc h2 .hlink:focus, .doc h3 .hlink:focus { opacity: 1; }
.doc h3 .chip { vertical-align: 0.15em; margin-left: 0.15rem; }
.doc p.provenance { font-size: 0.8rem; color: var(--ink-soft); border-left: 2px solid var(--rule); padding-left: 0.75rem; }
.doc h2 .hlink.copied, .doc h3 .hlink.copied { opacity: 1; color: var(--settled); }
