/* ============================================================
   Robinfall — Economy Whitepaper v3.2 · shared stylesheet

   Loaded by every whitepaper page (index + 10 chapters) via the
   absolute path /whitepaper/wp.css, so nested chapter directories
   resolve it identically.

   This is the PARAMETER HOME. Every number lives here and nowhere
   else on the public site. The landing pages are brand-only; this
   document is where a reader can actually audit the economy.

   Typography is document-optimised (longer measure, higher body
   contrast, numbered sections, real tables) rather than the
   landing page's display-led treatment.
   ============================================================ */
@font-face {
  font-family: 'Kenney';
  src: url('/fonts/kenney.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #170e08;
  --bg-deep: #0f0905;
  --line: #4a3f33;
  --line-soft: #2e2218;
  --text: #f4ecd6;
  --body: #ded0b4;          /* brighter than landing muted — built for reading */
  --muted: #b8a78a;
  --accent: #facc15;
  --violet: #a78bfa;
  --ink: #1a1208;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(900px 520px at 78% -4%, rgba(250,204,21,0.05), transparent 60%),
    linear-gradient(180deg, #22150c 0%, #170e08 30%, #0f0905 100%);
  color: var(--text);
  font: 16px/1.72 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    url("/assets/background-image-golden.png"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95  0 0 0 0 0.83  0 0 0 0 0.55  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 256px, 200px;
  opacity: 0.32;
  mix-blend-mode: soft-light;
}

#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 200; pointer-events: none;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 2; }

/* ---------- masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  padding: 18px 0; margin-bottom: 52px;
}
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; font-family: 'Kenney', system-ui, sans-serif; font-size: 17px; letter-spacing: 2.2px; }
.brand img { width: 32px; height: 32px; }
.brand em { font-style: normal; color: var(--accent); }
.back-link { font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.back-link:hover { color: var(--text); border-color: var(--muted); }

/* ============================================================
   two-column shell: sticky contents rail + document column
   ============================================================ */
.shell {
  max-width: 1160px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: 236px 1fr; gap: 54px;
  align-items: start; position: relative; z-index: 2;
}

/* ---------- contents rail ---------- */
.sidebar { position: sticky; top: 22px; }
.sb-details > summary { list-style: none; cursor: pointer; }
.sb-details > summary::-webkit-details-marker { display: none; }
.sb-title {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.sb-title::after {
  content: ""; width: 5px; height: 5px; border-right: 1.4px solid var(--muted);
  border-bottom: 1.4px solid var(--muted); transform: rotate(45deg) translateY(-1px);
}
.sb-details[open] .sb-title::after { transform: rotate(-135deg) translateY(-1px); }

.sb-list { list-style: none; }
.sb-list li { margin-bottom: 2px; }
.sb-list a {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13.5px; line-height: 1.45; color: var(--muted);
  padding: 6px 10px 6px 11px; border-left: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.sb-list a:hover { color: var(--text); border-left-color: var(--line); background: rgba(255,255,255,0.025); }
.sb-list a .n {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 11px; color: var(--muted); flex-shrink: 0; opacity: .8;
}
.sb-list a.cur {
  color: var(--text); border-left-color: var(--accent); background: rgba(250,204,21,0.055);
}
.sb-list a.cur .n { color: var(--accent); opacity: 1; }

.sb-home {
  display: block; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-family: Consolas, ui-monospace, monospace; font-size: 11.5px;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted);
}
.sb-home:hover { color: var(--accent); }

/* ---------- document column ---------- */
.content { min-width: 0; padding-bottom: 20px; }

.ch-title {
  font-family: 'Kenney', system-ui, sans-serif;
  font-size: clamp(26px, 3.6vw, 36px); font-weight: normal;
  letter-spacing: 0.6px; line-height: 1.16;
  padding-left: 15px; border-left: 2px solid var(--accent);
  margin-bottom: 22px;
}
.sec-num {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 11px; letter-spacing: 2.2px; color: var(--accent);
  display: block; margin-bottom: 10px;
}

h3 {
  font-size: 16px; font-weight: 600; margin: 28px 0 10px;
  letter-spacing: 0.2px; color: var(--text);
}
p { color: var(--body); margin-bottom: 14px; max-width: 72ch; }
p:last-child { margin-bottom: 0; }
ul { color: var(--body); margin: 0 0 14px 20px; max-width: 70ch; }
li { margin-bottom: 7px; }
b { color: var(--text); font-weight: 600; }
code, .mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
code {
  background: rgba(0,0,0,0.34); border: 1px solid var(--line-soft);
  border-radius: 4px; padding: 1px 6px; font-size: 13.5px; color: var(--text);
}
pre {
  background: rgba(0,0,0,0.42); border: 1px solid var(--line);
  border-radius: 7px; padding: 16px 18px; margin: 16px 0 20px;
  overflow-x: auto; font-family: Consolas, ui-monospace, monospace;
  font-size: 13.5px; line-height: 1.75; color: var(--text);
}

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; margin: 16px 0 22px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 460px; }
th, td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line-soft); }
th {
  color: var(--muted); font-weight: 600; font-size: 11.5px;
  letter-spacing: 1.4px; text-transform: uppercase;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { color: var(--body); }
td.num, th.num { font-family: Consolas, ui-monospace, monospace; white-space: nowrap; }
td.hi { color: var(--accent); }
tr.total td { border-top: 1px solid var(--line); border-bottom: none; font-weight: 600; color: var(--text); }

/* ---------- callout ---------- */
.callout {
  border-left: 2px solid var(--violet);
  background: rgba(167,139,250,0.06);
  padding: 14px 18px; margin: 18px 0 22px; border-radius: 0 6px 6px 0;
}
.callout.warn { border-left-color: var(--accent); background: rgba(250,204,21,0.06); }
.callout p { margin: 0; font-size: 14.5px; }
.callout .cl {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 6px;
}

/* ---------- chapter pager ---------- */
.pager {
  display: flex; justify-content: space-between; gap: 18px;
  margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line);
}
.pg {
  display: flex; flex-direction: column; gap: 5px;
  padding: 13px 18px; border: 1px solid var(--line-soft); border-radius: 7px;
  max-width: 46%; transition: border-color .15s, background .15s;
}
.pg:hover { border-color: var(--line); background: rgba(255,255,255,0.025); }
.pg-next { text-align: right; margin-left: auto; }
.pg-dir {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--muted);
}
.pg-name {
  font-family: 'Kenney', system-ui, sans-serif;
  font-size: 15px; letter-spacing: 0.4px; color: var(--text); line-height: 1.25;
}
.pg:hover .pg-name { color: var(--accent); }
.pg-spacer { flex: 1; }

