:root {
  --fg: #000;
  --bg: #fff;
  --muted: #787168;
  --line: #d0ccc8;
  --surface: #f6f5f4;
  --surface-raised: #e3e1de;
  --dot: #d4d4d4;
  --accent: #000;
  --accent-hover: #787168;
  --amber: #d97706;
  --amber-mid: #f59e0b;
  --amber-tint: #fef3c7;
  --violet: #7c3aed;
  --violet-mid: #8b5cf6;
  --violet-tint: #ede9fe;
  --grey: #8a8580;
  --green: #16a34a;
  --red: #dc2626;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 96px;
  --content: 1024px;
  --prose: 700px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 350;
  line-height: 1.65;
  font-optical-sizing: auto;
}
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
strong, b { font-weight: 600; }
em { font-style: italic; }
code { font-family: var(--mono); font-size: .82em; border: 1px solid var(--line); background: var(--surface); padding: 0 4px; }

.page { max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) 96px; }

/* Header */
.crumbs { font-family: var(--sans); font-size: 14px; padding: 28px 0 0; }
.crumbs a { color: var(--fg); text-decoration: none; }
.crumbs a:hover { color: var(--accent-hover); }
header.masthead { padding: 56px 0 40px; }
h1.title { font-family: var(--serif); font-weight: 400; font-size: 60px; line-height: 1.08; letter-spacing: -.012em; margin: 0; max-width: 15em; }
.subtitle { font-size: 22px; font-style: italic; color: var(--fg); margin: 18px 0 0; max-width: 34em; line-height: 1.45; }
.byline { font-family: var(--sans); font-size: 15px; margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.byline .who { font-weight: 500; }
.byline .meta { color: var(--muted); }
.byline .code-link { color: var(--fg); }
.byline .code-link:hover { color: var(--accent-hover); }
nav.toc .toc-code { margin-top: 14px; font-weight: 400; }

/* Lead: contents + teaser */
.lead { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 48px; align-items: start; }
nav.toc { font-family: var(--sans); font-size: 14px; line-height: 1.6; position: sticky; top: 24px; }
nav.toc p { margin: 0 0 8px; font-weight: 500; }
nav.toc ol { list-style: none; margin: 0; padding: 0; }
nav.toc li { margin: 0 0 6px; }
nav.toc a { color: var(--fg); text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; }
nav.toc a:hover { color: var(--accent-hover); }
nav.toc .num { font-family: var(--mono); font-size: 12px; margin-right: 6px; }
.lead > * { min-width: 0; }
figure.fig figcaption.tldr { font-size: 21px; line-height: 1.5; margin: 20px 0 0; max-width: none; text-align: left; }
.tldr b { font-weight: 600; }

/* Prose */
main { margin-top: 72px; }
section.chapter { max-width: var(--prose); margin: 0 auto; scroll-margin-top: 32px; }
section.chapter + section.chapter { margin-top: 64px; }
section.chapter > * + * { margin-top: 18px; }
section.chapter > p { margin-bottom: 0; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.2; margin: 0 0 22px; }
h2 .hash, h3 .hash { font-family: var(--mono); font-weight: 400; font-size: .62em; color: var(--muted); text-decoration: none; margin-right: 10px; vertical-align: .18em; }
h2 .hash:hover, h3 .hash:hover { color: var(--accent-hover); }
h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 36px 0 12px; }
section.chapter ul { list-style: square outside; padding-left: 24px; margin-bottom: 0; }
section.chapter li + li { margin-top: 8px; }
.callout { background: var(--surface); padding: 18px 22px; font-size: 17px; line-height: 1.6; }
.callout p { margin: 0; }
.callout p + p { margin-top: 10px; }
blockquote.pull { margin: 36px 0; padding: 0 0 0 22px; border-left: 2px solid var(--fg); font-size: 24px; line-height: 1.45; font-style: italic; }

