[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70E04833835R8SMG4CXM78R":3,"skill-same:01M70E04833835R8SMG4CXM78R":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M70E04833835R8SMG4CXM78R","typography",null,"Research-grounded typography for any text-bearing surface — web, PDF, email, documents. GENERATIVE: apply correct line length, font sizing, contrast, dark mode, mobile, and Japanese rules from the start when building any UI, page, layout, or document. REVIEW: audit existing CSS\u002FHTML\u002Ftemplates for typography violations. Use this skill whenever you are writing CSS that touches font-size, line-height, max-width, color, or font-family. Use it when building any frontend component, page, or layout — even if the user doesn't mention typography. Use it when reviewing any rendered output for readability. Use it when generating PDFs, emails, or any formatted document. If text will be read by a human, this skill applies.","EthanYoQ\u002FSkill-hub","EthanYoQ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257484394?v=4","01M70C9QKWR1YS0S7V26DNB18H","Ethan","01M70C9QMER047R5ANZZA6KC2P",11,"MIT","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"you","max","read","line","audit","human","layout","component","text","review","when","documents","writing","frontend","mode","generative","japanese","css","PDF","2026-11-10 10:12:30",false,"---\nname: typography\ndescription: >\n  Research-grounded typography for any text-bearing surface — web, PDF, email,\n  documents. GENERATIVE: apply correct line length, font sizing, contrast, dark mode,\n  mobile, and Japanese rules from the start when building any UI, page, layout,\n  or document. REVIEW: audit existing CSS\u002FHTML\u002Ftemplates for typography violations.\n  Use this skill whenever you are writing CSS that touches font-size, line-height,\n  max-width, color, or font-family. Use it when building any frontend component,\n  page, or layout — even if the user doesn't mention typography. Use it when\n  reviewing any rendered output for readability. Use it when generating PDFs,\n  emails, or any formatted document. If text will be read by a human, this skill\n  applies.\n---\n\n# Typography\n\nResearch-grounded decisions for every surface where humans read text. The\nphilosophy: the browser renders semantic HTML correctly; every typographic\ndecision on top of that is a bet. This skill records the bets worth making —\neach grounded in research — and the ones to skip.\n\nThe iA Writer principle applies: fewer decisions, made well, applied consistently.\n\n---\n\n## Modes\n\n### Generative — New Project\n\nWhen starting a new page, component, or document:\n\n1. **Establish tokens first.** Generate a typography token file (section 6) before writing any component CSS. Every size, color, and spacing value should reference a token.\n2. **Detect language.** If the project serves Japanese content, apply the Japanese overrides (section 3) from the start — not as a retrofit.\n3. **Set the reading container.** Every text-bearing surface gets a `max-width` constraint. No exceptions.\n4. **Ship both color schemes.** Default to `prefers-color-scheme`. Never force one mode.\n5. **Verify mobile.** Viewport meta tag, fluid font sizes via `clamp()`, touch targets ≥ 44px.\n6. **Reader controls.** For reading-focused interfaces, provide user-facing font size control (e.g., 3 steps: small\u002Fdefault\u002Flarge via a `--fs-scale` CSS variable multiplier). For Japanese content, offer horizontal\u002Fvertical mode toggle with per-content persistence.\n7. **Write the project ledger.** Create `TYPOGRAPHY.md` in the project root (see section 7).\n\n### Review — Existing Project\n\nWhen auditing existing CSS, HTML, or rendered output:\n\n1. **Line length** — is body text constrained to 45–80 CPL (Latin) or 30–40 CPL (Japanese)?\n2. **Font size** — is body ≥ 16px on mobile, ≥ 18px on desktop?\n3. **Line height** — is body ≥ 1.5 (Latin) or ≥ 1.65 (Japanese)?\n4. **Contrast** — does body text meet 4.5:1 minimum? Compute from actual hex values.\n5. **Dark mode** — is `#000` background or `#fff` text present? Both are violations.\n6. **Japanese** — is `lang=\"ja\"` declared? Is `line-break: strict` set? Is `font-style: italic` absent?\n7. **Type scale** — are there more than 6 distinct sizes? Is the ratio consistent?\n8. **Mobile** — viewport meta present? Touch targets ≥ 44px?\n9. **Prohibitions** — scan for every item in section 4.\n10. **Vertical text** — if Japanese content uses `writing-mode: vertical-rl`: is `text-align` set to `start` (not `justify`)? Is column height capped (~22em)? Is `width: max-content` set? Is `overflow-x: hidden` absent from body?\n11. **Reader controls** — for reading interfaces: is font size adjustable? For Japanese: is writing mode toggleable with persistence?\n12. **Write the project ledger.** Create or update `TYPOGRAPHY.md` in the project root (see section 7).\n\nReport each finding with: **property**, **current value**, **correct value**, **why**.\n\n---\n\n## 1. Core Decisions (Latin \u002F General)\n\nApply these unless the project brief specifies otherwise.\n\n### 1.1 Line Length\n```css\n.text-container {\n  max-width: min(90vw, 65ch);\n  margin-inline: auto;\n}\n```\n- Target: 60–65 CPL for reading. Hard limits: 45 min, 80 max.\n- Use `ch` for Latin — scales with font size and zoom.\n- Bringhurst: 45–75 CPL. Baymard: sweet spot ~65. Ruder: 50–60 for max speed.\n- The tension (Dyson & Haselgrove 2001): speed peaks wider, comprehension peaks narrower. For retention, bias toward 60–65.\n\n### 1.2 Font Size\n```css\n:root {\n  --size-body: clamp(16px, 1.1vw + 14px, 18px);\n}\nbody { font-size: var(--size-body); }\n```\n- Desktop body: 18px target.\n- Mobile minimum: 16px absolute floor.\n- Text-heavy surfaces (articles): 18–24px. Interaction-heavy (UI): 14–20px.\n- Minimum for any readable text anywhere: 12px.\n\n### 1.3 Line Height\n```css\nbody          { line-height: 1.5; }  \u002F* at 65ch column *\u002F\nh1, h2        { line-height: 1.1; }\nh3, h4        { line-height: 1.2; }\ncaption, label { line-height: 1.3; }\n```\nLine height couples to column width — wider columns need more vertical space for accurate return sweeps:\n- 45ch → 1.4\n- 65ch → 1.5\n- 80ch → 1.6\n\nMobile body: 1.55–1.6 (screens held closer, read in varied conditions).\n\n### 1.4 Type Scale (1.25 major third from 16px)\n```css\n:root {\n  --size-xs:   0.75rem;    \u002F* 12px — captions, fine print *\u002F\n  --size-sm:   0.875rem;   \u002F* 14px — labels, metadata *\u002F\n  --size-base: 1rem;       \u002F* 16px — body, inputs, nav *\u002F\n  --size-md:   1.25rem;    \u002F* 20px — lead, section intro *\u002F\n  --size-lg:   1.5625rem;  \u002F* 25px — H3, card titles *\u002F\n  --size-xl:   1.953rem;   \u002F* 31px — H2 *\u002F\n  --size-2xl:  2.441rem;   \u002F* 39px — H1 *\u002F\n  --size-3xl:  3.052rem;   \u002F* 49px — hero\u002Fdisplay *\u002F\n}\n```\n- 1.25 for standard web UI. 1.333 for editorial\u002Freading layouts. 1.125 for dense dashboards.\n- Maximum 5–6 distinct sizes per interface. More signals a missing design system.\n\n### 1.5 Color and Contrast\n```css\n:root {\n  color-scheme: light dark;\n  --color-text:           #1a1a1a;\n  --color-text-secondary: #595959;\n  --color-text-disabled:  #8a8a8a;\n  --color-bg:             #f5f5f5;\n  --color-surface:        #ffffff;\n}\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-text:           #e8e8e8;\n    --color-text-secondary: #a0a0a0;\n    --color-text-disabled:  #606060;\n    --color-bg:             #121212;\n    --color-surface:        #1e1e1e;\n  }\n}\n```\n- Light: target 7:1–10:1. Dark: target ~14:1.\n- WCAG AA body text minimum: 4.5:1. Never drop below.\n- Dark mode surfaces: `#121212` (base), `#1e1e1e` (+1), `#252525` (+2), `#2c2c2c` (+3).\n- Dark mode accents: desaturate 20–40%. Never mechanically invert light-mode colors.\n\n### 1.6 Font Weight as Hierarchy\n| Weight | Value | Use for |\n|--------|-------|---------|\n| Regular | 400 | Body, most UI text |\n| Medium | 500 | Active nav states |\n| Semi-bold | 600 | Nav labels, buttons, subheadings |\n| Bold | 700 | H1–H2, critical alerts only |\n| Heavy | 800+ | Display\u002Fhero only |\n\nReserve bold for the top of hierarchy. Bold everywhere flattens the signal.\n\n### 1.7 Spacing\n```css\np + p { margin-block-start: 1.1em; }\nh2    { margin-block-start: 2em; margin-block-end: 0.5em; }\nh3    { margin-block-start: 1.75em; margin-block-end: 0.4em; }\n```\nSpace above heading ≈ 2× space below — binds heading to its content.\n\n### 1.8 Mobile\n```css\n\u002F* Always include: \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> *\u002F\n:root {\n  --size-h1: clamp(28px, 4vw + 16px, 48px);\n  --size-h2: clamp(22px, 2.5vw + 16px, 32px);\n  --size-h3: clamp(18px, 1.5vw + 14px, 25px);\n}\na { padding-block: 0.25em; } \u002F* Expand touch target without visual shift *\u002F\n```\n- Portrait: line length resolves naturally. Landscape: `min(90vw, 65ch)` caps it.\n- Touch targets: 44×44px minimum (Apple HIG, WCAG 2.5.5).\n- Use `rem` for font sizes, `em` for spacing, `px` only for borders.\n\n### 1.9 Font Selection and Loading\n\n**Selection quick picks** (for full detail, pairing guidance, and personality taxonomy: read `references\u002Ffont-knowledge.md`):\n\n| Context | Top pick | Runner-up |\n|---------|----------|-----------|\n| Web UI | Inter | Source Sans 3 |\n| Long-form reading | Literata | Charter |\n| Code | JetBrains Mono | Fira Code |\n| Display headings | Fraunces (serif) \u002F Space Grotesk (sans) | Playfair Display |\n| Japanese sans | Noto Sans JP | M PLUS 1 |\n| Japanese serif | Shippori Mincho | Zen Old Mincho |\n| \"Just pick a system\" | Source superfamily (Sans + Serif + Code) | IBM Plex superfamily |\n\n**System font stacks** (zero loading cost — use for performance-critical or native-feeling UIs):\n```css\n\u002F* Sans-serif (UI) *\u002F\nfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", sans-serif;\n\n\u002F* Serif (reading\u002Feditorial) *\u002F\nfont-family: Georgia, \"Times New Roman\", serif;\n```\n\n**Loading defaults:**\n- Self-host fonts. Cache partitioning killed the CDN advantage.\n- woff2 only. Drop all other formats.\n- `font-display: optional` as default — eliminates FOUT\u002FFOIT. Use `swap` only for brand-critical display text.\n- Variable fonts when using 2+ weights of the same family (smaller total than separate static files).\n- Font budget: \u003C 100KB total per page. High-performance target: \u003C 50KB.\n- Subset aggressively. Use `unicode-range` or `glyphhanger`.\n- Enable `font-optical-sizing: auto` when using variable fonts.\n\n**Pairing rule:** Two typefaces maximum. One for headings, one for body. Superfamilies (Source, IBM Plex, Noto) eliminate pairing risk entirely. When pairing across families, match x-height and proportions; contrast by category (serif + sans). For specific pairings and the full personality taxonomy, read `references\u002Ffont-knowledge.md`.\n\n**Anti-patterns to flag in review mode:**\n- Montserrat + Roboto (or any \"top of Google Fonts by popularity\" combo) without a stated reason\n- Display faces (Playfair, Lobster, Pacifico) used for body text\n- More than 2 weight files loaded but only 1-2 used\n- Faux italic (no true italic in the font; browser synthesizes oblique)\n- Two fonts from the same category (e.g. two geometric sans) — looks like a mistake, not a choice\n- Full Japanese font loaded without subsetting (2MB+)\n\n---\n\n## 2. Heading Line Length\n\nHeadings follow different CPL rules than body text:\n\n| Level | Max CPL |\n|-------|---------|\n| Hero \u002F H1 | 30–40 |\n| H2 | 40–60 |\n| H3 | 50–65 |\n| Microcopy (CTAs) | 20–35 |\n\nLong H1s dilute the message. Cap hero text at ~35 characters.\n\n---\n\n## 3. Japanese Typography Overrides\n\n**Activate when:** `lang=\"ja\"` is present, Japanese characters appear in content, or the project brief mentions Japanese.\n\n**First action:** verify `lang=\"ja\"` is set on `\u003Chtml>` or the containing element. Without it, browser-level typography features (kinsoku, auto-phrase, text-autospace) do not activate.\n\n### 3.1 Block Defaults (Horizontal)\n```css\n:lang(ja) {\n  max-width: min(90vw, 38em);    \u002F* em, not ch — ch measures ASCII '0' *\u002F\n  line-height: 1.7;              \u002F* kanji have no ascenders\u002Fdescenders *\u002F\n  letter-spacing: 0.05em;        \u002F* aids character discrimination *\u002F\n  text-align: justify;           \u002F* horizontal only — no word spaces = no rivers *\u002F\n  text-align-last: left;\n  line-break: strict;            \u002F* JIS X 4051 kinsoku *\u002F\n  word-break: keep-all;\n  overflow-wrap: break-word;\n}\n```\nNote: `text-align: justify` applies to horizontal mode only. In vertical mode (`writing-mode: vertical-rl`), use `text-align: start` — justify stretches short columns to fill the height. See §3.8.\n\n### 3.2 Headings\n```css\n:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 {\n  line-height: 1.25;\n  letter-spacing: 0;\n  word-break: auto-phrase;  \u002F* phrase-boundary breaks, Chrome 119+ *\u002F\n}\n```\n\n### 3.3 Font Stacks\n```css\n\u002F* Gothic (sans-serif — UI, digital) *\u002F\n:lang(ja) {\n  font-family:\n    'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN',\n    'Yu Gothic', '游ゴシック体', YuGothic,\n    'Meiryo', 'メイリオ',\n    'Noto Sans JP', sans-serif;\n}\n\n\u002F* Mincho (serif — reading, editorial) *\u002F\n.reading-content:lang(ja) {\n  font-family:\n    'Hiragino Mincho ProN', 'ヒラギノ明朝 ProN',\n    'Yu Mincho', '游明朝体', YuMincho,\n    'Noto Serif JP', serif;\n}\n```\n\n### 3.4 Mixed Content\n```css\n\u002F* Japanese primary, Latin inline *\u002F\n:lang(ja) .latin-inline { font-size: 1.1em; }\n\n\u002F* Latin primary, Japanese inline *\u002F\n:lang(ja) span.ja-inline { font-size: 0.9em; }\n\n\u002F* Inter-script spacing (progressive) *\u002F\n@supports (text-autospace: ideograph-alpha) {\n  :lang(ja) { text-autospace: ideograph-alpha ideograph-numeric; }\n}\n```\n\n### 3.5 Punctuation Spacing\n```css\n\u002F* Native CSS (Chrome 118+) *\u002F\n:lang(ja) { text-spacing-trim: trim-start; }\n```\nFor broader support, consider the Yaku Han JP library for half-width punctuation.\n\n### 3.6 Emphasis (not italics)\n```css\n\u002F* Japanese emphasis = bōten dots, not italic *\u002F\n.emphasis-ja {\n  text-emphasis: filled circle;\n  text-emphasis-position: over right;\n}\n```\n\n### 3.7 Font Subsetting\nJapanese fonts are 2MB+. Always subset:\n```css\n@font-face {\n  font-family: 'Noto Sans JP';\n  src: url('...') format('woff2');\n  unicode-range: U+3000-9FFF, U+F900-FAFF, U+FF00-FFEF;\n}\n```\n\n### 3.8 Vertical Text (縦書き Tategaki)\n\nVertical Japanese text uses `writing-mode: vertical-rl` — columns flow top-to-bottom, right-to-left. This inverts many layout assumptions. Everything below was learned through implementation, not theory.\n\n**When to offer vertical mode:** Reading interfaces serving Japanese literary or editorial content should offer both horizontal and vertical as a reader preference, with per-content persistence (localStorage). Vertical is not purely an author decision — it is a legitimate reader choice for Japanese.\n\n```css\n\u002F* Vertical reading container *\u002F\n.vertical-content {\n  writing-mode: vertical-rl;\n  max-width: none;                         \u002F* width is unconstrained — content flows horizontally *\u002F\n  width: max-content;                      \u002F* REQUIRED — auto collapses in flex contexts *\u002F\n  height: min(calc(100dvh - 7rem), 22em);  \u002F* 20 chars\u002Fcolumn ≈ genkōyōshi standard *\u002F\n  font-family: var(--font-ja);\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n  text-align: start;                       \u002F* NOT justify — justify stretches short columns *\u002F\n}\n\n\u002F* Scroll container for vertical text *\u002F\n.vertical-scroll {\n  overflow-y: hidden;\n  overflow-x: auto;                        \u002F* horizontal scroll = \"read forward\" *\u002F\n  -webkit-overflow-scrolling: touch;\n  display: flex;\n  justify-content: center;                 \u002F* center when content is shorter than viewport *\u002F\n  align-items: center;                     \u002F* vertical centering of capped-height columns *\u002F\n}\n```\n\n**Critical implementation traps:**\n\n| Trap | Why it breaks | Fix |\n|------|--------------|-----|\n| `height` controls column length, not `max-width` | Axis inversion — vertical-rl swaps the meaning of width\u002Fheight | Use `height` to cap characters per column |\n| `width: auto` on vertical content | Collapses to zero in flex contexts | Use `width: max-content` |\n| `display: flex` on parent | Constrains vertical-rl children unpredictably | Use `display: block`, or add `flex-shrink: 0` on the vertical child |\n| `body { overflow-x: hidden }` | Common CSS reset clips vertical-rl overflow entirely | Remove or scope the reset; never apply globally when vertical text is present |\n| `text-align: justify` | Stretches short columns vertically to fill the height | Use `text-align: start` for vertical mode |\n| No scroll affordance | Users don't expect horizontal scrolling — \"read forward\" direction is invisible | Add a scroll hint (fade-out indicator) or swipe gesture cue |\n| Column height shorter than viewport | Text block hangs at top of viewport | Center vertically with flex `align-items: center` |\n\n**Column height target:** 20 characters per column ≈ 22em (with 0.05em letter-spacing). This follows the genkōyōshi (原稿用紙) manuscript paper standard. It is the vertical equivalent of `max-width: 65ch` for horizontal Latin text.\n\n### 3.9 Rule Inversions Summary\n\n| Property | Latin | Japanese (horizontal) | Japanese (vertical) |\n|----------|-------|-----------------------|---------------------|\n| CPL target | 60–65 | 30–40 | 20 chars\u002Fcolumn |\n| Column constraint | `max-width` | `max-width: 38em` | `height: 22em` |\n| Width unit | `ch` | `em` | `em` |\n| Line-height (body) | 1.5 | 1.7 | 1.7 |\n| Letter-spacing (body) | 0 | 0.05em | 0.05em |\n| Text alignment | left | justify | start |\n| Overflow\u002Fscroll | vertical | vertical | horizontal (right-to-left) |\n| Container width | constrained | constrained | `max-content` |\n| Parent layout | flex works | flex works | block safer |\n| Italics | available | never — use weight or text-emphasis | never |\n| `word-break` | default | `keep-all` | `keep-all` |\n| `line-break` | default | `strict` | `strict` |\n\n---\n\n## 4. Absolute Prohibitions\n\nThese are categorical. Flag as errors when auditing. Never produce them when generating.\n\n### Latin\n1. `text-align: justify` on Latin text\n2. `font-size` below 12px for any readable text\n3. `#000` on `#fff` for body text — soften both values\n4. `#000` as dark mode background — use `#121212`\n5. More than 6 distinct font sizes without documented reason\n6. Letter-spacing on mixed-case body text — only ALL-CAPS labels, max `0.05em`\n7. Full-width liquid layout for long-form reading\n8. Mechanical dark mode inversion — create dark-specific tokens\n9. ALL-CAPS for text longer than 4–5 words\n10. Omitting viewport meta tag for mobile-served pages\n\n### Japanese\n1. `word-break: break-all` on Japanese text — catastrophic\n2. `font-style: italic` on Japanese text — never\n3. `ch` units for Japanese column width — use `em`\n4. Omitting `lang=\"ja\"` — mandatory for correct rendering\n5. Full Japanese font without subsetting — 2MB+ unacceptable\n6. Default browser font for Japanese — MS Mincho is unusable\n7. `text-align: justify` without `text-align-last: left` (horizontal only)\n8. Ignoring punctuation spacing — full-width stacking creates gaps\n9. `text-align: justify` on vertical Japanese text — stretches short columns to fill height; use `start`\n10. `overflow-x: hidden` on `body` when vertical text is present — clips the entire reading surface\n11. `width: auto` on `writing-mode: vertical-rl` containers in flex contexts — collapses; use `max-content`\n\n---\n\n## 5. Non-Web Surfaces\n\nThe same principles apply to PDF, email, and document generation. The implementation changes.\n\n### PDF Generation\n- Line length: 60–65 characters per line. Set column width to achieve this.\n- Font size: 11–12pt body (print equivalent of 16–18px screen).\n- Line height: 1.4–1.5 for body (print needs slightly less than screen).\n- Contrast: ensure sufficient contrast for both screen viewing and print.\n- Japanese: 30–40 CPL, 1.6–1.7 line height.\n\n### Email Templates\n- Body font size: 16px minimum — email clients don't support `clamp()`.\n- Line length: constrain with `max-width` on the content table\u002Fdiv, target 550–600px.\n- Use inline styles — email clients strip `\u003Cstyle>` blocks unpredictably.\n- Dark mode: many email clients auto-invert. Test with and without `color-scheme: light dark`.\n- System font stacks only — web fonts are unreliable in email.\n- Japanese email: inline `lang=\"ja\"` on the wrapping element; use Noto Sans JP as web font if the ESP supports it, otherwise rely on system Gothic stack.\n\n### Document Generation (Markdown, DOCX, etc.)\n- Same CPL and line-height targets as web.\n- For Markdown rendered to HTML: the CSS token file (section 6) applies directly.\n- For DOCX: set paragraph style to equivalent values (11pt body, 1.5 line spacing, 6pt paragraph spacing).\n\n---\n\n## 6. CSS Token File\n\nWhen starting a new web project, generate this token file as the typography foundation:\n\n```css\n\u002F* typography-tokens.css *\u002F\n:root {\n  \u002F* Scale (1.25 major third) *\u002F\n  --size-xs:   0.75rem;\n  --size-sm:   0.875rem;\n  --size-base: 1rem;\n  --size-md:   1.25rem;\n  --size-lg:   1.5625rem;\n  --size-xl:   1.953rem;\n  --size-2xl:  2.441rem;\n  --size-3xl:  3.052rem;\n\n  \u002F* Line height *\u002F\n  --lh-body:     1.5;\n  --lh-heading:  1.1;\n  --lh-subhead:  1.2;\n  --lh-label:    1.3;\n  --lh-body-ja:  1.7;\n\n  \u002F* Japanese font stack *\u002F\n  --font-ja: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', '游ゴシック体', YuGothic, 'Meiryo', 'Noto Sans JP', sans-serif;\n\n  \u002F* Color — light *\u002F\n  --color-text:           #1a1a1a;\n  --color-text-secondary: #595959;\n  --color-text-disabled:  #8a8a8a;\n  --color-bg:             #f5f5f5;\n  --color-surface:        #ffffff;\n\n  \u002F* Reader font size control *\u002F\n  --fs-scale: 1;           \u002F* multiplier — toggle between 0.85, 1, 1.15 *\u002F\n\n  \u002F* Vertical Japanese *\u002F\n  --column-height-ja: 22em; \u002F* 20 chars\u002Fcolumn ≈ genkōyōshi *\u002F\n\n  \u002F* Spacing *\u002F\n  --paragraph-gap: 1.1em;\n\n  color-scheme: light dark;\n}\n\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-text:           #e8e8e8;\n    --color-text-secondary: #a0a0a0;\n    --color-text-disabled:  #606060;\n    --color-bg:             #121212;\n    --color-surface:        #1e1e1e;\n  }\n}\n\nbody {\n  font-size: calc(clamp(16px, 1.1vw + 14px, 18px) * var(--fs-scale));\n  line-height: var(--lh-body);\n  color: var(--color-text);\n  background-color: var(--color-bg);\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", sans-serif;\n  font-optical-sizing: auto;\n}\n\n.reading-content {\n  max-width: min(90vw, 65ch);\n  margin-inline: auto;\n}\n\n.reading-content p + p { margin-block-start: var(--paragraph-gap); }\n\nh1 { font-size: clamp(28px, 4vw + 16px, 48px); line-height: var(--lh-heading); }\nh2 { font-size: clamp(22px, 2.5vw + 16px, 32px); line-height: var(--lh-heading);\n     margin-block-start: 2em; margin-block-end: 0.5em; }\nh3 { font-size: clamp(18px, 1.5vw + 14px, 25px); line-height: var(--lh-subhead);\n     margin-block-start: 1.75em; margin-block-end: 0.4em; }\n\n\u002F* Japanese overrides *\u002F\n:lang(ja) {\n  max-width: min(90vw, 38em);\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n  text-align: justify;\n  text-align-last: left;\n  line-break: strict;\n  word-break: keep-all;\n  overflow-wrap: break-word;\n  font-family: var(--font-ja);\n}\n\n:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 {\n  line-height: 1.25;\n  letter-spacing: 0;\n  word-break: auto-phrase;\n}\n\na { padding-block: 0.25em; }\n\n\u002F* Vertical Japanese reading *\u002F\n.vertical-content:lang(ja) {\n  writing-mode: vertical-rl;\n  max-width: none;\n  width: max-content;\n  height: min(calc(100dvh - 7rem), var(--column-height-ja));\n  text-align: start;\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n}\n```\n\n---\n\n## 7. Project Ledger — `TYPOGRAPHY.md`\n\nEvery project this skill touches gets a `TYPOGRAPHY.md` file in the project root. This is the typography decision record for that project — what was found, what was changed, and why. It persists across sessions so anyone reading the project later understands the typographic choices without re-auditing.\n\n**Create it** at the end of every generative or review session. If it already exists, **append** a new session entry — never overwrite previous entries.\n\n### Structure\n\nUse this template. Fill in only the sections that apply to the current session.\n\n```markdown\n# Typography\n\nProject-specific typography decisions and audit history.\n\n---\n\n## Current State\n\n\u003C!-- Updated each session. This is a snapshot — overwrite on each visit. -->\n\n| Property | Value | Status |\n|----------|-------|--------|\n| Body CPL | e.g. 65ch | conforming \u002F non-conforming \u002F not set |\n| Body font size | e.g. clamp(16px, 1.1vw + 14px, 18px) | ... |\n| Body line-height | e.g. 1.5 | ... |\n| Light contrast | e.g. #1a1a1a on #f5f5f5 (~10:1) | ... |\n| Dark mode | e.g. #e8e8e8 on #121212 (~14:1) | ... |\n| Type scale | e.g. 1.25 major third, 6 sizes | ... |\n| Mobile viewport | present \u002F missing | ... |\n| Touch targets | ≥44px \u002F undersized \u002F not checked | ... |\n| Japanese support | yes \u002F no \u002F partial | ... |\n| Token file | e.g. typography-tokens.css | present \u002F absent |\n\n## Session Log\n\n### YYYY-MM-DD — [Generative | Review | Update]\n\n**Mode:** Generative \u002F Review\n**Surfaces touched:** e.g. main layout CSS, dark mode tokens, email template\n\n#### Before\n\u003C!-- What existed before this session. For new projects, write \"Greenfield — no prior typography.\" -->\n\n#### Decisions\n\u003C!-- What was set or changed, and the reasoning. Reference skill rule numbers. -->\n\n| Decision | Value chosen | Basis |\n|----------|-------------|-------|\n| e.g. Body CPL | 65ch | Skill §1.1 — Baymard sweet spot |\n| e.g. Dark bg | #121212 | Skill §1.5 — Material Design, depth cues |\n\n#### Violations Found\n\u003C!-- Review mode only. Leave blank for generative. -->\n\n| Property | Was | Should be | Fixed? |\n|----------|-----|-----------|--------|\n| e.g. Dark bg | #000000 | #121212 | yes |\n\n#### After\n\u003C!-- What the project looks like now. -->\n\n#### Open Items\n\u003C!-- Anything deferred, blocked, or needing user input. -->\n```\n\n### Rules\n\n- **Current State table:** overwrite each session with the latest snapshot. This is the \"at a glance\" view.\n- **Session Log entries:** append-only. Newest first. Never edit previous entries.\n- **Be specific.** Write actual hex values, actual pixel sizes, actual `clamp()` expressions — not \"improved contrast\" or \"fixed font size.\"\n- **Cite the skill.** Reference section numbers (e.g., \"Skill §1.1\", \"Skill §4, prohibition #3\") so decisions trace back to their basis.\n- **Greenfield projects** still get a Before section — write \"Greenfield — no prior typography\" so the record is complete.\n\n---\n\n## 8. Detailed Reference\n\nFor full rationale, research citations, and extended CSS examples:\n- Latin typography: read `references\u002Flatin-typography.md`\n- Japanese typography: read `references\u002Fjapanese-typography.md`\n- Font selection, pairing, personality, loading, and licensing: read `references\u002Ffont-knowledge.md`\n\nConsult these when a decision is not covered above, when advising on font selection, or when explaining a rule's basis to the user.\n","# Typography\n\nResearch-grounded decisions for every surface where humans read text. The\nphilosophy: the browser renders semantic HTML correctly; every typographic\ndecision on top of that is a bet. This skill records the bets worth making —\neach grounded in research — and the ones to skip.\n\nThe iA Writer principle applies: fewer decisions, made well, applied consistently.\n\n---\n\n## Modes\n\n### Generative — New Project\n\nWhen starting a new page, component, or document:\n\n1. **Establish tokens first.** Generate a typography token file (section 6) before writing any component CSS. Every size, color, and spacing value should reference a token.\n2. **Detect language.** If the project serves Japanese content, apply the Japanese overrides (section 3) from the start — not as a retrofit.\n3. **Set the reading container.** Every text-bearing surface gets a `max-width` constraint. No exceptions.\n4. **Ship both color schemes.** Default to `prefers-color-scheme`. Never force one mode.\n5. **Verify mobile.** Viewport meta tag, fluid font sizes via `clamp()`, touch targets ≥ 44px.\n6. **Reader controls.** For reading-focused interfaces, provide user-facing font size control (e.g., 3 steps: small\u002Fdefault\u002Flarge via a `--fs-scale` CSS variable multiplier). For Japanese content, offer horizontal\u002Fvertical mode toggle with per-content persistence.\n7. **Write the project ledger.** Create `TYPOGRAPHY.md` in the project root (see section 7).\n\n### Review — Existing Project\n\nWhen auditing existing CSS, HTML, or rendered output:\n\n1. **Line length** — is body text constrained to 45–80 CPL (Latin) or 30–40 CPL (Japanese)?\n2. **Font size** — is body ≥ 16px on mobile, ≥ 18px on desktop?\n3. **Line height** — is body ≥ 1.5 (Latin) or ≥ 1.65 (Japanese)?\n4. **Contrast** — does body text meet 4.5:1 minimum? Compute from actual hex values.\n5. **Dark mode** — is `#000` background or `#fff` text present? Both are violations.\n6. **Japanese** — is `lang=\"ja\"` declared? Is `line-break: strict` set? Is `font-style: italic` absent?\n7. **Type scale** — are there more than 6 distinct sizes? Is the ratio consistent?\n8. **Mobile** — viewport meta present? Touch targets ≥ 44px?\n9. **Prohibitions** — scan for every item in section 4.\n10. **Vertical text** — if Japanese content uses `writing-mode: vertical-rl`: is `text-align` set to `start` (not `justify`)? Is column height capped (~22em)? Is `width: max-content` set? Is `overflow-x: hidden` absent from body?\n11. **Reader controls** — for reading interfaces: is font size adjustable? For Japanese: is writing mode toggleable with persistence?\n12. **Write the project ledger.** Create or update `TYPOGRAPHY.md` in the project root (see section 7).\n\nReport each finding with: **property**, **current value**, **correct value**, **why**.\n\n---\n\n## 1. Core Decisions (Latin \u002F General)\n\nApply these unless the project brief specifies otherwise.\n\n### 1.1 Line Length\n```css\n.text-container {\n  max-width: min(90vw, 65ch);\n  margin-inline: auto;\n}\n```\n- Target: 60–65 CPL for reading. Hard limits: 45 min, 80 max.\n- Use `ch` for Latin — scales with font size and zoom.\n- Bringhurst: 45–75 CPL. Baymard: sweet spot ~65. Ruder: 50–60 for max speed.\n- The tension (Dyson & Haselgrove 2001): speed peaks wider, comprehension peaks narrower. For retention, bias toward 60–65.\n\n### 1.2 Font Size\n```css\n:root {\n  --size-body: clamp(16px, 1.1vw + 14px, 18px);\n}\nbody { font-size: var(--size-body); }\n```\n- Desktop body: 18px target.\n- Mobile minimum: 16px absolute floor.\n- Text-heavy surfaces (articles): 18–24px. Interaction-heavy (UI): 14–20px.\n- Minimum for any readable text anywhere: 12px.\n\n### 1.3 Line Height\n```css\nbody          { line-height: 1.5; }  \u002F* at 65ch column *\u002F\nh1, h2        { line-height: 1.1; }\nh3, h4        { line-height: 1.2; }\ncaption, label { line-height: 1.3; }\n```\nLine height couples to column width — wider columns need more vertical space for accurate return sweeps:\n- 45ch → 1.4\n- 65ch → 1.5\n- 80ch → 1.6\n\nMobile body: 1.55–1.6 (screens held closer, read in varied conditions).\n\n### 1.4 Type Scale (1.25 major third from 16px)\n```css\n:root {\n  --size-xs:   0.75rem;    \u002F* 12px — captions, fine print *\u002F\n  --size-sm:   0.875rem;   \u002F* 14px — labels, metadata *\u002F\n  --size-base: 1rem;       \u002F* 16px — body, inputs, nav *\u002F\n  --size-md:   1.25rem;    \u002F* 20px — lead, section intro *\u002F\n  --size-lg:   1.5625rem;  \u002F* 25px — H3, card titles *\u002F\n  --size-xl:   1.953rem;   \u002F* 31px — H2 *\u002F\n  --size-2xl:  2.441rem;   \u002F* 39px — H1 *\u002F\n  --size-3xl:  3.052rem;   \u002F* 49px — hero\u002Fdisplay *\u002F\n}\n```\n- 1.25 for standard web UI. 1.333 for editorial\u002Freading layouts. 1.125 for dense dashboards.\n- Maximum 5–6 distinct sizes per interface. More signals a missing design system.\n\n### 1.5 Color and Contrast\n```css\n:root {\n  color-scheme: light dark;\n  --color-text:           #1a1a1a;\n  --color-text-secondary: #595959;\n  --color-text-disabled:  #8a8a8a;\n  --color-bg:             #f5f5f5;\n  --color-surface:        #ffffff;\n}\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-text:           #e8e8e8;\n    --color-text-secondary: #a0a0a0;\n    --color-text-disabled:  #606060;\n    --color-bg:             #121212;\n    --color-surface:        #1e1e1e;\n  }\n}\n```\n- Light: target 7:1–10:1. Dark: target ~14:1.\n- WCAG AA body text minimum: 4.5:1. Never drop below.\n- Dark mode surfaces: `#121212` (base), `#1e1e1e` (+1), `#252525` (+2), `#2c2c2c` (+3).\n- Dark mode accents: desaturate 20–40%. Never mechanically invert light-mode colors.\n\n### 1.6 Font Weight as Hierarchy\n| Weight | Value | Use for |\n|--------|-------|---------|\n| Regular | 400 | Body, most UI text |\n| Medium | 500 | Active nav states |\n| Semi-bold | 600 | Nav labels, buttons, subheadings |\n| Bold | 700 | H1–H2, critical alerts only |\n| Heavy | 800+ | Display\u002Fhero only |\n\nReserve bold for the top of hierarchy. Bold everywhere flattens the signal.\n\n### 1.7 Spacing\n```css\np + p { margin-block-start: 1.1em; }\nh2    { margin-block-start: 2em; margin-block-end: 0.5em; }\nh3    { margin-block-start: 1.75em; margin-block-end: 0.4em; }\n```\nSpace above heading ≈ 2× space below — binds heading to its content.\n\n### 1.8 Mobile\n```css\n\u002F* Always include: \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> *\u002F\n:root {\n  --size-h1: clamp(28px, 4vw + 16px, 48px);\n  --size-h2: clamp(22px, 2.5vw + 16px, 32px);\n  --size-h3: clamp(18px, 1.5vw + 14px, 25px);\n}\na { padding-block: 0.25em; } \u002F* Expand touch target without visual shift *\u002F\n```\n- Portrait: line length resolves naturally. Landscape: `min(90vw, 65ch)` caps it.\n- Touch targets: 44×44px minimum (Apple HIG, WCAG 2.5.5).\n- Use `rem` for font sizes, `em` for spacing, `px` only for borders.\n\n### 1.9 Font Selection and Loading\n\n**Selection quick picks** (for full detail, pairing guidance, and personality taxonomy: read `references\u002Ffont-knowledge.md`):\n\n| Context | Top pick | Runner-up |\n|---------|----------|-----------|\n| Web UI | Inter | Source Sans 3 |\n| Long-form reading | Literata | Charter |\n| Code | JetBrains Mono | Fira Code |\n| Display headings | Fraunces (serif) \u002F Space Grotesk (sans) | Playfair Display |\n| Japanese sans | Noto Sans JP | M PLUS 1 |\n| Japanese serif | Shippori Mincho | Zen Old Mincho |\n| \"Just pick a system\" | Source superfamily (Sans + Serif + Code) | IBM Plex superfamily |\n\n**System font stacks** (zero loading cost — use for performance-critical or native-feeling UIs):\n```css\n\u002F* Sans-serif (UI) *\u002F\nfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", sans-serif;\n\n\u002F* Serif (reading\u002Feditorial) *\u002F\nfont-family: Georgia, \"Times New Roman\", serif;\n```\n\n**Loading defaults:**\n- Self-host fonts. Cache partitioning killed the CDN advantage.\n- woff2 only. Drop all other formats.\n- `font-display: optional` as default — eliminates FOUT\u002FFOIT. Use `swap` only for brand-critical display text.\n- Variable fonts when using 2+ weights of the same family (smaller total than separate static files).\n- Font budget: \u003C 100KB total per page. High-performance target: \u003C 50KB.\n- Subset aggressively. Use `unicode-range` or `glyphhanger`.\n- Enable `font-optical-sizing: auto` when using variable fonts.\n\n**Pairing rule:** Two typefaces maximum. One for headings, one for body. Superfamilies (Source, IBM Plex, Noto) eliminate pairing risk entirely. When pairing across families, match x-height and proportions; contrast by category (serif + sans). For specific pairings and the full personality taxonomy, read `references\u002Ffont-knowledge.md`.\n\n**Anti-patterns to flag in review mode:**\n- Montserrat + Roboto (or any \"top of Google Fonts by popularity\" combo) without a stated reason\n- Display faces (Playfair, Lobster, Pacifico) used for body text\n- More than 2 weight files loaded but only 1-2 used\n- Faux italic (no true italic in the font; browser synthesizes oblique)\n- Two fonts from the same category (e.g. two geometric sans) — looks like a mistake, not a choice\n- Full Japanese font loaded without subsetting (2MB+)\n\n---\n\n## 2. Heading Line Length\n\nHeadings follow different CPL rules than body text:\n\n| Level | Max CPL |\n|-------|---------|\n| Hero \u002F H1 | 30–40 |\n| H2 | 40–60 |\n| H3 | 50–65 |\n| Microcopy (CTAs) | 20–35 |\n\nLong H1s dilute the message. Cap hero text at ~35 characters.\n\n---\n\n## 3. Japanese Typography Overrides\n\n**Activate when:** `lang=\"ja\"` is present, Japanese characters appear in content, or the project brief mentions Japanese.\n\n**First action:** verify `lang=\"ja\"` is set on `\u003Chtml>` or the containing element. Without it, browser-level typography features (kinsoku, auto-phrase, text-autospace) do not activate.\n\n### 3.1 Block Defaults (Horizontal)\n```css\n:lang(ja) {\n  max-width: min(90vw, 38em);    \u002F* em, not ch — ch measures ASCII '0' *\u002F\n  line-height: 1.7;              \u002F* kanji have no ascenders\u002Fdescenders *\u002F\n  letter-spacing: 0.05em;        \u002F* aids character discrimination *\u002F\n  text-align: justify;           \u002F* horizontal only — no word spaces = no rivers *\u002F\n  text-align-last: left;\n  line-break: strict;            \u002F* JIS X 4051 kinsoku *\u002F\n  word-break: keep-all;\n  overflow-wrap: break-word;\n}\n```\nNote: `text-align: justify` applies to horizontal mode only. In vertical mode (`writing-mode: vertical-rl`), use `text-align: start` — justify stretches short columns to fill the height. See §3.8.\n\n### 3.2 Headings\n```css\n:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 {\n  line-height: 1.25;\n  letter-spacing: 0;\n  word-break: auto-phrase;  \u002F* phrase-boundary breaks, Chrome 119+ *\u002F\n}\n```\n\n### 3.3 Font Stacks\n```css\n\u002F* Gothic (sans-serif — UI, digital) *\u002F\n:lang(ja) {\n  font-family:\n    'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN',\n    'Yu Gothic', '游ゴシック体', YuGothic,\n    'Meiryo', 'メイリオ',\n    'Noto Sans JP', sans-serif;\n}\n\n\u002F* Mincho (serif — reading, editorial) *\u002F\n.reading-content:lang(ja) {\n  font-family:\n    'Hiragino Mincho ProN', 'ヒラギノ明朝 ProN',\n    'Yu Mincho', '游明朝体', YuMincho,\n    'Noto Serif JP', serif;\n}\n```\n\n### 3.4 Mixed Content\n```css\n\u002F* Japanese primary, Latin inline *\u002F\n:lang(ja) .latin-inline { font-size: 1.1em; }\n\n\u002F* Latin primary, Japanese inline *\u002F\n:lang(ja) span.ja-inline { font-size: 0.9em; }\n\n\u002F* Inter-script spacing (progressive) *\u002F\n@supports (text-autospace: ideograph-alpha) {\n  :lang(ja) { text-autospace: ideograph-alpha ideograph-numeric; }\n}\n```\n\n### 3.5 Punctuation Spacing\n```css\n\u002F* Native CSS (Chrome 118+) *\u002F\n:lang(ja) { text-spacing-trim: trim-start; }\n```\nFor broader support, consider the Yaku Han JP library for half-width punctuation.\n\n### 3.6 Emphasis (not italics)\n```css\n\u002F* Japanese emphasis = bōten dots, not italic *\u002F\n.emphasis-ja {\n  text-emphasis: filled circle;\n  text-emphasis-position: over right;\n}\n```\n\n### 3.7 Font Subsetting\nJapanese fonts are 2MB+. Always subset:\n```css\n@font-face {\n  font-family: 'Noto Sans JP';\n  src: url('...') format('woff2');\n  unicode-range: U+3000-9FFF, U+F900-FAFF, U+FF00-FFEF;\n}\n```\n\n### 3.8 Vertical Text (縦書き Tategaki)\n\nVertical Japanese text uses `writing-mode: vertical-rl` — columns flow top-to-bottom, right-to-left. This inverts many layout assumptions. Everything below was learned through implementation, not theory.\n\n**When to offer vertical mode:** Reading interfaces serving Japanese literary or editorial content should offer both horizontal and vertical as a reader preference, with per-content persistence (localStorage). Vertical is not purely an author decision — it is a legitimate reader choice for Japanese.\n\n```css\n\u002F* Vertical reading container *\u002F\n.vertical-content {\n  writing-mode: vertical-rl;\n  max-width: none;                         \u002F* width is unconstrained — content flows horizontally *\u002F\n  width: max-content;                      \u002F* REQUIRED — auto collapses in flex contexts *\u002F\n  height: min(calc(100dvh - 7rem), 22em);  \u002F* 20 chars\u002Fcolumn ≈ genkōyōshi standard *\u002F\n  font-family: var(--font-ja);\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n  text-align: start;                       \u002F* NOT justify — justify stretches short columns *\u002F\n}\n\n\u002F* Scroll container for vertical text *\u002F\n.vertical-scroll {\n  overflow-y: hidden;\n  overflow-x: auto;                        \u002F* horizontal scroll = \"read forward\" *\u002F\n  -webkit-overflow-scrolling: touch;\n  display: flex;\n  justify-content: center;                 \u002F* center when content is shorter than viewport *\u002F\n  align-items: center;                     \u002F* vertical centering of capped-height columns *\u002F\n}\n```\n\n**Critical implementation traps:**\n\n| Trap | Why it breaks | Fix |\n|------|--------------|-----|\n| `height` controls column length, not `max-width` | Axis inversion — vertical-rl swaps the meaning of width\u002Fheight | Use `height` to cap characters per column |\n| `width: auto` on vertical content | Collapses to zero in flex contexts | Use `width: max-content` |\n| `display: flex` on parent | Constrains vertical-rl children unpredictably | Use `display: block`, or add `flex-shrink: 0` on the vertical child |\n| `body { overflow-x: hidden }` | Common CSS reset clips vertical-rl overflow entirely | Remove or scope the reset; never apply globally when vertical text is present |\n| `text-align: justify` | Stretches short columns vertically to fill the height | Use `text-align: start` for vertical mode |\n| No scroll affordance | Users don't expect horizontal scrolling — \"read forward\" direction is invisible | Add a scroll hint (fade-out indicator) or swipe gesture cue |\n| Column height shorter than viewport | Text block hangs at top of viewport | Center vertically with flex `align-items: center` |\n\n**Column height target:** 20 characters per column ≈ 22em (with 0.05em letter-spacing). This follows the genkōyōshi (原稿用紙) manuscript paper standard. It is the vertical equivalent of `max-width: 65ch` for horizontal Latin text.\n\n### 3.9 Rule Inversions Summary\n\n| Property | Latin | Japanese (horizontal) | Japanese (vertical) |\n|----------|-------|-----------------------|---------------------|\n| CPL target | 60–65 | 30–40 | 20 chars\u002Fcolumn |\n| Column constraint | `max-width` | `max-width: 38em` | `height: 22em` |\n| Width unit | `ch` | `em` | `em` |\n| Line-height (body) | 1.5 | 1.7 | 1.7 |\n| Letter-spacing (body) | 0 | 0.05em | 0.05em |\n| Text alignment | left | justify | start |\n| Overflow\u002Fscroll | vertical | vertical | horizontal (right-to-left) |\n| Container width | constrained | constrained | `max-content` |\n| Parent layout | flex works | flex works | block safer |\n| Italics | available | never — use weight or text-emphasis | never |\n| `word-break` | default | `keep-all` | `keep-all` |\n| `line-break` | default | `strict` | `strict` |\n\n---\n\n## 4. Absolute Prohibitions\n\nThese are categorical. Flag as errors when auditing. Never produce them when generating.\n\n### Latin\n1. `text-align: justify` on Latin text\n2. `font-size` below 12px for any readable text\n3. `#000` on `#fff` for body text — soften both values\n4. `#000` as dark mode background — use `#121212`\n5. More than 6 distinct font sizes without documented reason\n6. Letter-spacing on mixed-case body text — only ALL-CAPS labels, max `0.05em`\n7. Full-width liquid layout for long-form reading\n8. Mechanical dark mode inversion — create dark-specific tokens\n9. ALL-CAPS for text longer than 4–5 words\n10. Omitting viewport meta tag for mobile-served pages\n\n### Japanese\n1. `word-break: break-all` on Japanese text — catastrophic\n2. `font-style: italic` on Japanese text — never\n3. `ch` units for Japanese column width — use `em`\n4. Omitting `lang=\"ja\"` — mandatory for correct rendering\n5. Full Japanese font without subsetting — 2MB+ unacceptable\n6. Default browser font for Japanese — MS Mincho is unusable\n7. `text-align: justify` without `text-align-last: left` (horizontal only)\n8. Ignoring punctuation spacing — full-width stacking creates gaps\n9. `text-align: justify` on vertical Japanese text — stretches short columns to fill height; use `start`\n10. `overflow-x: hidden` on `body` when vertical text is present — clips the entire reading surface\n11. `width: auto` on `writing-mode: vertical-rl` containers in flex contexts — collapses; use `max-content`\n\n---\n\n## 5. Non-Web Surfaces\n\nThe same principles apply to PDF, email, and document generation. The implementation changes.\n\n### PDF Generation\n- Line length: 60–65 characters per line. Set column width to achieve this.\n- Font size: 11–12pt body (print equivalent of 16–18px screen).\n- Line height: 1.4–1.5 for body (print needs slightly less than screen).\n- Contrast: ensure sufficient contrast for both screen viewing and print.\n- Japanese: 30–40 CPL, 1.6–1.7 line height.\n\n### Email Templates\n- Body font size: 16px minimum — email clients don't support `clamp()`.\n- Line length: constrain with `max-width` on the content table\u002Fdiv, target 550–600px.\n- Use inline styles — email clients strip `\u003Cstyle>` blocks unpredictably.\n- Dark mode: many email clients auto-invert. Test with and without `color-scheme: light dark`.\n- System font stacks only — web fonts are unreliable in email.\n- Japanese email: inline `lang=\"ja\"` on the wrapping element; use Noto Sans JP as web font if the ESP supports it, otherwise rely on system Gothic stack.\n\n### Document Generation (Markdown, DOCX, etc.)\n- Same CPL and line-height targets as web.\n- For Markdown rendered to HTML: the CSS token file (section 6) applies directly.\n- For DOCX: set paragraph style to equivalent values (11pt body, 1.5 line spacing, 6pt paragraph spacing).\n\n---\n\n## 6. CSS Token File\n\nWhen starting a new web project, generate this token file as the typography foundation:\n\n```css\n\u002F* typography-tokens.css *\u002F\n:root {\n  \u002F* Scale (1.25 major third) *\u002F\n  --size-xs:   0.75rem;\n  --size-sm:   0.875rem;\n  --size-base: 1rem;\n  --size-md:   1.25rem;\n  --size-lg:   1.5625rem;\n  --size-xl:   1.953rem;\n  --size-2xl:  2.441rem;\n  --size-3xl:  3.052rem;\n\n  \u002F* Line height *\u002F\n  --lh-body:     1.5;\n  --lh-heading:  1.1;\n  --lh-subhead:  1.2;\n  --lh-label:    1.3;\n  --lh-body-ja:  1.7;\n\n  \u002F* Japanese font stack *\u002F\n  --font-ja: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', '游ゴシック体', YuGothic, 'Meiryo', 'Noto Sans JP', sans-serif;\n\n  \u002F* Color — light *\u002F\n  --color-text:           #1a1a1a;\n  --color-text-secondary: #595959;\n  --color-text-disabled:  #8a8a8a;\n  --color-bg:             #f5f5f5;\n  --color-surface:        #ffffff;\n\n  \u002F* Reader font size control *\u002F\n  --fs-scale: 1;           \u002F* multiplier — toggle between 0.85, 1, 1.15 *\u002F\n\n  \u002F* Vertical Japanese *\u002F\n  --column-height-ja: 22em; \u002F* 20 chars\u002Fcolumn ≈ genkōyōshi *\u002F\n\n  \u002F* Spacing *\u002F\n  --paragraph-gap: 1.1em;\n\n  color-scheme: light dark;\n}\n\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-text:           #e8e8e8;\n    --color-text-secondary: #a0a0a0;\n    --color-text-disabled:  #606060;\n    --color-bg:             #121212;\n    --color-surface:        #1e1e1e;\n  }\n}\n\nbody {\n  font-size: calc(clamp(16px, 1.1vw + 14px, 18px) * var(--fs-scale));\n  line-height: var(--lh-body);\n  color: var(--color-text);\n  background-color: var(--color-bg);\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Noto Sans\", sans-serif;\n  font-optical-sizing: auto;\n}\n\n.reading-content {\n  max-width: min(90vw, 65ch);\n  margin-inline: auto;\n}\n\n.reading-content p + p { margin-block-start: var(--paragraph-gap); }\n\nh1 { font-size: clamp(28px, 4vw + 16px, 48px); line-height: var(--lh-heading); }\nh2 { font-size: clamp(22px, 2.5vw + 16px, 32px); line-height: var(--lh-heading);\n     margin-block-start: 2em; margin-block-end: 0.5em; }\nh3 { font-size: clamp(18px, 1.5vw + 14px, 25px); line-height: var(--lh-subhead);\n     margin-block-start: 1.75em; margin-block-end: 0.4em; }\n\n\u002F* Japanese overrides *\u002F\n:lang(ja) {\n  max-width: min(90vw, 38em);\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n  text-align: justify;\n  text-align-last: left;\n  line-break: strict;\n  word-break: keep-all;\n  overflow-wrap: break-word;\n  font-family: var(--font-ja);\n}\n\n:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 {\n  line-height: 1.25;\n  letter-spacing: 0;\n  word-break: auto-phrase;\n}\n\na { padding-block: 0.25em; }\n\n\u002F* Vertical Japanese reading *\u002F\n.vertical-content:lang(ja) {\n  writing-mode: vertical-rl;\n  max-width: none;\n  width: max-content;\n  height: min(calc(100dvh - 7rem), var(--column-height-ja));\n  text-align: start;\n  line-height: var(--lh-body-ja);\n  letter-spacing: 0.05em;\n}\n```\n\n---\n\n## 7. Project Ledger — `TYPOGRAPHY.md`\n\nEvery project this skill touches gets a `TYPOGRAPHY.md` file in the project root. This is the typography decision record for that project — what was found, what was changed, and why. It persists across sessions so anyone reading the project later understands the typographic choices without re-auditing.\n\n**Create it** at the end of every generative or review session. If it already exists, **append** a new session entry — never overwrite previous entries.\n\n### Structure\n\nUse this template. Fill in only the sections that apply to the current session.\n\n```markdown\n# Typography\n\nProject-specific typography decisions and audit history.\n\n---\n\n## Current State\n\n\u003C!-- Updated each session. This is a snapshot — overwrite on each visit. -->\n\n| Property | Value | Status |\n|----------|-------|--------|\n| Body CPL | e.g. 65ch | conforming \u002F non-conforming \u002F not set |\n| Body font size | e.g. clamp(16px, 1.1vw + 14px, 18px) | ... |\n| Body line-height | e.g. 1.5 | ... |\n| Light contrast | e.g. #1a1a1a on #f5f5f5 (~10:1) | ... |\n| Dark mode | e.g. #e8e8e8 on #121212 (~14:1) | ... |\n| Type scale | e.g. 1.25 major third, 6 sizes | ... |\n| Mobile viewport | present \u002F missing | ... |\n| Touch targets | ≥44px \u002F undersized \u002F not checked | ... |\n| Japanese support | yes \u002F no \u002F partial | ... |\n| Token file | e.g. typography-tokens.css | present \u002F absent |\n\n## Session Log\n\n### YYYY-MM-DD — [Generative | Review | Update]\n\n**Mode:** Generative \u002F Review\n**Surfaces touched:** e.g. main layout CSS, dark mode tokens, email template\n\n#### Before\n\u003C!-- What existed before this session. For new projects, write \"Greenfield — no prior typography.\" -->\n\n#### Decisions\n\u003C!-- What was set or changed, and the reasoning. Reference skill rule numbers. -->\n\n| Decision | Value chosen | Basis |\n|----------|-------------|-------|\n| e.g. Body CPL | 65ch | Skill §1.1 — Baymard sweet spot |\n| e.g. Dark bg | #121212 | Skill §1.5 — Material Design, depth cues |\n\n#### Violations Found\n\u003C!-- Review mode only. Leave blank for generative. -->\n\n| Property | Was | Should be | Fixed? |\n|----------|-----|-----------|--------|\n| e.g. Dark bg | #000000 | #121212 | yes |\n\n#### After\n\u003C!-- What the project looks like now. -->\n\n#### Open Items\n\u003C!-- Anything deferred, blocked, or needing user input. -->\n```\n\n### Rules\n\n- **Current State table:** overwrite each session with the latest snapshot. This is the \"at a glance\" view.\n- **Session Log entries:** append-only. Newest first. Never edit previous entries.\n- **Be specific.** Write actual hex values, actual pixel sizes, actual `clamp()` expressions — not \"improved contrast\" or \"fixed font size.\"\n- **Cite the skill.** Reference section numbers (e.g., \"Skill §1.1\", \"Skill §4, prohibition #3\") so decisions trace back to their basis.\n- **Greenfield projects** still get a Before section — write \"Greenfield — no prior typography\" so the record is complete.\n\n---\n\n## 8. Detailed Reference\n\nFor full rationale, research citations, and extended CSS examples:\n- Latin typography: read `references\u002Flatin-typography.md`\n- Japanese typography: read `references\u002Fjapanese-typography.md`\n- Font selection, pairing, personality, loading, and licensing: read `references\u002Ffont-knowledge.md`\n\nConsult these when a decision is not covered above, when advising on font selection, or when explaining a rule's basis to the user.\n",{"name":5,"description":7},"mine","1e7390741dffd3d5041fca4ebc056071ee3ba137","archives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography",5,"https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub","https:\u002F\u002Fgithub.com\u002FEthanYoQ","www.orz.md","Part Marketer, Part AI Explorer.","2026-11-07 14:52:29",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add EthanYoQ\u002FSkill-hub --skill typography",{"tool":58,"command":59},"bunx","bunx skills add EthanYoQ\u002FSkill-hub --skill typography",{"tool":61,"command":62},"pnpm","pnpm dlx skills add EthanYoQ\u002FSkill-hub --skill typography","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002FSKILL.md",true,[66,72,78,82],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},".gitignore","OTHER","其他",107,"https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002F.gitignore",{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Ffont-knowledge.md","REFERENCE","参考文档",20624,"https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002Freferences\u002Ffont-knowledge.md",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fjapanese-typography.md",21547,"https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002Freferences\u002Fjapanese-typography.md",{"path":83,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Flatin-typography.md",17962,"https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Farchives\u002Fuser-installed-skills\u002Ftypography\u002Fbc4e191c9c3dfa07\u002Ftypography\u002Freferences\u002Flatin-typography.md",[87,113,137,160,177,191],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":38},"01M713CBDSYARG4PXFXK2R2NNN","xhs-pharma-social-listening","Run evidence-disciplined Xiaohongshu social listening for foreign pharma employee pain points. Use when the user asks to collect and analyze notes\u002Fcomments about pharma companies, aliases, roles, compliance, medical affairs, or AI topics, then produce a cited and scored sampled-insight report. Includes independent-evidence counting, MediaCrawler batch collection, and CAPTCHA\u002F461 fallback to Agent Reach\u002FOpenCLI.","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fxhs-pharma-social-listening\u002FSKILL.md",[],[94,95,96,97,98,99,29,100,101,102,103,104,105,106,107,108,109,110,111,112],"social","xhs pharma social listening","social listening","xhs","medical","counting","collection","batch","analyze","notes","run","opencli","fallback","captcha","agent reach","evidence","for","collect","produce",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":38},"01M713C8Q76ZP0WXXBRAFKS6EE","healthcare-phi-compliance","Protected Health Information (PHI) and Personally Identifiable Information (PII) compliance patterns for healthcare applications. Covers data classification, access control, audit trails, encryption, and common leak vectors. Use when code touches PHI or PII in a healthcare system, or when auditing access control, audit trails, or leak vectors.","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fhealthcare-phi-compliance\u002FSKILL.md",[],[120,121,122,123,124,125,126,127,29,128,129,130,23,131,132,133,110,134,135,136],"healthcare","phi","compliance","healthcare phi compliance","pii","compliance patterns","information","access","encryption","code","common","data","patterns","Access Control","system","applications","Auditing Access Control",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":38},"01M713C5R2GE43X45T2K75TB76","healthcare-eval-harness","Patient safety evaluation harness for healthcare application deployments. Automated test suites for CDSS accuracy, PHI exposure, clinical workflow integrity, and integration compliance. Blocks deployments on safety failures. Use when a healthcare deployment must be gated on patient-safety tests for CDSS accuracy, PHI exposure, and workflow integrity.","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fhealthcare-eval-harness\u002FSKILL.md",[],[120,144,145,146,147,148,149,29,150,151,152,153,121,110,154,155,156,157,158,159],"eval","harness","healthcare eval harness","eval harness","clinical","patient","workflow","Evaluation","Safety","integrity","deployment","accuracy","tests","deployments","use","super",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":38},"01M713C2J17S91VYR7A8M696VR","healthcare-emr-patterns","EMR\u002FEHR development patterns for healthcare applications. Clinical safety, encounter workflows, prescription generation, clinical decision support integration, and accessibility-first UI for medical data entry. Use when building EMR or EHR features such as encounter workflows, prescription generation, or clinical data entry UI.","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fhealthcare-emr-patterns\u002FSKILL.md",[],[120,167,132,168,169,98,148,170,29,171,172,173,152,131,174,175,176,110,135,158],"EMR","healthcare emr patterns","decision","workflows","support","clinical decision support","features","ui","as","development",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":38},"01M713BZERTXV0N8X6SW9DDVWZ","healthcare-cdss-patterns","Clinical Decision Support System (CDSS) development patterns. Drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), alert severity classification, and integration into EMR workflows. Use when building clinical decision support — drug interaction checks, dose validation, clinical scoring, or alert severity.","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fhealthcare-cdss-patterns\u002FSKILL.md",[],[120,132,184,169,148,167,170,29,185,186,171,172,187,176,134,188,158,189,159,190],"healthcare cdss patterns","scoring","interaction","severity","classification","alert","decision support",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":197,"publishedAt":38},"01M713BVK3PQR7V4ZKYGMWMXJD","dxy-task-clarify","用户的请求含糊、缺背景、缺资料说明、缺读者或用途时使用。先用少量带选项的追问把任务问清楚，写成任务卡，用户确认后再执行。尤其适用于医生、科研人员和药企各岗位的工作，例如「帮我分析一下这些数据」「帮我准备明天的拜访」「写个总结」「做个 PPT」「回一下这封邮件」「整理一下会议纪要」「整理一下这些文献」「帮我准备下周的讲课」「写个病例汇报」「帮我写个提示词」。用户说「先问我」「帮我理清需求」「我不知道怎么描述」「我不会问 AI」时也使用。用途、资料、读者都已说清的请求，纯翻译，以及写代码、改代码，不使用。","https:\u002F\u002Fgithub.com\u002FEthanYoQ\u002FSkill-hub\u002Fblob\u002Fmine\u002Fskills\u002F10-business-industry\u002Fdxy-task-clarify\u002FSKILL.md",[],[198,199,200,201,202,203,204,205],"clarify","dxy task clarify","task","pptx","整理","翻译","数据","总结"]