/* ---------- index page ---------- */
.title-block { margin-bottom: 48px; }
.title-block .eyebrow {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px;
}
.idx-h1 {
  font-family: 'Kenney', system-ui, sans-serif;
  font-size: clamp(30px, 5.6vw, 50px); line-height: 1.08;
  letter-spacing: 1px; font-weight: normal; margin-bottom: 20px;
}
.idx-h1 .a { color: var(--accent); }
.title-block .abstract { color: var(--body); font-size: 16.5px; max-width: 72ch; }

.chapters { list-style: none; margin: 0; }
.chapters li { border-top: 1px solid var(--line-soft); }
.chapters li:last-child { border-bottom: 1px solid var(--line-soft); }
.chapters a {
  display: grid; grid-template-columns: 52px 1fr 22px; gap: 18px;
  align-items: baseline; padding: 20px 4px;
  transition: background .15s, padding-left .15s;
}
.chapters a:hover { background: rgba(255,255,255,0.025); padding-left: 12px; }
.chapters .cn {
  font-family: Consolas, ui-monospace, monospace;
  font-size: 12px; letter-spacing: 1.6px; color: var(--muted); padding-top: 3px;
}
.chapters a:hover .cn { color: var(--accent); }
.chapters .ct {
  font-family: 'Kenney', system-ui, sans-serif;
  font-size: 19px; letter-spacing: 0.5px; color: var(--text); margin-bottom: 5px;
}
.chapters .cd { display: block; font-family: system-ui, sans-serif; font-size: 14px; color: var(--muted); letter-spacing: 0; line-height: 1.6; }
.chapters .cgo { color: var(--muted); font-size: 15px; transition: transform .15s, color .15s; }
.chapters a:hover .cgo { color: var(--accent); transform: translateX(4px); }

/* ---------- footer ---------- */
.doc-footer { border-top: 1px solid var(--line); padding: 40px 0 64px; margin-top: 64px; }
.doc-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.doc-footer p { font-size: 13px; color: var(--muted); max-width: 46ch; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.foot-links a {
  font-family: Consolas, ui-monospace, monospace; font-size: 12px;
  color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 2px; height: fit-content;
}
.foot-links a:hover { color: var(--text); border-color: var(--muted); }

/* ---------- responsive ---------- */
@media (min-width: 901px) {
  /* the rail is permanent on desktop — collapse is mobile-only */
  .sb-details > summary { pointer-events: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; margin-bottom: 34px; }
  .sb-details {
    border: 1px solid var(--line-soft); border-radius: 7px;
    background: rgba(0,0,0,0.22); padding: 12px 14px;
  }
  .sb-title { margin-bottom: 0; }
  .sb-list { margin-top: 12px; }
  .sb-home { margin-top: 14px; padding-top: 12px; }
  .masthead { margin-bottom: 34px; }
  .pager { flex-direction: column; }
  .pg { max-width: 100%; }
  .pg-next { text-align: left; margin-left: 0; }
  .chapters a { grid-template-columns: 40px 1fr; gap: 12px; }
  .chapters .cgo { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
