@champpaba/claude-agent-kit 1.1.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 (82) hide show
  1. package/.claude/CHANGELOG-v1.1.1.md +259 -0
  2. package/.claude/CLAUDE.md +555 -0
  3. package/.claude/agents/01-integration.md +797 -0
  4. package/.claude/agents/02-uxui-frontend.md +955 -0
  5. package/.claude/agents/03-test-debug.md +759 -0
  6. package/.claude/agents/04-frontend.md +1099 -0
  7. package/.claude/agents/05-backend.md +1217 -0
  8. package/.claude/agents/06-database.md +969 -0
  9. package/.claude/commands/agentsetup.md +1464 -0
  10. package/.claude/commands/cdev.md +327 -0
  11. package/.claude/commands/csetup.md +447 -0
  12. package/.claude/commands/cstatus.md +60 -0
  13. package/.claude/commands/cview.md +364 -0
  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/.claude/commands/psetup.md +101 -0
  18. package/.claude/contexts/design/accessibility.md +611 -0
  19. package/.claude/contexts/design/box-thinking.md +566 -0
  20. package/.claude/contexts/design/color-theory.md +519 -0
  21. package/.claude/contexts/design/index.md +290 -0
  22. package/.claude/contexts/design/layout.md +400 -0
  23. package/.claude/contexts/design/responsive.md +551 -0
  24. package/.claude/contexts/design/shadows.md +522 -0
  25. package/.claude/contexts/design/spacing.md +445 -0
  26. package/.claude/contexts/design/typography.md +465 -0
  27. package/.claude/contexts/domain/README.md +164 -0
  28. package/.claude/contexts/patterns/agent-coordination.md +388 -0
  29. package/.claude/contexts/patterns/agent-discovery.md +182 -0
  30. package/.claude/contexts/patterns/change-workflow.md +538 -0
  31. package/.claude/contexts/patterns/code-standards.md +515 -0
  32. package/.claude/contexts/patterns/development-principles.md +513 -0
  33. package/.claude/contexts/patterns/error-handling.md +478 -0
  34. package/.claude/contexts/patterns/error-recovery.md +365 -0
  35. package/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
  36. package/.claude/contexts/patterns/git-workflow.md +207 -0
  37. package/.claude/contexts/patterns/logging.md +424 -0
  38. package/.claude/contexts/patterns/task-breakdown.md +452 -0
  39. package/.claude/contexts/patterns/task-classification.md +523 -0
  40. package/.claude/contexts/patterns/tdd-classification.md +516 -0
  41. package/.claude/contexts/patterns/testing.md +413 -0
  42. package/.claude/contexts/patterns/ui-component-consistency.md +304 -0
  43. package/.claude/contexts/patterns/validation-framework.md +776 -0
  44. package/.claude/lib/README.md +39 -0
  45. package/.claude/lib/agent-executor.md +258 -0
  46. package/.claude/lib/agent-router.md +572 -0
  47. package/.claude/lib/flags-updater.md +469 -0
  48. package/.claude/lib/tdd-classifier.md +345 -0
  49. package/.claude/lib/validation-gates.md +484 -0
  50. package/.claude/settings.local.json +42 -0
  51. package/.claude/templates/STYLE_GUIDE.template.md +879 -0
  52. package/.claude/templates/context-template.md +45 -0
  53. package/.claude/templates/flags-template.json +42 -0
  54. package/.claude/templates/page-plan-example.md +562 -0
  55. package/.claude/templates/phase-templates.json +124 -0
  56. package/.claude/templates/phases-sections/accessibility-test.md +17 -0
  57. package/.claude/templates/phases-sections/api-design.md +37 -0
  58. package/.claude/templates/phases-sections/backend-tests.md +16 -0
  59. package/.claude/templates/phases-sections/backend.md +37 -0
  60. package/.claude/templates/phases-sections/business-logic-validation.md +16 -0
  61. package/.claude/templates/phases-sections/component-tests.md +17 -0
  62. package/.claude/templates/phases-sections/contract-backend.md +16 -0
  63. package/.claude/templates/phases-sections/contract-frontend.md +16 -0
  64. package/.claude/templates/phases-sections/database.md +35 -0
  65. package/.claude/templates/phases-sections/documentation.md +17 -0
  66. package/.claude/templates/phases-sections/e2e-tests.md +16 -0
  67. package/.claude/templates/phases-sections/fix-implementation.md +17 -0
  68. package/.claude/templates/phases-sections/frontend-integration.md +18 -0
  69. package/.claude/templates/phases-sections/frontend-mockup.md +123 -0
  70. package/.claude/templates/phases-sections/manual-flow-test.md +15 -0
  71. package/.claude/templates/phases-sections/manual-ux-test.md +16 -0
  72. package/.claude/templates/phases-sections/refactor-implementation.md +17 -0
  73. package/.claude/templates/phases-sections/refactor.md +16 -0
  74. package/.claude/templates/phases-sections/regression-tests.md +15 -0
  75. package/.claude/templates/phases-sections/report.md +16 -0
  76. package/.claude/templates/phases-sections/responsive-test.md +16 -0
  77. package/.claude/templates/phases-sections/script-implementation.md +43 -0
  78. package/.claude/templates/phases-sections/test-coverage.md +16 -0
  79. package/.claude/templates/phases-sections/user-approval.md +14 -0
  80. package/lib/init.js +1 -1
  81. package/lib/update.js +1 -1
  82. package/package.json +2 -2
