/* Simcraft docs: the paper-and-ink world shared with the Simcraft home page.
   One warm paper surface, ink for text and every interactive emphasis, and
   the scene triad (sage, dusk, clay) reserved for figures, scenes, charts,
   and generated data markers. Bricolage Grotesque carries display and body;
   JetBrains Mono is reserved for code, data, and file paths. Light and dark
   are one system with two token sets. */

/* ------------------------------------------------------------- fonts */

@font-face {
  font-family: "Bricolage Grotesque Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(./fonts/bricolage-grotesque-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FB01-FB02;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(./fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2");
}

/* ------------------------------------------------------------ tokens */

:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #24282c;
  --ink-hover: #3a4046;

  --bg: var(--paper);
  --surface: var(--card);
  --heading: var(--ink);
  --text: #4b4a42;
  --text-dim: #6b6455;
  --text-faint: #6f695c;
  --line: rgba(36, 40, 44, 0.14);
  --line-strong: rgba(36, 40, 44, 0.34);
  --code-inline-bg: rgba(36, 40, 44, 0.06);
  --sheet: #fffdf8;
  --sheet-border: #d9d1bd;
  --dots: rgba(36, 40, 44, 0.09);
  --halo: rgba(139, 167, 184, 0.55);

  /* The scene triad: figures, scenes, charts, data markers. */
  --sage: #a4b391;
  --dusk: #8ba7b8;
  --clay: #d8926b;
  /* Text-weight variants of the triad, for generated data markers. */
  --sage-deep: #5a6a44;
  --dusk-deep: #4e6b7d;
  --clay-deep: #96552e;
  --error: #a03f2e;
  --ok: #54604f;

  /* Syntax highlighting on paper sheets. */
  --hl-key: #4e6b7d;
  --hl-string: #5a6a44;
  --hl-number: #96552e;
  --hl-keyword: #96552e;
  --hl-name: #4e6b7d;
  --hl-comment: #857d6b;
  --hl-punct: #6b6455;

  --font: "Bricolage Grotesque Variable", "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --header-h: 60px;
  --r-sm: 8px;
  --r-md: 12px;
}

.dark {
  --bg: #211e19;
  --surface: #292520;
  --heading: #f0e9da;
  --text: #cdc5b2;
  --text-dim: #a89e89;
  --text-faint: #998f7a;
  --ink-hover: #d9d2c2;
  --line: rgba(240, 233, 218, 0.13);
  --line-strong: rgba(240, 233, 218, 0.32);
  --code-inline-bg: rgba(240, 233, 218, 0.08);
  --sheet: #2a2620;
  --sheet-border: #453f33;
  --dots: rgba(240, 233, 218, 0.08);
  --halo: rgba(139, 167, 184, 0.35);

  --sage-deep: #b0bf98;
  --dusk-deep: #9db8c9;
  --clay-deep: #dda380;
  --error: #d68268;
  --ok: #a9b8a0;

  --hl-key: #9db8c9;
  --hl-string: #b0bf98;
  --hl-number: #dda380;
  --hl-keyword: #dda380;
  --hl-name: #9db8c9;
  --hl-comment: #8c8371;
  --hl-punct: #a89e89;
}

/* -------------------------------------------------------------- base */

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-h) + 24px);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}
.dark ::selection {
  background: var(--heading);
  color: var(--bg);
}

a {
  color: var(--heading);
  font-weight: 520;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease-out, color 0.2s ease-out;
}
a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -52px;
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: top 0.2s ease-out;
}
.skip-link:focus {
  top: 12px;
}

/* --------------------------------------------------------- utilities */

.tech-label {
  font-size: 12px;
  font-weight: 560;
  color: var(--text-dim);
  margin: 0;
}

