/* ============================================================
   Helena UDO Primer — site stylesheet
   Built from the worksheet design language. City of Helena brand:
   Helena Blue #003B5C, Helena Gold #866D4B, accent palette
   per cityofhelenastyleguide_final.pdf.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  --helena-blue: #003B5C;
  --helena-blue-hover: #00557f;
  --helena-blue-dark: #002b44;
  --helena-gold: #866D4B;
  --helena-gold-light: #b39773;

  /* accent palette from style guide */
  --accent-green: #8E8C13;
  --accent-amber: #AF6D04;
  --accent-turquoise: #006BA6;
  --accent-rust: #8A391B;
  --accent-brown: #623412;

  --ink: #1c1c1c;
  --ink-soft: #2a2a2a;
  --paper: #f4f1ea;
  --paper-warm: #fbf9f3;
  --card: #ffffff;
  --rule: #d8d2c4;
  --rule-strong: #b3aa95;
  --muted: #6b6354;
  --muted-soft: #8a8170;

  --provenance-statutory-bg: #d9e6ee;
  --provenance-statutory-fg: #1d5a7a;
  --provenance-existing-bg: #e3e8da;
  --provenance-existing-fg: #5a6340;
  --provenance-revised-bg: #f3e2c4;
  --provenance-revised-fg: #8a5a12;
  --provenance-new-bg: #e8d8e8;
  --provenance-new-fg: #6a3a6a;
  --provenance-relocated-bg: #e7e9ee;
  --provenance-relocated-fg: #4a5568;
  --provenance-translated-bg: #e7e9ee;
  --provenance-translated-fg: #4a5568;
  --provenance-judgment-bg: #f3e2c4;
  --provenance-judgment-fg: #8a5a12;
  --provenance-carried-bg: #e3e8da;
  --provenance-carried-fg: #5a6340;

  --shell-max: 1280px;
  --content-max: 760px;
  --content-wide-max: 980px;
  --nav-width: 260px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Cambria", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ========== top mast ========== */
header.site-mast {
  background: var(--card);
  border-bottom: 3px solid var(--helena-blue);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-mast-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--helena-blue);
}
.brand .wordmark {
  font-family: "Roboto Slab", "Roboto", system-ui, serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--helena-blue);
}
.brand .wordmark .light {
  display: block;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin-top: 4px;
}
.site-mast .doctitle {
  font-family: "Roboto Slab", system-ui, serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-left: auto;
  letter-spacing: 0.02em;
}
.site-mast .doctitle .ver {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-family: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ========== mobile nav toggle ========== */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--helena-blue);
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  cursor: pointer;
  text-transform: uppercase;
}

/* ========== shell layout ========== */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  gap: 36px;
  min-height: calc(100vh - 60px);
}

/* ========== left nav ========== */
nav.site-nav {
  border-right: 1px solid var(--rule);
  padding: 32px 18px 60px 0;
  position: sticky;
  top: 60px;
  align-self: start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
nav.site-nav .navgroup {
  margin-bottom: 22px;
}
nav.site-nav .navgroup-label {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin: 0 0 8px;
  padding-left: 4px;
}
nav.site-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
nav.site-nav li a {
  display: block;
  padding: 6px 10px;
  font-family: "Roboto Slab", system-ui, serif;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: border-color .12s, color .12s, background .12s;
}
nav.site-nav li a:hover {
  color: var(--helena-blue);
  background: var(--paper-warm);
  border-left-color: var(--helena-gold-light);
}
nav.site-nav li a.current {
  color: var(--helena-blue);
  font-weight: 600;
  border-left-color: var(--helena-blue);
  background: var(--paper-warm);
}
nav.site-nav li a.stub {
  color: var(--muted-soft);
  font-style: italic;
}
nav.site-nav li a .ord {
  display: inline-block;
  width: 38px;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
nav.site-nav li a.current .ord { color: var(--helena-gold); }

/* ========== main column ========== */
main.col {
  padding: 32px 0 80px;
  min-width: 0;
}
.col-inner {
  max-width: var(--content-max);
}
.col-inner.wide { max-width: var(--content-wide-max); }
.col-inner.full { max-width: 100%; }

/* ========== page head ========== */
.page-head {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 28px;
}
.page-head .kicker {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin: 0 0 8px;
}
.page-head h1 {
  font-family: "Roboto Slab", system-ui, serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--helena-blue);
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.page-head .lede {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 14px 0 0;
  line-height: 1.5;
  max-width: 700px;
}
.page-head .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 16px;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.page-head .meta .meta-item strong {
  color: var(--ink);
  font-weight: 500;
  margin-right: 6px;
}

/* ========== framing card (used on most pages) ========== */
.framing-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--helena-gold);
  padding: 18px 22px;
  margin: 0 0 30px;
}
.framing-card .framing-label {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin: 0 0 8px;
}
.framing-card p { margin: 0 0 10px; font-size: 15px; }
.framing-card p:last-child { margin-bottom: 0; }