/* Figures */
figure.fig { margin: 44px auto; max-width: var(--content); }
section.chapter > figure.fig { width: min(var(--content), calc(100vw - 2 * var(--gutter))); max-width: none; position: relative; left: 50%; transform: translateX(-50%); }
.frame {
  border: 1px solid var(--fg);
  padding: 22px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  background-color: #fff;
  background-image: radial-gradient(circle, var(--dot) .65px, transparent .8px);
  background-size: 6px 6px;
}
figure.fig figcaption { max-width: 46rem; margin: 14px auto 0; text-align: center; font-family: var(--serif); font-size: 15px; line-height: 1.6; }
figure.fig figcaption .fignum { font-family: var(--mono); font-size: 12px; font-weight: 600; margin-right: 8px; }
.fig-title { font-family: var(--mono); font-size: 15px; font-weight: 500; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fig-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: -8px 0 14px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { font-family: var(--mono); }
svg.chart * { vector-effect: non-scaling-stroke; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid currentColor; }
.sw.dash { border-top-style: dashed; }

/* Tokens */
.tok { display: inline-block; border: 1px solid var(--fg); background: #fff; padding: 1px 6px; margin: 0 1px; white-space: nowrap; box-shadow: 0 2px 2px rgba(0,0,0,.07); }
.tok.amber { border-color: var(--amber-mid); background: var(--amber-tint); }
.tok.violet { border-color: var(--violet-mid); background: var(--violet-tint); }
.tok.plain { border-color: transparent; background: transparent; box-shadow: none; padding: 1px 2px; margin: 0; }
.tok.act { font-weight: 600; }
.chip { display: inline-block; font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--fg); background: #fff; }
.chip.amber { border-color: var(--amber-mid); background: var(--amber-tint); }
.chip.violet { border-color: var(--violet-mid); background: var(--violet-tint); }
.chip.on { border-color: var(--fg); background: var(--fg); color: #fff; }

/* Segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--fg); background: #fff; }
.seg button { font-family: var(--mono); font-size: 12px; padding: 3px 9px; border: 0; background: transparent; color: var(--fg); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--fg); }
.seg button[aria-pressed="true"] { background: var(--fg); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Teaser */
.t-world { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.t-world-head { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.t-worlds { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.t-world-one { min-width: 0; }
.t-world-one .name { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.t-world-one .name span { font-weight: 400; color: var(--muted); }
.t-world-one p { font-size: 11.5px; line-height: 1.5; margin: 6px 0 0; }
.t-grid { display: grid; grid-template-columns: 104px minmax(0, .9fr) minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px 26px; align-items: center; margin-top: 14px; }
.t-head { font-size: 11px; color: var(--muted); line-height: 1.35; align-self: end; }
.t-label { font-size: 12.5px; font-weight: 600; line-height: 1.3; border-left: 3px solid; padding: 6px 0 6px 8px; }
.t-label.amber { border-color: var(--amber-mid); color: var(--amber); }
.t-label.violet { border-color: var(--violet-mid); color: var(--violet); }
.t-label small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.t-cell { min-width: 0; font-size: 12px; line-height: 2; }
.t-cell .cap { display: none; }
.result .bar-row { display: grid; grid-template-columns: 40px minmax(0,1fr) 34px; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.4; }
.result .bar-row + .bar-row { margin-top: 6px; }
.bar-track { height: 12px; border: 1px solid var(--fg); background: #fff; position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.teaser-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); text-align: left; line-height: 1.5; }

/* Opening figure: the four stages of the study, above the evidence */
.t-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.t-stage { min-width: 0; border-top: 1px solid var(--fg); padding: 10px 0 0; }
.t-stage > span { display: block; font-size: 11px; color: var(--muted); }
.t-stage strong { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.35; margin-top: 6px; }
.t-stage p { font-size: 11.5px; line-height: 1.5; margin: 5px 0 0; }
@media (max-width: 760px) { .t-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; } }

/* World strip */
.world-grid { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 14px 18px; align-items: center; }
.world-label { font-size: 12px; line-height: 1.4; }
.world-label b { font-size: 13px; font-weight: 600; display: block; }
.actions-key { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; font-size: 12px; border-top: 1px solid var(--line); padding-top: 14px; }

/* Bodies */
.bodies { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: center; }
.body-card { border: 1px solid var(--fg); background: #fff; padding: 12px 14px; box-shadow: 0 2px 2px rgba(0,0,0,.07); }
.body-card + .body-card { margin-top: 12px; }
.body-card .name { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.meter { display: grid; grid-template-columns: 74px minmax(0,1fr) 36px; gap: 8px; align-items: center; font-size: 11.5px; margin-top: 4px; }
.meter .track { height: 9px; border: 1px solid var(--fg); position: relative; background: #fff; }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--fg); }

/* Renderings */
.lane-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.lane-head b { font-weight: 600; font-size: 13px; }
.render { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; }
.render .pane { border-left: 2px solid var(--fg); padding-left: 16px; min-width: 0; }
.render .pane.amber { border-color: var(--amber-mid); }
.render .pane.violet { border-color: var(--violet-mid); }
.render .tut { font-size: 12px; line-height: 1.6; margin-bottom: 12px; }
.render .lines { font-size: 12px; line-height: 1.9; }
.render .lines div { white-space: nowrap; overflow-x: auto; }
.render .reply { font-weight: 600; }
.same { margin-top: 16px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
.same span::before { content: "="; margin-right: 5px; color: var(--muted); }

/* Notes */
details.notes { max-width: var(--prose); margin: 72px auto 0; border-top: 1px solid var(--line); padding-top: 20px; font-size: 16px; line-height: 1.6; }
details.notes summary { font-family: var(--sans); font-size: 15px; font-weight: 500; cursor: pointer; width: fit-content; }
details.notes ul { padding-left: 22px; list-style: square outside; }
details.notes li + li { margin-top: 8px; }
footer.end { max-width: var(--prose); margin: 56px auto 0; font-family: var(--sans); font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
footer.end a { color: var(--fg); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1150px) {
  :root { --gutter: 48px; }
  h1.title { font-size: 52px; }
}
@media (max-width: 860px) {
  .lead { grid-template-columns: 1fr; gap: 28px; }
  nav.toc { position: static; }
  .bodies { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 17px; }
  header.masthead { padding: 36px 0 28px; }
  h1.title { font-size: 36px; }
  .subtitle { font-size: 18px; }
  figure.fig figcaption.tldr { font-size: 18px; }
  h2 { font-size: 25px; }
  main { margin-top: 48px; }
  .frame { padding: 14px; font-size: 12px; }
  .render { grid-template-columns: 1fr; }
  .t-worlds { grid-template-columns: 1fr; gap: 16px; }
  .t-grid { grid-template-columns: 1fr; gap: 8px; }
  .t-head { display: none; }
  .t-label { margin-top: 10px; }
  .t-cell .cap { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
  .world-grid { grid-template-columns: 1fr; gap: 6px; }
  .world-grid .world-label { margin-top: 10px; }
  blockquote.pull { font-size: 20px; }
}

/* Framing and prioritized next steps */
.study-lens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 30px 0 14px; padding: 19px 0; border-top: 1px solid var(--fg); border-bottom: 1px solid var(--line); }
.study-lens > div { min-width: 0; }
.study-lens span, .eyebrow { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted); }
.study-lens p { font-size: 16px; line-height: 1.5; margin: 6px 0 0; }
.question-focus { margin: 30px 0; border-left: 2px solid var(--fg); padding: 3px 0 3px 22px; }
.question-focus p { font-size: 21px; line-height: 1.5; margin: 10px 0 0; }
.roadmap { margin: 34px 0 42px; border-top: 2px solid var(--fg); }
.roadmap-step { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 18px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.roadmap-index { font-family: var(--mono); line-height: 1.4; }
.roadmap-index b { display: block; font-size: 24px; font-weight: 500; }
.roadmap-index span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.roadmap-step h3 { margin: 0 0 8px; font-size: 22px; }
.roadmap-step p { margin: 0; font-size: 17px; line-height: 1.6; }
.roadmap-step .test-result { margin-top: 12px; font-size: 15px; line-height: 1.6; }
@media (max-width: 640px) {
  .study-lens { grid-template-columns: 1fr; gap: 17px; }
  .question-focus p { font-size: 19px; }
  .roadmap-step { grid-template-columns: 40px minmax(0,1fr); gap: 12px; padding: 22px 0; }
  .roadmap-index b { font-size: 19px; }
  .roadmap-index span { font-size: 9px; }
  .roadmap-step h3 { font-size: 20px; }
  .roadmap-step p { font-size: 16px; }
  .roadmap-step .test-result { font-size: 14px; }
}

/* Shared keyboard navigation */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 10px; background: var(--bg); z-index: 2; }

/* Content-specific layout; typography and colors use the shared components. */
.t-stages.honeycomb-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 28px 0 10px; }
.t-stage.honeycomb-training { border-top-color: var(--amber); }
.t-stage.honeycomb-training > span { color: var(--amber); }
.workflow-node { display: inline-flex; align-items: center; gap: 12px; }
.flow button.tok { appearance: none; border-radius: 0; font: inherit; color: var(--fg); padding: 6px 8px; min-height: 44px; cursor: pointer; }
.flow button.tok:hover { background: var(--surface); }
.flow button.tok[aria-pressed="true"] { background: var(--amber-tint); border-color: var(--amber); }
.flow button.tok:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .t-stages.honeycomb-stages { grid-template-columns: 1fr; }
}
