@champpaba/claude-agent-kit 1.0.0 → 1.1.1

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 (84) hide show
  1. package/{template/.claude → .claude}/CHANGELOG-v1.1.1.md +259 -259
  2. package/{template/.claude → .claude}/CLAUDE.md +555 -329
  3. package/{template/.claude → .claude}/agents/01-integration.md +797 -797
  4. package/{template/.claude → .claude}/agents/02-uxui-frontend.md +955 -899
  5. package/{template/.claude → .claude}/agents/03-test-debug.md +759 -759
  6. package/{template/.claude → .claude}/agents/04-frontend.md +1099 -1099
  7. package/{template/.claude → .claude}/agents/05-backend.md +1217 -1217
  8. package/{template/.claude → .claude}/agents/06-database.md +969 -969
  9. package/{template/.claude → .claude}/commands/agentsetup.md +1464 -1464
  10. package/{template/.claude → .claude}/commands/cdev.md +327 -327
  11. package/{template/.claude → .claude}/commands/csetup.md +447 -447
  12. package/{template/.claude → .claude}/commands/cstatus.md +60 -60
  13. package/{template/.claude → .claude}/commands/cview.md +364 -364
  14. package/.claude/commands/designsetup.md +838 -0
  15. package/.claude/commands/extract.md +1005 -0
  16. package/.claude/commands/pageplan.md +327 -0
  17. package/{template/.claude → .claude}/commands/psetup.md +101 -101
  18. package/{template/.claude → .claude}/contexts/design/accessibility.md +611 -611
  19. package/{template/.claude → .claude}/contexts/design/box-thinking.md +566 -553
  20. package/{template/.claude → .claude}/contexts/design/color-theory.md +519 -498
  21. package/{template/.claude → .claude}/contexts/design/index.md +290 -247
  22. package/{template/.claude → .claude}/contexts/design/layout.md +400 -400
  23. package/{template/.claude → .claude}/contexts/design/responsive.md +551 -551
  24. package/{template/.claude → .claude}/contexts/design/shadows.md +522 -522
  25. package/{template/.claude → .claude}/contexts/design/spacing.md +445 -428
  26. package/{template/.claude → .claude}/contexts/design/typography.md +465 -465
  27. package/{template/.claude → .claude}/contexts/domain/README.md +164 -164
  28. package/{template/.claude → .claude}/contexts/patterns/agent-coordination.md +388 -388
  29. package/{template/.claude → .claude}/contexts/patterns/agent-discovery.md +182 -182
  30. package/{template/.claude → .claude}/contexts/patterns/change-workflow.md +538 -538
  31. package/{template/.claude → .claude}/contexts/patterns/code-standards.md +515 -515
  32. package/{template/.claude → .claude}/contexts/patterns/development-principles.md +513 -513
  33. package/{template/.claude → .claude}/contexts/patterns/error-handling.md +478 -478
  34. package/{template/.claude → .claude}/contexts/patterns/error-recovery.md +365 -365
  35. package/{template/.claude → .claude}/contexts/patterns/logging.md +424 -424
  36. package/{template/.claude → .claude}/contexts/patterns/task-breakdown.md +452 -452
  37. package/{template/.claude → .claude}/contexts/patterns/task-classification.md +523 -523
  38. package/{template/.claude → .claude}/contexts/patterns/tdd-classification.md +516 -516
  39. package/{template/.claude → .claude}/contexts/patterns/testing.md +413 -413
  40. package/{template/.claude → .claude}/contexts/patterns/validation-framework.md +776 -776
  41. package/{template/.claude → .claude}/lib/README.md +39 -39
  42. package/{template/.claude → .claude}/lib/agent-executor.md +258 -258
  43. package/{template/.claude → .claude}/lib/agent-router.md +572 -572
  44. package/{template/.claude → .claude}/lib/flags-updater.md +469 -469
  45. package/{template/.claude → .claude}/lib/tdd-classifier.md +345 -345
  46. package/{template/.claude → .claude}/lib/validation-gates.md +484 -484
  47. package/{template/.claude → .claude}/settings.local.json +42 -42
  48. package/.claude/templates/STYLE_GUIDE.template.md +879 -0
  49. package/{template/.claude → .claude}/templates/context-template.md +45 -45
  50. package/{template/.claude → .claude}/templates/flags-template.json +42 -42
  51. package/.claude/templates/page-plan-example.md +562 -0
  52. package/{template/.claude → .claude}/templates/phase-templates.json +124 -124
  53. package/{template/.claude → .claude}/templates/phases-sections/accessibility-test.md +17 -17
  54. package/{template/.claude → .claude}/templates/phases-sections/api-design.md +37 -37
  55. package/{template/.claude → .claude}/templates/phases-sections/backend-tests.md +16 -16
  56. package/{template/.claude → .claude}/templates/phases-sections/backend.md +37 -37
  57. package/{template/.claude → .claude}/templates/phases-sections/business-logic-validation.md +16 -16
  58. package/{template/.claude → .claude}/templates/phases-sections/component-tests.md +17 -17
  59. package/{template/.claude → .claude}/templates/phases-sections/contract-backend.md +16 -16
  60. package/{template/.claude → .claude}/templates/phases-sections/contract-frontend.md +16 -16
  61. package/{template/.claude → .claude}/templates/phases-sections/database.md +35 -35
  62. package/{template/.claude → .claude}/templates/phases-sections/documentation.md +17 -17
  63. package/{template/.claude → .claude}/templates/phases-sections/e2e-tests.md +16 -16
  64. package/{template/.claude → .claude}/templates/phases-sections/fix-implementation.md +17 -17
  65. package/{template/.claude → .claude}/templates/phases-sections/frontend-integration.md +18 -18
  66. package/{template/.claude → .claude}/templates/phases-sections/frontend-mockup.md +123 -123
  67. package/{template/.claude → .claude}/templates/phases-sections/manual-flow-test.md +15 -15
  68. package/{template/.claude → .claude}/templates/phases-sections/manual-ux-test.md +16 -16
  69. package/{template/.claude → .claude}/templates/phases-sections/refactor-implementation.md +17 -17
  70. package/{template/.claude → .claude}/templates/phases-sections/refactor.md +16 -16
  71. package/{template/.claude → .claude}/templates/phases-sections/regression-tests.md +15 -15
  72. package/{template/.claude → .claude}/templates/phases-sections/report.md +16 -16
  73. package/{template/.claude → .claude}/templates/phases-sections/responsive-test.md +16 -16
  74. package/{template/.claude → .claude}/templates/phases-sections/script-implementation.md +43 -43
  75. package/{template/.claude → .claude}/templates/phases-sections/test-coverage.md +16 -16
  76. package/{template/.claude → .claude}/templates/phases-sections/user-approval.md +14 -14
  77. package/LICENSE +21 -21
  78. package/README.md +758 -331
  79. package/lib/init.js +1 -1
  80. package/lib/update.js +1 -1
  81. package/package.json +2 -2
  82. /package/{template/.claude → .claude}/contexts/patterns/frontend-component-strategy.md +0 -0
  83. /package/{template/.claude → .claude}/contexts/patterns/git-workflow.md +0 -0
  84. /package/{template/.claude → .claude}/contexts/patterns/ui-component-consistency.md +0 -0