/* ========== section ========== */
section.ord-section {
  margin: 0 0 36px;
  scroll-margin-top: 80px;
}
section.ord-section h2 {
  font-family: "Roboto Slab", system-ui, serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--helena-blue);
  margin: 0 0 6px;
  letter-spacing: -0.005em;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
section.ord-section h2 .secid {
  font-family: "Roboto Mono", monospace;
  font-size: 13px;
  color: var(--helena-gold);
  font-weight: 400;
  letter-spacing: 0.04em;
}
section.ord-section h2 .note-pin {
  margin-left: auto;
}

.ord-body p {
  margin: 0 0 12px;
  font-size: 15.5px;
  line-height: 1.6;
}

/* Multi-level ordinance list:
   level-1 = A. B. C. (lettered subsection)
   level-2 = (1) (2) (3) (numbered)
   level-3 = (a) (b) (c) (lettered)
   level-4 = (i) (ii) (iii) (Roman) */
.ord-body .ord-sub {
  display: grid;
  grid-template-columns: 2.2em 1fr;
  gap: 0 8px;
  margin: 0 0 10px;
  padding-left: 0;
}
.ord-body .ord-sub.level-1 {
  padding-left: 0;
}
.ord-body .ord-sub.level-2 {
  padding-left: 0;
  margin-left: 1.6em;
  grid-template-columns: 2.2em 1fr;
}
.ord-body .ord-sub.level-3 {
  margin-left: 1.6em;
  grid-template-columns: 2.2em 1fr;
}
.ord-body .ord-sub.level-4 {
  margin-left: 1.6em;
  grid-template-columns: 2.2em 1fr;
}
.ord-body .ord-marker {
  font-weight: 600;
  color: var(--helena-blue);
  font-family: "Cambria", Georgia, serif;
  padding-top: 0;
  line-height: 1.6;
}
.ord-body .ord-sub.level-2 .ord-marker,
.ord-body .ord-sub.level-3 .ord-marker,
.ord-body .ord-sub.level-4 .ord-marker {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.95em;
}
.ord-body .ord-sub-body p:first-child {
  margin-top: 0;
}
.ord-body .ord-sub-body p:last-child {
  margin-bottom: 0;
}
.ord-body .ord-sub-body > .ord-sub:first-child {
  margin-top: 6px;
}

/* legacy .subsection class kept for any content that still uses inline rendering */
.ord-body .subsection {
  display: block;
  margin: 0 0 12px;
  padding-left: 0;
}
.ord-body .subsection .letter {
  font-weight: 600;
  color: var(--helena-blue);
  margin-right: 4px;
}

