# kami · Cheatsheet
One-page quick reference. Scan before filling a template or tweaking a detail. Full spec in `references/design.md`.
## Ten invariants
1. Default page background `#f5f4ed` (parchment); the white-paper print variant is an explicit exception
2. Single accent: ink-blue `#1B365D`
3. All grays **warm-toned** (yellow-brown undertone), no cool blue-gray
4. One serif font per page (headings + body). `--sans` is a CSS alias for the same family; introduce a real sans only for genuinely UI-style chrome
5. Serif weight locked at 500, no bold
6. Line-height: headlines 1.1-1.3 / dense 1.4-1.45 / reading 1.5-1.55
7. Letter-spacing: Chinese body with TsangerJinKai 0.1-0.2pt (dense layouts may push to 0.3pt); English body 0; small labels and all-caps overlines get +0.2-1pt
8. Tag backgrounds solid hex, no rgba (WeasyPrint double-rectangle bug)
9. No decorative ticks, short rules, or side accents; every line must encode separation, state, or relationship
10. No italic in templates or demos
## Sources and Materials
Full pass in SKILL.md Step 2.1. The one contract worth repeating: a number you cannot verify ships as a magnitude or a marked gap, never as fake precision.
## Color
| Role | Hex | Use |
| ------------ | ------------- | --------------------------------------------------- |
| Parchment | `#f5f4ed` | Page background |
| Ivory | `#faf9f5` | Quiet filled container |
| Inline Code | `#f0eee6` | Screen annotation, slightly darker than paper |
| Warm Sand | `#e8e6dc` | Button / interactive surface |
| Dark Surface | `#30302e` | Dark container |
| Deep Dark | `#141413` | Dark page background |
| **Brand** | **`#1B365D`** | **Accent · CTA · key labels (≤ 5% of surface)** |
| Ink Light | `#2D5A8A` | Links on dark surfaces |
| Near Black | `#141413` | Primary text |
| Dark Warm | `#3d3d3a` | Secondary text · table headers · links |
| Olive | `#504e49` | Subtext · descriptions |
| Stone | `#6b6a64` | Tertiary · metadata |
| Border | `#e8e6dc` | Primary border · section divider |
| Border Soft | `#e5e3d8` | Secondary border · row separator |
**Registered solid tints** (never substitute `rgba()`):
| Role | Solid |
| ----------- | --------------------------- |
| Quiet fill | `#EEF2F7` |
| Default tag | **`#E4ECF5`** |
## Type (print pt)
| Role | Size | Weight | Line-height |
| ---------- | ---- | ------ | ----------- |
| Display | 36 | 500 | 1.10 |
| H1 | 22 | 500 | 1.20 |
| H2 | 16 | 500 | 1.25 |
| H3 | 13 | 500 | 1.30 |
| Body Lead | 11 | 400 | 1.55 |
| Body | 10 | 400 | 1.55 |
| Body Dense | 9.2 | 400 | 1.42 |
| Caption | 9 | 400 | 1.45 |
| Label | 9 | 600 | 1.35 |
| Tiny | 9 | 400 | 1.40 |
Screen (px) ≈ pt × 1.33.
Minimum floor: web text >= 12px, PDF text >= 9pt.
### Typography cross-check (from Pierrick Calvez, "A Five-Minute Guide to Better Typography")
- **Set blocks, not glyphs**: judge a paragraph as an even gray shape, not one nice letter at a time.
- **Measure**: reading body ~40-70 characters per line; hold screen prose to the ~720px reading column, print to the A4 margins.
- **Optical > mathematical alignment**: aligned when it looks aligned; nudge back quotes, bullets, and big display caps by eye.
- **Line-spacing maps onto Kami tiers**: short ~1.2x → tight/dense tiers; long reading ~1.5x → reading tier. Never invent 1.6+ on a print body.
- **Hierarchy = contrast (size / weight / space)**, not ornament. Use the next registered size step, never an in-between size or a decorative rule.
- **Left-align body; centre only short display lines.** No centred paragraphs or lists.
- **Do NOT import multi-weight**: the guide wants Light/Regular/Medium/Bold; Kami serif is 400 body + 500 headings only, no 700, no Light. Emphasis is size, space, and ink-blue. Also skip its em-dash / ornamental-punctuation habits (see anti-patterns #28). Full cross-check: `references/design.md` §2 «External principles cross-check».
## Font stacks
Each language uses a single serif for the entire page. `--sans` always equals `var(--serif)`.
English:
```css
--serif: Charter, Georgia, Palatino,
"Times New Roman", serif;
--sans: var(--serif);
--mono: "JetBrains Mono", "SF Mono", "Fira Code",
Consolas, Monaco, monospace;
```
Chinese:
```css
--serif: "TsangerJinKai02", "Source Han Serif SC",
"Noto Serif CJK SC", "Songti SC", "STSong",
Georgia, serif;
--sans: var(--serif);
--mono: "JetBrains Mono", "SF Mono", Consolas,
"TsangerJinKai02", "Source Han Serif SC",
monospace;
```
Japanese:
```css
--serif: "YuMincho", "Yu Mincho", "Hiragino Mincho ProN",
"Noto Serif CJK JP", "Source Han Serif JP",
"TsangerJinKai02", Georgia, serif;
--sans: var(--serif);
```
Any font-family that may render Chinese or Japanese must include a CJK fallback, including `@page` footer text, `pre`, `code`, and SVG labels. A pure mono stack can render missing glyph boxes in WeasyPrint.
## Spacing (4pt base)
| Tier | Value | Use |
| ---- | -------- | ---------------------- |
| xs | 2-3pt | Inline |
| sm | 4-5pt | Tag padding |
| md | 8-10pt | Component interior |
| lg | 16-20pt | Between components |
| xl | 24-32pt | Section-title margin |
| 2xl | 40-60pt | Between major sections |
| 3xl | 80-120pt | Between chapters |
**Page margins (A4)**
| Document | T · R · B · L |
| ------------- | -------------------- |
| Resume | 11 · 13 · 11 · 13 mm |
| One-Pager | 15 · 18 · 15 · 18 mm |
| Long Doc | 20 · 22 · 22 · 22 mm |
| Letter | 25 mm all sides |
| Portfolio | 12 · 15 · 12 · 15 mm |
| Equity Report | 16 · 18 · 18 · 18 mm |
| Changelog | 20 · 22 · 22 · 22 mm |
| Landing Page | N/A (screen-first, max-width: 1120px, padding: 88px 64px) |
## Radius scale
Print radii stay within `2-6pt` and follow physical scale, from compact chips to
large media frames. Screen: `8px` for blocks and `999px` only for pill actions.
Do not use radius alone to create emphasis.
## Common CSS snippets
### Card
```css
.card {
background: var(--ivory); /* one quiet grouping cue; no border/shadow */
border-radius: 4pt;
padding: 16pt 20pt;
}
```
A sub-1pt closed border plus a radius renders as a double ring (production.md
pitfall #2) and fails `scripts/build.py --check`. To give a card more weight,
strengthen its label or opening sentence. Do not add an accent edge.
### Tag (solid fill, never rgba)
```css
.tag {
background: var(--tag-bg);
color: var(--brand);
font-size: 9pt; font-weight: 500;
padding: 1pt 5pt;
border-radius: 3pt;
letter-spacing: 0.3pt;
}
```
### Section title
```css
h2 {
font-family: var(--serif);
font-size: 16pt; font-weight: 500;
color: var(--near-black);
margin-bottom: 6pt;
}
```
Type carries the hierarchy; a section head needs no rule, bar, or underline.
This also applies to `changelog*.html`: release groups stay scannable through
type, numbering, and spacing. `resume*.html` uses a quiet full-width bottom
rule because it separates major content regions, and keeps project rows
borderless so section titles never create double rules or lonely page-top lines.
### Table (kami-table)
Base class works on bare `
` or `.kami-table`. Add variant classes for density/alignment:
```css
/* Base */
table, .kami-table {
width: 100%; border-collapse: collapse;
font-size: 9.5pt; margin: 12pt 0; break-inside: avoid;
}
table th { text-align: left; font-weight: 500; color: var(--dark-warm);
padding: 6pt 8pt; border-bottom: 0.6pt solid var(--border); }
table td { padding: 5pt 8pt; border-bottom: 0.25pt solid var(--border);
vertical-align: top; }
table.compact th { padding: 3pt 6pt; font-size: 8pt; }
table.compact td { padding: 2.5pt 6pt; font-size: 8pt; line-height: 1.4; }
table .total td { font-weight: 500; border-top: 0.6pt solid var(--border);
border-bottom: none; }
```
| Variant | Class | Effect |
| --------- | ------------------ | ---------------------------------------------------- |
| Compact | `.compact` | 8pt font, 3pt / 2.5pt vertical padding; use only when density requires it |
| Financial | `.financial` | Right-align all columns except first, `tabular-nums` |
| Striped | `.striped` | Neutral rows only for 8+ body rows that remain hard to track |
| Total row | `.total` on `
` | Bold, 0.6pt neutral top rule, no bottom border |
Start without striping. Add it only after the rendered 8+ row table fails the row-tracking check: `
`.
Table acceptance: all rules use `--border`; header and total rules are 0.6pt, body rules are 0.25pt; normal vertical padding is at least 6pt / 5pt, compact padding is at least 3pt / 2.5pt. No tinted header, category-colored value, brand-colored rule, vertical grid, or framed box.
### Metric (data card)
```css
.metric { display: flex; align-items: baseline; gap: 6pt; }
.metric-value {
font-family: var(--serif); font-size: 16pt; font-weight: 500;
color: var(--brand);
font-variant-numeric: tabular-nums;
}
.metric-label { font-size: 9pt; color: var(--olive); }
```
### Quote
```css
.quote {
margin: 12pt 16pt;
padding: 4pt 0;
color: var(--olive);
line-height: 1.55;
}
```
## Diagram components
Eighteen built-in diagram types (incl. Mermaid-sourced sequence / class / ER; see `references/mermaid.md`). Extract the `