@@ -1,428 +1,445 @@
1
- # Spacing System
2
-
3
- > **Purpose:** Consistent spacing scale for layouts, components, and rhythm
4
-
5
- ---
6
-
7
- ## Base Unit Approach
8
-
9
- **Core Principle:** All spacing should be multiples of a base unit for consistency
10
-
11
- ```css
12
- --spacing: 0.25rem; /* 4px - Base spacing unit (at default 16px root font size) */
13
- ```
14
-
15
- **Why 0.25rem (4px)?**
16
- - ✅ Divisible by 2, 4, 8 (common design ratios)
17
- - ✅ Works with 8px grid systems (common in Figma, Sketch)
18
- - Small enough for fine-tuning
19
- - Large enough to be visually meaningful
20
-
21
- ---
22
-
23
- ## Spacing Scale
24
-
25
- ### Standard Scale (Multiples of Base)
26
-
27
- | Token | Value | Pixels | Common Use Case |
28
- |-------|-------|--------|-----------------|
29
- | `spacing-1` | 0.25rem | 4px | Tiny gaps (icon padding, tight spacing) |
30
- | `spacing-2` | 0.5rem | 8px | Small gaps (button padding, input padding) |
31
- | `spacing-3` | 0.75rem | 12px | Medium gaps (card padding, list items) |
32
- | `spacing-4` | 1rem | 16px | Default gaps (section spacing, form fields) |
33
- | `spacing-5` | 1.25rem | 20px | Between default and large |
34
- | `spacing-6` | 1.5rem | 24px | Large gaps (component spacing, cards) |
35
- | `spacing-8` | 2rem | 32px | XL gaps (section margins, page headers) |
36
- | `spacing-10` | 2.5rem | 40px | XXL gaps (major sections) |
37
- | `spacing-12` | 3rem | 48px | XXXL gaps (page margins, hero sections) |
38
- | `spacing-16` | 4rem | 64px | Huge gaps (full section spacing) |
39
- | `spacing-20` | 5rem | 80px | Extra huge (landing page sections) |
40
- | `spacing-24` | 6rem | 96px | Maximum (hero padding, page dividers) |
41
-
42
- ### Implementation
43
-
44
- ```css
45
- :root {
46
- /* Base unit */
47
- --spacing-base: 0.25rem;
48
-
49
- /* Scale */
50
- --spacing-1: calc(var(--spacing-base) * 1); /* 0.25rem / 4px */
51
- --spacing-2: calc(var(--spacing-base) * 2); /* 0.5rem / 8px */
52
- --spacing-3: calc(var(--spacing-base) * 3); /* 0.75rem / 12px */
53
- --spacing-4: calc(var(--spacing-base) * 4); /* 1rem / 16px */
54
- --spacing-5: calc(var(--spacing-base) * 5); /* 1.25rem / 20px */
55
- --spacing-6: calc(var(--spacing-base) * 6); /* 1.5rem / 24px */
56
- --spacing-8: calc(var(--spacing-base) * 8); /* 2rem / 32px */
57
- --spacing-10: calc(var(--spacing-base) * 10); /* 2.5rem / 40px */
58
- --spacing-12: calc(var(--spacing-base) * 12); /* 3rem / 48px */
59
- --spacing-16: calc(var(--spacing-base) * 16); /* 4rem / 64px */
60
- --spacing-20: calc(var(--spacing-base) * 20); /* 5rem / 80px */
61
- --spacing-24: calc(var(--spacing-base) * 24); /* 6rem / 96px */
62
- }
63
- ```
64
-
65
- ---
66
-
67
- ## Usage Patterns
68
-
69
- ### Component Padding
70
-
71
- **Buttons:**
72
- ```css
73
- /* Small button */
74
- .btn-sm {
75
- padding: var(--spacing-1) var(--spacing-3); /* 4px 12px */
76
- }
77
-
78
- /* Default button */
79
- .btn {
80
- padding: var(--spacing-2) var(--spacing-4); /* 8px 16px */
81
- }
82
-
83
- /* Large button */
84
- .btn-lg {
85
- padding: var(--spacing-3) var(--spacing-6); /* 12px 24px */
86
- }
87
- ```
88
-
89
- **Cards:**
90
- ```css
91
- .card {
92
- padding: var(--spacing-6); /* 24px */
93
- }
94
-
95
- .card-compact {
96
- padding: var(--spacing-4); /* 16px */
97
- }
98
-
99
- .card-spacious {
100
- padding: var(--spacing-8); /* 32px */
101
- }
102
- ```
103
-
104
- **Inputs:**
105
- ```css
106
- .input {
107
- padding: var(--spacing-2) var(--spacing-3); /* 8px 12px */
108
- }
109
-
110
- .input-large {
111
- padding: var(--spacing-3) var(--spacing-4); /* 12px 16px */
112
- }
113
- ```
114
-
115
- ---
116
-
117
- ### Component Gaps (Spacing Between Elements)
118
-
119
- **Stack (Vertical Spacing):**
120
- ```css
121
- /* Tight stack (list items) */
122
- .stack-tight > * + * {
123
- margin-top: var(--spacing-2); /* 8px */
124
- }
125
-
126
- /* Default stack (form fields) */
127
- .stack > * + * {
128
- margin-top: var(--spacing-4); /* 16px */
129
- }
130
-
131
- /* Loose stack (sections) */
132
- .stack-loose > * + * {
133
- margin-top: var(--spacing-8); /* 32px */
134
- }
135
- ```
136
-
137
- **Inline (Horizontal Spacing):**
138
- ```css
139
- /* Tight inline (breadcrumbs) */
140
- .inline-tight > * + * {
141
- margin-left: var(--spacing-2); /* 8px */
142
- }
143
-
144
- /* Default inline (button groups) */
145
- .inline > * + * {
146
- margin-left: var(--spacing-4); /* 16px */
147
- }
148
-
149
- /* Loose inline (navigation items) */
150
- .inline-loose > * + * {
151
- margin-left: var(--spacing-6); /* 24px */
152
- }
153
- ```
154
-
155
- **Grid Gaps:**
156
- ```css
157
- /* Tight grid (image galleries) */
158
- .grid-tight {
159
- gap: var(--spacing-2); /* 8px */
160
- }
161
-
162
- /* Default grid (product listings) */
163
- .grid {
164
- gap: var(--spacing-4); /* 16px */
165
- }
166
-
167
- /* Loose grid (feature cards) */
168
- .grid-loose {
169
- gap: var(--spacing-8); /* 32px */
170
- }
171
- ```
172
-
173
- ---
174
-
175
- ### Layout Spacing
176
-
177
- **Page Margins:**
178
- ```css
179
- /* Mobile (small screens) */
180
- .page-container {
181
- padding: var(--spacing-4); /* 16px */
182
- }
183
-
184
- /* Tablet */
185
- @media (min-width: 640px) {
186
- .page-container {
187
- padding: var(--spacing-6); /* 24px */
188
- }
189
- }
190
-
191
- /* Desktop */
192
- @media (min-width: 1024px) {
193
- .page-container {
194
- padding: var(--spacing-8); /* 32px */
195
- }
196
- }
197
- ```
198
-
199
- **Section Spacing:**
200
- ```css
201
- /* Between page sections */
202
- .section {
203
- margin-bottom: var(--spacing-12); /* 48px */
204
- }
205
-
206
- @media (min-width: 1024px) {
207
- .section {
208
- margin-bottom: var(--spacing-16); /* 64px */
209
- }
210
- }
211
- ```
212
-
213
- **Component Spacing:**
214
- ```css
215
- /* Between components in a section */
216
- .component {
217
- margin-bottom: var(--spacing-6); /* 24px */
218
- }
219
- ```
220
-
221
- ---
222
-
223
- ## Vertical Rhythm
224
-
225
- **Definition:** Consistent vertical spacing creates visual harmony
226
-
227
- ### Line Height + Margin System
228
-
229
- ```css
230
- /* Typography with rhythm */
231
- p {
232
- margin-bottom: var(--spacing-4); /* 16px */
233
- line-height: 1.5; /* 24px at 16px font size */
234
- }
235
-
236
- h1 {
237
- margin-bottom: var(--spacing-6); /* 24px */
238
- line-height: 1.2; /* 48px at 40px font size */
239
- }
240
-
241
- h2 {
242
- margin-bottom: var(--spacing-4); /* 16px */
243
- line-height: 1.3; /* 41.6px at 32px font size */
244
- }
245
- ```
246
-
247
- **Rule:** Margin-bottom should be a multiple of base unit (4px)
248
-
249
- ---
250
-
251
- ## White Space
252
-
253
- **Principle:** White space (negative space) is as important as content
254
-
255
- ### Content Density Levels
256
-
257
- **Tight (Compact):**
258
- ```css
259
- /* Use for: Data tables, dashboards, dense information */
260
- .container-tight {
261
- padding: var(--spacing-2); /* 8px */
262
- gap: var(--spacing-2); /* 8px */
263
- }
264
- ```
265
-
266
- **Default (Balanced):**
267
- ```css
268
- /* Use for: Standard pages, forms, articles */
269
- .container {
270
- padding: var(--spacing-4); /* 16px */
271
- gap: var(--spacing-4); /* 16px */
272
- }
273
- ```
274
-
275
- **Loose (Spacious):**
276
- ```css
277
- /* Use for: Landing pages, marketing content, hero sections */
278
- .container-loose {
279
- padding: var(--spacing-8); /* 32px */
280
- gap: var(--spacing-8); /* 32px */
281
- }
282
- ```
283
-
284
- ---
285
-
286
- ## Responsive Spacing
287
-
288
- ### Mobile-First Scaling
289
-
290
- ```css
291
- /* Mobile (default) */
292
- .section {
293
- padding: var(--spacing-4); /* 16px */
294
- margin-bottom: var(--spacing-8); /* 32px */
295
- }
296
-
297
- /* Tablet (640px+) */
298
- @media (min-width: 640px) {
299
- .section {
300
- padding: var(--spacing-6); /* 24px */
301
- margin-bottom: var(--spacing-12); /* 48px */
302
- }
303
- }
304
-
305
- /* Desktop (1024px+) */
306
- @media (min-width: 1024px) {
307
- .section {
308
- padding: var(--spacing-8); /* 32px */
309
- margin-bottom: var(--spacing-16); /* 64px */
310
- }
311
- }
312
- ```
313
-
314
- **Pattern:** Increase spacing ~1.5-2x per breakpoint
315
-
316
- ---
317
-
318
- ## Common Spacing Patterns
319
-
320
- ### Navigation
321
-
322
- ```css
323
- /* Header padding */
324
- .header {
325
- padding: var(--spacing-4) var(--spacing-6); /* 16px 24px */
326
- }
327
-
328
- /* Navigation item spacing */
329
- .nav-item + .nav-item {
330
- margin-left: var(--spacing-6); /* 24px */
331
- }
332
- ```
333
-
334
- ### Forms
335
-
336
- ```css
337
- /* Label to input */
338
- .form-field label {
339
- margin-bottom: var(--spacing-2); /* 8px */
340
- }
341
-
342
- /* Between form fields */
343
- .form-field + .form-field {
344
- margin-top: var(--spacing-4); /* 16px */
345
- }
346
-
347
- /* Form groups */
348
- .form-group + .form-group {
349
- margin-top: var(--spacing-8); /* 32px */
350
- }
351
- ```
352
-
353
- ### Cards
354
-
355
- ```css
356
- .card {
357
- padding: var(--spacing-6); /* 24px */
358
- border-radius: var(--spacing-2); /* 8px */
359
- }
360
-
361
- .card-header {
362
- margin-bottom: var(--spacing-4); /* 16px */
363
- padding-bottom: var(--spacing-4); /* 16px */
364
- border-bottom: 1px solid var(--color-border);
365
- }
366
-
367
- .card-body {
368
- padding: var(--spacing-4) 0; /* 16px 0 */
369
- }
370
-
371
- .card-footer {
372
- margin-top: var(--spacing-4); /* 16px */
373
- padding-top: var(--spacing-4); /* 16px */
374
- border-top: 1px solid var(--color-border);
375
- }
376
- ```
377
-
378
- ---
379
-
380
- ## Best Practices
381
-
382
- ### DO:
383
- - ✅ Use spacing scale values only (no arbitrary values)
384
- - ✅ Maintain consistent gaps in similar contexts
385
- - ✅ Scale spacing up for larger screens
386
- - ✅ Use generous white space for readability
387
- - ✅ Align spacing with vertical rhythm
388
- - ✅ Test spacing on all screen sizes
389
-
390
- ### DON'T:
391
- - Use arbitrary spacing values (e.g., `padding: 13px`)
392
- - ❌ Mix different spacing systems
393
- - ❌ Overcrowd content (too little spacing)
394
- - ❌ Use excessive spacing (too much empty space)
395
- - ❌ Forget to scale spacing responsively
396
- - ❌ Inconsistent spacing for similar elements
397
-
398
- ---
399
-
400
- ## Quick Reference
401
-
402
- **Component Padding:**
403
- | Component | Padding |
404
- |-----------|---------|
405
- | Button (small) | `spacing-1` `spacing-3` (4px 12px) |
406
- | Button (default) | `spacing-2` `spacing-4` (8px 16px) |
407
- | Button (large) | `spacing-3` `spacing-6` (12px 24px) |
408
- | Input | `spacing-2` `spacing-3` (8px 12px) |
409
- | Card | `spacing-6` (24px) |
410
-
411
- **Component Gaps:**
412
- | Context | Gap |
413
- |---------|-----|
414
- | List items | `spacing-2` (8px) |
415
- | Form fields | `spacing-4` (16px) |
416
- | Cards in grid | `spacing-4` to `spacing-6` (16-24px) |
417
- | Page sections | `spacing-12` to `spacing-16` (48-64px) |
418
-
419
- **Responsive Scale:**
420
- | Breakpoint | Multiplier |
421
- |------------|------------|
422
- | Mobile (< 640px) | 1x (base) |
423
- | Tablet (640-1024px) | 1.5x |
424
- | Desktop (> 1024px) | 2x |
425
-
426
- ---
427
-
428
- **💡 Remember:** Consistent spacing creates visual rhythm and improves readability!
1
+ # Spacing System
2
+
3
+ > **Purpose:** Consistent spacing scale for layouts, components, and rhythm
4
+
5
+ ---
6
+
7
+ ## ⚠️ Priority: Project-Specific vs Generic
8
+
9
+ **This file contains GENERIC spacing guidelines.**
10
+
11
+ **If your project has a STYLE_GUIDE.md:**
12
+ STYLE_GUIDE.md values take **priority** (use its spacing values)
13
+ → This file = **reference** for concepts and principles only
14
+
15
+ **Check:** `.claude/contexts/domain/{project}/STYLE_GUIDE.md`
16
+
17
+ **Priority order:**
18
+ 1. `STYLE_GUIDE.md` (project-specific) **Use this if exists!**
19
+ 2. Existing components (brownfield) Extract from code
20
+ 3. This file (generic defaults) ← Fallback only
21
+
22
+ ---
23
+
24
+ ## Base Unit Approach
25
+
26
+ **Core Principle:** All spacing should be multiples of a base unit for consistency
27
+
28
+ ```css
29
+ --spacing: 0.25rem; /* 4px - Base spacing unit (at default 16px root font size) */
30
+ ```
31
+
32
+ **Why 0.25rem (4px)?**
33
+ - Divisible by 2, 4, 8 (common design ratios)
34
+ - Works with 8px grid systems (common in Figma, Sketch)
35
+ - Small enough for fine-tuning
36
+ - Large enough to be visually meaningful
37
+
38
+ ---
39
+
40
+ ## Spacing Scale
41
+
42
+ ### Standard Scale (Multiples of Base)
43
+
44
+ | Token | Value | Pixels | Common Use Case |
45
+ |-------|-------|--------|-----------------|
46
+ | `spacing-1` | 0.25rem | 4px | Tiny gaps (icon padding, tight spacing) |
47
+ | `spacing-2` | 0.5rem | 8px | Small gaps (button padding, input padding) |
48
+ | `spacing-3` | 0.75rem | 12px | Medium gaps (card padding, list items) |
49
+ | `spacing-4` | 1rem | 16px | Default gaps (section spacing, form fields) |
50
+ | `spacing-5` | 1.25rem | 20px | Between default and large |
51
+ | `spacing-6` | 1.5rem | 24px | Large gaps (component spacing, cards) |
52
+ | `spacing-8` | 2rem | 32px | XL gaps (section margins, page headers) |
53
+ | `spacing-10` | 2.5rem | 40px | XXL gaps (major sections) |
54
+ | `spacing-12` | 3rem | 48px | XXXL gaps (page margins, hero sections) |
55
+ | `spacing-16` | 4rem | 64px | Huge gaps (full section spacing) |
56
+ | `spacing-20` | 5rem | 80px | Extra huge (landing page sections) |
57
+ | `spacing-24` | 6rem | 96px | Maximum (hero padding, page dividers) |
58
+
59
+ ### Implementation
60
+
61
+ ```css
62
+ :root {
63
+ /* Base unit */
64
+ --spacing-base: 0.25rem;
65
+
66
+ /* Scale */
67
+ --spacing-1: calc(var(--spacing-base) * 1); /* 0.25rem / 4px */
68
+ --spacing-2: calc(var(--spacing-base) * 2); /* 0.5rem / 8px */
69
+ --spacing-3: calc(var(--spacing-base) * 3); /* 0.75rem / 12px */
70
+ --spacing-4: calc(var(--spacing-base) * 4); /* 1rem / 16px */
71
+ --spacing-5: calc(var(--spacing-base) * 5); /* 1.25rem / 20px */
72
+ --spacing-6: calc(var(--spacing-base) * 6); /* 1.5rem / 24px */
73
+ --spacing-8: calc(var(--spacing-base) * 8); /* 2rem / 32px */
74
+ --spacing-10: calc(var(--spacing-base) * 10); /* 2.5rem / 40px */
75
+ --spacing-12: calc(var(--spacing-base) * 12); /* 3rem / 48px */
76
+ --spacing-16: calc(var(--spacing-base) * 16); /* 4rem / 64px */
77
+ --spacing-20: calc(var(--spacing-base) * 20); /* 5rem / 80px */
78
+ --spacing-24: calc(var(--spacing-base) * 24); /* 6rem / 96px */
79
+ }
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Usage Patterns
85
+
86
+ ### Component Padding
87
+
88
+ **Buttons:**
89
+ ```css
90
+ /* Small button */
91
+ .btn-sm {
92
+ padding: var(--spacing-1) var(--spacing-3); /* 4px 12px */
93
+ }
94
+
95
+ /* Default button */
96
+ .btn {
97
+ padding: var(--spacing-2) var(--spacing-4); /* 8px 16px */
98
+ }
99
+
100
+ /* Large button */
101
+ .btn-lg {
102
+ padding: var(--spacing-3) var(--spacing-6); /* 12px 24px */
103
+ }
104
+ ```
105
+
106
+ **Cards:**
107
+ ```css
108
+ .card {
109
+ padding: var(--spacing-6); /* 24px */
110
+ }
111
+
112
+ .card-compact {
113
+ padding: var(--spacing-4); /* 16px */
114
+ }
115
+
116
+ .card-spacious {
117
+ padding: var(--spacing-8); /* 32px */
118
+ }
119
+ ```
120
+
121
+ **Inputs:**
122
+ ```css
123
+ .input {
124
+ padding: var(--spacing-2) var(--spacing-3); /* 8px 12px */
125
+ }
126
+
127
+ .input-large {
128
+ padding: var(--spacing-3) var(--spacing-4); /* 12px 16px */
129
+ }
130
+ ```
131
+
132
+ ---
133
+
134
+ ### Component Gaps (Spacing Between Elements)
135
+
136
+ **Stack (Vertical Spacing):**
137
+ ```css
138
+ /* Tight stack (list items) */
139
+ .stack-tight > * + * {
140
+ margin-top: var(--spacing-2); /* 8px */
141
+ }
142
+
143
+ /* Default stack (form fields) */
144
+ .stack > * + * {
145
+ margin-top: var(--spacing-4); /* 16px */
146
+ }
147
+
148
+ /* Loose stack (sections) */
149
+ .stack-loose > * + * {
150
+ margin-top: var(--spacing-8); /* 32px */
151
+ }
152
+ ```
153
+
154
+ **Inline (Horizontal Spacing):**
155
+ ```css
156
+ /* Tight inline (breadcrumbs) */
157
+ .inline-tight > * + * {
158
+ margin-left: var(--spacing-2); /* 8px */
159
+ }
160
+
161
+ /* Default inline (button groups) */
162
+ .inline > * + * {
163
+ margin-left: var(--spacing-4); /* 16px */
164
+ }
165
+
166
+ /* Loose inline (navigation items) */
167
+ .inline-loose > * + * {
168
+ margin-left: var(--spacing-6); /* 24px */
169
+ }
170
+ ```
171
+
172
+ **Grid Gaps:**
173
+ ```css
174
+ /* Tight grid (image galleries) */
175
+ .grid-tight {
176
+ gap: var(--spacing-2); /* 8px */
177
+ }
178
+
179
+ /* Default grid (product listings) */
180
+ .grid {
181
+ gap: var(--spacing-4); /* 16px */
182
+ }
183
+
184
+ /* Loose grid (feature cards) */
185
+ .grid-loose {
186
+ gap: var(--spacing-8); /* 32px */
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ### Layout Spacing
193
+
194
+ **Page Margins:**
195
+ ```css
196
+ /* Mobile (small screens) */
197
+ .page-container {
198
+ padding: var(--spacing-4); /* 16px */
199
+ }
200
+
201
+ /* Tablet */
202
+ @media (min-width: 640px) {
203
+ .page-container {
204
+ padding: var(--spacing-6); /* 24px */
205
+ }
206
+ }
207
+
208
+ /* Desktop */
209
+ @media (min-width: 1024px) {
210
+ .page-container {
211
+ padding: var(--spacing-8); /* 32px */
212
+ }
213
+ }
214
+ ```
215
+
216
+ **Section Spacing:**
217
+ ```css
218
+ /* Between page sections */
219
+ .section {
220
+ margin-bottom: var(--spacing-12); /* 48px */
221
+ }
222
+
223
+ @media (min-width: 1024px) {
224
+ .section {
225
+ margin-bottom: var(--spacing-16); /* 64px */
226
+ }
227
+ }
228
+ ```
229
+
230
+ **Component Spacing:**
231
+ ```css
232
+ /* Between components in a section */
233
+ .component {
234
+ margin-bottom: var(--spacing-6); /* 24px */
235
+ }
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Vertical Rhythm
241
+
242
+ **Definition:** Consistent vertical spacing creates visual harmony
243
+
244
+ ### Line Height + Margin System
245
+
246
+ ```css
247
+ /* Typography with rhythm */
248
+ p {
249
+ margin-bottom: var(--spacing-4); /* 16px */
250
+ line-height: 1.5; /* 24px at 16px font size */
251
+ }
252
+
253
+ h1 {
254
+ margin-bottom: var(--spacing-6); /* 24px */
255
+ line-height: 1.2; /* 48px at 40px font size */
256
+ }
257
+
258
+ h2 {
259
+ margin-bottom: var(--spacing-4); /* 16px */
260
+ line-height: 1.3; /* 41.6px at 32px font size */
261
+ }
262
+ ```
263
+
264
+ **Rule:** Margin-bottom should be a multiple of base unit (4px)
265
+
266
+ ---
267
+
268
+ ## White Space
269
+
270
+ **Principle:** White space (negative space) is as important as content
271
+
272
+ ### Content Density Levels
273
+
274
+ **Tight (Compact):**
275
+ ```css
276
+ /* Use for: Data tables, dashboards, dense information */
277
+ .container-tight {
278
+ padding: var(--spacing-2); /* 8px */
279
+ gap: var(--spacing-2); /* 8px */
280
+ }
281
+ ```
282
+
283
+ **Default (Balanced):**
284
+ ```css
285
+ /* Use for: Standard pages, forms, articles */
286
+ .container {
287
+ padding: var(--spacing-4); /* 16px */
288
+ gap: var(--spacing-4); /* 16px */
289
+ }
290
+ ```
291
+
292
+ **Loose (Spacious):**
293
+ ```css
294
+ /* Use for: Landing pages, marketing content, hero sections */
295
+ .container-loose {
296
+ padding: var(--spacing-8); /* 32px */
297
+ gap: var(--spacing-8); /* 32px */
298
+ }
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Responsive Spacing
304
+
305
+ ### Mobile-First Scaling
306
+
307
+ ```css
308
+ /* Mobile (default) */
309
+ .section {
310
+ padding: var(--spacing-4); /* 16px */
311
+ margin-bottom: var(--spacing-8); /* 32px */
312
+ }
313
+
314
+ /* Tablet (640px+) */
315
+ @media (min-width: 640px) {
316
+ .section {
317
+ padding: var(--spacing-6); /* 24px */
318
+ margin-bottom: var(--spacing-12); /* 48px */
319
+ }
320
+ }
321
+
322
+ /* Desktop (1024px+) */
323
+ @media (min-width: 1024px) {
324
+ .section {
325
+ padding: var(--spacing-8); /* 32px */
326
+ margin-bottom: var(--spacing-16); /* 64px */
327
+ }
328
+ }
329
+ ```
330
+
331
+ **Pattern:** Increase spacing ~1.5-2x per breakpoint
332
+
333
+ ---
334
+
335
+ ## Common Spacing Patterns
336
+
337
+ ### Navigation
338
+
339
+ ```css
340
+ /* Header padding */
341
+ .header {
342
+ padding: var(--spacing-4) var(--spacing-6); /* 16px 24px */
343
+ }
344
+
345
+ /* Navigation item spacing */
346
+ .nav-item + .nav-item {
347
+ margin-left: var(--spacing-6); /* 24px */
348
+ }
349
+ ```
350
+
351
+ ### Forms
352
+
353
+ ```css
354
+ /* Label to input */
355
+ .form-field label {
356
+ margin-bottom: var(--spacing-2); /* 8px */
357
+ }
358
+
359
+ /* Between form fields */
360
+ .form-field + .form-field {
361
+ margin-top: var(--spacing-4); /* 16px */
362
+ }
363
+
364
+ /* Form groups */
365
+ .form-group + .form-group {
366
+ margin-top: var(--spacing-8); /* 32px */
367
+ }
368
+ ```
369
+
370
+ ### Cards
371
+
372
+ ```css
373
+ .card {
374
+ padding: var(--spacing-6); /* 24px */
375
+ border-radius: var(--spacing-2); /* 8px */
376
+ }
377
+
378
+ .card-header {
379
+ margin-bottom: var(--spacing-4); /* 16px */
380
+ padding-bottom: var(--spacing-4); /* 16px */
381
+ border-bottom: 1px solid var(--color-border);
382
+ }
383
+
384
+ .card-body {
385
+ padding: var(--spacing-4) 0; /* 16px 0 */
386
+ }
387
+
388
+ .card-footer {
389
+ margin-top: var(--spacing-4); /* 16px */
390
+ padding-top: var(--spacing-4); /* 16px */
391
+ border-top: 1px solid var(--color-border);
392
+ }
393
+ ```
394
+
395
+ ---
396
+
397
+ ## Best Practices
398
+
399
+ ### DO:
400
+ - Use spacing scale values only (no arbitrary values)
401
+ - ✅ Maintain consistent gaps in similar contexts
402
+ - ✅ Scale spacing up for larger screens
403
+ - Use generous white space for readability
404
+ - ✅ Align spacing with vertical rhythm
405
+ - Test spacing on all screen sizes
406
+
407
+ ### DON'T:
408
+ - Use arbitrary spacing values (e.g., `padding: 13px`)
409
+ - Mix different spacing systems
410
+ - ❌ Overcrowd content (too little spacing)
411
+ - ❌ Use excessive spacing (too much empty space)
412
+ - Forget to scale spacing responsively
413
+ - ❌ Inconsistent spacing for similar elements
414
+
415
+ ---
416
+
417
+ ## Quick Reference
418
+
419
+ **Component Padding:**
420
+ | Component | Padding |
421
+ |-----------|---------|
422
+ | Button (small) | `spacing-1` `spacing-3` (4px 12px) |
423
+ | Button (default) | `spacing-2` `spacing-4` (8px 16px) |
424
+ | Button (large) | `spacing-3` `spacing-6` (12px 24px) |
425
+ | Input | `spacing-2` `spacing-3` (8px 12px) |
426
+ | Card | `spacing-6` (24px) |
427
+
428
+ **Component Gaps:**
429
+ | Context | Gap |
430
+ |---------|-----|
431
+ | List items | `spacing-2` (8px) |
432
+ | Form fields | `spacing-4` (16px) |
433
+ | Cards in grid | `spacing-4` to `spacing-6` (16-24px) |
434
+ | Page sections | `spacing-12` to `spacing-16` (48-64px) |
435
+
436
+ **Responsive Scale:**
437
+ | Breakpoint | Multiplier |
438
+ |------------|------------|
439
+ | Mobile (< 640px) | 1x (base) |
440
+ | Tablet (640-1024px) | 1.5x |
441
+ | Desktop (> 1024px) | 2x |
442
+
443
+ ---
444
+
445
+ **💡 Remember:** Consistent spacing creates visual rhythm and improves readability!