.mono-micro {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.muted {
  color: var(--text-faint);
}
.small {
  font-size: 12.5px;
}
.dim {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.85em;
}

/* -------------------------------------------------------- top header */

.top {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  text-decoration: none;
  user-select: none;
}
.logo {
  display: none;
}
html:not(.dark) .logo-light {
  display: block;
}
.dark .logo-dark {
  display: block;
}
.brand-name {
  font-size: 17px;
  font-weight: 640;
  letter-spacing: 0.01em;
}
.brand-docs {
  font-size: 12px;
  font-weight: 560;
  color: var(--text-dim);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
  transform: translateY(1px);
}

.top-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.top-link {
  font-size: 14px;
  font-weight: 540;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: 999px;
  transition: color 0.2s ease-out, background-color 0.2s ease-out;
}
.top-link:hover {
  color: var(--heading);
}
.top-link.active {
  color: var(--heading);
  background: var(--code-inline-bg);
}

.top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-app {
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text-dim);
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
  transition: color 0.2s ease-out, border-color 0.2s ease-out, background-color 0.2s ease-out;
}
.top-app:hover {
  color: var(--heading);
  border-color: var(--heading);
  background: var(--surface);
}

.top-icon,
.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease-out, border-color 0.2s ease-out, background-color 0.2s ease-out;
}
.top-icon:hover,
.theme-toggle:hover {
  color: var(--heading);
  border-color: var(--line-strong);
  background: var(--surface);
}
html:not(.dark) .icon-sun {
  display: none;
}
.dark .icon-moon {
  display: none;
}

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
}
.nav-burger span {
  width: 17px;
  height: 1.5px;
  background: var(--text);
}

/* ------------------------------------------------------------ search */

.search {
  position: relative;
}
.search input {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 32px 6px 14px;
  width: 190px;
  outline: none;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}
.search input::placeholder {
  color: var(--text-dim);
}
.search input:focus {
  border-color: var(--heading);
  box-shadow: 0 0 0 3px var(--halo);
}
.search kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 390px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 6px 14px rgba(36, 40, 44, 0.08), 0 18px 36px rgba(36, 40, 44, 0.1);
  z-index: 200;
}
.dark .search-results {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), 0 18px 36px rgba(0, 0, 0, 0.4);
}
.search-hit {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 400;
  text-decoration: none;
}
.search-hit:last-child {
  border-bottom: none;
}
.search-hit:hover,
.search-hit.sel {
  background: var(--code-inline-bg);
}
.search-hit .hit-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
}
.search-hit .hit-section {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: 8px;
}
.search-hit .hit-context {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ------------------------------------------------------------ layout */

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 208px;
  gap: 48px;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 36px 20px 64px 0;
  border-right: 1px solid var(--line);
}
.side-group {
  margin-bottom: 28px;
}
.side-title {
  font-size: 13px;
  font-weight: 640;
  color: var(--heading);
  margin: 0;
}
.side-group ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.side-link {
  display: block;
  font-size: 13.5px;
  font-weight: 420;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0 4px 13px;
  border-left: 1px solid var(--line);
  line-height: 1.45;
  transition: color 0.2s ease-out, border-color 0.2s ease-out;
}
.side-link:hover {
  color: var(--heading);
}
.side-link.active {
  color: var(--heading);
  font-weight: 600;
  border-left-color: var(--heading);
}

.content {
  padding: 44px 0 96px;
  min-width: 0;
}
.content-body {
  max-width: 738px;
}

.toc {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 40px 0 64px;
  font-size: 12.5px;
}
.toc-title {
  font-size: 12.5px;
  font-weight: 640;
  color: var(--heading);
  margin: 0;
}
.toc ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.toc-link {
  display: block;
  color: var(--text-dim);
  font-weight: 420;
  text-decoration: none;
  padding: 3px 0;
  line-height: 1.45;
  overflow-wrap: break-word;
  transition: color 0.2s ease-out;
}
.toc-link:hover,
.toc-link.active {
  color: var(--heading);
}
.toc-link.active {
  font-weight: 600;
}
.toc-l3 {
  padding-left: 14px;
}

/* -------------------------------------------------------- typography */

