qualia-framework 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CLAUDE.md +13 -1
  2. package/README.md +16 -13
  3. package/agents/builder.md +12 -20
  4. package/agents/plan-checker.md +18 -0
  5. package/agents/planner.md +9 -0
  6. package/agents/verifier.md +62 -0
  7. package/bin/agent-runs.js +233 -0
  8. package/bin/cli.js +225 -21
  9. package/bin/install.js +25 -5
  10. package/bin/plan-contract.js +220 -0
  11. package/bin/slop-detect.mjs +357 -0
  12. package/bin/state.js +199 -10
  13. package/docs/agent-runs.md +273 -0
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/plan-contract.md +321 -0
  16. package/hooks/auto-update.js +3 -7
  17. package/hooks/pre-compact.js +22 -11
  18. package/hooks/pre-deploy-gate.js +16 -2
  19. package/hooks/pre-push.js +22 -2
  20. package/hooks/stop-session-log.js +1 -1
  21. package/package.json +8 -2
  22. package/rules/design-brand.md +110 -0
  23. package/rules/design-laws.md +144 -0
  24. package/rules/design-product.md +110 -0
  25. package/rules/design-rubric.md +153 -0
  26. package/skills/qualia-build/SKILL.md +5 -5
  27. package/skills/qualia-flush/SKILL.md +1 -1
  28. package/skills/qualia-new/SKILL.md +40 -3
  29. package/skills/qualia-polish/SKILL.md +180 -136
  30. package/skills/qualia-quick/SKILL.md +1 -1
  31. package/skills/qualia-report/SKILL.md +25 -5
  32. package/skills/qualia-ship/SKILL.md +12 -10
  33. package/skills/zoho-workflow/SKILL.md +64 -0
  34. package/templates/DESIGN.md +229 -435
  35. package/templates/PRODUCT.md +95 -0
  36. package/templates/help.html +13 -7
  37. package/tests/bin.test.sh +6 -3
  38. package/tests/hooks.test.sh +9 -20
  39. package/tests/lib.test.sh +217 -0
  40. package/tests/runner.js +96 -75
  41. package/tests/state.test.sh +4 -3
  42. package/skills/qualia-design/SKILL.md +0 -169
@@ -1,475 +1,269 @@
1
- # Design System — {Project Name}
1
+ # DESIGN — {Project Name}
2
2
 
