/* Guide pages (/docs/), generated by crates/okdocs. The colour tokens are
   the landing page's (site/index.html); keep the two in step. */
:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --code-bg: #f3f4f1;
  --text: #1c1f1c;
  --muted: #5d635d;
  --border: #e3e5e0;
  --accent: #15803d;
  --accent-soft: #e7f5ec;
  --kw: #7c3aed;
  --str: #b45309;
  --com: #8a908a;
  --fn: #0369a1;
  --red: #dc2626;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111311;
    --surface: #181b18;
    --code-bg: #1d211d;
    --text: #e8ebe7;
    --muted: #9aa29a;
    --border: #2b302b;
    --accent: #4ade80;
    --accent-soft: #16301f;
    --kw: #c4b5fd;
    --str: #fbbf24;
    --com: #6f776f;
    --fn: #7dd3fc;
    --red: #f87171;
  }
}
* { box-sizing: border-box; }
/* Ligatures would show `!=` as one glyph; code must look as it is typed. */
code, pre { font-variant-ligatures: none; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

header.top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
header nav a { color: var(--muted); text-decoration: none; margin-left: 20px; font-size: 15px; }
header nav a:hover, header nav a[aria-current] { color: var(--text); }

/* Sidebar and content. minmax(0, 1fr) lets the content column shrink below
   its widest code line, so code scrolls inside its <pre> instead of
   widening the page. */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-bottom: 48px; }
aside { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; font-size: 15px; }
.toc summary { display: none; }
.nav-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 6px; }
.nav-section:first-child { margin-top: 4px; }
aside ul { list-style: none; margin: 0; padding: 0; }
aside li a { display: block; color: var(--text); text-decoration: none; padding: 3px 10px; border-radius: 6px; }
aside li a:hover { background: var(--code-bg); }
aside li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  aside { position: static; max-height: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 4px 14px; }
  .toc summary { display: block; cursor: pointer; font-weight: 600; padding: 6px 0; }
  .toc[open] nav { padding-bottom: 10px; }
}
@media (max-width: 420px) { header nav a { margin-left: 14px; font-size: 14px; } }

article { max-width: 760px; }
article h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.15; margin: 8px 0 16px; letter-spacing: -0.02em; }
article h2 { font-size: 24px; margin: 40px 0 10px; letter-spacing: -0.01em; }
article h3 { font-size: 18px; margin: 28px 0 8px; }
article h2, article h3 { position: relative; scroll-margin-top: 16px; }
.anchor { position: absolute; left: -0.9em; color: var(--com); text-decoration: none; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
article p, article li { max-width: 70ch; }
article :not(pre) > code { font: 0.9em var(--mono); background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.3em; overflow-wrap: anywhere; }
article blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
article table { border-collapse: collapse; margin: 16px 0; font-size: 15px; display: block; overflow-x: auto; }
article th, article td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
article th { background: var(--code-bg); }

pre {
  margin: 16px 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font: 13.5px/1.6 var(--mono);
}
pre code { font: inherit; }
figure { margin: 16px 0; min-width: 0; }
figure pre { margin: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
figcaption {
  display: flex; align-items: center; gap: 10px; font: 13px var(--mono); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; padding: 6px 12px; min-height: 37px;
}
.sample-file code[contenteditable] { display: block; outline: none; }
.sample-file pre:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.sample-out pre.out { background: var(--surface); white-space: pre; }
.prompt { color: var(--accent); }
.run-status { margin-left: auto; font-family: var(--sans); }
.run {
  font: 600 13px var(--sans); background: var(--accent); color: var(--surface); border: 0; border-radius: 6px;
  padding: 4px 12px; cursor: pointer; flex-shrink: 0;
}
.run-status:empty + .run { margin-left: auto; }
.run:disabled { opacity: 0.6; cursor: progress; }

.k { color: var(--kw); }
.s { color: var(--str); }
.c { color: var(--com); }
.f { color: var(--fn); }
.out .b { font-weight: 700; }
.out .red { color: var(--red); }
.out .green { color: var(--accent); }
.out .yellow { color: var(--str); }
.out .blue, .out .cyan { color: var(--fn); }
.out .magenta { color: var(--kw); }

.pager { display: flex; gap: 16px; margin-top: 48px; max-width: 760px; }
.pager a { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager span { display: block; font-size: 13px; color: var(--muted); }
.pager .next { text-align: right; margin-left: auto; }
.edit { font-size: 14px; margin-top: 20px; }
.edit a { color: var(--muted); }

footer { border-top: 1px solid var(--border); padding: 28px 0 48px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
footer a { color: var(--muted); }
