/* Canopy diligence library — charcoal / cream / gold. Updated 16 Sep 2026. */
:root {
  --bg: #12100c;
  --bg-deep: #0c0b09;
  --ink: #f3ead3;
  --gold: #c4a35a;
  --muted: #8a8070;
  --rule: #3e3426;
  --card: #1c1814;
  --card-hover: #221e19;
  --amber: #c4a35a;
  --amber-bg: rgba(196, 163, 90, 0.28);
  --hair: rgba(196, 163, 90, 0.35);
  --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: text;
}

::selection { background: rgba(196, 163, 90, 0.28); color: var(--ink); }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ink); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.85rem 6vw;
  background: rgba(12, 11, 9, 0.92);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(12px);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.wordmark svg { width: 1.1rem; height: 1.1rem; display: block; }
.topbar-meta {
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.topbar-links { margin-left: auto; display: flex; gap: 1.1rem; }
.topbar-links a {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 500;
}
.topbar-links a:hover,
.topbar-links a[aria-current="page"] { color: var(--gold); }

.crumbs {
  padding: 1rem 6vw 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--gold); }
.crumbs span { color: var(--ink); }

.page {
  padding: 1.4rem 6vw 4rem;
  max-width: 78rem;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 0.85fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 2rem;
}
.page-hero.solo { grid-template-columns: 1fr; max-width: 46rem; }
.kicker {
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 500;
}
.stamp {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.62rem;
}
h1 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: clamp(2.1rem, 4.4vw, 3.6rem);
  line-height: 1.08;
  margin: 0.55rem 0 0.8rem;
}
.gold-rule { width: 3rem; height: 2px; background: var(--gold); margin: 0 0 1.1rem; }
.lede { color: var(--muted); max-width: 42rem; line-height: 1.6; font-size: 1.05rem; }

.hero-figure {
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--card);
  overflow: hidden;
}
.hero-figure img,
.figure img {
  display: block;
  width: 100%;
  height: auto;
}
.hero-figure figcaption,
.figure figcaption {
  padding: 0.7rem 0.9rem 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  border-top: 1px solid var(--rule);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 2.2rem;
}
a.card, .card {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 1.15rem 1.2rem 1.25rem;
  color: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
a.card:hover { border-color: var(--gold); background: var(--card-hover); }
.card .idx {
  display: block;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.68rem;
  margin-bottom: 0.4rem;
}
.card strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
}
.card em {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-style: normal;
  font-size: 0.9rem;
  line-height: 1.45;
}
.org-card { display: flex; flex-direction: column; gap: 0.45rem; }
.org-card a { color: var(--gold); }

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 2.4rem;
  align-items: start;
}
.doc-layout.wide { grid-template-columns: 1fr; }

article.doc {
  max-width: 52rem;
  padding-bottom: 2rem;
}
article.doc.full { max-width: none; }

article.doc h2 {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2.1rem 0 0.75rem;
  scroll-margin-top: 5rem;
}
article.doc h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.55rem;
  scroll-margin-top: 5rem;
}
article.doc p, article.doc li { line-height: 1.65; }
article.doc p { margin: 0.7rem 0; color: var(--ink); }
article.doc ul, article.doc ol { margin: 0.6rem 0 0.9rem 1.2rem; }
article.doc li { margin: 0.28rem 0; }
article.doc hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.8rem 0;
}
article.doc blockquote {
  border-left: 2px solid var(--gold);
  padding: 0.2rem 0 0.2rem 1rem;
  color: var(--muted);
  margin: 1rem 0;
}
article.doc code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86em;
  color: var(--gold);
}
article.doc pre {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 0.9rem 1rem;
  overflow: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}
article.doc pre code { color: var(--ink); }
.cite {
  color: var(--gold);
  font-weight: 500;
  white-space: nowrap;
}

.table-wrap {
  margin: 1rem 0 1.4rem;
  overflow: auto;
  border: 1px solid var(--rule);
  background: var(--card);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  background: #16130f;
  position: sticky;
  top: 0;
}
table.data td {
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid rgba(62, 52, 38, 0.55);
  vertical-align: top;
  line-height: 1.45;
}
table.data tbody tr:nth-child(odd) td { background: rgba(18, 16, 12, 0.35); }
table.data td.num { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }

