79920c9e6c
Three strands of work on the chapter surface, all reading from the same constraint: this site ships no runtime dependencies, so every effect below is native CSS or an .astro component. Motion (src/styles/motion.css, DrawRule.astro). A scroll-driven layer of reveals, hero parallax, section depth, and a hairline that paints itself along its path, scrubbed by `animation-timeline: view()` — 0KB against lottie-web's ~60KB gzipped on the main thread. Every scrubbed rule sits inside `prefers-reduced-motion: no-preference` and `@supports`, so a Firefox reader or an opted-out one gets the complete static page rather than one with holes in it. Ranges key to `cover 40%`-`cover 75%` where the motion is meant to be watched: `view()` ranges key to first visibility, which on a 2600px page is long before anyone is reading the section. `.agents/skills/motion/references/scroll-driven.md` records the technique and the two ways `pathLength` normalisation was broken while building it. Diagrams (StepFlow.astro, WorktreeMap.astro). The `.steps` stack on /skills/, /models/, and /agents/ becomes a numbered flow with connectors, and /agents/ grows the worktree map it was describing in prose — reusing the `trees` collection rather than a second set of strings. The map's static variant is gated one class deeper than full-guide's page styles, so the interactive copy renders byte-identical. Connectors are pseudo-elements, not SVG: a stretched path desynchronises its own dash pattern, and a straight line does not need one. Mermaid was considered and rejected at ~1MB of runtime. Retrieval practice (/rules/, /skills/). A "check yourself" section of native `<details>` question/answer pairs plus a citation row, both bilingual through the existing `data-copy` toggle, and both JavaScript-free. Two audit blind spots surfaced and are closed rather than worked around: `build.inlineStylesheets: 'never'`, because Astro inlined sheets under ~4kB and audit-ui.mjs reads its colour and size baseline from dist/_astro/*.css; and `--columns` declared in the grid components, because an element-level custom property is not a declaration the audit can resolve. legacy/styles/skills.css is renamed and imported for its side effect. Inside a *page*, `?url` resolves to that page's own CSS chunk whatever file it names, so the link pointed at the wrong asset and the sheet was emitted but never loaded — the package preview had been rendering unstyled and overflowing since the Astro cutover. verify.mjs gains 5 assertions for the recall sections and their Portuguese copy: 89 now, against the 84 baseline. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
77 lines
2.8 KiB
Markdown
77 lines
2.8 KiB
Markdown
---
|
|
name: design-tokens
|
|
description:
|
|
Extract, name, and enforce the design token layer for the ai-for-dummies site.
|
|
Use when touching any colour, font size, spacing value, or breakpoint, when
|
|
consolidating the three drifted palettes, or when a check-tokens failure needs
|
|
resolving.
|
|
---
|
|
|
|
# Design tokens
|
|
|
|
## Before anything
|
|
|
|
Read [`../../context/design-system.md`](../../context/design-system.md). This
|
|
site has **three drifting palettes** and a **broken `@font-face`**. Both are
|
|
traps. If you have not read that file, you will "preserve the styles" by copying
|
|
a bug.
|
|
|
|
## Extracting
|
|
|
|
```bash
|
|
python3 - <<'PY'
|
|
import re
|
|
files=['legacy/styles/guide.css','legacy/styles/chapters.css','legacy/styles/skills-chapter.css',
|
|
'legacy/styles/skills-review.css','legacy/styles/change-lens.css',
|
|
'legacy/styles/audit.css','public/hands-on/starter/styles.css',
|
|
'public/hands-on/rules/styles.css']
|
|
seen={}
|
|
for f in files:
|
|
for m in re.finditer(r'--([a-z-]+):\s*([^;}]+)', open(f).read()):
|
|
seen.setdefault(m.group(1),{}).setdefault(m.group(2).strip(),[]).append(f)
|
|
for k,v in sorted(seen.items()):
|
|
print(f"--{k}:")
|
|
for val,fs in v.items(): print(f" {val:12} <- {', '.join(fs)}")
|
|
PY
|
|
```
|
|
|
|
Re-run this after any consolidation. Every token should print exactly one value.
|
|
|
|
## Consolidating a drifted token
|
|
|
|
1. List every value and where it is used (above).
|
|
2. Compute the perceptual delta. Sub-perceptual (a few units per channel) →
|
|
canonicalize freely. Visible (`--blue`: `#527f9f` vs `#215675`) → screenshot
|
|
both, get a human decision, record it in the task file.
|
|
3. Pick the canonical value. Prefer the one used on the most-visited surface.
|
|
4. Replace, then screenshot every affected page at 560/800/1100/1600 px.
|
|
5. Attach before/after images to the task report. "It looked fine to me" is not
|
|
evidence.
|
|
|
|
## Naming
|
|
|
|
Semantic, matching the existing vocabulary — `--ink`, `--paper`, `--muted`,
|
|
`--line`, `--accent`, `--gold`, `--blue`, `--deep`. Never numeric scales. New
|
|
surfaces extend semantically: `--surface-lab`, `--ink-inverse`.
|
|
|
|
## Type scale and breakpoints
|
|
|
|
Collapse the 14 ad-hoc `clamp()` triples to named steps and the 16 breakpoints
|
|
to five, per [`../../rules/theming.md`](../../rules/theming.md). When collapsing
|
|
a breakpoint, **screenshot at the old value** — that is where the regression is.
|
|
|
|
## Enforcing
|
|
|
|
```bash
|
|
node .agents/scripts/check-tokens.mjs # fails on raw hex outside tokens.css
|
|
```
|
|
|
|
Wire it into `pnpm run verify`. A rule nobody checks is a suggestion.
|
|
|
|
## The font decision
|
|
|
|
Do not self-host Manrope/DM Mono as part of a refactor task. The intended fonts
|
|
have never rendered, so adopting them is a visual redesign. Default to matching
|
|
what renders today (Arial / generic monospace) and delete the dead `@font-face`.
|
|
If a human wants the real fonts, that is its own task with its own screenshots.
|