3
- > Source of truth for all frontend work. Builder agents read this before writing any component.
4
- > `/qualia-new` fills this during project setup. Update as design evolves.
5
- > Format inspired by [awesome-design-md](https://github.com/VoltAgent/awesome-design-md).
3
+ > Visual contract for `{project}`. Every Qualia agent reads this before any frontend work.
4
+ > `/qualia-new` generates the skeleton. Update as visual decisions firm up.
5
+ > Required pair: `PRODUCT.md` (sets the brief). This file (`DESIGN.md`) realizes it visually.
6
6
 
7
- ## 1. Visual Theme & Atmosphere
7
+ ## 1. Direction (mandatory commit, before any color or font)
8
8
 
9
- <!-- 2-3 paragraphs describing the FEEL of the site. Not what it does — what it FEELS like.
10
- What mood does it create? What's the design philosophy? What makes it distinctive?
11
- Example: "The site opens on a deep charcoal canvas with copper accents that feel
12
- like a luxury watch brand crossed with a fintech terminal. The custom variable font
13
- runs at weight 300 for headlines — light as confidence, not weakness." -->
9
+ ```
10
+ Aesthetic direction: {editorial · brutalist · luxury · maximalist · retro-futuristic · organic · terminal-native · sci-fi · pastoral · industrial · ...}
11
+ Color strategy: {Restrained · Committed · Full palette · Drenched}
12
+ Scene sentence: {one sentence: who uses this, where, ambient light, mood}
13
+ Differentiation: {what someone remembers 24 hours later}
14
+ ```
15
+
16
+ This block is the brief in 4 lines. Every other section in this file flows from it. If any other section disagrees, the brief wins or the brief gets rewritten.
17
+
18
+ ## 2. Color (OKLCH only)
19
+
20
+ > No `#hex`. No `rgb()`. No `hsl()`. OKLCH is the source. Translations happen at build time if at all.
21
+ > No pure `#000` or `#fff` — every neutral tinted toward the brand hue (chroma 0.005-0.015).
22
+
23
+ ### Tokens
24
+
25
+ ```css
26
+ :root {
27
+ /* Surfaces — tinted toward {hue} */
28
+ --bg: oklch(0.16 0.012 {hue}); /* page background */
29
+ --bg-2: oklch(0.20 0.014 {hue}); /* raised surface */
30
+ --surface: oklch(0.24 0.014 {hue}); /* card */
31
+ --surface-2: oklch(0.28 0.014 {hue}); /* card on card (rare — depth max 2) */
32
+
33
+ /* Text */
34
+ --text: oklch(0.94 0.006 {hue}); /* body */
35
+ --muted: oklch(0.66 0.010 {hue}); /* secondary */
36
+ --dim: oklch(0.50 0.012 {hue}); /* tertiary, captions */
37
+
38
+ /* Lines */
39
+ --line: oklch(0.32 0.012 {hue});
40
+ --line-soft: oklch(0.27 0.010 {hue});
41
+
42
+ /* Accent — the brand color */
43
+ --accent: oklch({L} {C} {H}); /* primary CTA, brand */
44
+ --accent-2: oklch({L-0.08} {C-0.01} {H}); /* hover */
45
+ --accent-bg: oklch({L} {C} {H} / 0.18); /* tinted bg */
46
+
47
+ /* Semantic (Product register only) */
48
+ --ok: oklch(0.78 0.14 152);
49
+ --warn: oklch(0.78 0.13 65);
50
+ --kill: oklch(0.66 0.16 22);
51
+ }
52
+ ```
53
+
54
+ ### Accent rules
55
+
56
+ - Brand register: ≤10% surface coverage IF Restrained, otherwise per strategy
57
+ - Product register: ≤10% surface coverage (Restrained default)
58
+ - Accent must be **sharp** — not a desaturated pastel-of-the-brand
59
+ - Accent contrast vs `--bg`: ≥4.5:1 (WCAG AA for text), ≥3:1 (UI components)
60
+
61
+ ### Contrast verification
14
62
 
15
- {Write the visual narrative here. Be specific about mood, density, and what makes this site NOT look AI-generated.}
63
+ ```
64
+ {role} on {role} — {ratio} (WCAG {AA · AA Large · FAIL})
65
+ text on bg — 12.4:1 (AA)
66
+ muted on bg — 5.8:1 (AA)
67
+ accent on bg — 6.2:1 (AA)
68
+ text on accent — 4.7:1 (AA)
69
+ ```
16
70
 
17
- **Key Characteristics:**
18
- - {Font choice and why — e.g., "Outfit at weight 300 for headlines — geometric, modern, not overused"}
19
- - {Color signature — e.g., "Deep charcoal (#1a1a2e) backgrounds with copper (#c9784e) accents"}
20
- - {Shadow approach — e.g., "Warm-tinted multi-layer shadows, not flat or neutral gray"}
21
- - {Border-radius philosophy — e.g., "Conservative 4-8px, nothing pill-shaped"}
22
- - {Layout approach — e.g., "Full-bleed sections, asymmetric grids, no card monotony"}
23
- - {One signature detail — e.g., "Noise texture overlay at 2% on hero, grain filter on images"}
71
+ ## 3. Typography
24
72
 
25
- ## 2. Color Palette & Roles
73
+ ```
74
+ Display: {font name} — {weight axis} — {use case}
75
+ Body: {font name} — {weight axis} — {use case}
76
+ Mono: {font name} — {weight axis} — {use case}
77
+ ```
26
78
 
27
- <!-- Every color must have a name, hex value, AND its role. No unnamed colors in code. -->
79
+ **Banned (per `design-laws.md`):** Inter, Roboto, Arial, system-ui, Space Grotesk, Helvetica.
28
80
 
29
- ### Primary
30
- - **{Brand Color Name}** (`#{hex}`): Primary brand identity. Used for {where}.
31
- - **{Heading Color}** (`#{hex}`): All headings. Not pure black — {warm/cool undertone}.
32
- - **{Background}** (`#{hex}`): Page background.
81
+ ### Scale
33
82
 
34
- ### Accent & CTA
35
- - **{Accent Name}** (`#{hex}`): CTAs, interactive highlights, links.
36
- - **{Accent Hover}** (`#{hex}`): Hover state for accent elements.
37
- - **{Secondary Accent}** (`#{hex}`): {role badges, decorative, gradients}.
83
+ | Token | Size | Line height | Letter spacing | Use |
84
+ |---|---|---|---|---|
85
+ | display | clamp(2.5rem, 5.5vw, 4.25rem) | 1.02 | -0.035em | hero |
86
+ | h1 | clamp(1.8rem, 3.6vw, 2.75rem) | 1.1 | -0.025em | section |
87
+ | h2 | clamp(1.4rem, 2.6vw, 2.1rem) | 1.15 | -0.02em | subsection |
88
+ | h3 | 1.25rem | 1.25 | -0.015em | card title |
89
+ | body | 0.95rem | 1.55 | 0 | paragraphs |
90
+ | small | 0.82rem | 1.5 | 0 | meta |
91
+ | caption | 0.7rem | 1.4 | +0.08em | labels (uppercase) |
38
92
 
39
- ### Neutral Scale
40
- - **{Text Primary}** (`#{hex}`): Body text, paragraphs.
41
- - **{Text Muted}** (`#{hex}`): Secondary text, descriptions, captions.
42
- - **{Text Subtle}** (`#{hex}`): Placeholders, hints, disabled text.
43
- - **{Border Default}** (`#{hex}`): Card borders, dividers.
44
- - **{Border Subtle}** (`#{hex}`): Faint separators, inactive states.
93
+ ### Numerals
45
94
 
46
- ### Semantic
47
- - **Success** (`#{hex}`): With icon. Background: `{rgba}`. Border: `{rgba}`.
48
- - **Warning** (`#{hex}`): With icon. Background: `{rgba}`. Border: `{rgba}`.
49
- - **Error** (`#{hex}`): With icon. Background: `{rgba}`. Border: `{rgba}`.
50
- - **Info** (`#{hex}`): With icon. Background: `{rgba}`. Border: `{rgba}`.
95
+ ```css
96
+ .tabular { font-feature-settings: "tnum" 1, "cv11" 1; }
97
+ ```
51
98
 
52
- ### Shadow Colors
53
- - **Primary Shadow** (`{rgba}`): {e.g., "Brand-tinted — warm brown-gray, not neutral"}.
54
- - **Secondary Shadow** (`{rgba}`): Reinforcement layer for depth.
55
- - **Ambient Shadow** (`{rgba}`): Soft lift for subtle elevation.
99
+ Apply to any column of numbers (tables, financial data, stats).
56
100
 
57
- ### CSS Variables
101
+ ### Body line length
58
102
 
59
103
  ```css
60
- :root {
61
- /* Brand */
62
- --color-primary: #{hex};
63
- --color-primary-hover: #{hex};
64
- --color-primary-subtle: #{hex};
104
+ .prose { max-width: 65ch; }
105
+ ```
65
106
 
66
- /* Accent */
67
- --color-accent: #{hex};
68
- --color-accent-hover: #{hex};
107
+ Cap at 65-75ch. Beyond that, eyes lose the line.
69
108
 
70
- /* Backgrounds */
71
- --color-bg: #{hex};
72
- --color-bg-subtle: #{hex};
73
- --color-bg-muted: #{hex};
109
+ ## 4. Spacing
74
110
 
75
- /* Text */
76
- --color-text: #{hex};
77
- --color-text-muted: #{hex};
78
- --color-text-subtle: #{hex};
79
-
80
- /* Borders */
81
- --color-border: #{hex};
82
- --color-border-subtle: #{hex};
83
-
84
- /* Semantic */
85
- --color-success: #{hex};
86
- --color-warning: #{hex};
87
- --color-error: #{hex};
88
- --color-info: #{hex};
89
-
90
- /* Shadows */
91
- --shadow-primary: {rgba};
92
- --shadow-secondary: {rgba};
93
- --shadow-ambient: {rgba};
94
- }
111
+ 8px grid, fluid where appropriate.
95
112
 