.toc {
  position: sticky;
  top: 4.6rem;
  padding: 0.9rem 0 1rem 1rem;
  border-left: 1px solid var(--rule);
}
.toc p {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.66rem;
  margin-bottom: 0.65rem;
}
.toc a {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  margin: 0.38rem 0;
}
.toc a:hover, .toc a.active { color: var(--ink); }
.toc a.h3 { padding-left: 0.7rem; font-size: 0.75rem; }

.figure {
  margin: 1.3rem 0 1.6rem;
  border: 1px solid var(--rule);
  background: var(--card);
}
.diagram {
  margin: 1.3rem 0 1.6rem;
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 1.2rem 1rem 1rem;
}
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 6vw 0;
  max-width: 78rem;
  border-top: 1px solid var(--rule);
  margin: 0 0 0;
}
.pager a {
  display: block;
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 0.85rem 1rem;
  min-width: 12rem;
  background: var(--card);
}
.pager a:hover { border-color: var(--gold); }
.pager a span {
  display: block;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.64rem;
  margin-bottom: 0.25rem;
}
.pager a.next { margin-left: auto; text-align: right; }

.site-footer {
  padding: 2rem 6vw 2.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--gold); }

.notice {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  background: var(--card);
  padding: 0.85rem 1rem;
  margin: 1rem 0 1.3rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1rem 0 1.1rem;
}
.filters input,
.filters select {
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--ink);
  font: inherit;
  padding: 0.55rem 0.7rem;
  min-width: 14rem;
}
.filters input:focus,
.filters select:focus,
.sheet-input:focus {
  outline: 1px solid var(--gold);
  border-color: var(--gold);
}
.filters .count { color: var(--muted); align-self: center; font-size: 0.85rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0.8rem;
}
.tabs button {
  appearance: none;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--rule);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}
.tabs button[aria-selected="true"],
.tabs button:hover { color: var(--ink); border-color: var(--gold); }

.workbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 0.4rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.workbook-toolbar button,
.btn {
  appearance: none;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  font: inherit;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.68rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}
.workbook-toolbar button:hover,
.btn:hover { background: rgba(196, 163, 90, 0.12); color: var(--ink); }
.formula-bar {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 0.45rem 0.7rem;
  min-height: 2.1rem;
}
.formula-bar b { color: var(--gold); font-weight: 500; margin-right: 0.5rem; }

.sheet-wrap {
  overflow: auto;
  border: 1px solid var(--rule);
  max-height: calc(100vh - 16rem);
  background: #16130f;
}
table.sheet {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 100%;
}
table.sheet th,
table.sheet td {
  border: 1px solid rgba(62, 52, 38, 0.7);
  padding: 0.28rem 0.45rem;
  vertical-align: top;
  white-space: nowrap;
}
table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1c1814;
  color: var(--gold);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
table.sheet th.rowhead {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #1c1814;
  color: var(--muted);
  text-align: right;
  min-width: 2.2rem;
}
table.sheet td.label { min-width: 18rem; white-space: normal; max-width: 28rem; }
table.sheet td.section { color: var(--gold); font-weight: 600; letter-spacing: 0.04em; }
table.sheet td.formula { color: var(--muted); }
table.sheet td.amber,
table.sheet td.input {
  background: var(--amber-bg);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.45);
}
.sheet-input {
  width: 7.2rem;
  background: transparent;
  border: 0;
  color: var(--gold);
  font: inherit;
  padding: 0;
}
table.sheet td.benchmark { color: var(--ink); }
.sandbox-flag { color: var(--gold); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.6rem 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.legend i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
  border: 1px solid var(--rule);
}
.legend i.amber { background: var(--amber-bg); border-color: var(--gold); }
.legend i.formula { background: #16130f; }
.legend i.bench { background: #2a2418; }

@media (max-width: 900px) {
  .page-hero, .doc-layout { grid-template-columns: 1fr; }
  .toc { position: static; border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; }
  .topbar { padding: 0.75rem 1.1rem; flex-wrap: wrap; }
  .page, .crumbs, .pager, .site-footer { padding-left: 1.1rem; padding-right: 1.1rem; }
  .pager a { min-width: 0; flex: 1; }
}

@media print {
  .topbar, .toc, .pager, .site-footer, .workbook-toolbar, .tabs { display: none !important; }
  body { background: white; color: #221c14; }
  a { color: inherit; }
}