.content-body h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.05rem);
  font-weight: 660;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--heading);
  margin: 0 0 16px;
  text-wrap: balance;
}
.content-body h2 {
  font-size: 21px;
  font-weight: 640;
  letter-spacing: -0.012em;
  line-height: 1.25;
  color: var(--heading);
  margin: 54px 0 14px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.content-body h3 {
  font-size: 17px;
  font-weight: 620;
  color: var(--heading);
  margin: 34px 0 10px;
}
.content-body h4 {
  font-size: 14px;
  font-weight: 620;
  color: var(--heading);
  margin: 26px 0 8px;
}
.content-body p {
  margin: 0 0 16px;
}
.content-body strong {
  color: var(--heading);
  font-weight: 620;
}
.lead {
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--text-dim);
}
.source-note {
  margin: 2px 0 30px;
}
.source-note code {
  background: none;
  border: none;
  padding: 0;
}

.anchor {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 400;
  color: var(--text-faint);
  text-decoration: none;
  margin-left: 10px;
  opacity: 0;
  transition: opacity 120ms;
}
:is(h1, h2, h3, h4):hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.content-body ul,
.content-body ol {
  padding-left: 22px;
  margin: 0 0 16px;
}
.content-body li {
  margin-bottom: 6px;
}

.content-body blockquote {
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  border-left: 1px solid var(--line-strong);
  color: var(--text-dim);
}

.content-body hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

/* -------------------------------------------------------------- code */

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-inline-bg);
  border-radius: 5px;
  padding: 1.5px 5px;
  color: var(--heading);
}
a code {
  color: inherit;
}
code.ns {
  color: var(--dusk-deep);
}
kbd {
  font-family: var(--mono);
}

/* Code blocks are paper sheets: the document is content, not console output. */
.code-block {
  position: relative;
  margin: 0 0 18px;
  border: 1px solid var(--sheet-border);
  border-radius: var(--r-sm);
  background: var(--sheet);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.code-block code {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--text);
}
.code-lang {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  user-select: none;
}

.hljs-attr,
.hljs-attribute {
  color: var(--hl-key);
}
.hljs-string,
.hljs-meta .hljs-string,
.hljs-regexp {
  color: var(--hl-string);
}
.hljs-number,
.hljs-literal {
  color: var(--hl-number);
}
.hljs-keyword,
.hljs-built_in,
.hljs-type,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable {
  color: var(--hl-keyword);
}
.hljs-title,
.hljs-title.class_,
.hljs-title.function_,
.hljs-section,
.hljs-name,
.hljs-selector-tag {
  color: var(--hl-name);
}
.hljs-comment,
.hljs-code,
.hljs-formula {
  color: var(--hl-comment);
}
.hljs-punctuation,
.hljs-operator,
.hljs-meta {
  color: var(--hl-punct);
}
.hljs-strong {
  font-weight: 600;
}

.excerpt {
  margin: 0 0 18px;
}
.excerpt .code-block {
  margin-bottom: 8px;
}
.excerpt figcaption {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ------------------------------------------------------------ tables */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.content-body > table {
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
th {
  font-size: 12.5px;
  font-weight: 620;
  text-align: left;
  color: var(--text-dim);
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.55;
}
tr:last-child td {
  border-bottom: none;
}
td:first-child {
  white-space: nowrap;
}

/* --------------------------------------------- generated data markers */

.req {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--clay-deep);
  margin-left: 7px;
}
.constraints {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.chip {
  font-size: 12px;
  font-weight: 540;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 9px;
  margin-left: 9px;
  vertical-align: 2px;
  white-space: nowrap;
}
.h-label {
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 10px;
}
.dir {
  font-family: var(--mono);
  font-size: 11.5px;
}
.dir-in {
  color: var(--sage-deep);
}
.dir-out {
  color: var(--dusk-deep);
}

.variants {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin: 0 0 20px;
}
.variant {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 12px 16px 2px;
  margin: 10px 0;
}
.variant .table-wrap {
  border: none;
  background: none;
  margin-bottom: 10px;
}
.variant-head {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--heading);
  margin-bottom: 8px;
}
.def {
  margin-bottom: 8px;
}

.method {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  margin-right: 10px;
  vertical-align: 3px;
  color: var(--text-dim);
}
.method-get {
  color: var(--sage-deep);
  border-color: color-mix(in srgb, var(--sage-deep) 45%, transparent);
}
.method-post {
  color: var(--dusk-deep);
  border-color: color-mix(in srgb, var(--dusk-deep) 45%, transparent);
}
.method-put,
.method-patch {
  color: var(--clay-deep);
  border-color: color-mix(in srgb, var(--clay-deep) 45%, transparent);
}
.method-delete {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 45%, transparent);
}
.ep-path {
  font-size: 0.8em;
}

