/*
 * Shelf's design tokens: colours, fonts, radius, shadow, layout, easing and
 * the document-site table of contents' spacing,
 * shared by the landing pages and /design (and meant for the app).
 * GENERATED by scripts/build-tokens.mjs from tokens/shelf.tokens.json:
 * edit that file and run `node scripts/build-tokens.mjs`, never this one.
 */

:root,
[data-theme="light"] {
  --accent: #eab308;
  --accent-ink: #1c1500;
  /* The accent as text: yellow on white needs darkening to stay readable. Picked so small text passes WCAG AA (5.5:1 on white, 5.2:1 on --bg-soft). */
  --accent-text: #866300;
  --bg: #ffffff;
  --bg-soft: color-mix(in oklab, var(--fg) 3%, var(--bg));
  --fg: #14140f;
  --fg-soft: #57564c;
  /* Small mono labels: AA (4.5:1) on --bg and --bg-soft in both themes. */
  --muted: #6e6d64;
  /* The accent inside the closing card, which is drawn in --fg. */
  --cta-accent: var(--accent);
  --line: rgba(20, 20, 15, 0.12);
  --line-soft: rgba(20, 20, 15, 0.07);
  /* Errors and destructive actions. Red 700 in light (6.5:1 on --bg), red 400 in dark (6.8:1 on --bg, 6.3:1 on --bg-soft): AA in both themes. */
  --danger: #b91c1c;
  /* Code highlighting in rendered Markdown (class names from rehype-highlight). */
  --code-keyword: color-mix(in oklab, #7c3aed 85%, var(--fg));
  --code-string: color-mix(in oklab, #15803d 85%, var(--fg));
  --code-number: color-mix(in oklab, #c2410c 85%, var(--fg));
  --code-title: color-mix(in oklab, #1d4ed8 85%, var(--fg));
  --code-type: var(--accent-text);
  --code-comment: var(--muted);

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --shadow: 0 1px 0 rgba(20, 20, 19, 0.04), 0 8px 24px -16px rgba(20, 20, 19, 0.18);

  --maxw: 960px;
  --maxw-wide: 1180px;
  --pad-x: clamp(20px, 5vw, 64px);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Document sites: the book-style 'On this page' table of contents. */
  --docsite-toc-num: 28px;
  --docsite-toc-indent: 28px;
  --docsite-toc-sub-num: 36px;
  --docsite-toc-leader-gap: 8px;
  --docsite-toc-row: 3px;
  --docsite-toc-section-gap: 10px;

  color-scheme: light;
}

/* Dark: set on <html> by js/theme.js and the toggle; without JS, follow the
   OS setting. Both blocks are generated from the same list. */
[data-theme="dark"] {
  --accent: #facc15;
  --accent-ink: #171300;
  --accent-text: var(--accent);
  --bg: #121210;
  --bg-soft: #1a1a17;
  --fg: #f3f2ea;
  --fg-soft: #a8a79c;
  --muted: #8e8d86;
  --cta-accent: #866300;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.07);
  --danger: #f87171;
  --code-keyword: #c4b5fd;
  --code-string: #86efac;
  --code-number: #fdba74;
  --code-title: #93c5fd;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 24px -16px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #facc15;
    --accent-ink: #171300;
    --accent-text: var(--accent);
    --bg: #121210;
    --bg-soft: #1a1a17;
    --fg: #f3f2ea;
    --fg-soft: #a8a79c;
    --muted: #8e8d86;
    --cta-accent: #866300;
    --line: rgba(255, 255, 255, 0.12);
    --line-soft: rgba(255, 255, 255, 0.07);
    --danger: #f87171;
    --code-keyword: #c4b5fd;
    --code-string: #86efac;
    --code-number: #fdba74;
    --code-title: #93c5fd;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 24px -16px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
  }
}