@@ -0,0 +1,290 @@
1
+ # Design System Hub
2
+
3
+ > 🎯 **Purpose**: Design Principal Index - Guide all design decisions with proper context
4
+
5
+ ---
6
+
7
+ ## 🎨 IMPORTANT: Style Guide Priority System
8
+
9
+ **uxui-frontend agents MUST check this priority order:**
10
+
11
+ ### Priority 1: Project-Specific Style Guide (Highest)
12
+ ```
13
+ design-system/STYLE_GUIDE.md
14
+ ```
15
+
16
+ **If this file exists:**
17
+ - ✅ Use STYLE_GUIDE.md as **PRIMARY source of truth**
18
+ - Contains: Complete design system (colors, typography, spacing, components)
19
+ - Generated by: `/designsetup` command (from reference/codebase/AI)
20
+ - **DO NOT** override with universal principles below
21
+
22
+ **If this file does NOT exist:**
23
+ - ⚠️ Fallback to Priority 2 (universal principles)
24
+ - 💡 Suggest user run: `/designsetup`
25
+
26
+ ### Priority 2: Universal Design Principles (Fallback)
27
+ ```
28
+ .claude/contexts/design/*.md (this directory)
29
+ ```
30
+
31
+ **Use these when:**
32
+ - No STYLE_GUIDE.md exists
33
+ - Need general design theory
34
+ - Understanding design concepts (box thinking, color theory)
35
+
36
+ ### Priority 3: Legacy Project Tokens (Deprecated)
37
+ ```
38
+ .claude/contexts/domain/[project]/design-tokens.md
39
+ ```
40
+
41
+ **Note:** This is being replaced by STYLE_GUIDE.md
42
+
43
+ ---
44
+
45
+ ## 🧠 Design Decision Framework
46
+
47
+ **Before ANY design recommendation, ask:**
48
+
49
+ 1. **Do we have a style guide?**
50
+ - Check: `design-system/STYLE_GUIDE.md`
51
+ - If YES → Use it (Priority 1)
52
+ - If NO → Use universal principles (Priority 2)
53
+
54
+ 2. **What type of decision?**
55
+ - Color/Palette
56
+ - Layout/Spacing
57
+ - Depth/Shadows
58
+ - Typography
59
+ - Component Structure
60
+ - Box Relationships
61
+
62
+ 3. **What context?**
63
+ - Project-specific style guide (STYLE_GUIDE.md)
64
+ - Universal design principles (this directory)
65
+
66
+ 4. **What's the user goal?**
67
+ - Usability (Can users complete tasks easily?)
68
+ - Accessibility (Can ALL users access content?)
69
+ - Aesthetics (Does it look professional and trustworthy?)
70
+
71
+ **Then route to:**
72
+ - **Color** → See `color-theory.md` for harmony, contrast, accessibility
73
+ - **Layout** → See `layout.md` + `box-thinking.md` for structure and flow
74
+ - **Depth** → See `shadows.md` for elevation and layering
75
+ - **Typography** → See `typography.md` for hierarchy and readability
76
+ - **Spacing** → See `spacing.md` for consistent gaps and rhythm
77
+ - **Responsive** → See `responsive.md` for behavior across devices
78
+ - **Accessibility** → See `accessibility.md` for WCAG compliance
79
+
80
+ ---
81
+
82
+ ## 📦 Box Thinking Framework
83
+
84
+ **Core Principle:** Every element is a box. Understand box relationships before writing code.
85
+
86
+ ### Box Analysis Method
87
+
88
+ > "Before building or improving this layout, take a step back and observe **every element on the screen** — navigation, headers, cards, buttons, sidebars, text blocks — everything that occupies space. Imagine **each of them as a box** and describe how they relate to one another: which boxes contain others, how they align, and how space flows between them."
89
+
90
+ ### Box Relationship Patterns
91
+
92
+ - **Container Boxes**: What contains what (hierarchy)
93
+ - **Adjacent Boxes**: Side-by-side relationships
94
+ - **Nested Boxes**: Parent-child relationships
95
+ - **Space Flow**: How space flows between boxes
96
+ - **Alignment Logic**: How boxes position relative to each other
97
+
98
+ ### Box Behavior in Responsive Context
99
+
100
+ > "Now, describe how this layout behaves when the screen or container changes size. Think in terms of movement, proportion, and flow, not pixels. Which sections move above or below others? Which expand, and which step back?"
101
+
102
+ **Box Movement Patterns:**
103
+ - **Stacking**: Horizontal → Vertical arrangement
104
+ - **Merging**: Multiple boxes → Single unified box
105
+ - **Prioritizing**: Important boxes maintain prominence
106
+ - **Compressing**: Boxes shrink but maintain relationships
107
+ - **Reorganizing**: Smart rules for box rearrangement
108
+
109
+ **See `box-thinking.md` for complete framework.**
110
+
111
+ ---
112
+
113
+ ## 🎨 Universal Design Principles
114
+
115
+ ### Color System
116
+
117
+ **60-30-10 Rule** (Industry standard for balanced color distribution)
118
+ - **60% Dominant**: Neutral colors (backgrounds, text) - Creates calm foundation
119
+ - **30% Secondary**: Supporting colors (secondary brand color, muted tones)
120
+ - **10% Accent**: Primary brand color for emphasis (CTAs, highlights)
121
+
122
+ **Color Harmony Types:**
123
+ - **Monochromatic**: Variations of single hue (most harmonious)
124
+ - **Complementary**: Opposite colors on color wheel (high contrast)
125
+ - **Analogous**: Adjacent colors (cohesive, natural)
126
+ - **Triadic**: 3 colors evenly spaced (vibrant, balanced)
127
+
128
+ **Accessibility Requirements:**
129
+ - Text on background: Minimum 4.5:1 contrast (WCAG AA)
130
+ - Large text (18pt+): Minimum 3:1 contrast
131
+ - UI components: Minimum 3:1 contrast
132
+
133
+ **See `color-theory.md` for complete color system.**
134
+
135
+ ---
136
+
137
+ ### Spacing System
138
+
139
+ **Base Unit Approach:**
140
+ ```css
141
+ --spacing: 0.25rem; /* 4px - Base spacing unit */
142
+ ```
143
+
144
+ **Scale (Multiples of base):**
145
+ - `1x` (0.25rem / 4px) - Tiny gaps
146
+ - `2x` (0.5rem / 8px) - Small gaps
147
+ - `3x` (0.75rem / 12px) - Medium gaps
148
+ - `4x` (1rem / 16px) - Default gaps
149
+ - `6x` (1.5rem / 24px) - Large gaps
150
+ - `8x` (2rem / 32px) - XL gaps
151
+ - `12x` (3rem / 48px) - XXL gaps
152
+
153
+ **See `spacing.md` for complete spacing system.**
154
+
155
+ ---
156
+
157
+ ### Shadow System
158
+
159
+ **3-Tier Elevation:**
160
+
161
+ **Level 1: Subtle** (Cards, Inputs)
162
+ ```css
163
+ --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
164
+ ```
165
+
166
+ **Level 2: Medium** (Dropdowns, Modals)
167
+ ```css
168
+ --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
169
+ 0 2px 4px -2px rgb(0 0 0 / 0.1);
170
+ ```
171
+
172
+ **Level 3: Large** (Overlays, Popovers)
173
+ ```css
174
+ --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
175
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
176
+ ```
177
+
178
+ **See `shadows.md` for complete shadow system.**
179
+
180
+ ---
181
+
182
+ ### Typography Hierarchy
183
+
184
+ **5-Level System:**
185
+
186
+ 1. **H1** (Display) - 2.5rem (40px) - Hero titles
187
+ 2. **H2** (Headline) - 2rem (32px) - Section titles
188
+ 3. **H3** (Title) - 1.5rem (24px) - Subsection titles
189
+ 4. **Body** (Text) - 1rem (16px) - Paragraphs, content
190
+ 5. **Small** (Caption) - 0.875rem (14px) - Labels, metadata
191
+
192
+ **Line Height Rules:**
193
+ - Headings: 1.2-1.3 (tight for impact)
194
+ - Body text: 1.5-1.6 (comfortable reading)
195
+ - Small text: 1.4-1.5 (legible but compact)
196
+
197
+ **See `typography.md` for complete typography system.**
198
+
199
+ ---
200
+
201
+ ### Responsive Behavior
202
+
203
+ **3-Tier Breakpoint System:**
204
+
205
+ ```css
206
+ /* Mobile-first approach */
207
+ --breakpoint-sm: 640px; /* Tablets */
208
+ --breakpoint-md: 768px; /* Small laptops */
209
+ --breakpoint-lg: 1024px; /* Desktops */
210
+ ```
211
+
212
+ **Layout Flow Rules:**
213
+ - Mobile (< 640px): Stack all boxes vertically
214
+ - Tablet (640-1024px): Partial side-by-side, smart stacking
215
+ - Desktop (> 1024px): Full multi-column layouts
216
+
217
+ **See `responsive.md` for complete responsive patterns.**
218
+
219
+ ---
220
+
221
+ ## 🔍 When to Use Each File
222
+
223
+ | Need | File | Purpose |
224
+ |------|------|---------|
225
+ | Choose colors for new feature | `color-theory.md` | Color harmony, contrast, accessibility |
226
+ | Set spacing between elements | `spacing.md` | Consistent gaps, rhythm, whitespace |
227
+ | Add shadows to cards/modals | `shadows.md` | Elevation, depth, layering |
228
+ | Define text hierarchy | `typography.md` | Font sizes, weights, line heights |
229
+ | Plan component layout | `layout.md` + `box-thinking.md` | Box structure, alignment |
230
+ | Make responsive design | `responsive.md` | Breakpoints, movement patterns |
231
+ | Ensure accessibility | `accessibility.md` | WCAG compliance, keyboard nav |
232
+
233
+ ---
234
+
235
+ ## 🎯 Quick Start Checklist
236
+
237
+ **For every new UI component:**
238
+
239
+ - [ ] **Box Structure** - Identify all boxes and their relationships
240
+ - [ ] **Color** - Apply 60-30-10 rule, check contrast (4.5:1 min)
241
+ - [ ] **Spacing** - Use multiples of base unit (0.25rem)
242
+ - [ ] **Typography** - Follow 5-level hierarchy
243
+ - [ ] **Shadows** - Use 3-tier elevation system
244
+ - [ ] **Responsive** - Test all 3 breakpoints (mobile, tablet, desktop)
245
+ - [ ] **Accessibility** - Keyboard navigation, screen reader support
246
+
247
+ ---
248
+
249
+ ## 📖 Design System Files
250
+
251
+ ```
252
+ design/
253
+ ├── index.md (this file) # Design hub and decision framework
254
+ ├── color-theory.md # Color harmony, contrast, accessibility
255
+ ├── spacing.md # Spacing scale, rhythm, whitespace
256
+ ├── shadows.md # 3-tier shadow system
257
+ ├── typography.md # Font hierarchy, sizes, weights
258
+ ├── layout.md # Layout patterns, alignment
259
+ ├── responsive.md # Breakpoints, responsive behavior
260
+ ├── box-thinking.md # Box analysis framework
261
+ └── accessibility.md # WCAG compliance, a11y patterns
262
+ ```
263
+
264
+ ---
265
+
266
+ ## 🔗 Project-Specific Design
267
+
268
+ **Universal principles (this directory) + Project tokens (domain folder)**
269
+
270
+ **Project design tokens go in:**
271
+ ```
272
+ .claude/contexts/domain/[project-name]/design-tokens.md
273
+ ```
274
+
275
+ **Example:**
276
+ ```css
277
+ /* domain/ecommerce/design-tokens.md */
278
+ --primary: #3B82F6; /* Blue - Trust */
279
+ --secondary: #10B981; /* Green - Success */
280
+ --accent: #F59E0B; /* Amber - Urgency */
281
+ ```
282
+
283
+ **How agents use this:**
284
+ 1. Load universal principles (design/)
285
+ 2. Load project tokens (domain/[project]/)
286
+ 3. Apply principles with project colors
287
+
288
+ ---
289
+
290
+ **💡 Remember: Think in boxes, design with purpose, implement with consistency!**
@@ -0,0 +1,400 @@
1
+ # Layout Patterns
2
+
3
+ > **Purpose:** Common layout structures and alignment strategies
4
+
5
+ ---
6
+
7
+ ## Core Layout Principles
8
+
9
+ 1. **Box Model First** - Understand all elements as boxes (see `box-thinking.md`)
10
+ 2. **Flex for 1D** - Use flexbox for single-axis layouts (rows or columns)
11
+ 3. **Grid for 2D** - Use CSS Grid for multi-axis layouts (rows AND columns)
12
+ 4. **Responsive by Default** - Design mobile-first, enhance for larger screens
13
+
14
+ ---
15
+
16
+ ## Common Layout Patterns
17
+
18
+ ### 1. Stack (Vertical)
19
+
20
+ **Use for:** Form fields, article content, vertical lists
21
+
22
+ ```css
23
+ .stack {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--spacing-4); /* 16px */
27
+ }
28
+
29
+ /* Variants */
30
+ .stack-tight {
31
+ gap: var(--spacing-2); /* 8px */
32
+ }
33
+
34
+ .stack-loose {
35
+ gap: var(--spacing-8); /* 32px */
36
+ }
37
+ ```
38
+
39
+ **HTML:**
40
+ ```html
41
+ <div class="stack">
42
+ <div>Item 1</div>
43
+ <div>Item 2</div>
44
+ <div>Item 3</div>
45
+ </div>
46
+ ```
47
+
48
+ ---
49
+
50
+ ### 2. Inline (Horizontal)
51
+
52
+ **Use for:** Button groups, breadcrumbs, navigation
53
+
54
+ ```css
55
+ .inline {
56
+ display: flex;
57
+ flex-direction: row;
58
+ gap: var(--spacing-4); /* 16px */
59
+ align-items: center; /* Vertical centering */
60
+ }
61
+
62
+ /* Variants */
63
+ .inline-start {
64
+ justify-content: flex-start; /* Left-aligned */
65
+ }
66
+
67
+ .inline-center {
68
+ justify-content: center; /* Centered */
69
+ }
70
+
71
+ .inline-end {
72
+ justify-content: flex-end; /* Right-aligned */
73
+ }
74
+
75
+ .inline-between {
76
+ justify-content: space-between; /* Space between items */
77
+ }
78
+ ```
79
+
80
+ ---
81
+
82
+ ### 3. Sidebar Layout
83
+
84
+ **Use for:** Dashboard, admin panels, documentation
85
+
86
+ ```css
87
+ .sidebar-layout {
88
+ display: grid;
89
+ grid-template-columns: 250px 1fr; /* Fixed sidebar + fluid main */
90
+ gap: var(--spacing-6); /* 24px */
91
+ min-height: 100vh;
92
+ }
93
+
94
+ @media (max-width: 768px) {
95
+ .sidebar-layout {
96
+ grid-template-columns: 1fr; /* Stack on mobile */
97
+ }
98
+ }
99
+ ```
100
+
101
+ **HTML:**
102
+ ```html
103
+ <div class="sidebar-layout">
104
+ <aside class="sidebar">Sidebar</aside>
105
+ <main class="main-content">Main Content</main>
106
+ </div>
107
+ ```
108
+
109
+ ---
110
+
111
+ ### 4. Holy Grail Layout
112
+
113
+ **Use for:** Classic web pages (header, sidebar, content, footer)
114
+
115
+ ```css
116
+ .holy-grail {
117
+ display: grid;
118
+ grid-template-areas:
119
+ "header header header"
120
+ "sidebar main aside"
121
+ "footer footer footer";
122
+ grid-template-columns: 200px 1fr 200px;
123
+ grid-template-rows: auto 1fr auto;
124
+ min-height: 100vh;
125
+ gap: var(--spacing-4);
126
+ }
127
+
128
+ .header { grid-area: header; }
129
+ .sidebar { grid-area: sidebar; }
130
+ .main { grid-area: main; }
131
+ .aside { grid-area: aside; }
132
+ .footer { grid-area: footer; }
133
+
134
+ @media (max-width: 1024px) {
135
+ .holy-grail {
136
+ grid-template-areas:
137
+ "header"
138
+ "main"
139
+ "sidebar"
140
+ "aside"
141
+ "footer";
142
+ grid-template-columns: 1fr;
143
+ }
144
+ }
145
+ ```
146
+
147
+ ---
148
+
149
+ ### 5. Card Grid
150
+
151
+ **Use for:** Product listings, portfolios, image galleries
152
+
153
+ ```css
154
+ .card-grid {
155
+ display: grid;
156
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
157
+ gap: var(--spacing-6); /* 24px */
158
+ }
159
+
160
+ /* Auto-fill: Creates as many columns as fit */
161
+ /* minmax(300px, 1fr): Min 300px, max equal width */
162
+ ```
163
+
164
+ **Responsive Behavior:**
165
+ - Mobile: 1 column
166
+ - Tablet: 2 columns
167
+ - Desktop: 3-4 columns (auto-adjusts)
168
+
169
+ ---
170
+
171
+ ### 6. Center Element
172
+
173
+ **Use for:** Modals, empty states, landing hero sections
174
+
175
+ ```css
176
+ /* Flexbox method */
177
+ .center-flex {
178
+ display: flex;
179
+ justify-content: center;
180
+ align-items: center;
181
+ min-height: 100vh;
182
+ }
183
+
184
+ /* Grid method */
185
+ .center-grid {
186
+ display: grid;
187
+ place-items: center; /* Shorthand for center both axes */
188
+ min-height: 100vh;
189
+ }
190
+
191
+ /* Absolute positioning (legacy) */
192
+ .center-absolute {
193
+ position: absolute;
194
+ top: 50%;
195
+ left: 50%;
196
+ transform: translate(-50%, -50%);
197
+ }
198
+ ```
199
+
200
+ ---
201
+
202
+ ### 7. Header with Navigation
203
+
204
+ **Use for:** Site headers, app nav bars
205
+
206
+ ```css
207
+ .header {
208
+ display: flex;
209
+ justify-content: space-between;
210
+ align-items: center;
211
+ padding: var(--spacing-4) var(--spacing-6);
212
+ background: white;
213
+ box-shadow: var(--shadow-sm);
214
+ }
215
+
216
+ .nav {
217
+ display: flex;
218
+ gap: var(--spacing-6);
219
+ }
220
+
221
+ @media (max-width: 768px) {
222
+ .nav {
223
+ display: none; /* Hide on mobile (use hamburger menu) */
224
+ }
225
+ }
226
+ ```
227
+
228
+ ---
229
+
230
+ ### 8. Container (Max-Width)
231
+
232
+ **Use for:** Constraining content width for readability
233
+
234
+ ```css
235
+ .container {
236
+ max-width: 1280px; /* Desktop max width */
237
+ margin-left: auto;
238
+ margin-right: auto;
239
+ padding-left: var(--spacing-6); /* 24px */
240
+ padding-right: var(--spacing-6);
241
+ }
242
+
243
+ /* Variants */
244
+ .container-narrow {
245
+ max-width: 768px; /* Blog posts, forms */
246
+ }
247
+
248
+ .container-wide {
249
+ max-width: 1536px; /* Dashboards, wide layouts */
250
+ }
251
+ ```
252
+
253
+ **Optimal Reading Widths:**
254
+ - Text content: 65-75 characters per line (~768px)
255
+ - Dashboard: 1280-1536px
256
+ - Full-width: No max-width (use sparingly)
257
+
258
+ ---
259
+
260
+ ## Alignment Strategies
261
+
262
+ ### Flexbox Alignment
263
+
264
+ **Main Axis (justify-content):**
265
+ ```css
266
+ .flex-start { justify-content: flex-start; } /* Left/Top */
267
+ .flex-center { justify-content: center; } /* Center */
268
+ .flex-end { justify-content: flex-end; } /* Right/Bottom */
269
+ .flex-between { justify-content: space-between; } /* Space between */
270
+ .flex-around { justify-content: space-around; } /* Space around */
271
+ ```
272
+
273
+ **Cross Axis (align-items):**
274
+ ```css
275
+ .items-start { align-items: flex-start; } /* Top/Left */
276
+ .items-center { align-items: center; } /* Center */
277
+ .items-end { align-items: flex-end; } /* Bottom/Right */
278
+ .items-stretch { align-items: stretch; } /* Stretch to fill */
279
+ ```
280
+
281
+ ### Grid Alignment
282
+
283
+ ```css
284
+ /* Place items (both axes) */
285
+ .place-center { place-items: center; }
286
+ .place-start { place-items: start; }
287
+ .place-end { place-items: end; }
288
+
289
+ /* Justify/align individual item */
290
+ .justify-self-center { justify-self: center; }
291
+ .align-self-center { align-self: center; }
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Z-Index Layering
297
+
298
+ **Standard Z-Index Scale:**
299
+
300
+ ```css
301
+ :root {
302
+ --z-base: 1; /* Base content */
303
+ --z-dropdown: 10; /* Dropdowns, popovers */
304
+ --z-sticky: 20; /* Sticky headers */
305
+ --z-modal-backdrop: 100; /* Modal overlays */
306
+ --z-modal: 110; /* Modal content */
307
+ --z-popover: 200; /* Tooltips, toasts */
308
+ --z-notification: 1000; /* Notifications (top layer) */
309
+ }
310
+ ```
311
+
312
+ **Usage:**
313
+ ```css
314
+ .content { z-index: var(--z-base); }
315
+ .dropdown { z-index: var(--z-dropdown); }
316
+ .modal-backdrop { z-index: var(--z-modal-backdrop); }
317
+ .modal { z-index: var(--z-modal); }
318
+ .toast { z-index: var(--z-notification); }
319
+ ```
320
+
321
+ ---
322
+
323
+ ## Aspect Ratios
324
+
325
+ **Use for:** Images, videos, cards with consistent proportions
326
+
327
+ ```css
328
+ /* Modern approach (aspect-ratio property) */
329
+ .aspect-square { aspect-ratio: 1 / 1; } /* 1:1 */
330
+ .aspect-video { aspect-ratio: 16 / 9; } /* 16:9 */
331
+ .aspect-portrait { aspect-ratio: 3 / 4; } /* 3:4 */
332
+
333
+ /* Legacy approach (padding-bottom hack) */
334
+ .aspect-ratio-16-9 {
335
+ position: relative;
336
+ padding-bottom: 56.25%; /* 9/16 = 0.5625 */
337
+ }
338
+
339
+ .aspect-ratio-16-9 > * {
340
+ position: absolute;
341
+ top: 0;
342
+ left: 0;
343
+ width: 100%;
344
+ height: 100%;
345
+ }
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Best Practices
351
+
352
+ ### DO:
353
+ - ✅ Use flexbox for 1D layouts
354
+ - ✅ Use grid for 2D layouts
355
+ - ✅ Design mobile-first (stack by default)
356
+ - ✅ Use semantic HTML (header, main, aside, footer)
357
+ - ✅ Constrain content width for readability
358
+ - ✅ Use CSS custom properties for spacing
359
+ - ✅ Test on all screen sizes
360
+
361
+ ### DON'T:
362
+ - ❌ Use floats for layouts (legacy technique)
363
+ - ❌ Use fixed pixel widths (not responsive)
364
+ - ❌ Nest too many layout containers (keep it flat)
365
+ - ❌ Forget semantic HTML
366
+ - ❌ Use arbitrary z-index values (100, 9999)
367
+ - ❌ Overcomplicate layouts (KISS principle)
368
+
369
+ ---
370
+
371
+ ## Quick Reference
372
+
373
+ **Layout Techniques:**
374
+ | Pattern | Technique | Use Case |
375
+ |---------|-----------|----------|
376
+ | Stack | Flexbox (column) | Vertical lists, forms |
377
+ | Inline | Flexbox (row) | Horizontal groups, nav |
378
+ | Sidebar | Grid (2 columns) | Admin panels, docs |
379
+ | Card Grid | Grid (auto-fill) | Products, galleries |
380
+ | Center | Flexbox/Grid | Modals, empty states |
381
+
382
+ **Container Widths:**
383
+ | Type | Max Width | Use Case |
384
+ |------|-----------|----------|
385
+ | Narrow | 768px | Blog posts, forms |
386
+ | Default | 1280px | Standard pages |
387
+ | Wide | 1536px | Dashboards |
388
+ | Full | none | Landing pages |
389
+
390
+ **Z-Index Layers:**
391
+ | Layer | Z-Index | Element Type |
392
+ |-------|---------|--------------|
393
+ | Base | 1 | Content |
394
+ | Dropdown | 10 | Dropdowns, popovers |
395
+ | Modal | 100-110 | Modals, overlays |
396
+ | Notification | 1000 | Toasts, alerts |
397
+
398
+ ---
399
+
400
+ **💡 Remember:** Good layout is invisible. Users should focus on content, not structure!