96
- /* Dark mode — rethink surfaces, don't just invert */
97
- [data-theme="dark"] {
98
- --color-bg: #{hex};
99
- --color-bg-subtle: #{hex};
100
- --color-text: #{hex};
101
- --color-text-muted: #{hex};
102
- --color-border: #{hex};
103
- /* ... override all tokens ... */
113
+ ```css
114
+ :root {
115
+ --space-1: 4px;
116
+ --space-2: 8px;
117
+ --space-3: 12px;
118
+ --space-4: 16px;
119
+ --space-6: 24px;
120
+ --space-8: 32px;
121
+ --space-12: 48px;
122
+ --space-16: 64px;
123
+ --space-24: 96px;
124
+
125
+ /* Fluid */
126
+ --pad-x: clamp(1rem, 5vw, 4rem); /* horizontal page padding */
127
+ --pad-section: clamp(2rem, 8vw, 6rem); /* vertical section padding */
128
+ --pad-card: 1.25rem 1.5rem; /* card interior */
129
+ --gap-stack: 1rem;
130
+ --gap-grid: 1.25rem;
104
131
  }
105
132
  ```
106
133
 
107
- **Contrast verification:**
108
- - Body text on background: {ratio} (must be >= 4.5:1)
109
- - Muted text on background: {ratio} (must be >= 4.5:1)
110
- - Accent on background: {ratio} (must be >= 3:1 for large text)
111
-
112
- ## 3. Typography Rules
113
-
114
- ### Font Families
115
- - **Display/Heading**: `'{Font Name}'`, {fallback stack}
116
- - **Body**: `'{Font Name}'`, {fallback stack}
117
- - **Mono**: `'{Font Name}'`, monospace
118
-
119
- **Google Fonts import:** `{URL}`
120
-
121
- **Never use:** Inter, Roboto, Arial, Helvetica, system-ui, Space Grotesk.
122
-
123
- ### Hierarchy Table
124
-
125
- | Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
126
- |------|------|------|--------|-------------|----------------|-------|
127
- | Display Hero | {display} | {clamp(2.5rem, 1rem + 4vw, 4rem)} | {weight} | 1.05 | {-0.02em} | Largest text on site |
128
- | Display | {display} | {clamp(2rem, 1rem + 3vw, 3rem)} | {weight} | 1.1 | {-0.015em} | Section heroes |
129
- | H1 | {heading} | {clamp(1.75rem, 1rem + 2.5vw, 2.5rem)} | {weight} | 1.15 | {-0.01em} | Page titles |
130
- | H2 | {heading} | {clamp(1.5rem, 0.75rem + 2vw, 2rem)} | {weight} | 1.2 | normal | Section titles |
131
- | H3 | {heading} | {clamp(1.25rem, 0.75rem + 1.5vw, 1.5rem)} | {weight} | 1.25 | normal | Subsection titles |
132
- | Body Large | {body} | {1.125rem} | 400 | 1.6 | normal | Intro text, feature descriptions |
133
- | Body | {body} | {1rem} | 400 | 1.6 | normal | Standard reading text |
134
- | Body Small | {body} | {0.875rem} | 400 | 1.5 | normal | Secondary text |
135
- | Caption | {body} | {0.75rem} | 500 | 1.4 | {0.02em} | Labels, metadata |
136
- | Button | {body} | {0.875rem–1rem} | 500 | 1.0 | {0.01em} | Button text |
137
- | Code | {mono} | {0.875rem} | 500 | 1.7 | normal | Code blocks |
138
-
139
- ### Principles
140
- - {e.g., "Weight 300 at display sizes — light as authority, not shouting"}
141
- - {e.g., "Progressive tracking: tighter letter-spacing at larger sizes"}
142
- - {e.g., "Two-weight simplicity: 300 for display, 400 for body/UI, 600 for emphasis only"}
143
- - Body text max-width: `65ch`. Everything else: fluid full-width.
144
- - Min body font size: 16px. Never smaller for reading text.
145
-
146
- ## 4. Component Specifications
147
-
148
- ### Buttons
149
-
150
- **Primary**
151
- - Background: `var(--color-accent)`
152
- - Text: `#ffffff`
153
- - Padding: {8px 20px}
154
- - Radius: {6px}
155
- - Font: {size} {font} weight {weight}
156
- - Hover: `var(--color-accent-hover)`, transition 150ms ease-out
157
- - Active: `transform: scale(0.98)`
158
- - Focus: `2px solid var(--color-accent)` offset 2px
159
- - Disabled: opacity 0.5, `cursor: not-allowed`, `aria-disabled="true"`
160
-
161
- **Secondary / Outlined**
162
- - Background: transparent
163
- - Text: `var(--color-accent)`
164
- - Border: `1px solid var(--color-border)`
165
- - Hover: `var(--color-bg-subtle)` background
166
-
167
- **Ghost**
168
- - Background: transparent
169
- - Text: `var(--color-text)`
170
- - Hover: `var(--color-bg-subtle)` background
171
-
172
- **Destructive**
173
- - Background: `var(--color-error)`
174
- - Text: `#ffffff`
175
- - Use: Only for irreversible actions with confirmation
176
-
177
- **Sizes:** sm (32px height), md (40px), lg (48px)
178
-
179
- ### Cards & Surfaces
180
-
181
- - Background: `var(--color-bg-subtle)`
182
- - Border: `1px solid var(--color-border-subtle)`
183
- - Radius: {8px}
184
- - Shadow (resting): `var(--shadow-ambient) 0px 4px 12px`
185
- - Shadow (hover): `var(--shadow-primary) 0px 8px 24px, var(--shadow-secondary) 0px 4px 12px`
186
- - Transition: shadow 200ms ease-out
187
- - **No identical card grids** — vary layout, size, and emphasis
188
-
189
- ### Inputs & Forms
190
-
191
- - Height: 40px (md), 48px (lg)
192
- - Border: `1px solid var(--color-border)`
193
- - Radius: {6px}
194
- - Focus: `2px solid var(--color-accent)` ring
195
- - Error: `var(--color-error)` border + error text below with `aria-describedby`
196
- - Label: visible `<label>` with `htmlFor` — never placeholder-only
197
- - Placeholder: `var(--color-text-subtle)`
198
-
199
- ### Badges / Status
200
-
201
- - Padding: 2px 8px
202
- - Radius: {4px}
203
- - Font: caption size, weight 500
204
- - Success: `var(--color-success)` bg at 0.15 alpha, text at full, border at 0.3 alpha
205
- - Warning: same pattern with `var(--color-warning)`
206
- - Error: same pattern with `var(--color-error)`
207
-
208
- ### Navigation
209
-
210
- - {Sticky header with backdrop-filter blur(12px) / Fixed sidebar / etc.}
211
- - Logo: {left-aligned / centered}
212
- - Links: {font, size, weight, color}
213
- - Active indicator: {underline / background / border-bottom}
214
- - Mobile: hamburger with drawer, 44px touch target
215
- - CTA button: accent color, right-aligned
216
-
217
- ### Toasts / Notifications
218
-
219
- - Position: {top-right / bottom-center}
220
- - `aria-live="polite"` for info, `"assertive"` for errors
221
- - Auto-dismiss: 5s minimum, dismissible via close button
222
- - Semantic coloring matching badge pattern
223
-
224
- ## 5. Layout & Spacing
225
-
226
- ### Spacing Scale (8px grid)
227
-
228
- `4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96 / 128`
229
-
230
- | Context | Value |
231
- |---------|-------|
232
- | Within components | 8–16px |
233
- | Between related elements | 16–24px |
234
- | Between sections | `clamp(3rem, 8vw, 6rem)` |
235
- | Page horizontal padding | `clamp(1rem, 5vw, 4rem)` |
236
- | Component gap | `clamp(1rem, 3vw, 2rem)` |
237
-
238
- ### Grid & Layout Strategy
239
-
240
- - **Full-width layouts** — no hardcoded `max-width: 1200px` caps
241
- - Prose/reading content: `max-width: 65ch`
242
- - Feature sections: varied layouts (side-by-side, staggered, asymmetric, full-bleed)
243
- - {Specific grid: e.g., "12-column CSS grid with fluid gutters"}
244
- - Break symmetry where it serves design — offset, overlap, diagonal flow
245
-
246
- ### Whitespace Philosophy
247
-
248
- {e.g., "Dense data, generous chrome. Financial tables are tightly packed, but the UI frame
249
- around them breathes. Sections alternate between dense content and generous breathing room."}
250
-
251
- ### Border Radius Scale
252
-
253
- | Level | Value | Use |
254
- |-------|-------|-----|
255
- | Micro | 2px | Subtle rounding, inline elements |
256
- | Standard | {4-6px} | Buttons, inputs, badges — the workhorse |
257
- | Comfortable | {8px} | Cards, containers |
258
- | Large | {12px} | Featured cards, hero elements |
259
- | Full | 9999px | Avatars, pills (use sparingly) |
260
-
261
- ## 6. Depth & Elevation
262
-
263
- | Level | Shadow | Use |
264
- |-------|--------|-----|
265
- | Flat (0) | none | Page background, inline content |
266
- | Subtle (1) | `var(--shadow-ambient) 0px 1px 3px` | Resting cards, slight lift |
267
- | Standard (2) | `var(--shadow-primary) 0px 4px 12px` | Cards, panels |
268
- | Elevated (3) | `var(--shadow-primary) 0px 8px 24px, var(--shadow-secondary) 0px 4px 12px` | Dropdowns, popovers, hover cards |
269
- | Overlay (4) | `var(--shadow-primary) 0px 16px 48px, var(--shadow-secondary) 0px 8px 24px` | Modals, dialogs, floating panels |
270
- | Focus ring | `0 0 0 2px var(--color-accent)` | Keyboard focus (non-negotiable) |
271
-
272
- **Shadow philosophy:** {e.g., "Brand-tinted shadows — use warm rgba tones that echo the palette,
273
- not neutral gray. Multi-layer: branded far shadow + neutral close shadow for depth parallax."}
274
-
275
- ## 7. Do's and Don'ts
276
-
277
- ### Do
278
- - {e.g., "Use weight 300 for display headlines — lightness is the signature"}
279
- - {e.g., "Apply brand-tinted shadows on all elevated elements"}
280
- - {e.g., "Use the accent color ONLY for interactive/CTA elements — never decorative"}
281
- - {e.g., "Keep border-radius within the defined scale — consistency over creativity"}
282
- - {e.g., "Layer surfaces: bg → subtle → muted, each one shade step apart"}
283
- - Use `cursor: pointer` on every clickable element
284
- - Use CSS variables for every color — zero scattered hex values in components
285
- - Use `clamp()` for fluid typography and spacing
286
- - Test at 320px, 768px, 1024px, 1440px before shipping
287
-
288
- ### Don't
289
- - {e.g., "Don't use bold (700) for headlines — this brand uses light weights"}
290
- - {e.g., "Don't use pill-shaped buttons (border-radius: 9999px) — conservative rounding only"}
291
- - {e.g., "Don't use warm accents (orange, yellow) for interactive elements"}
292
- - Don't use Inter, Roboto, Arial, Helvetica, system-ui, Space Grotesk
293
- - Don't use blue-purple gradients (AI slop tell #1)
294
- - Don't use identical card grids — vary layout and emphasis
295
- - Don't use `outline: none` without a visible focus replacement
296
- - Don't use `max-width: 1200px` or `1280px` containers — go full-width fluid
297
- - Don't use placeholder-only form inputs — always pair with visible `<label>`
298
- - Don't ship gray-on-gray text (#999 on #fff fails WCAG)
299
-
300
- ## 8. Responsive Behavior
301
-
302
- ### Breakpoints
303
-
304
- | Name | Width | Key Changes |
305
- |------|-------|-------------|
306
- | Mobile | < 640px | Single column, stacked nav, reduced heading sizes |
307
- | Tablet | 640–1023px | 2-column grids, condensed nav |
308
- | Desktop | 1024–1279px | Full layout, expanded nav |
309
- | Large | >= 1280px | Maximum content width, generous margins |
310
-
311
- ### Collapsing Strategy
312
-
313
- | Element | Desktop | Tablet | Mobile |
314
- |---------|---------|--------|--------|
315
- | Navigation | Full horizontal + CTA | Condensed or hamburger | Hamburger + drawer |
316
- | Hero | {Side-by-side / full-width} | {Stacked, padded} | {Stacked, full-width} |
317
- | Feature sections | {3-column / asymmetric} | {2-column} | {Single column stacked} |
318
- | Sidebar | Always visible | Collapsible | Hidden, overlay |
319
- | Tables | Full table | Scroll with sticky col | Card view |
320
- | Modals | Centered, max-width | Centered, 80% width | Full screen |
321
-
322
- ### Touch Targets
323
- - All interactive elements: 44x44px minimum (48px recommended)
324
- - Adequate spacing between tap targets (8px minimum gap)
325
- - Mobile nav toggle: prominent, easy to reach
326
-
327
- ### Image Behavior
328
- - `next/image` with explicit `width`/`height` (prevent layout shift)
329
- - Responsive `srcset` for different densities
330
- - `max-width: 100%`, `height: auto` on all images
331
- - Lazy-load below-fold images
332
-
333
- ## 9. Agent Prompt Guide
334
-
335
- ### Quick Color Reference
336
- - Primary CTA: {Name} (`#{hex}`)
337
- - CTA Hover: {Name} (`#{hex}`)
338
- - Page background: {Name} (`#{hex}`)
339
- - Heading text: {Name} (`#{hex}`)
340
- - Body text: {Name} (`#{hex}`)
341
- - Muted text: {Name} (`#{hex}`)
342
- - Border: {Name} (`#{hex}`)
343
- - Link: {Name} (`#{hex}`)
344
- - Dark section: {Name} (`#{hex}`)
345
- - Success: (`#{hex}`)
346
- - Error: (`#{hex}`)
347
-
348
- ### Example Component Prompts
349
-
350
- **Hero section:**
351
- "{Describe: background color, headline font/size/weight/color/spacing, subtitle treatment, CTA button specs, layout}"
352
-
353
- **Card:**
354
- "{Describe: background, border, radius, shadow (exact rgba), title font treatment, body text treatment}"
355
-
356
- **Form:**
357
- "{Describe: input border/radius/height, focus ring, label treatment, error state, submit button}"
358
-
359
- ### Iteration Checklist
360
- 1. Always use CSS variables — never hardcode colors in components
361
- 2. {Font rule — e.g., "Enable ss01 on all display font text"}
362
- 3. {Weight rule — e.g., "Default to 300; use 400 only for UI/buttons"}
363
- 4. {Shadow rule — e.g., "Always use branded rgba, never neutral gray shadows"}
364
- 5. {Heading rule — e.g., "Heading color is deep navy, not black — warmth matters"}
365
- 6. {Radius rule — e.g., "Stay within 4-8px range except avatars"}
366
-
367
- ## 10. Accessibility (Non-Negotiable)
368
-
369
- ### Perceivable
370
- - [ ] All images: descriptive `alt` text (decorative: `alt=""` + `aria-hidden="true"`)
371
- - [ ] Color contrast: 4.5:1 normal text, 3:1 large text (18px+ bold / 24px+)
372
- - [ ] Color contrast: 3:1 for UI components and graphical objects
373
- - [ ] Information not conveyed by color alone — icons, text, patterns as supplements
374
- - [ ] Text resizable to 200% without loss of content
375
- - [ ] Content reflows at 320px (no horizontal scroll)
376
-
377
- ### Operable
378
- - [ ] All functionality available via keyboard (Tab, Enter, Space, Escape, Arrows)
379
- - [ ] No keyboard traps (except focus traps in modals)
380
- - [ ] Visible focus indicator on every interactive element
381
- - [ ] Skip navigation link: `<a href="#main" class="sr-only focus:not-sr-only">`
382
- - [ ] Touch targets: 44x44px minimum
383
- - [ ] Page titles are descriptive and unique
384
-
385
- ### Understandable
386
- - [ ] Form inputs have visible `<label>` linked via `htmlFor`
387
- - [ ] Error messages identify the field and describe the fix
388
- - [ ] Required fields: `aria-required="true"` + visual indicator
389
- - [ ] `<html lang="en">` set
390
- - [ ] Consistent navigation across pages
391
-
392
- ### Robust
393
- - [ ] Semantic HTML: `<nav>`, `<main>`, `<article>`, `<section>`, `<header>`, `<footer>`
394
- - [ ] One `<h1>` per page, sequential heading order
395
- - [ ] ARIA used correctly when HTML semantics aren't enough
396
- - [ ] Dynamic content: `aria-live="polite"` for updates, `"assertive"` for errors
397
- - [ ] Modals: focus trap, close on Escape, `aria-modal="true"`, restore focus on close
398
-
399
- ## 11. Hardening Criteria
400
-
401
- Before shipping, stress-test:
402
-
403
- - [ ] **Long text:** 200-character username, 3-paragraph description — does layout hold?
404
- - [ ] **Empty everywhere:** all lists empty, all data missing — helpful empty states?
405
- - [ ] **Error everywhere:** every fetch fails — error states visible and recoverable?
406
- - [ ] **320px viewport:** nothing overflows, clips, or overlaps
407
- - [ ] **Keyboard only:** Tab through entire app — everything reachable, focus visible?
408
- - [ ] **Slow network:** loading states visible? Content streams, doesn't flash?
409
- - [ ] **RTL text:** if applicable, does layout mirror correctly?
410
- - [ ] **Zoom 200%:** content still usable, nothing hidden?
411
-
412
- ## 12. Anti-Slop Detection
413
-
414
- <!-- These patterns are checked by /qualia-polish grep scans. Any matches = mandatory fix. -->
415
-
416
- | Pattern | Check | Fix |
417
- |---------|-------|-----|
418
- | Generic fonts | `grep -rn "Inter\|Roboto\|Arial\|Helvetica\|system-ui\|Space.Grotesk"` | Replace with project fonts |
419
- | Hardcoded containers | `grep -rn "max-w-7xl\|max-w-\[1200\|max-width.*1200"` | Use fluid `clamp()` padding |
420
- | Blue-purple gradients | `grep -rn "from-blue.*to-purple\|from-purple.*to-blue"` | Use brand colors |
421
- | Card grid monotony | `grep -rn "grid-cols-3\|grid-cols-4"` in component files | Vary layout and emphasis |
422
- | Scattered hex colors | `grep -rn "text-\[#\|bg-\[#\|border-\[#"` count > 5 | Use CSS variables |
423
- | Missing focus styles | `grep -rn "outline: none\|outline:none"` | Add visible focus replacement |
424
- | Placeholder-only inputs | `<input>` without adjacent `<label>` | Add visible label |
425
-
426
- ## Motion Reference
427
-
428
- ### Duration Table
429
-
430
- | Action | Duration | Easing |
431
- |--------|----------|--------|
432
- | Micro-feedback (press, toggle) | 100ms | ease-out |
433
- | Hover/focus | 150ms | ease-out |
434
- | Tooltip, dropdown | 200ms | ease-out |
435
- | Expand/collapse | 250ms | ease-in-out |
436
- | Page element enter | 300ms | `cubic-bezier(0, 0, 0.2, 1)` |
437
- | Page/route transition | 400ms | `cubic-bezier(0.4, 0, 0.2, 1)` |
438
- | Complex orchestration | 500–800ms | staggered |
439
-
440
- ### Easing Curves
134
+ **Vary spacing for rhythm.** Same padding everywhere is monotony. Tight within groups, generous between sections.
135
+
136
+ ## 5. Components
137
+
138
+ Token-driven. Every component composes from above.
139
+
140
+ ### Buttons (Product register: 3 variants max)
141
+
142
+ ```css
143
+ .btn-primary { background: var(--accent); color: var(--bg); padding: 0.6rem 1.1rem; border-radius: 6px; }
144
+ .btn-secondary { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
145
+ .btn-ghost { background: transparent; color: var(--text); }
146
+ .btn-danger { background: var(--kill); color: oklch(0.94 0.006 220); }
147
+ ```
148
+
149
+ ### Inputs
150
+
151
+ - Visible label, never placeholder-only
152
+ - Focus ring: 2px offset, `--accent` color
153
+ - Error: `aria-describedby` linked to inline error text
154
+
155
+ ### Cards
441
156
 
442
157
  ```css
443
- --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
444
- --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
445
- --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
446
- --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
158
+ .card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: var(--pad-card); }
447
159
  ```
448
160
 
449
- ### Stagger Pattern
161
+ **Container depth max 2.** No card-on-card.
162
+
163
+ ### Tables (Product register)
164
+
165
+ - Tabular numerals on numeric columns
166
+ - Sticky header on scroll
167
+ - Right-align numbers, left-align text
168
+ - Sort indicator on hover, persistent on active
169
+ - Row hover background: `--bg-2`
170
+
171
+ ## 6. Depth & elevation
172
+
173
+ 3 levels max. OKLCH-tinted shadows, never neutral gray.
450
174
 
451
175
  ```css
452
- @keyframes fadeUp {
453
- from { opacity: 0; transform: translateY(12px); }
454
- to { opacity: 1; transform: translateY(0); }
176
+ :root {
177
+ --elev-1: 0 1px 2px oklch(0.10 0.02 {hue} / 0.15);
178
+ --elev-2: 0 2px 8px oklch(0.10 0.02 {hue} / 0.18);
179
+ --elev-3: 0 12px 32px oklch(0.10 0.02 {hue} / 0.25);
455
180
  }
456
- .stagger > * { animation: fadeUp 300ms var(--ease-decelerate) both; }
457
- .stagger > *:nth-child(1) { animation-delay: 0ms; }
458
- .stagger > *:nth-child(2) { animation-delay: 60ms; }
459
- .stagger > *:nth-child(3) { animation-delay: 120ms; }
460
- .stagger > *:nth-child(4) { animation-delay: 180ms; }
461
- .stagger > *:nth-child(5) { animation-delay: 240ms; }
462
181
  ```
463
182
 
464
- ### Reduced Motion (mandatory)
183
+ Use elevation semantically: `elev-1` for hovered cards, `elev-2` for popovers, `elev-3` for modals.
184
+
185
+ ## 7. Motion
465
186
 
466
187
  ```css
188
+ :root {
189
+ /* Easing */
190
+ --ease-out-quart: cubic-bezier(0.22, 1, 0.36, 1);
191
+ --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
192
+ --ease-out-std: cubic-bezier(0, 0, 0.2, 1);
193
+
194
+ /* Duration */
195
+ --d-instant: 100ms; /* hover, focus */
196
+ --d-quick: 150ms; /* tooltip, dropdown */
197
+ --d-default: 200ms; /* panel slide */
198
+ --d-section: 300ms; /* page transition */
199
+ --d-feature: 500ms; /* signature motion */
200
+ }
201
+
467
202
  @media (prefers-reduced-motion: reduce) {
468
203
  *, *::before, *::after {
469
204
  animation-duration: 0.01ms !important;
470
- animation-iteration-count: 1 !important;
471
205
  transition-duration: 0.01ms !important;
472
- scroll-behavior: auto !important;
473
206
  }
474
207
  }
475
208
  ```
209
+
210
+ **Don't animate layout properties** (`width`, `height`, `top`, `left`, `margin`, `padding`). Animate `transform` and `opacity` only.
211
+
212
+ **No bounce. No elastic.** Ease out with exponential curves.
213
+
214
+ ### Signature motion (Brand register only)
215
+
216
+ Pick ONE. Document below what it is and where it lives.
217
+
218
+ ```
219
+ Signature: {parallax · cursor-follow · letter reveal · scroll scrub · magnetic buttons · morphing shapes · ...}
220
+ Where: {homepage hero · /work case studies · ...}
221
+ ```
222
+
223
+ ## 8. Iconography
224
+
225
+ ```
226
+ Family: {Lucide · Heroicons · Phosphor · Radix Icons · custom}
227
+ Stroke: {1.5px · 2px}
228
+ Size: {16px / 20px / 24px}
229
+ ```
230
+
231
+ ONE icon family. Mixing icon families is the visual equivalent of mixing fonts.
232
+
233
+ ## 9. Responsive
234
+
235
+ Mobile-first. Test at 375 / 768 / 1280.
236
+
237
+ ```
238
+ Breakpoints:
239
+ sm: 640px
240
+ md: 768px
241
+ lg: 1024px
242
+ xl: 1280px
243
+ 2xl: 1536px
244
+
245
+ Touch targets: 44×44px minimum
246
+ Tables on mobile: card view OR horizontal scroll with sticky first col
247
+ Navigation: hamburger drawer on mobile, full horizontal on lg+
248
+ ```
249
+
250
+ ## 10. Anti-pattern checklist (mandatory before commit)
251
+
252
+ - [ ] No `#000` or `#fff` (only OKLCH)
253
+ - [ ] No banned fonts (Inter, Roboto, Arial, system-ui, Space Grotesk)
254
+ - [ ] No purple-blue gradients
255
+ - [ ] No side-stripe borders (`border-left: ≥2px` decorative)
256
+ - [ ] No gradient text (`background-clip: text`)
257
+ - [ ] No identical card grids of 3
258
+ - [ ] No "Get Started" / "Learn More"
259
+ - [ ] No em dashes in copy (— or `--`)
260
+ - [ ] No `max-w-7xl` or hardcoded width caps
261
+ - [ ] No glassmorphism by default
262
+ - [ ] No modal as first thought
263
+ - [ ] Container depth ≤ 2 on cards/panels
264
+ - [ ] One icon family
265
+ - [ ] `prefers-reduced-motion` respected
266
+ - [ ] Touch targets ≥ 44×44px
267
+ - [ ] WCAG AA contrast verified
268
+
269
+ `bin/slop-detect.mjs` runs this checklist automatically. Builders run it before every commit.