/* ========== note pin (tooltip) ========== */
.note-pin {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.note-pin-btn {
  background: var(--paper-warm);
  border: 1px solid var(--helena-gold-light);
  color: var(--helena-gold);
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  cursor: pointer;
  border-radius: 2px;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.note-pin-btn:hover, .note-pin-btn:focus, .note-pin-btn.open {
  background: var(--helena-gold);
  color: #fff;
  border-color: var(--helena-gold);
  outline: none;
}
.note-pin-btn::before {
  content: "✶ ";
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.8;
}
.note-pin-body {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(440px, 80vw);
  background: var(--helena-blue);
  color: #f4f1ea;
  border-top: 3px solid var(--helena-gold);
  padding: 14px 18px 16px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  z-index: 30;
  font-family: "Cambria", Georgia, serif;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  border-radius: 0 0 3px 3px;
  max-height: 60vh;
  overflow-y: auto;
}
.note-pin.open .note-pin-body { display: block; }
.note-pin-body .nh {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fc0d2;
  margin: 0 0 8px;
}

/* inline note pin (used inside definitions, etc.) */
.note-pin.inline {
  display: inline-flex;
}

/* ========== open-items disclosure ========== */
details.open-items {
  margin: 40px 0 0;
  border: 1px solid var(--rule);
  background: var(--paper-warm);
  padding: 0;
}
details.open-items > summary {
  cursor: pointer;
  padding: 12px 18px;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--helena-blue);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
details.open-items > summary::-webkit-details-marker { display: none; }
details.open-items > summary::before {
  content: "+";
  font-size: 14px;
  color: var(--helena-gold);
  font-weight: 700;
}
details.open-items[open] > summary::before { content: "−"; }
details.open-items[open] > summary {
  border-bottom: 1px solid var(--rule);
}
details.open-items .oi-body {
  padding: 14px 18px 18px;
}
details.open-items ul {
  margin: 0;
  padding-left: 22px;
}
details.open-items li {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ========== provenance tags ========== */
.prov {
  display: inline-block;
  font-family: "Roboto Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  margin-left: 8px;
  border-radius: 2px;
  vertical-align: 2px;
  font-weight: 500;
}
.prov.statutory { background: var(--provenance-statutory-bg); color: var(--provenance-statutory-fg); }
.prov.existing, .prov.carried_forward { background: var(--provenance-existing-bg); color: var(--provenance-existing-fg); }
.prov.revised, .prov.translated, .prov.judgment_call { background: var(--provenance-revised-bg); color: var(--provenance-revised-fg); }
.prov.new { background: var(--provenance-new-bg); color: var(--provenance-new-fg); }
.prov.relocated, .prov.statutory_constraint { background: var(--provenance-relocated-bg); color: var(--provenance-relocated-fg); }

/* ========== definitions list ========== */
.defs-list {
  margin: 18px 0 0;
  border-top: 1px solid var(--rule);
}
.def-entry {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 18px;
  padding: 14px 0 14px;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.def-entry .term {
  font-family: "Roboto Slab", system-ui, serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--helena-blue);
  padding-top: 2px;
}
.def-entry .def-body {
  font-size: 15px;
  line-height: 1.55;
}
.def-entry .def-source {
  display: block;
  margin-top: 4px;
  font-family: "Roboto Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.def-entry .def-tags {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  padding-top: 4px;
}
.def-entry .def-tags .prov { margin: 0; }

/* defs filter */
.defs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 18px 0 8px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--helena-gold);
  align-items: center;
}
.defs-toolbar input[type="search"] {
  font-family: inherit;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid var(--rule-strong);
  background: #fff;
  min-width: 260px;
  flex: 1 1 260px;
}
.defs-toolbar input[type="search"]:focus { outline: 2px solid var(--helena-blue); outline-offset: -1px; }
.defs-toolbar .filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.defs-toolbar .filter-group button {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 11px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
}
.defs-toolbar .filter-group button.active {
  background: var(--helena-blue);
  border-color: var(--helena-blue);
  color: #fff;
}
.defs-toolbar .filter-group button:hover:not(.active) {
  background: var(--paper);
}
.defs-toolbar .count {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ========== generic tables (crosswalk, etc.) ========== */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--rule-strong);
  margin: 18px 0;
  font-size: 14px;
}
table.data thead th {
  background: var(--helena-blue);
  color: #fff;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 500;
  padding: 10px 12px;
  text-align: left;
  border-right: 1px solid #0a4a70;
  text-transform: uppercase;
}
table.data tbody td {
  border-right: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  padding: 11px 12px;
  vertical-align: top;
  line-height: 1.45;
}
table.data tbody tr:hover td { background: var(--paper-warm); }
table.data td .source-tag {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-top: 4px;
}

