Built in Lith

The source of this site.

This site is built in Lith, and Lith enforces its design system: every colour and size below comes from tokens.json.

src/content.lith

// Content the pages are built from. The docs bundle (llms.txt, llms-guide.txt, llms-full.txt) and the card are the
// lab's own files, served exactly as generated (npm run sync-content: lith-docs-0.4, spec v0.4; llms.lith).
import designRules from "../content/design-rules.json"

// The design system (§7.1). Named, because the vendored compiler in toolchain/ carries its own default token file.
design "../tokens.json"

const SITE = "https://lith.codes"
const VERSION = "v0.4"
const COMPILER = "m2.3"
const CARD = readFileSync("content/lith-card.md", "utf8")
const GUIDE = readFileSync("content/llms-guide.txt", "utf8")
const AGENTS = readFileSync("content/agents.md", "utf8")
const CARD_TOKENS = 2680 // o200k_base (spec-lab/improve/v0.4/INTEGRATION.md)
const GUIDE_TOKENS = 7079 // lith-docs-0.4 (DOCS_NOTES.md + the scripts note)
const FULL_TOKENS = 60152

// The v0.4 release check: six real-project tickets rebuilt from the same base code (improve/RELEASES.md).
const REPLAY = { tickets: 6, qaPassed: 82, qaTotal: 83, codeBefore: 105.8, codeAfter: 86.4 }

// This site's own design system, for the numbers the pages show about it.
type TokenGroups = Record<string, Record<string, unknown>>
const TOKENS = JSON.parse(readFileSync("tokens.json", "utf8")) as { semantic: TokenGroups, primitive: TokenGroups }
const countTokens = (groups: TokenGroups) =>
  Object.values(groups).reduce((n, g) => n + Object.keys(g).filter((k) => !k.startsWith("$")).length, 0)
const DESIGN = { semantic: countTokens(TOKENS.semantic), primitive: countTokens(TOKENS.primitive) }

// What the compiler enforces about design systems (spec §7.1), each with the diagnostic a model gets.
// Kept as content: the "bad" examples are styling a checker would rightly reject in app code.
const DS_RULES = designRules

src/docs.lith

// The docs are the lab's own files, word for word: the card (/docs, also /llms.txt) and the guide's recipes
// (/docs/guide, also /llms-guide.txt). /llms-full.txt is the specification. All three are served from public/.

// each section may switch the background world (index into DOCS_WORLDS in layout.lith)
const SECTION_WORLD: Record<string, int> = { "Tables": 1, "Pages and layout": 2, "APIs": 3 }

function Toc(sections: { title: string, slug: string }[], raw: boolean) {
  return <aside class="toc">
    <div class="label">On this page</div>
    <ol>{sections.map((s) => <li><a href={`#${s.slug}`}>{s.title}</a></li>)}</ol>
    {raw ? <div class="raw">
      <a href="/llms.txt">llms.txt</a>
      <a href="/llms-guide.txt">llms-guide.txt</a>
      <a href="/llms-full.txt">llms-full.txt</a>
    </div> : null}
  </aside>
}

// The three tiers an agent can fetch, smallest first.
function Tiers() {
  return <div class="row">
    <a class="btn ghost" href="/llms.txt">llms.txt</a>
    <a class="btn ghost" href="/llms-guide.txt">llms-guide.txt</a>
    <a class="btn ghost" href="/llms-full.txt">llms-full.txt</a>
  </div>
}

function DocBody(sections: Section[], intro: Html[], worlds: boolean) {
  return <main>
    {intro.length ? <div class="intro">{intro}</div> : null}
    {sections.map((s, i) => <section class="doc" id={s.slug} data-world={worlds ? SECTION_WORLD[s.title] : i % 4}>
      <h2><a href={`#${s.slug}`}>{s.title}</a></h2>
      {s.blocks}
    </section>)}
  </main>
}