/* ---------------------------------------------------- generated pages */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin: 0 0 32px;
}
.fact {
  background: var(--surface);
  padding: 13px 16px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fact-n {
  font-size: 19px;
  font-weight: 620;
  color: var(--heading);
  line-height: 1.3;
}
.fact-n code {
  font-size: 12px;
  vertical-align: 2px;
}

.conn-list {
  list-style: none;
  padding: 0 !important;
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
  margin: 0 0 20px;
}
.conn-list li {
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  margin: 0 !important;
}
.conn-list li:last-child {
  border-bottom: none;
}
.conn-arrow {
  color: var(--clay-deep);
  margin: 0 10px;
}

.src-details summary {
  cursor: pointer;
  padding: 9px 0;
  user-select: none;
}
.src-details summary:hover {
  color: var(--text);
}

.component {
  margin-bottom: 12px;
}

.note-box {
  font-size: 14.5px;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 12px 16px;
  margin: 0 0 22px;
}
.note-box code {
  font-size: 0.86em;
}

.run-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  margin-bottom: 26px;
}
.run-banner .note {
  font-size: 13.5px;
  color: var(--text-dim);
  flex: 1;
  min-width: 220px;
}

/* ----------------------------------------------------------- buttons */

.btn-primary,
.btn-secondary {
  display: inline-block;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-md);
  padding: 9px 20px;
  white-space: nowrap;
  transition: background-color 0.2s ease-out, color 0.2s ease-out, border-color 0.2s ease-out;
}
.btn-primary {
  background: var(--heading);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--ink-hover);
}
.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1.5px solid var(--line-strong);
}
.btn-secondary:hover {
  color: var(--heading);
  border-color: var(--heading);
  background: var(--surface);
}

/* ------------------------------------------------- example directory */

.example-list {
  list-style: none;
  margin: 28px 0 8px;
  padding: 0;
}
.example-list > li {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 8px 28px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.example-list h3 {
  margin: 0 !important;
  font-size: 17px;
}
.example-list .paradigm {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 3px;
}
.example-list p {
  margin: 0 0 8px;
}
.example-links {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

/* ------------------------------------------------------- home landing */

.landing {
  font-size: 17px;
  line-height: 1.65;
}

.site-head {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-head .brand-name {
  font-size: 18px;
}
.head-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.head-pill {
  font-size: 15px;
  font-weight: 560;
  color: var(--text-dim);
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 18px;
  transition: color 0.2s ease-out, border-color 0.2s ease-out, background-color 0.2s ease-out;
}
.head-pill:hover {
  color: var(--heading);
  border-color: var(--heading);
  background: var(--surface);
}

/* The hero shares the passage reading column so the whole page scrolls as
   one centered flow. */
.hero {
  max-width: 660px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 110px) 32px 0;
}
.hero h1 {
  max-width: 21ch;
  font-size: clamp(2.1rem, 5.2vw, 3.45rem);
  font-weight: 660;
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--heading);
  margin: 0;
  text-wrap: balance;
}
.hero-sub {
  margin: 22px 0 0;
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 36rem;
}
.hero-links {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.passage {
  max-width: 660px;
  margin: 0 auto;
  padding: clamp(56px, 10vh, 108px) 32px 0;
}
.passage h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 640;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--heading);
  margin: 0 0 18px;
  text-wrap: balance;
}
.passage p {
  margin: 0 0 14px;
}
.passage p:last-child {
  margin-bottom: 0;
}