/* ========== card grid (chapters index, infographics index) ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 28px 0 0;
}
a.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 20px 22px 18px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  border-left: 3px solid var(--helena-gold);
}
a.card:hover {
  border-color: var(--helena-blue);
  border-left-color: var(--helena-blue);
  box-shadow: 0 6px 22px rgba(0,59,92,0.10);
  transform: translateY(-2px);
}
a.card .card-kicker {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin: 0 0 8px;
}
a.card h3 {
  font-family: "Roboto Slab", system-ui, serif;
  font-size: 17px;
  color: var(--helena-blue);
  margin: 0 0 8px;
  font-weight: 600;
  line-height: 1.3;
}
a.card .card-blurb {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
a.card .card-status {
  display: inline-block;
  margin-top: 12px;
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 3px 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
}
a.card.stub { opacity: 0.72; border-left-color: var(--rule-strong); }
a.card.stub:hover { opacity: 1; }
a.card.stub .card-status {
  color: var(--accent-rust);
  border-color: var(--accent-rust);
}

/* ========== chapter ToC (right rail on chapter pages) ========== */
.chapter-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-size: 13px;
  border-left: 1px solid var(--rule);
  padding: 0 0 0 18px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.chapter-toc h4 {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--helena-gold);
  margin: 0 0 10px;
  font-weight: 500;
}
.chapter-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: tocsec;
}
.chapter-toc li {
  margin: 0 0 5px;
}
.chapter-toc li a {
  display: block;
  font-family: "Roboto Slab", system-ui, serif;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 4px 0 4px 4px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  line-height: 1.3;
}
.chapter-toc li a:hover { color: var(--helena-blue); border-left-color: var(--helena-gold-light); }
.chapter-toc li a.tocactive {
  color: var(--helena-blue);
  border-left-color: var(--helena-blue);
  font-weight: 600;
}
.chapter-toc li a .secid {
  font-family: "Roboto Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-right: 6px;
}

/* chapter page can opt into a 3-column layout */
.chapter-shell {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr 220px;
  gap: 36px;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 28px;
}