page "/docs" {
  const doc = parseMarkdown(CARD)
  return <>
    <title>Lith Docs</title>
    <meta name="description" content="The complete Lith language on one page, written for LLMs first. Copy it into your agent or point it at /llms.txt." />
    <link rel="alternate" type="text/markdown" href="/docs/lith-card.md" title="Lith card (Markdown)" />
    <link rel="alternate" type="text/plain" href="/llms.txt" title="llms.txt" />
    <style>{DOCS_CSS + NO_LIGATURES}</style>

    <header data-world="0">
      <div class="wrap">
        <div>
          <div class="label">Documentation · {VERSION}</div>
          <h1>The whole language<br />on <em>one page</em>.</h1>
          <p class="lede">Lith's docs are its language card: one page a model reads once before writing working Lith. Recipes for the tasks it does not cover are in the guide, and every rule and diagnostic is in the specification.</p>
          <div class="facts">
            <div><b>{CARD_TOKENS.toLocaleString("en-US")}</b>tokens: the card</div>
            <div><b>{GUIDE_TOKENS.toLocaleString("en-US")}</b>tokens: {parseMarkdown(GUIDE).sections.length} recipes</div>
            <div><b>{REPLAY.qaPassed} / {REPLAY.qaTotal}</b>QA checks in the {VERSION} replays</div>
          </div>
        </div>
        <div class="llm">
          <h3>Give it to your agent</h3>
          <p>Paste the card into the context, or point the agent at <code>/llms.txt</code>. It links the guide (<code>/llms-guide.txt</code>) and the full specification (<code>/llms-full.txt</code>, {Math.round(FULL_TOKENS / 1000)}k tokens, with a contents line that gives each section's start line).</p>
          <div class="row">
            <button class="btn primary" id="copy" type="button">Copy card as Markdown</button>
            <a class="btn ghost" href="/docs/guide">Guide</a>
            <a class="btn ghost" href="/docs/agents">MCP and agents</a>
          </div>
          <Tiers />
          <div class="prompt"><span>{"// example prompt"}</span>{"\n"}Read {SITE}/llms.txt, then build the app in Lith.</div>
          <p class="note-ds"><b>Design systems are enforced, not explained.</b> The card's Styling section is short because the compiler carries the rules: give your agent a W3C or Figma token file, and raw colours, sizes, primitives and invented tokens fail to compile, in pages and in server code, each with a patch to the right semantic token.</p>
        </div>
      </div>
    </header>

    <div class="wrap layout">
      <Toc sections={doc.sections} raw={true} />
      <DocBody sections={doc.sections} intro={doc.intro} worlds={true} />
    </div>
    <script type="text/markdown" id="card-src">{CARD.replaceAll("</script", "<\\/script")}</script>
    <script src="/docs.js" defer></script>
  </>
}

page "/docs/guide" {
  const guide = parseMarkdown(GUIDE)
  return <>
    <title>Lith Guide</title>
    <meta name="description" content="Recipes for Lith tasks the card does not cover, each checked by the compiler. Also at /llms-guide.txt." />
    <link rel="alternate" type="text/plain" href="/llms-guide.txt" title="llms-guide.txt" />
    <style>{DOCS_CSS + NO_LIGATURES}</style>

    <header data-world="0">
      <div class="wrap">
        <div>
          <div class="label">Guide · {VERSION}</div>
          <h1>Recipes for <em>the rest</em>.</h1>
          <p class="lede">{guide.sections.length} tasks the card leaves out, from cookies and error pages to webhooks, streaming and the design system. Every example passes lith check.</p>
        </div>
        <div class="llm">
          <h3>For agents</h3>
          <p>The same recipes as plain text: <code>/llms-guide.txt</code>, {GUIDE_TOKENS.toLocaleString("en-US")} tokens. Read the card first, or look up a single recipe with <a href="/docs/agents">lith docs or the MCP server</a>.</p>
          <Tiers />
        </div>
      </div>
    </header>

    <div class="wrap layout">
      <Toc sections={guide.sections} raw={true} />
      <DocBody sections={guide.sections} intro={guide.intro} worlds={false} />
    </div>
    <script src="/docs.js" defer></script>
  </>
}

// This site's own source, as an example of Lith that compiles today.
page "/docs/agents" {
  const doc = parseMarkdown(AGENTS)
  return <>
    <title>Lith for Agents</title>
    <meta name="description" content="Give a coding agent Lith: docs over MCP at lith.codes/mcp, the compiler as MCP tools (lith mcp), lith docs in the terminal and an AGENTS.md in every project." />
    <style>{DOCS_CSS + NO_LIGATURES}</style>

    <header data-world="0">
      <div class="wrap">
        <div>
          <div class="label">Agents · {VERSION} · compiler {COMPILER}</div>
          <h1>Plug Lith into <em>your agent</em>.</h1>
          <p class="lede">An agent should read only the part of the docs it needs. The docs MCP server, the compiler's tools and the AGENTS.md in every new project all return the card once, then just the passages that answer the question.</p>
        </div>
        <div class="llm">
          <h3>One command</h3>
          <p>Connect the docs to Claude Code, nothing to install:</p>
          <div class="prompt">claude mcp add --transport http lith {SITE}/mcp</div>
          <Tiers />
        </div>
      </div>
    </header>

    <div class="wrap layout">
      <Toc sections={doc.sections} raw={true} />
      <DocBody sections={doc.sections} intro={doc.intro} worlds={false} />
    </div>
    <script src="/docs.js" defer></script>
  </>
}

page "/source" {
  const files = [...SOURCES.map((f) => `src/${f}`), "tokens.json"].map((f) => ({ title: f, slug: slug(f), src: readFileSync(f, "utf8") }))
  return <>
    <title>Lith · Source of this site</title>
    <meta name="description" content="The Lith source and design system lith.codes is built from." />
    <style>{DOCS_CSS + NO_LIGATURES}</style>
    <header data-world="0">
      <div class="wrap">
        <div>
          <div class="label">Built in Lith</div>
          <h1>The source of <em>this site</em>.</h1>
          <p class="lede">This site is built in Lith, and Lith enforces its design system: every colour and size below comes from tokens.json.</p>
        </div>
      </div>
    </header>
    <div class="wrap layout">
      <Toc sections={files} raw={false} />
      <main>
        {files.map((f, i) => <section class="doc" id={f.slug} data-world={i % 4}>
          <h2><a href={`#${f.slug}`}>{f.title}</a></h2>
          <pre>{Code(f.src)}</pre>
        </section>)}
      </main>
    </div>
    <script src="/docs.js" defer></script>
  </>
}

src/highlight.lith

// Syntax highlighting for Lith code, done at build time so the HTML already holds the colours.
// Code is rendered as an array of lines directly inside <pre>, which Lith joins with newlines (spec §8,
// readable output). Within a line the tokens are chained, not an array, so no newline lands between them.

const DECL_WORDS = new Set(["table", "page", "api", "crud", "layout", "state", "effect", "auth", "own", "function"])
const KEYWORDS = new Set(["const", "let", "return", "if", "else", "async", "await", "try", "catch", "import", "from", "new", "true", "false", "null", "test", "seed", "system", "for", "of"])
const TYPE_WORDS = new Set(["string", "int", "number", "boolean", "Date", "day", "email", "User", "Todo", "Post", "Tag", "Note", "Person", "Html", "Product", "Response"])
const TOKEN = /((?<![:\w])\/\/[^\n]*)|("[^"\n]*"|`[^`]*`)|(<\/?)([a-z][a-z0-9]*)|(\b\d+(?:\.\.\d*)?\b)|([A-Za-z_]\w*)/g

function token(m: RegExpMatchArray) {
  if (m[1]) return <span class="t-com">{m[1]}</span>
  if (m[2]) return <span class="t-str">{m[2]}</span>
  if (m[3]) return <span>{m[3]}<span class="t-tag">{m[4]}</span></span>
  if (m[5]) return <span class="t-num">{m[5]}</span>
  if (DECL_WORDS.has(m[6])) return <span class="t-decl">{m[6]}</span>
  if (KEYWORDS.has(m[6])) return <span class="t-kw">{m[6]}</span>
  if (TYPE_WORDS.has(m[6])) return <span class="t-ty">{m[6]}</span>
  return m[6]
}

// One highlighted line as a chain: plain text, then a token, then the rest of the line.
function Line(src: string, from: int = 0) {
  TOKEN.lastIndex = from
  const m = TOKEN.exec(src)
  if (!m) return <span>{src.slice(from)}</span>
  const end = m.index + m[0].length
  return <span>{src.slice(from, m.index)}{token(m)}{end < src.length ? Line(src, end) : null}</span>
}

// Numbered lines (the home page numbers them with CSS counters).
function NumberedCode(src: string, caret: boolean = false) {
  const lines = src.split("\n")
  return lines.map((line, i) => <span class="l">{line === "" ? " " : Line(line)}{caret && i === lines.length - 1 ? <span>{" "}<span class="caret"></span></span> : null}</span>)
}

function Code(src: string) {
  return src.split("\n").map((line) => Line(line))
}

src/home.lith

// lith.codes home page. Benchmarks are o200k_base write tokens per task: other stacks from
// spec-lab/baseline/multi_stack.json, Lith from the v0.3.1 reference solutions (spec-lab/improve/v0.3.1/solutions).

type Key = "li" | "ts" | "sveltekit" | "laravel" | "django" | "rails"
type Stack = { key: Key, name: string, sub: string, files: int }
type Task = { name: string, id: string } & Record<Key, int>

const STACKS: Stack[] = [
  { key: "ts", name: "Next.js", sub: "TypeScript", files: 32 },
  { key: "sveltekit", name: "SvelteKit", sub: "TypeScript", files: 34 },
  { key: "laravel", name: "Laravel", sub: "PHP", files: 31 },
  { key: "django", name: "Django", sub: "Python", files: 32 },
  { key: "rails", name: "Rails", sub: "Ruby", files: 37 },
]
const TASKS: Task[] = [
  { name: "Counter island", id: "T02", li: 114, ts: 229, sveltekit: 168, laravel: 276, django: 293, rails: 297 },
  { name: "Todo CRUD", id: "T03", li: 340, ts: 1193, sveltekit: 1098, laravel: 941, django: 837, rails: 698 },
  { name: "Login & logout", id: "T04", li: 177, ts: 1076, sveltekit: 1135, laravel: 513, django: 600, rails: 606 },
  { name: "JSON CRUD API", id: "T07", li: 38, ts: 744, sveltekit: 681, laravel: 499, django: 331, rails: 391 },
  { name: "Per-user notes", id: "T09", li: 233, ts: 1078, sveltekit: 942, laravel: 743, django: 666, rails: 617 },
  { name: "Optimistic star", id: "T13", li: 266, ts: 630, sveltekit: 623, laravel: 716, django: 586, rails: 615 },
]
const API_FILES: Record<string, int> = { ts: 5, sveltekit: 5, laravel: 5, django: 5, rails: 4 }
const LINES = { li: 166, rails: 363, ts: 611 } // all six tasks
const less = (a: number, b: number) => `−${Math.round((1 - a / b) * 100)}%`

const mean = (key: Key) => TASKS.reduce((s, t) => s + t[key], 0) / TASKS.length
const fmt = (n: number) => Math.round(n).toLocaleString("en-US")
const width = (v: number, max: number) => (v / max * 86).toFixed(2)
const STACK_MAX = Math.max(...STACKS.map((s) => mean(s.key)))
const TASK_MAX = Math.max(...TASKS.flatMap((t) => STACKS.map((s) => t[s.key])))
const API = TASKS.find((t) => t.id === "T07") ?? TASKS[0]

const HERO_CODE = `table Todo own {
  title: string(1..200)
  done: boolean = false
  created: Date = now()
}

page "/" {
  const todos = db.todo.findMany({ orderBy: [{ done: "asc" }] })
  return <main>
    <form action={addTodo}>
      <input name="title" /><button>Add</button>
    </form>
    <ul>{todos.map(t => <li>
      <input type="checkbox" checked={t.done}
        onChange={() => setDone(t.id, !t.done)} />
      {t.title}
    </li>)}</ul>
  </main>
}

function addTodo(title: string) {
  db.todo.create({ data: { title } })
}

function setDone(id: int, done: boolean) {
  db.todo.update({ where: { id }, data: { done } })
}`

const TODO_CODE = readFileSync("content/todo-example.lith", "utf8").trimEnd()

const FEATURES = [
  { title: "Looks like TypeScript because it is", text: "The TS 5 TSX grammar plus contextual declarations. Models already know it: 64 blind programs had zero syntax-caused errors.", code: <><span class="k">table page api crud layout</span>{"\n"}<span class="k">state effect auth</span></> },
  { title: "Tables with refinement types", text: "Ranges and lengths live in the type and are checked on every write and every form. Migrations for new columns are automatic.", code: <>title: <span class="k">string(1..200)</span>{"\nviews: "}<span class="k">int(0..)</span> = 0</> },
  { title: "Ownership as a keyword", text: <><span class="mono">own</span> scopes every query, update and delete to the logged-in user. Other users' rows act as missing.</>, code: <><span class="k">table</span> Note <span class="k">own</span>{" { body: string }"}</> },
  { title: "Inferred server / client split", text: <>A function that touches <span class="mono">db</span> or <span class="mono">me</span> runs on the server; the browser calls it automatically. No <span class="mono">"use server"</span>, no API glue.</>, code: <>{"<form action={"}<span class="k">addComment</span>{"}>"}</> },
  { title: "Forms that handle themselves", text: "Inputs fill typed parameters by name. Every check runs at once, and failures re-show the form with messages next to each field. It works without JS.", code: <><span class="k">fail</span>{'({ body: "No links" })'}</> },
  { title: "A REST API in one line", text: <>List, get, create, patch and delete with validation, JSON errors and correct status codes. Plain <span class="mono">api</span> routes return any <span class="mono">Response</span>.</>, code: <><span class="k">crud</span> "/api/products" Product</> },
  { title: "Compiled signals, tiny islands", text: <><span class="mono">state</span> and <span class="mono">effect</span> replace hooks. Pages without islands ship 0 kB of JavaScript; the client runtime targets 10 kB gzipped.</>, code: <><span class="k">state</span> starred = task.starred</> },
  { title: "Errors an agent can apply", text: <><span class="mono">lith check</span> returns the first error as JSON with a ready patch, so a fix costs one short round instead of a debugging session.</>, code: <>{'{ "code": '}<span class="k">"E0110"</span>{', "patch": … }'}</> },
  { title: "Native to the web", text: <>Emits standard JS, HTML and CSS on Node 22. Import any npm package; export <span class="mono">.d.ts</span> types so TypeScript can call into Lith.</>, code: <><span class="k">import</span>{" { marked } "}<span class="k">from</span> "marked"</> },
]

const PRINCIPLES = [
  "Retries cost more than keystrokes. Prevent the wrong guess first.",
  "If it looks like JS or React, it behaves like JS or React.",
  "One way to write each thing. Never two.",
  "Always an escape hatch to plain web standards.",
  "Reading code is a cost too. Keep files short and dense.",
]

const NEXT_TREE = [
  ["app/", "", "dir"], ["page.tsx", "server", "ind1"], ["actions.ts", '"use server"', "ind1"], ["todo-controls.tsx", '"use client"', "ind1"],
  ["todos/[id]/", "", "ind1 dir"], ["page.tsx", "server", "ind2"], ["lib/", "", "dir"], ["db.ts", "prisma", "ind1"], ["prisma/", "", "dir"], ["schema.prisma", "schema", "ind1"],
]

// A counter shows its real value in the HTML; home.js animates it up from 0 when it scrolls in.
function Count(value: number, decimals: number = 0, id: string | null = null) {
  return <span id={id} data-count={value.toFixed(decimals)} data-dec={decimals}>{value.toFixed(decimals)}</span>
}

function Stat(value: Html, unit: string, what: string, vs: string, gain: string) {
  return <div class="stat">
    <div class="num">{value}<small>{unit}</small></div>
    <div class="what">{what}</div>
    <div class="vs">{vs} <b>{gain}</b></div>
  </div>
}

function StackRow(name: string, sub: string, value: number, lith: boolean) {
  return <div class={lith ? "row lith" : "row"}>
    <div class="name">{name}<span>{sub}</span></div>
    <div class="bars"><div class={lith ? "bar li" : "bar ts"} data-w={width(value, STACK_MAX)} title={`${name}: ${fmt(value)} tokens per task`}><em>{fmt(value)}</em></div></div>
    <div class={lith ? "x dim" : "x"}>{lith ? "—" : `${(value / mean("li")).toFixed(1)}×`}</div>
  </div>
}

// Rows show Next.js first; data-* holds every stack so home.js can switch without a round trip.
function TaskRow(t: Task) {
  const stacks = Object.fromEntries(STACKS.map((s) => [`data-${s.key}`, t[s.key]]))
  return <div class="row" data-li={t.li} {...stacks}>
    <div class="name">{t.name}<span>{t.id}</span></div>
    <div class="bars">
      <div class="bar ts" data-w={width(t.ts, TASK_MAX)} title={`Next.js · ${t.id}: ${fmt(t.ts)} tokens`}><em>{fmt(t.ts)}</em></div>
      <div class="bar li" data-w={width(t.li, TASK_MAX)} title={`Lith · ${t.id}: ${t.li} tokens`}><em>{t.li}</em></div>
    </div>
    <div class="x">{(t.ts / t.li).toFixed(1)}×</div>
  </div>
}

function CodeWindow(file: string, tag: string, src: string, caret: boolean = false, foot: Html | null = null, extra: string = "") {
  return <div class={`code reveal ${extra}`}>
    <div class="code-head"><div class="dots"><span></span><span></span><span></span></div><span>{file}</span><span>{tag}</span></div>
    <pre>{NumberedCode(src, caret)}</pre>
    {foot}
  </div>
}

page "/" {
  const liMean = mean("li")
  const rails = mean("rails")
  return <>
    <title>Lith</title>
    <meta name="description" content="Lith is a web language built for AI agents: TypeScript, JSX and Prisma-style queries plus five declarations. Ship a correct web app in a quarter of the tokens." />
    <style>{HOME_CSS + NO_LIGATURES}</style>

    <section class="hero" data-world="0">
      <div class="wrap">
        <div class="reveal">
          <span class="tag"><i></i>{VERSION} · compiler {COMPILER}</span>
          <h1>The web language<br />written for <em>agents</em>.</h1>
          <p class="lede">Lith is TypeScript, JSX and Prisma-style queries plus five declarations. An AI agent builds a correct, full-stack web app in about a quarter of the tokens it spends on Next.js, and the compiler keeps every colour and size on your design system.</p>
          <div class="cta">
            <a href="#stats" class="btn primary">See the numbers →</a>
            <a href="#features" class="btn ghost">Features</a>
          </div>
          <div class="hero-meta">
            <div><b>1 file</b>per app</div>
            <div><b>{(CARD_TOKENS / 1000).toFixed(1)}k</b>tokens to learn it</div>
            <div><b>0 kB</b>JS on static pages</div>
          </div>
        </div>
        <CodeWindow file="todos.lith" tag="full-stack" src={HERO_CODE} caret={true} extra="d2" />
      </div>
    </section>

    <section class="stats" id="stats" data-world="1">
      <div class="wrap">
        <div class="reveal">
          <div class="label">01 · Benchmarks</div>
          <h2>Less to write. Less to read. Fewer retries.</h2>
          <p class="lede">Six reference tasks, each written by an expert in Lith and in five popular web stacks: Next.js, SvelteKit, Laravel, Django and Rails. Tokens are counted with the o200k_base tokenizer: what a model actually pays.</p>
        </div>

        <div class="stat-grid reveal">
          <Stat value={Count(rails / liMean, 1)} unit={`–${(mean("ts") / liMean).toFixed(1)}×`} what="fewer tokens to write" vs={`${fmt(liMean)} vs ${fmt(rails)}–${fmt(mean("ts"))} per app`} gain="−64 to −76%" />
          <Stat value={Count(6)} unit="files" what="for all six apps" vs="other stacks: 31–37" gain="−81 to −84%" />
          <Stat value={Count(LINES.li)} unit="lines" what="of source in total" vs={`Rails ${LINES.rails} · Next.js ${LINES.ts}`} gain={`${less(LINES.li, LINES.rails)} to ${less(LINES.li, LINES.ts)}`} />
          <Stat value={Count(REPLAY.qaPassed)} unit={`/ ${REPLAY.qaTotal}`} what="QA checks passed" vs={`${REPLAY.tickets} real-project tickets rebuilt in ${VERSION}`} gain={`${Math.round((REPLAY.qaPassed / REPLAY.qaTotal) * 100)}%`} />
        </div>

        <div class="chart">
          <div class="reveal">
            <div class="chart-head">
              <h3>Mean tokens per task, by stack</h3>
              <div class="legend"><span><i class="ts"></i>Baseline stack</span><span><i class="li"></i>Lith</span></div>
            </div>
            <div>
              {STACKS.map((s) => <StackRow name={s.name} sub={`${s.sub} · ${s.files} files`} value={mean(s.key)} lith={false} />)}
              <StackRow name="Lith" sub={`${VERSION} · 6 files`} value={liMean} lith={true} />
            </div>
          </div>
          <aside class="chart-aside reveal d2">
            <div class="label">Closest stack</div>
            <div class="big">{Count(rails / liMean, 1)}×</div>
            <p>Rails, the leanest stack measured, still writes {(rails / liMean).toFixed(1)}× more. Batteries-included frameworks save tokens on auth, forms and REST, then spend them again on Stimulus or vanilla JS beside every template that needs client interactivity.</p>
          </aside>
        </div>

        <div class="chart">
          <div class="reveal">
            <div class="chart-head">
              <h3>Tokens per task</h3>
              <div class="legend"><span><i class="ts"></i><span id="base-name">Next.js</span></span><span><i class="li"></i>Lith</span></div>
            </div>
            <div class="switch" id="stack-switch" role="group" aria-label="Compare Lith with">
              {STACKS.map((s) => <button type="button" data-key={s.key} data-files={API_FILES[s.key]} aria-pressed={s.key === "ts" ? "true" : "false"}>{s.name}</button>)}
            </div>
            <div id="rows">{TASKS.map((t) => <TaskRow t={t} />)}</div>
          </div>
          <aside class="chart-aside reveal d2">
            <div class="label">Biggest gap</div>
            <div class="big">{Count(API.ts / API.li, 1, "gap")}×</div>
            <p>A full JSON REST API with validation, 404s and status codes. <span id="gap-text">{API_FILES.ts} files of Next.js</span> become one <span class="mono">crud</span> line and a table.</p>
            <div class="formula">
              Lith is designed against one cost:<br />
              <b>C</b> = T<sub>read</sub> + T<sub>write</sub> + Σ (T<sub>error</sub> + T<sub>fix</sub>)<br />
              every token an agent reads, writes and spends on retries.
            </div>
          </aside>
        </div>
        <p class="note reveal">Write tokens are the mean of 6 expert solutions per stack (Lith: the v0.3.1 reference solutions). Files and lines count everything written for a task, starting from each framework's standard scaffold. The release check: {REPLAY.tickets} real-project tickets rebuilt in {VERSION} with the {CARD_TOKENS.toLocaleString("en-US")}-token card and the guide passed {REPLAY.qaPassed} of {REPLAY.qaTotal} QA checks, with {Math.round((1 - REPLAY.codeAfter / REPLAY.codeBefore) * 100)}% fewer code tokens (read, write and compiler) than the originals.</p>
      </div>
    </section>

    <section class="compare" data-world="3">
      <div class="wrap">
        <div class="reveal">
          <div class="label">02 · Same app, side by side</div>
          <h2>One file instead of a framework's worth.</h2>
          <p class="lede">A todo app with per-user data, validation, a detail page and a 404. In Lith, the schema, pages, server logic and the server/client split all live together, and the compiler infers which code runs where.</p>
        </div>
        <div class="cmp">
          <div class="tree reveal">
            <h4>TypeScript / Next.js</h4>
            <ul>{NEXT_TREE.map(([file, note, cls]) => <li class={cls}><span>{file}</span><span>{note}</span></li>)}</ul>
            <div class="sum"><span>6 files · 146 lines</span><span>1,193 tok</span></div>
          </div>
          <CodeWindow file="T03_app.lith" tag="Lith" src={TODO_CODE} extra="d1"
            foot={<div class="code-foot"><span>1 file · {TODO_CODE.split("\n").length} lines</span><span>{TASKS[1].li} tok · {(TASKS[1].ts / TASKS[1].li).toFixed(1)}× fewer</span></div>} />
        </div>
      </div>
    </section>

    <section class="features" id="features" data-world="4">
      <div class="wrap">
        <div class="reveal">
          <div class="label">03 · Highlights</div>
          <h2>Every feature had to earn its tokens.</h2>
          <p class="lede">Lith came out of a measured design lab: four competing designs, blind tests with models that had never seen the language, and a rule that every feature must lower total cost.</p>
        </div>
        <div class="feat-grid reveal">
          {FEATURES.map((f, i) => <article class="feat">
            <span class="idx">/{String(i + 1).padStart(2, "0")}</span>
            <h3>{f.title}</h3>
            <p>{f.text}</p>
            <code>{f.code}</code>
          </article>)}
        </div>
      </div>
    </section>

    <section class="ds" id="design-systems" data-world="2">
      <div class="wrap">
        <div class="reveal">
          <div class="label">04 · Design systems, enforced</div>
          <h2>A model can't invent a colour in Lith.</h2>
          <p class="lede">Every Lith app takes its look from a design system: a standard token file with primitives and semantic tokens. The rules are in the compiler, not in a prompt, so a model follows them in markup, CSS and server code alike, and every violation comes back with the fix.</p>
        </div>
        <div class="ds-grid reveal">
          {DS_RULES.map((r) => <article class="ds-card">
            <div class="tag-row"><span>{r.tag}</span></div>
            <h3>{r.title}</h3>
            <p>{r.text}</p>
            <div class="diag"><span class="bad">{r.bad}</span>{"\n"}<span class="fix">{r.fix}</span></div>
          </article>)}
        </div>
        <div class="ds-facts reveal">
          <div><b>0</b>raw values, primitives, extra tokens or broken modes in 9 blind design-system tasks</div>
          <div><b>+122</b>card tokens for the whole design-system section; the compiler holds the rest</div>
          <div><b>{DESIGN.semantic}</b>semantic tokens style this site, checked on every build</div>
        </div>
      </div>
    </section>

    <section class="closing" data-world="5">
      <div class="wrap">
        <div class="reveal">
          <div class="label">05 · Principles</div>
          <h2>Built on what the measurements said, not on taste.</h2>
        </div>
        <ul class="principles reveal">
          {PRINCIPLES.map((p, i) => <li><span>{["i", "ii", "iii", "iv", "v"][i]}</span>{p}</li>)}
        </ul>
        <p class="sources reveal">Token counts: o200k_base · 6 measured tasks · 5 baseline stacks · blind validation n = 8</p>
      </div>
    </section>
    <script src="/home.js" defer></script>
  </>
}

src/layout.lith

// Imports are shared by every .lith file (one namespace); the docs and source pages read files at build time.
import { readdirSync, readFileSync } from "node:fs"

// The source files this site is built from, counted at build time for the footer.
const SOURCES = readdirSync("src").filter((f) => f.endsWith(".lith")).sort()

// Background worlds rendered for the Álmodozó music video; sections pick one by index (data-world).
const HOME_WORLDS = "indigo-twist,aurora-silk,ember-silk,jade-spire,paper-boats,rose-twist"
const DOCS_WORLDS = "nebula-veil,sapphire-veil,golden-sea,celadon-orbs"

const REPO = "https://github.com/arminjamak/lith"

// The link preview every page shares (Open Graph, Twitter/X): a frame of the indigo-twist world under a dark overlay.
const SHARE = {
  title: "Lith: the web language for agents",
  description: "Web apps for AI agents at a quarter of the token cost. TypeScript, JSX and Prisma-style queries, compiled to plain HTML, CSS and JS.",
  image: `${SITE}/og.jpg`,
}
const GITHUB_ICON = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"

// v0.3 error pages (404 and the rest) render through the layout, which shows this instead of the page.
function ErrorView(status: int, message: string) {
  return <>
    <title>{status === 404 ? "Not found" : message} · Lith</title>
    <style>{ERROR_CSS + NO_LIGATURES}</style>
    <section class="error-page" data-world="0">
      <div class="wrap">
        <div class="label">Error {status}</div>
        <h1>{status === 404 ? "This page is not here." : message}</h1>
        <p class="lede">The language, its docs and this site's source are a click away.</p>
        <div class="cta"><a class="btn primary" href="/">Home</a><a class="btn ghost" href="/docs">Docs</a><a class="btn ghost" href="/source">Source</a></div>
      </div>
    </section>
  </>
}

layout {
  const home = path === "/"
  return <html lang="en">
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
    <meta property="og:type" content="website" />
    <meta property="og:site_name" content="Lith" />
    {error ? null : <meta property="og:url" content={`${SITE}${path}`} />}
    <meta property="og:title" content={SHARE.title} />
    <meta property="og:description" content={SHARE.description} />
    <meta property="og:image" content={SHARE.image} />
    <meta property="og:image:width" content="1200" />
    <meta property="og:image:height" content="630" />
    <meta property="og:image:alt" content="Lith: web apps for AI agents at a quarter of the token cost" />
    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content={SHARE.title} />
    <meta name="twitter:description" content={SHARE.description} />
    <meta name="twitter:image" content={SHARE.image} />
    <style>{BASE_CSS}</style>
    <noscript><style>{".reveal { opacity: 1; transform: none; }"}</style></noscript>

    <div class="world" aria-hidden="true" data-worlds={home ? HOME_WORLDS : DOCS_WORLDS} data-dim={home ? "0.62" : "0.5"}><canvas id="world"></canvas></div>
    <div class="scrim" aria-hidden="true"></div>

    <nav>
      <div class="wrap">
        <a href="/" class="brand">Lith</a>
        <div class="nav-links">
          <a class="docs-link" href="/docs" aria-current={path.startsWith("/docs") ? "page" : null}>Docs</a>
          <a class="gh" href={REPO} target="_blank" rel="noopener">
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d={GITHUB_ICON} /></svg>
            GitHub
          </a>
        </div>
      </div>
    </nav>

    {error ? <ErrorView status={error.status} message={error.message} /> : children}

    <footer class="site">
      <div class="wrap">
        <span>Lith {VERSION}</span>
        <span class="built"><i></i><span>This site is <b>built in Lith</b>: {SOURCES.length} .lith files and a design system, compiled by the Lith {VERSION} compiler ({COMPILER}). <a href="/source">Read the source</a></span></span>
      </div>
    </footer>
    <script src="/world.js" defer></script>
  </html>
}

src/llms.lith

// The docs bundle for agents, served exactly as the lab generates it (lith-docs-0.3.1): the card, the guide's
// recipes and the full specification. The static build writes each route to a file.

const LLMS = readFileSync("content/llms.txt", "utf8")
const LLMS_FULL = readFileSync("content/llms-full.txt", "utf8")
const text = (body: string, type: string = "text/plain") => new Response(body, { headers: { "Content-Type": `${type}; charset=utf-8` } })

api GET "/llms.txt" { return text(LLMS) }
api GET "/llms-guide.txt" { return text(GUIDE) }
api GET "/llms-full.txt" { return text(LLMS_FULL) }
api GET "/docs/lith-card.md" { return text(CARD, "text/markdown") }

src/markdown.lith

// The markdown subset the card and the guide use: ## headings, paragraphs, "> " lead lines, "- " bullets
// (continued by indented lines), ``` fences and `code`. Returns the text before the first heading and one entry
// per section.

type Section = { title: string, slug: string, blocks: Html[] }

function slug(s: string) {
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")
}

function inline(s: string) {
  return s.split(/(`[^`]*`)/).map((p) => p.length > 1 && p.startsWith("`") && p.endsWith("`") ? <code>{p.slice(1, -1)}</code> : p)
}

function parseMarkdown(md: string) {
  const intro: Html[] = []
  const sections: Section[] = []
  let blocks = intro
  let para: string[] = []
  let quote: string[] = []
  let items: string[][] = []
  const flush = () => {
    if (quote.length) blocks.push(<p class="lead">{inline(quote.join(" "))}</p>)
    if (para.length) blocks.push(<p>{inline(para.join(" "))}</p>)
    if (items.length) blocks.push(<ul>{items.map((it) => <li>{inline(it.join(" "))}</li>)}</ul>)
    quote = []
    para = []
    items = []
  }
  const lines = md.split("\n")
  for (let i = 0; i < lines.length; i++) {
    const ln = lines[i]
    if (ln.startsWith("```")) {
      flush()
      const code: string[] = []
      i++
      while (i < lines.length && !lines[i].startsWith("```")) code.push(lines[i++])
      blocks.push(<pre>{Code(code.join("\n"))}</pre>)
    } else if (ln.startsWith("# ")) {
      // the page has its own title
    } else if (ln.startsWith("## ")) {
      flush()
      const title = ln.slice(3).trim()
      blocks = []
      sections.push({ title, slug: slug(title), blocks })
    } else if (ln.startsWith("> ")) {
      if (para.length || items.length) flush()
      quote.push(ln.slice(2).trim())
    } else if (ln.startsWith("- ")) {
      if (para.length || quote.length) flush()
      items.push([ln.slice(2).trim()])
    } else if (ln.startsWith("  ") && items.length && ln.trim()) {
      items[items.length - 1].push(ln.trim())
    } else if (!ln.trim()) {
      flush()
    } else {
      if (items.length || quote.length) flush()
      para.push(ln.trim())
    }
  }
  flush()
  return { intro, sections }
}

src/styles.lith

// Stylesheets as strings: Lith emits <style> children raw (spec §7), so each page carries its own CSS.
// Lith v0.2.2 design-system rules hold here too: every colour and length is a semantic token from
// tokens.json, read as var(--name); no hex, px, rem or em, and no custom properties of our own.
// Responsive layout is intrinsic (auto-fit, minmax, clamp): media queries cannot take var() breakpoints.

const BASE_CSS = `
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { color-scheme: dark; scroll-behavior: smooth; background: var(--surface); }
  body {
    background: transparent; color: var(--text);   /* html paints the surface; the world canvas sits between */
    font: 400 var(--size-base)/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  a { color: inherit; text-decoration: none; }
  /* Lith's base stylesheet (@layer base) lays out bare HTML for apps without their own CSS; this site has its own,
     so reset the parts it does not restyle. Unlayered rules beat the layer, whatever their specificity. */
  main, nav { max-width: none; margin: 0; padding: 0; display: block; }
  ul, ol { display: block; }
  li { display: list-item; }
  pre { background: none; border-radius: 0; }
  .wrap { max-width: var(--page); margin: 0 auto; padding-inline: clamp(var(--space-lg), 4vw, var(--space-2xl)); }
  .mono { font-family: var(--mono); }

  /* One fixed WebGL canvas behind everything; a CSS crossfade stands in without WebGL. */
  .world { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
  .world canvas, .world .fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
  .world video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }  /* decoding source for the canvas, covered by it */
  .world .fallback img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity 1.2s ease; filter: brightness(.55) saturate(1.05);
  }
  .world .fallback img.on { opacity: 1; }
  .scrim {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
      linear-gradient(90deg, var(--scrim-strong) 0%, var(--scrim-soft) 60%, transparent 100%),
      linear-gradient(180deg, var(--scrim-soft) 0%, transparent 30%, transparent 70%, var(--scrim) 100%),
      var(--scrim-soft);
  }

  nav {
    position: sticky; top: 0; z-index: 10;
    background: var(--chrome);   /* no backdrop blur: it re-blurs the moving canvas every frame */
    border-bottom: var(--hairline) solid var(--border);
  }
  nav .wrap { height: var(--space-4xl); display: flex; align-items: center; justify-content: space-between; }
  .brand { font-weight: 600; font-size: var(--size-xl); letter-spacing: var(--tracking-tight); }
  .nav-links { display: flex; align-items: center; gap: var(--space-sm); }
  .docs-link, .gh {
    display: inline-flex; align-items: center; gap: var(--space-sm); height: calc(var(--control-height) - var(--space-sm));
    padding-inline: var(--space-md); border: var(--hairline) solid transparent; border-radius: var(--radius-control);
    font: 500 var(--size-sm)/1 var(--mono); letter-spacing: var(--tracking-mono);
    transition: color .2s, border-color .2s, background .2s;
  }
  .docs-link { color: var(--text-muted); }
  .docs-link:hover, .docs-link[aria-current] { color: var(--text); border-color: var(--border); }
  .gh { border-color: var(--text); padding-inline: var(--space-lg); }
  .gh:hover { background: var(--text); color: var(--surface); }
  .gh svg { width: var(--space-lg); height: var(--space-lg); fill: currentColor; }

  .label {
    font: 500 var(--size-xs)/1 var(--mono); letter-spacing: var(--tracking-label); text-transform: uppercase;
    color: var(--text-subtle); display: flex; align-items: center; gap: var(--space-md);
  }
  .label::before { content: ""; width: var(--space-xl); height: var(--hairline); background: var(--text-subtle); }

  .t-kw { color: var(--accent); }
  .t-decl { color: var(--accent); font-weight: 500; }
  .t-str { color: var(--code-string); }
  .t-com { color: var(--code-comment); font-style: italic; }
  .t-tag { color: var(--code-tag); }
  .t-ty { color: var(--code-type); }
  .t-num { color: var(--code-number); }

  footer.site { border-top: var(--hairline) solid var(--border); background: var(--chrome); padding-block: var(--space-2xl); }
  footer.site .wrap { display: flex; justify-content: space-between; align-items: center; gap: var(--space-lg); flex-wrap: wrap; font: 400 var(--size-xs)/1.6 var(--mono); color: var(--text-subtle); }
  footer.site a { color: var(--text-muted); border-bottom: var(--hairline) solid var(--border); }
  footer.site a:hover { color: var(--accent); border-color: var(--accent); }
  .built { display: inline-flex; align-items: center; gap: var(--space-sm); }
  .built b { color: var(--text); font-weight: 500; }
  .built i { width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--accent); flex: none; }
`

// Last in every page's CSS, so no `font:` shorthand after it resets it: show != and => as typed.
const NO_LIGATURES = `
  pre, code, .mono { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
`

const HOME_CSS = `
  section { border-bottom: var(--hairline) solid var(--border); }
  h2 {
    font-weight: 500; font-size: clamp(var(--heading-min), 4vw, var(--heading-max)); line-height: 1.08;
    letter-spacing: var(--tracking-heading); margin-top: var(--space-lg); max-width: var(--measure-heading);
  }
  .lede { color: var(--text-muted); font-size: var(--size-lg); max-width: var(--measure); margin-top: var(--space-lg); }
  .reveal { opacity: 0; transform: translateY(var(--space-md)); transition: opacity .8s ease, transform .8s ease; }
  .reveal.in { opacity: 1; transform: none; }
  .stats, .compare, .features, .ds, .closing { padding-block: clamp(var(--space-5xl), 11vw, var(--space-6xl)); }

  /* hero */
  .hero { position: relative; overflow: hidden; }
  .hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
      linear-gradient(var(--border-subtle) var(--hairline), transparent var(--hairline)),
      linear-gradient(90deg, var(--border-subtle) var(--hairline), transparent var(--hairline));
    background-size: var(--space-4xl) var(--space-4xl);
    mask-image: radial-gradient(ellipse 70% 80% at 70% 40%, var(--mask) 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 40%, var(--mask) 20%, transparent 75%);
  }
  .hero .wrap {
    position: relative; display: grid; gap: var(--space-4xl); align-items: center;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-hero)), 1fr));
    padding-block: clamp(var(--space-4xl), 9vw, var(--space-6xl));
  }
  .tag {
    display: inline-flex; align-items: center; gap: var(--space-sm);
    font: 500 var(--size-xs)/1 var(--mono); color: var(--text-muted);
    border: var(--hairline) solid var(--border); background: var(--raised);
    padding: var(--space-sm) var(--space-md); border-radius: var(--radius-control);
  }
  .tag i { width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--accent); animation: pulse 2.4s infinite; }
  @keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
  h1 {
    font-weight: 500; font-size: clamp(var(--display-min), 6.4vw, var(--display-max)); line-height: 0.98;
    letter-spacing: var(--tracking-display); margin-top: var(--space-xl);
  }
  h1 em { font-style: normal; color: var(--accent); }
  .cta { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-2xl); }
  .btn {
    display: inline-flex; align-items: center; gap: var(--space-sm); height: var(--control-height); padding-inline: var(--space-xl);
    font: 500 var(--size-md)/1 var(--mono); border-radius: var(--radius-control); transition: transform .2s, background .2s;
  }
  .btn.primary { background: var(--text); color: var(--surface); }
  .btn.primary:hover { transform: translateY(calc(-1 * var(--hairline))); }
  .btn.ghost { border: var(--hairline) solid var(--border); color: var(--text-muted); background: var(--raised); }
  .btn.ghost:hover { border-color: var(--text-subtle); color: var(--text); }
  .hero-meta { display: flex; flex-wrap: wrap; gap: var(--space-xl) var(--space-2xl); margin-top: var(--space-3xl); padding-top: var(--space-xl); border-top: var(--hairline) solid var(--border); }
  .hero-meta div { font: 400 var(--size-xs)/1.5 var(--mono); color: var(--text-subtle); }
  .hero-meta b { display: block; font: 500 var(--size-2xl)/1.2 var(--sans); color: var(--text); letter-spacing: var(--tracking-tight); }

  /* code window */
  .code {
    background: var(--code-surface); color: var(--code-text); border-radius: var(--radius-window);
    box-shadow: 0 var(--space-2xl) var(--space-4xl) calc(-1 * var(--space-2xl)) var(--shadow), 0 0 0 var(--hairline) var(--border-ghost);
    overflow: hidden; min-width: 0;
  }
  .code-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg); border-bottom: var(--hairline) solid var(--border-subtle);
    font: 400 var(--size-xs)/1 var(--mono); color: var(--code-comment);
  }
  .dots { display: flex; gap: var(--dot); }
  .dots span { width: var(--space-sm); height: var(--space-sm); border-radius: 50%; background: var(--code-chrome); }
  pre {
    font: 400 clamp(var(--size-xs), 3.4vw, var(--size-sm))/1.7 var(--mono);
    padding: var(--space-lg) var(--space-xl) var(--space-lg) 0; overflow-x: auto; counter-reset: ln; tab-size: 2;
  }
  pre .l { white-space: pre; }  /* inline: the newlines between lines do the breaking */
  pre .l::before {
    counter-increment: ln; content: counter(ln);
    display: inline-block; width: var(--line-gutter); padding-right: var(--space-lg); text-align: right;
    color: var(--code-gutter); user-select: none;
  }
  .caret { display: inline-block; width: var(--space-sm); height: var(--space-lg); background: var(--accent); vertical-align: calc(-1 * var(--space-xs)); animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0 } }

  /* benchmarks */
  .stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-stat)), 1fr)); margin-top: var(--space-4xl);
    border-top: var(--hairline) solid var(--border); border-left: var(--hairline) solid var(--border);
  }
  .stat {
    padding: var(--space-xl); border-right: var(--hairline) solid var(--border); border-bottom: var(--hairline) solid var(--border);
    background: var(--raised);
  }
  .stat .num {
    font-weight: 500; font-size: clamp(var(--figure-min), 4.6vw, var(--figure-max)); line-height: 1; letter-spacing: var(--tracking-display);
    font-variant-numeric: tabular-nums;
  }
  .stat .num small { font-size: var(--size-xl); color: var(--text-subtle); margin-left: var(--space-xs); letter-spacing: 0; }
  .stat .what { margin-top: var(--space-md); font-weight: 500; }
  .stat .vs { margin-top: var(--space-xs); font: 400 var(--size-xs)/1.5 var(--mono); color: var(--text-subtle); }
  .stat .vs b { color: var(--accent); font-weight: 500; }

  .chart { margin-top: var(--space-4xl); display: flex; flex-wrap: wrap; gap: var(--space-3xl); align-items: flex-start; }
  .chart > :first-child { flex: 999 1 var(--col-chart); min-width: 0; }
  .chart-aside { flex: 1 1 var(--col-aside); border: var(--hairline) solid var(--border); background: var(--raised); padding: var(--space-xl); }
  .chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--space-md); margin-bottom: var(--space-xl); }
  .chart-head h3 { font-weight: 500; font-size: var(--size-xl); letter-spacing: var(--tracking-tight); }
  .legend { display: flex; gap: var(--space-lg); font: 400 var(--size-xs)/1 var(--mono); color: var(--text-muted); }
  .legend span { display: inline-flex; align-items: center; gap: var(--space-sm); }
  .legend i { width: var(--swatch); height: var(--swatch); display: inline-block; }
  .legend i.ts { background: var(--baseline); }
  .legend i.li { background: var(--accent); }
  .row {
    display: grid; grid-template-columns: minmax(var(--row-label-min), var(--row-label)) minmax(0, 1fr) var(--space-3xl);
    align-items: center; gap: var(--space-lg); padding-block: var(--space-md); border-top: var(--hairline) solid var(--border-subtle);
  }
  .row:last-child { border-bottom: var(--hairline) solid var(--border-subtle); }
  .row .name { font-size: var(--size-md); }
  .row .name span { display: block; font: 400 var(--size-2xs)/1.4 var(--mono); color: var(--text-subtle); }
  .bars { display: grid; gap: var(--space-xs); overflow: hidden; }
  .bar { height: var(--swatch); width: 0; transition: width 1.4s cubic-bezier(.2,.7,.1,1); position: relative; }
  .bar.ts { background: var(--baseline); }
  .bar.li { background: var(--accent); }
  .bar em {
    position: absolute; left: calc(100% + var(--space-sm)); top: 50%; transform: translateY(-50%);
    font: 400 var(--size-2xs)/1 var(--mono); font-style: normal; color: var(--text-subtle); white-space: nowrap;
    opacity: 0; transition: opacity .4s 1.1s;
  }
  .in .bar em { opacity: 1; }
  .row .x { font: 500 var(--size-md)/1 var(--mono); color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
  .row.lith .name { color: var(--accent); font-weight: 500; }
  .row .x.dim { color: var(--text-subtle); }
  .chart-aside .big { margin-top: var(--space-lg); font-size: var(--figure); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
  .chart-aside p { color: var(--text-muted); font-size: var(--size-md); margin-top: var(--space-md); }
  .formula { margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: var(--hairline) solid var(--border); font: 400 var(--size-xs)/1.7 var(--mono); color: var(--text-muted); }
  .formula b { color: var(--text); font-weight: 500; }
  .note { margin-top: var(--space-xl); font: 400 var(--size-xs)/1.6 var(--mono); color: var(--text-subtle); max-width: var(--measure-wide); }
  .switch { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
  .switch button {
    font: 500 var(--size-xs)/1 var(--mono); color: var(--text-muted); background: var(--raised);
    border: var(--hairline) solid var(--border); border-radius: var(--radius-control); padding: var(--space-sm) var(--space-md); cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
  }
  .switch button:hover { border-color: var(--text-subtle); color: var(--text); }
  .switch button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
  .switch button:focus-visible { outline: var(--space-2xs) solid var(--accent); outline-offset: var(--space-2xs); }

  /* side by side */
  .cmp { display: flex; flex-wrap: wrap; gap: var(--space-xl); margin-top: var(--space-3xl); align-items: stretch; }
  .tree { flex: 1 1 var(--col-tree); border: var(--hairline) solid var(--border); background: var(--raised); padding: var(--space-xl); display: flex; flex-direction: column; }
  .cmp .code { flex: 1.6 1 var(--col-code); }
  .tree h4 { font: 500 var(--size-xs)/1 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-subtle); }
  .tree ul { list-style: none; margin-top: var(--space-lg); font: 400 var(--size-sm)/2 var(--mono); color: var(--text-muted); flex: 1; }
  .tree li { display: flex; justify-content: space-between; gap: var(--space-md); }
  .tree li span:last-child { color: var(--text-subtle); }
  .tree .ind1 { padding-left: var(--space-lg); } .tree .ind2 { padding-left: var(--space-2xl); }
  .tree .dir { color: var(--text-subtle); }
  .tree .sum { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: var(--hairline) solid var(--border); display: flex; justify-content: space-between; font: 500 var(--size-sm)/1 var(--mono); }
  .cmp .code pre { max-height: var(--code-max); }
  .code-foot { display: flex; justify-content: space-between; padding: var(--space-md) var(--space-lg); border-top: var(--hairline) solid var(--border-subtle); font: 500 var(--size-xs)/1 var(--mono); color: var(--accent); }

  /* highlights */
  .feat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-feature)), 1fr)); margin-top: var(--space-4xl);
    border-top: var(--hairline) solid var(--border); border-left: var(--hairline) solid var(--border);
    background: var(--panel);
  }
  .feat {
    padding: var(--space-2xl) var(--space-xl); border-right: var(--hairline) solid var(--border); border-bottom: var(--hairline) solid var(--border);
    display: flex; flex-direction: column; gap: var(--space-md); transition: background .3s;
  }
  .feat:hover { background: var(--panel-hover); }
  .feat .idx { font: 400 var(--size-xs)/1 var(--mono); color: var(--text-subtle); }
  .feat h3 { font-weight: 500; font-size: var(--size-lg); letter-spacing: var(--tracking-tight); line-height: 1.25; }
  .feat p { color: var(--text-muted); font-size: var(--size-md); line-height: 1.6; }
  .feat code {
    margin-top: auto; display: block; font: 400 var(--size-xs)/1.6 var(--mono); color: var(--text);
    background: var(--surface); border: var(--hairline) solid var(--border); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-control);
    white-space: pre; overflow-x: auto;
  }
  .feat code .k { color: var(--accent); font-weight: 500; }

  /* design systems */
  .ds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-feature)), 1fr)); gap: var(--space-xl); margin-top: var(--space-4xl); }
  .ds-card { border: var(--hairline) solid var(--border); background: var(--raised); padding: var(--space-xl); display: flex; flex-direction: column; gap: var(--space-md); }
  .ds-card h3 { font-weight: 500; font-size: var(--size-lg); letter-spacing: var(--tracking-tight); }
  .ds-card p { color: var(--text-muted); font-size: var(--size-md); }
  .ds-card .tag-row { display: flex; gap: var(--space-sm); flex-wrap: wrap; font: 500 var(--size-2xs)/1 var(--mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--accent); }
  .diag { margin-top: auto; font: 400 var(--size-xs)/1.7 var(--mono); background: var(--code-surface); color: var(--code-text); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-control); padding: var(--space-md); white-space: pre-wrap; overflow-wrap: anywhere; }
  .diag .bad { color: var(--code-number); }
  .diag .fix { color: var(--accent); }
  .ds-facts { display: flex; flex-wrap: wrap; gap: var(--space-xl) var(--space-3xl); margin-top: var(--space-3xl); padding-top: var(--space-xl); border-top: var(--hairline) solid var(--border); }
  .ds-facts div { font: 400 var(--size-xs)/1.5 var(--mono); color: var(--text-subtle); max-width: var(--col-stat); }
  .ds-facts b { display: block; font: 500 var(--size-2xl)/1.2 var(--sans); color: var(--text); letter-spacing: var(--tracking-tight); }

  /* principles */
  .closing .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-closing)), 1fr)); gap: var(--space-4xl); align-items: end; }
  .principles { list-style: none; border-top: var(--hairline) solid var(--border); background: var(--panel); padding-inline: var(--space-lg); }
  .principles li { display: grid; grid-template-columns: var(--space-2xl) 1fr; padding-block: var(--space-md); border-bottom: var(--hairline) solid var(--border); font-size: var(--size-md); color: var(--text-muted); }
  .principles li span { font: 400 var(--size-xs)/1.9 var(--mono); color: var(--text-subtle); }
  .sources { grid-column: 1 / -1; font: 400 var(--size-xs)/1.6 var(--mono); color: var(--text-subtle); }

  /* reveal delays (inline style attributes are E0606) */
  .d1 { transition-delay: .1s; }
  .d2 { transition-delay: .15s; }

  @media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .bar { transition: none; }
    .tag i, .caret { animation: none; }
  }
`

const DOCS_CSS = `
  /* docs: denser panels, wider column, anchors clear the sticky nav */
  .wrap { max-width: var(--page-wide); }
  html { scroll-padding-top: var(--space-5xl); }
  header { padding-block: clamp(var(--space-3xl), 8vw, var(--space-5xl)) var(--space-3xl); }
  header .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col-hero)), 1fr)); gap: var(--space-3xl); align-items: end; }
  h1 { font-weight: 500; font-size: clamp(var(--figure-min), 5.6vw, var(--figure)); line-height: 1; letter-spacing: var(--tracking-display); margin-top: var(--space-xl); }
  h1 em { font-style: normal; color: var(--accent); }
  .lede { color: var(--text-muted); font-size: var(--size-lg); max-width: var(--measure); margin-top: var(--space-lg); }
  .facts { display: flex; flex-wrap: wrap; gap: var(--space-xl) var(--space-2xl); margin-top: var(--space-2xl); padding-top: var(--space-lg); border-top: var(--hairline) solid var(--border); }
  .facts div { font: 400 var(--size-xs)/1.5 var(--mono); color: var(--text-subtle); }
  .facts b { display: block; font: 500 var(--size-2xl)/1.2 var(--sans); color: var(--text); letter-spacing: var(--tracking-tight); }

  .llm { border: var(--hairline) solid var(--border); background: var(--panel-strong); padding: var(--space-xl); }
  .llm h3 { font-weight: 500; font-size: var(--size-lg); letter-spacing: var(--tracking-tight); }
  .llm p { color: var(--text-muted); font-size: var(--size-md); margin-top: var(--space-sm); }
  .llm .row { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }
  .btn {
    display: inline-flex; align-items: center; gap: var(--space-sm); height: calc(var(--control-height) - var(--space-xs)); padding-inline: var(--space-lg);
    font: 500 var(--size-sm)/1 var(--mono); border-radius: var(--radius-control); cursor: pointer; border: 0;
    transition: transform .2s, border-color .2s, color .2s;
  }
  .btn.primary { background: var(--text); color: var(--surface); }
  .btn.primary:hover { transform: translateY(calc(-1 * var(--hairline))); }
  .btn.ghost { background: transparent; border: var(--hairline) solid var(--border); color: var(--text-muted); }
  .btn.ghost:hover { border-color: var(--text-subtle); color: var(--text); }
  .prompt {
    margin-top: var(--space-lg); font: 400 var(--size-xs)/1.6 var(--mono); color: var(--code-text);
    background: var(--code-surface); border: var(--hairline) solid var(--border-subtle); padding: var(--space-md); border-radius: var(--radius-control);
    white-space: pre-wrap; word-break: break-word;
  }
  .prompt span { color: var(--code-comment); }
  .llm .row + .row { margin-top: var(--space-sm); }
  .lead { color: var(--text); font-size: var(--size-lg); }
  .note-ds { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: var(--hairline) solid var(--border); font-size: var(--size-md); color: var(--text-muted); }
  .note-ds b { color: var(--accent); font-weight: 500; }

  /* body: a sticky contents rail beside the text on landscape screens, stacked above it otherwise */
  .layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3xl); padding-bottom: var(--space-5xl); }
  .toc { display: none; }
  @media (min-aspect-ratio: 4/3) {
    .layout { grid-template-columns: var(--col-toc) minmax(0, 1fr); }
    .toc { display: block; position: sticky; top: var(--space-5xl); align-self: start; }
  }
  .toc ol { list-style: none; margin-top: var(--space-lg); border-left: var(--hairline) solid var(--border); }
  .toc a {
    display: block; padding: var(--dot) 0 var(--dot) var(--space-lg); margin-left: calc(-1 * var(--hairline)); border-left: var(--hairline) solid transparent;
    font-size: var(--size-md); color: var(--text-subtle); transition: color .2s, border-color .2s;
  }
  .toc a:hover { color: var(--text); }
  .toc a.on { color: var(--text); border-left-color: var(--accent); }
  .toc .raw { margin-top: var(--space-xl); display: grid; gap: var(--dot); font: 400 var(--size-xs)/1.5 var(--mono); }
  .toc .raw a { padding: 0; border: 0; font: inherit; color: var(--text-subtle); }
  .toc .raw a:hover { color: var(--accent); }

  .intro { background: var(--panel-strong); border: var(--hairline) solid var(--border); padding: var(--space-xl) var(--space-2xl); margin-bottom: var(--space-lg); }
  .intro p { color: var(--text); font-size: var(--size-lg); overflow-wrap: anywhere; }
  .doc { background: var(--panel-strong); border: var(--hairline) solid var(--border); padding: clamp(var(--space-lg), 3vw, var(--space-2xl)); margin-bottom: var(--space-lg); }
  .doc h2 { font-weight: 500; font-size: var(--size-3xl); letter-spacing: var(--tracking-tight); margin-bottom: var(--space-md); }
  .doc h2 a:hover { color: var(--accent); }
  .doc p, .doc li { color: var(--text-muted); font-size: var(--size-base); overflow-wrap: anywhere; }  /* long inline code may wrap on phones */
  .doc p + p, .doc p + ul, .doc ul + p, .doc pre + p, .doc pre + ul { margin-top: var(--space-md); }
  .doc ul { list-style: none; display: grid; gap: var(--space-sm); }
  .doc li { position: relative; padding-left: var(--space-lg); }
  .doc li::before { content: ""; position: absolute; left: 0; top: var(--space-md); width: var(--space-sm); height: var(--hairline); background: var(--accent); }
  :not(pre) > code {
    font: 400 var(--size-sm)/1 var(--mono); color: var(--text);
    background: var(--border-subtle); border: var(--hairline) solid var(--border-subtle); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-control);
    white-space: normal;
  }
  pre {
    font: 400 clamp(var(--size-xs), 3.4vw, var(--size-sm))/1.7 var(--mono); color: var(--code-text); background: var(--code-surface);
    border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-window); padding: var(--space-lg); margin: var(--space-md) 0 var(--space-xs);
    overflow-x: auto; tab-size: 2; white-space: pre;
  }
`

const ERROR_CSS = `
  .error-page { min-height: 70vh; display: flex; align-items: center; padding-block: var(--space-5xl); }
  .error-page h1 { font-weight: 500; font-size: clamp(var(--figure-min), 5.6vw, var(--figure)); line-height: 1; letter-spacing: var(--tracking-display); margin-top: var(--space-xl); max-width: var(--measure-wide); }
  .error-page .lede { color: var(--text-muted); font-size: var(--size-lg); margin-top: var(--space-lg); max-width: var(--measure); }
  .error-page .cta { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-2xl); }
  .error-page .btn { display: inline-flex; align-items: center; height: var(--control-height); padding-inline: var(--space-xl); font: 500 var(--size-md)/1 var(--mono); border-radius: var(--radius-control); }
  .error-page .btn.primary { background: var(--text); color: var(--surface); }
  .error-page .btn.ghost { border: var(--hairline) solid var(--border); color: var(--text-muted); background: var(--raised); }
`

tokens.json

{
  "$description": "lith.codes design system (W3C Design Tokens). Primitives are the palette and scales; app code may use only the semantic tokens, by name: var(--surface), var(--space-lg), var(--size-sm).",
  "$extensions": { "lith": { "baseMode": "dark" } },
  "primitive": {
    "color": {
      "$type": "color",
      "night-950": { "$value": "#0a0d10" },
      "night-950-a82": { "$value": "#0a0d10d1" },
      "night-950-a62": { "$value": "#0a0d109e" },
      "night-900-a78": { "$value": "#0e1216c7" },
      "night-900-a90": { "$value": "#090c0fe6" },
      "night-850-a76": { "$value": "#080a0dc2" },
      "night-800-a70": { "$value": "#141a1fb3" },
      "ink-950-a78": { "$value": "#07090cc7" },
      "ink-950-a50": { "$value": "#07090c80" },
      "ink-950-a30": { "$value": "#07090c4d" },
      "sea-950-a45": { "$value": "#0a141e73" },
      "black": { "$value": "#000000" },
      "white-a12": { "$value": "#ffffff1f" },
      "white-a07": { "$value": "#ffffff12" },
      "white-a04": { "$value": "#ffffff0a" },
      "snow-100": { "$value": "#eceff2" },
      "snow-200": { "$value": "#d6dbe0" },
      "steel-300": { "$value": "#b4bcc4" },
      "steel-500": { "$value": "#7d8790" },
      "steel-550": { "$value": "#66727d" },
      "steel-600": { "$value": "#5b646c" },
      "steel-800": { "$value": "#3a444d" },
      "steel-850": { "$value": "#2c353d" },
      "frost-300": { "$value": "#8fbcbb" },
      "sand-300": { "$value": "#c9b48a" },
      "mist-300": { "$value": "#a3b9d1" },
      "lilac-300": { "$value": "#b9a7c9" },
      "clay-300": { "$value": "#d4a28c" }
    },
    "space": {
      "$type": "dimension",
      "1": { "$value": "1px" },
      "2": { "$value": "2px" },
      "4": { "$value": "4px" },
      "6": { "$value": "6px" },
      "8": { "$value": "8px" },
      "10": { "$value": "10px" },
      "12": { "$value": "12px" },
      "16": { "$value": "16px" },
      "24": { "$value": "24px" },
      "32": { "$value": "32px" },
      "48": { "$value": "48px" },
      "64": { "$value": "64px" },
      "80": { "$value": "80px" },
      "112": { "$value": "112px" }
    },
    "font-size": {
      "$type": "dimension",
      "11": { "$value": "11px" },
      "12": { "$value": "12px" },
      "13": { "$value": "13px" },
      "14": { "$value": "14px" },
      "16": { "$value": "16px" },
      "18": { "$value": "18px" },
      "20": { "$value": "20px" },
      "24": { "$value": "24px" },
      "28": { "$value": "28px" },
      "30": { "$value": "30px" },
      "40": { "$value": "40px" },
      "44": { "$value": "44px" },
      "46": { "$value": "46px" },
      "60": { "$value": "60px" },
      "64": { "$value": "64px" },
      "80": { "$value": "80px" }
    },
    "tracking": {
      "$type": "dimension",
      "minus-2-5": { "$value": "-2.5px" },
      "minus-1": { "$value": "-1px" },
      "minus-0-4": { "$value": "-0.4px" },
      "plus-0-25": { "$value": "0.25px" },
      "plus-1": { "$value": "1px" },
      "plus-1-4": { "$value": "1.4px" }
    },
    "radius": {
      "$type": "dimension",
      "2": { "$value": "2px" },
      "4": { "$value": "4px" }
    },
    "length": {
      "$type": "dimension",
      "44": { "$value": "44px" },
      "46": { "$value": "46px" },
      "96": { "$value": "96px" },
      "150": { "$value": "150px" },
      "210": { "$value": "210px" },
      "220": { "$value": "220px" },
      "260": { "$value": "260px" },
      "280": { "$value": "280px" },
      "300": { "$value": "300px" },
      "360": { "$value": "360px" },
      "420": { "$value": "420px" },
      "440": { "$value": "440px" },
      "480": { "$value": "480px" },
      "500": { "$value": "500px" },
      "540": { "$value": "540px" },
      "560": { "$value": "560px" },
      "640": { "$value": "640px" },
      "1120": { "$value": "1120px" },
      "1180": { "$value": "1180px" }
    },
    "font": {
      "$type": "fontFamily",
      "inter-tight": { "$value": ["Inter Tight", "system-ui", "-apple-system", "sans-serif"] },
      "jetbrains-mono": { "$value": ["JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", "monospace"] }
    }
  },
  "semantic": {
    "color": {
      "$type": "color",
      "surface": { "$value": "{primitive.color.night-950}", "$description": "page background" },
      "raised": { "$value": "{primitive.color.night-900-a78}", "$description": "cards and controls over the moving background" },
      "panel": { "$value": "{primitive.color.night-950-a62}", "$description": "large grouped areas over the background" },
      "panel-strong": { "$value": "{primitive.color.night-950-a82}", "$description": "reading panels (docs)" },
      "panel-hover": { "$value": "{primitive.color.night-800-a70}" },
      "chrome": { "$value": "{primitive.color.night-850-a76}", "$description": "navigation bar and footer" },
      "scrim-strong": { "$value": "{primitive.color.ink-950-a78}", "$description": "behind text, left side" },
      "scrim": { "$value": "{primitive.color.ink-950-a50}" },
      "scrim-soft": { "$value": "{primitive.color.ink-950-a30}" },
      "shadow": { "$value": "{primitive.color.sea-950-a45}" },
      "mask": { "$value": "{primitive.color.black}", "$description": "opaque stop of a CSS mask" },
      "text": { "$value": "{primitive.color.snow-100}" },
      "text-muted": { "$value": "{primitive.color.steel-300}" },
      "text-subtle": { "$value": "{primitive.color.steel-500}" },
      "border": { "$value": "{primitive.color.white-a12}" },
      "border-subtle": { "$value": "{primitive.color.white-a07}" },
      "border-ghost": { "$value": "{primitive.color.white-a04}" },
      "accent": { "$value": "{primitive.color.frost-300}", "$description": "Lith frost: links, highlights, Lith's bars" },
      "baseline": { "$value": "{primitive.color.steel-600}", "$description": "other stacks' bars" },
      "code-surface": { "$value": "{primitive.color.night-900-a90}" },
      "code-text": { "$value": "{primitive.color.snow-200}" },
      "code-comment": { "$value": "{primitive.color.steel-550}" },
      "code-string": { "$value": "{primitive.color.sand-300}" },
      "code-tag": { "$value": "{primitive.color.mist-300}" },
      "code-type": { "$value": "{primitive.color.lilac-300}" },
      "code-number": { "$value": "{primitive.color.clay-300}" },
      "code-gutter": { "$value": "{primitive.color.steel-800}" },
      "code-chrome": { "$value": "{primitive.color.steel-850}" }
    },
    "space": {
      "$type": "dimension",
      "hairline": { "$value": "{primitive.space.1}", "$description": "borders and rules" },
      "space-2xs": { "$value": "{primitive.space.2}" },
      "space-xs": { "$value": "{primitive.space.4}" },
      "space-sm": { "$value": "{primitive.space.8}" },
      "space-md": { "$value": "{primitive.space.12}" },
      "space-lg": { "$value": "{primitive.space.16}" },
      "space-xl": { "$value": "{primitive.space.24}" },
      "space-2xl": { "$value": "{primitive.space.32}" },
      "space-3xl": { "$value": "{primitive.space.48}" },
      "space-4xl": { "$value": "{primitive.space.64}" },
      "space-5xl": { "$value": "{primitive.space.80}" },
      "space-6xl": { "$value": "{primitive.space.112}" }
    },
    "mark": {
      "$type": "dimension",
      "dot": { "$value": "{primitive.space.6}", "$description": "status dot" },
      "swatch": { "$value": "{primitive.space.10}", "$description": "chart bars and legend swatches" }
    },
    "type": {
      "$type": "dimension",
      "size-2xs": { "$value": "{primitive.font-size.11}" },
      "size-xs": { "$value": "{primitive.font-size.12}" },
      "size-sm": { "$value": "{primitive.font-size.13}" },
      "size-md": { "$value": "{primitive.font-size.14}" },
      "size-base": { "$value": "{primitive.font-size.16}" },
      "size-lg": { "$value": "{primitive.font-size.18}" },
      "size-xl": { "$value": "{primitive.font-size.20}" },
      "size-2xl": { "$value": "{primitive.font-size.24}" },
      "size-3xl": { "$value": "{primitive.font-size.28}" },
      "heading-min": { "$value": "{primitive.font-size.30}" },
      "heading-max": { "$value": "{primitive.font-size.46}" },
      "figure-min": { "$value": "{primitive.font-size.40}" },
      "figure-max": { "$value": "{primitive.font-size.60}" },
      "figure": { "$value": "{primitive.font-size.64}" },
      "display-min": { "$value": "{primitive.font-size.44}" },
      "display-max": { "$value": "{primitive.font-size.80}" }
    },
    "tracking": {
      "$type": "dimension",
      "tracking-display": { "$value": "{primitive.tracking.minus-2-5}" },
      "tracking-heading": { "$value": "{primitive.tracking.minus-1}" },
      "tracking-tight": { "$value": "{primitive.tracking.minus-0-4}" },
      "tracking-mono": { "$value": "{primitive.tracking.plus-0-25}" },
      "tracking-caps": { "$value": "{primitive.tracking.plus-1}" },
      "tracking-label": { "$value": "{primitive.tracking.plus-1-4}" }
    },
    "radius": {
      "$type": "dimension",
      "radius-control": { "$value": "{primitive.radius.2}" },
      "radius-window": { "$value": "{primitive.radius.4}" }
    },
    "layout": {
      "$type": "dimension",
      "page": { "$value": "{primitive.length.1120}", "$description": "content width" },
      "page-wide": { "$value": "{primitive.length.1180}", "$description": "docs content width" },
      "measure": { "$value": "{primitive.length.560}", "$description": "comfortable line length for prose" },
      "measure-wide": { "$value": "{primitive.length.640}" },
      "measure-heading": { "$value": "{primitive.length.480}" },
      "control-height": { "$value": "{primitive.length.46}" },
      "line-gutter": { "$value": "{primitive.length.44}", "$description": "code line numbers" },
      "code-max": { "$value": "{primitive.length.540}" },
      "row-label": { "$value": "{primitive.length.150}" },
      "row-label-min": { "$value": "{primitive.length.96}" },
      "col-hero": { "$value": "{primitive.length.440}", "$description": "columns wrap below twice this width" },
      "col-stat": { "$value": "{primitive.length.220}" },
      "col-feature": { "$value": "{primitive.length.300}" },
      "col-chart": { "$value": "{primitive.length.500}" },
      "col-aside": { "$value": "{primitive.length.260}" },
      "col-tree": { "$value": "{primitive.length.280}" },
      "col-code": { "$value": "{primitive.length.420}" },
      "col-closing": { "$value": "{primitive.length.360}" },
      "col-toc": { "$value": "{primitive.length.210}" }
    },
    "font": {
      "$type": "fontFamily",
      "sans": { "$value": "{primitive.font.inter-tight}" },
      "mono": { "$value": "{primitive.font.jetbrains-mono}" }
    }
  }
}