.passage-figure {
  position: relative;
}
.doc-figure {
  margin: 28px 0 0;
  max-width: 340px;
}
.doc-figure svg {
  width: 100%;
  height: auto;
  display: block;
}
@media (min-width: 1240px) {
  .doc-figure {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: min(320px, calc(50vw - 370px));
    margin: 0 0 0 36px;
  }
}

/* The section figures are paper artifacts; on the dark ground they read as
   lit dioramas, held slightly quieter. */
.dark .doc-figure {
  opacity: 0.92;
}

.home-examples {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(56px, 10vh, 108px) 32px 0;
}
.home-examples h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 640;
  letter-spacing: -0.015em;
  color: var(--heading);
  margin: 0 0 8px;
}
.home-examples > p {
  color: var(--text-dim);
  max-width: 40rem;
  margin: 0 0 12px;
}
.home-example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 40px;
}
.home-example {
  padding: 20px 0 4px;
  border-top: 1px solid var(--line);
}
.home-example h3 {
  font-size: 17.5px;
  font-weight: 620;
  color: var(--heading);
  margin: 0 0 2px;
}
.home-example .paradigm {
  font-size: 13.5px;
  color: var(--text-dim);
}
.home-example p {
  font-size: 15px;
  margin: 8px 0 10px;
}
.home-example .example-links {
  font-size: 14.5px;
}

.closing {
  max-width: 660px;
  margin: 0 auto;
  padding: clamp(72px, 12vh, 130px) 32px clamp(72px, 12vh, 120px);
}
.closing h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 640;
  letter-spacing: -0.015em;
  color: var(--heading);
  margin: 0 0 18px;
}
.closing p {
  max-width: 34rem;
}

/* ---------------------------------------------------- subscribe form */

.subscribe {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 30rem;
}
.subscribe input {
  flex: 1;
  min-width: 220px;
  font: inherit;
  font-size: 16px;
  color: var(--heading);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 12px 18px;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}
.subscribe input::placeholder {
  color: var(--text-dim);
}
.subscribe input:focus {
  outline: none;
  border-color: var(--heading);
  box-shadow: 0 0 0 3px var(--halo);
}
.subscribe button {
  font: inherit;
  font-size: 16px;
  font-weight: 620;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: var(--r-md);
  padding: 12px 26px;
  cursor: pointer;
  transition: background-color 0.2s ease-out, transform 0.2s ease-out;
}
.dark .subscribe button {
  background: var(--heading);
  color: var(--bg);
}
.subscribe button:hover {
  background: var(--ink-hover);
}
.subscribe button:active {
  transform: translateY(1px);
}
.subscribe button:disabled {
  background: var(--text-faint);
  cursor: default;
  transform: none;
}
.form-note,
.form-status {
  flex-basis: 100%;
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
}
.form-status:empty {
  display: none;
}
.form-status.is-error {
  color: var(--error);
}
.form-status.is-success {
  color: var(--ok);
  font-weight: 560;
}
.subscribe.is-done input,
.subscribe.is-done button,
.subscribe.is-done .form-note {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------- site footer */

.site-foot {
  border-top: 1px solid var(--line);
  max-width: 1160px;
  margin: 0 auto;
  padding: 30px 32px 44px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.foot-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 620;
  font-size: 16px;
  color: var(--heading);
}
.site-foot nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}
.site-foot nav a {
  font-size: 15px;
  font-weight: 480;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s ease-out;
}
.site-foot nav a:hover {
  color: var(--heading);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.foot-legal {
  flex-basis: 100%;
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0;
}

/* -------------------------------------------------------- scrollbars */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 5px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* -------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .toc {
    display: none;
  }
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .nav-burger {
    display: flex;
  }
  .top-nav {
    display: none;
  }
  .top-inner {
    gap: 14px;
  }
  .top-inner .search {
    margin-left: auto;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: 280px;
    background: var(--bg);
    border-right: 1px solid var(--line-strong);
    padding: 24px 20px 64px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 90;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .search input {
    width: 140px;
  }
  .example-list > li {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .top-app {
    display: none;
  }
  .site-head {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 20px;
  }
  .head-nav {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .search {
    display: none;
  }
}

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