/* ========== infographic block (content-ready, pre-render) ========== */
.ig-block {
  background: var(--card);
  border: 1px solid var(--rule);
  margin: 0 0 28px;
}
.ig-block-head {
  background: var(--helena-blue);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.ig-block-head .ig-id {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--helena-gold-light);
}
.ig-block-head h3 {
  font-family: "Roboto Slab", serif;
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.ig-block-body {
  padding: 18px 22px 4px;
}
.ig-block-body .ig-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  line-height: 1.5;
}
.ig-block-body .ig-row:last-child { border-bottom: none; }
.ig-block-body .ig-row .ig-label {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--helena-gold);
  padding-top: 2px;
}
.ig-block-body .ig-row ul { margin: 0; padding-left: 20px; }
.ig-block-body .ig-row li { margin-bottom: 4px; }
.ig-placeholder {
  margin: 14px 0 22px;
  background: var(--paper-warm);
  border: 1px dashed var(--rule-strong);
  padding: 36px 22px;
  text-align: center;
}
.ig-placeholder .ig-ph-label {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.ig-placeholder .ig-ph-text {
  font-family: "Roboto Slab", serif;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

/* ========== stub-chapter banner ========== */
.stub-banner {
  background: var(--paper-warm);
  border: 1px dashed var(--rule-strong);
  padding: 22px 26px;
  margin: 0 0 28px;
}
.stub-banner .sb-label {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-rust);
  margin: 0 0 8px;
}
.stub-banner p { margin: 0 0 8px; }
.stub-banner p:last-child { margin-bottom: 0; }

/* ========== footer ========== */
footer.site-foot {
  border-top: 1px solid var(--rule);
  margin-top: 60px;
  padding: 22px 28px 40px;
  max-width: var(--shell-max);
  margin-left: auto;
  margin-right: auto;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 14px 30px;
  justify-content: space-between;
}
footer.site-foot .ft-meta {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ========== Ch. 4 inline form/dimensional tables ========== */
.ch4-table-wrap {
  margin: 18px 0 22px;
}
.ch4-table-caption {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  font-style: italic;
}
.ch4-table-caption a {
  color: var(--helena-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ch4-fam-table {
  margin: 0 0 18px;
}
.ch4-fam-name {
  font-family: "Roboto Slab", serif;
  font-size: 13px;
  color: var(--helena-blue);
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}
.ch4-data {
  font-size: 13px;
  border: 1px solid var(--rule);
  margin: 0;
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}
.ch4-data th {
  background: var(--helena-blue);
  color: #fff;
  font-weight: 500;
  padding: 7px 6px;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.ch4-data th:last-child { border-right: none; }
.ch4-data td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.ch4-data td:last-child { border-right: none; }
.ch4-data tr:last-child td { border-bottom: none; }
.ch4-data tr:nth-child(even) td { background: var(--paper-warm); }
.ws-tbd {
  font-style: italic;
  color: var(--muted);
  font-family: "Cambria", Georgia, serif;
  font-size: 11.5px;
}
.ws-unit {
  font-size: 10.5px;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-weight: 400;
}
.ws-new {
  font-size: 9px;
  color: var(--helena-gold);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-left: 4px;
  text-transform: lowercase;
  font-family: "Cambria", Georgia, serif;
  font-style: italic;
}

/* ========== working-file page (drafting record) ========== */
h2.wf-section-h {
  font-family: "Roboto Slab", serif;
  color: var(--helena-blue);
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 14px;
  letter-spacing: -0.005em;
}
.wf-chapter-index {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.wf-chapter-index li a {
  display: inline-block;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--helena-blue);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--rule-strong);
  background: var(--card);
}
.wf-chapter-index li a:hover {
  background: var(--helena-blue);
  color: #fff;
  border-color: var(--helena-blue);
}
.wf-chapter {
  background: var(--card);
  border: 1px solid var(--rule);
  margin: 0 0 22px;
  scroll-margin-top: 80px;
}
.wf-chapter-head {
  background: var(--paper-warm);
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.wf-chapter-head .wf-chapter-id {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--helena-gold);
}
.wf-chapter-head h3 {
  font-family: "Roboto Slab", serif;
  font-size: 17px;
  color: var(--helena-blue);
  font-weight: 600;
  margin: 0;
  flex: 1 1 auto;
}
.wf-chapter-head .wf-chapter-version {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wf-chapter-body {
  padding: 6px 18px 14px;
}
.wf-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  line-height: 1.5;
}
.wf-row:last-child { border-bottom: none; }
.wf-row-label {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--helena-gold);
  padding-top: 2px;
}
.wf-row-body ul { margin: 0; padding-left: 20px; }
.wf-row-body li { margin-bottom: 4px; }
@media (max-width: 760px) {
  .wf-row { grid-template-columns: 1fr; gap: 4px; }
}

/* primary/secondary grid candidate set */
.grid-sub-h {
  font-family: "Roboto Slab", serif;
  font-size: 17px;
  color: var(--helena-blue);
  font-weight: 600;
  margin: 28px 0 8px;
}
.grid-sub-note {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  font-style: italic;
  line-height: 1.55;
}
.grid-criteria-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--rule);
  font-size: 14px;
  margin: 0 0 24px;
}
.grid-criteria-table th {
  background: var(--helena-blue);
  color: #fff;
  font-weight: 500;
  padding: 8px 10px;
  text-align: left;
  border-right: 1px solid rgba(255,255,255,0.15);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.grid-criteria-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  vertical-align: top;
  line-height: 1.5;
}
.grid-criteria-table td:first-child {
  font-family: "Roboto Mono", monospace;
  color: var(--helena-gold);
  width: 50px;
}
.grid-criteria-table td:nth-child(2) { width: 240px; }
.grid-criteria-table td:last-child { border-right: none; }
.grid-criteria-table tr:last-child td { border-bottom: none; }

.grid-area {
  margin: 0 0 22px;
}
.grid-area-h {
  font-family: "Roboto Slab", serif;
  font-size: 14px;
  color: var(--helena-gold);
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.grid-seg {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--helena-gold);
  padding: 10px 14px;
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
}
.grid-seg-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.grid-seg-head strong {
  color: var(--helena-blue);
  font-size: 14.5px;
}
.grid-seg-from-to {
  font-family: "Roboto Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 2px 0 6px;
}
.grid-seg-crits {
  display: flex;
  gap: 4px;
  margin: 0 0 6px;
  flex-wrap: wrap;
}
.grid-crit {
  font-family: "Roboto Mono", monospace;
  font-size: 9.5px;
  background: var(--helena-blue);
  color: #fff;
  padding: 2px 6px;
  letter-spacing: 0.04em;
}
.grid-conf {
  font-family: "Roboto Mono", monospace;
  font-size: 9.5px;
  padding: 2px 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.grid-conf-high { background: rgba(76, 137, 76, 0.15); color: #2c5e2c; }
.grid-conf-medium { background: rgba(180, 130, 50, 0.15); color: #7a5520; }
.grid-conf-low { background: rgba(160, 120, 100, 0.15); color: #6b4a3f; }
.grid-seg-basis {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink);
}
.grid-seg-note {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  border-top: 1px dashed var(--rule);
  padding-top: 6px;
}
.grid-env {
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  padding: 12px 16px;
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
}
.grid-env h5 {
  font-family: "Roboto Slab", serif;
  font-size: 14.5px;
  color: var(--helena-blue);
  font-weight: 600;
  margin: 0 0 6px;
}
.grid-env p { margin: 4px 0; }

/* corridor-study pending cards */
.grid-corridor {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--helena-blue);
  padding: 12px 16px;
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
}
.grid-corridor-head strong {
  color: var(--helena-blue);
  font-size: 14.5px;
  font-family: "Roboto Slab", serif;
}
.grid-corridor-extent {
  font-family: "Roboto Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 2px 0 8px;
}
.grid-corridor-class,
.grid-corridor-reason {
  margin: 4px 0;
  font-size: 13.5px;
}
.grid-corridor-class strong,
.grid-corridor-reason strong {
  color: var(--ink);
  font-weight: 600;
}

/* utility */
.cite, code.cite {
  font-family: "Roboto Mono", monospace;
  font-size: 0.93em;
  color: var(--accent-turquoise);
  letter-spacing: 0.01em;
}
.muted { color: var(--muted); }
.hr-soft { border: none; border-top: 1px solid var(--rule); margin: 28px 0; }

/* ========== responsive ========== */
@media (max-width: 980px) {
  .chapter-shell { grid-template-columns: var(--nav-width) 1fr; }
  .chapter-toc { display: none; }
}
@media (max-width: 760px) {
  .shell, .chapter-shell { grid-template-columns: 1fr; padding: 0 18px; }
  nav.site-nav {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 14px 0;
    display: none;
  }
  nav.site-nav.open { display: block; }
  .nav-toggle { display: inline-block; }
  .site-mast-inner { padding: 12px 18px; }
  .site-mast .doctitle { display: none; }
  .page-head h1 { font-size: 26px; }
  .def-entry { grid-template-columns: 1fr; gap: 6px; }
  .def-entry .def-tags { flex-direction: row; align-items: flex-start; }
  .ig-block-body .ig-row { grid-template-columns: 1fr; gap: 4px; }
  .note-pin-body { width: 90vw; right: -10px; }
  .col-inner { max-width: 100%; }
}

@media print {
  header.site-mast, nav.site-nav, .chapter-toc, .note-pin-btn, footer.site-foot { display: none; }
  .shell, .chapter-shell { display: block; padding: 0; }
  body { background: #fff; }
  .note-pin-body { display: block !important; position: static; background: #f4f1ea; color: #1c1c1c; border: 1px solid var(--rule); margin: 8px 0; box-shadow: none; }
  .note-pin-body .nh { color: var(--helena-gold); }
  details.open-items { border: 1px solid var(--rule); }
  details.open-items[open] > summary { background: var(--paper-warm); }
  a { color: inherit; text-decoration: none; }
}
