tribunal-kit 3.0.0 → 3.1.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 (226) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +187 -220
  4. package/.agent/agents/ai-code-reviewer.md +199 -233
  5. package/.agent/agents/backend-specialist.md +215 -238
  6. package/.agent/agents/code-archaeologist.md +161 -181
  7. package/.agent/agents/database-architect.md +184 -207
  8. package/.agent/agents/debugger.md +191 -218
  9. package/.agent/agents/dependency-reviewer.md +103 -136
  10. package/.agent/agents/devops-engineer.md +218 -238
  11. package/.agent/agents/documentation-writer.md +201 -221
  12. package/.agent/agents/explorer-agent.md +160 -180
  13. package/.agent/agents/frontend-reviewer.md +160 -194
  14. package/.agent/agents/frontend-specialist.md +248 -237
  15. package/.agent/agents/game-developer.md +48 -52
  16. package/.agent/agents/logic-reviewer.md +116 -149
  17. package/.agent/agents/mobile-developer.md +200 -223
  18. package/.agent/agents/mobile-reviewer.md +162 -195
  19. package/.agent/agents/orchestrator.md +181 -211
  20. package/.agent/agents/penetration-tester.md +157 -174
  21. package/.agent/agents/performance-optimizer.md +183 -203
  22. package/.agent/agents/performance-reviewer.md +178 -211
  23. package/.agent/agents/product-manager.md +142 -162
  24. package/.agent/agents/product-owner.md +6 -25
  25. package/.agent/agents/project-planner.md +142 -162
  26. package/.agent/agents/qa-automation-engineer.md +225 -242
  27. package/.agent/agents/security-auditor.md +174 -194
  28. package/.agent/agents/seo-specialist.md +193 -213
  29. package/.agent/agents/sql-reviewer.md +161 -194
  30. package/.agent/agents/supervisor-agent.md +184 -203
  31. package/.agent/agents/swarm-worker-contracts.md +17 -17
  32. package/.agent/agents/swarm-worker-registry.md +46 -46
  33. package/.agent/agents/test-coverage-reviewer.md +160 -193
  34. package/.agent/agents/test-engineer.md +0 -21
  35. package/.agent/agents/type-safety-reviewer.md +175 -208
  36. package/.agent/patterns/generator.md +9 -9
  37. package/.agent/patterns/inversion.md +12 -12
  38. package/.agent/patterns/pipeline.md +9 -9
  39. package/.agent/patterns/reviewer.md +13 -13
  40. package/.agent/patterns/tool-wrapper.md +9 -9
  41. package/.agent/rules/GEMINI.md +63 -63
  42. package/.agent/scripts/compress_skills.py +167 -0
  43. package/.agent/scripts/consolidate_skills.py +173 -0
  44. package/.agent/scripts/deep_compress.py +202 -0
  45. package/.agent/scripts/minify_context.py +80 -0
  46. package/.agent/scripts/security_scan.py +1 -1
  47. package/.agent/scripts/strip_tribunal.py +41 -0
  48. package/.agent/skills/agent-organizer/SKILL.md +92 -126
  49. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  50. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +126 -160
  51. package/.agent/skills/api-patterns/SKILL.md +123 -215
  52. package/.agent/skills/api-security-auditor/SKILL.md +143 -177
  53. package/.agent/skills/app-builder/SKILL.md +326 -50
  54. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  55. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  56. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  57. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  58. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  59. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  60. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  61. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  62. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  63. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  64. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  65. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  66. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  67. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  68. package/.agent/skills/appflow-wireframe/SKILL.md +87 -121
  69. package/.agent/skills/architecture/SKILL.md +82 -252
  70. package/.agent/skills/authentication-best-practices/SKILL.md +139 -173
  71. package/.agent/skills/bash-linux/SKILL.md +120 -154
  72. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  73. package/.agent/skills/brainstorming/SKILL.md +428 -104
  74. package/.agent/skills/building-native-ui/SKILL.md +143 -174
  75. package/.agent/skills/clean-code/SKILL.md +323 -360
  76. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  77. package/.agent/skills/config-validator/SKILL.md +107 -141
  78. package/.agent/skills/csharp-developer/SKILL.md +468 -528
  79. package/.agent/skills/database-design/SKILL.md +104 -369
  80. package/.agent/skills/deployment-procedures/SKILL.md +111 -145
  81. package/.agent/skills/devops-engineer/SKILL.md +295 -332
  82. package/.agent/skills/devops-incident-responder/SKILL.md +79 -113
  83. package/.agent/skills/doc.md +5 -5
  84. package/.agent/skills/documentation-templates/SKILL.md +19 -63
  85. package/.agent/skills/edge-computing/SKILL.md +123 -157
  86. package/.agent/skills/extract-design-system/SKILL.md +100 -134
  87. package/.agent/skills/framer-motion-expert/SKILL.md +111 -855
  88. package/.agent/skills/frontend-design/SKILL.md +151 -499
  89. package/.agent/skills/game-design-expert/SKILL.md +71 -105
  90. package/.agent/skills/game-engineering-expert/SKILL.md +88 -122
  91. package/.agent/skills/geo-fundamentals/SKILL.md +89 -124
  92. package/.agent/skills/github-operations/SKILL.md +279 -314
  93. package/.agent/skills/gsap-expert/SKILL.md +119 -826
  94. package/.agent/skills/i18n-localization/SKILL.md +104 -138
  95. package/.agent/skills/intelligent-routing/SKILL.md +159 -127
  96. package/.agent/skills/lint-and-validate/SKILL.md +8 -52
  97. package/.agent/skills/llm-engineering/SKILL.md +344 -357
  98. package/.agent/skills/local-first/SKILL.md +120 -154
  99. package/.agent/skills/mcp-builder/SKILL.md +84 -118
  100. package/.agent/skills/mobile-design/SKILL.md +213 -219
  101. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  102. package/.agent/skills/nextjs-react-expert/SKILL.md +99 -698
  103. package/.agent/skills/nodejs-best-practices/SKILL.md +498 -559
  104. package/.agent/skills/observability/SKILL.md +293 -330
  105. package/.agent/skills/parallel-agents/SKILL.md +88 -122
  106. package/.agent/skills/performance-profiling/SKILL.md +217 -254
  107. package/.agent/skills/plan-writing/SKILL.md +84 -118
  108. package/.agent/skills/platform-engineer/SKILL.md +89 -123
  109. package/.agent/skills/playwright-best-practices/SKILL.md +128 -162
  110. package/.agent/skills/powershell-windows/SKILL.md +112 -146
  111. package/.agent/skills/python-patterns/SKILL.md +7 -35
  112. package/.agent/skills/python-pro/SKILL.md +148 -754
  113. package/.agent/skills/react-specialist/SKILL.md +123 -827
  114. package/.agent/skills/readme-builder/SKILL.md +15 -85
  115. package/.agent/skills/realtime-patterns/SKILL.md +269 -304
  116. package/.agent/skills/red-team-tactics/SKILL.md +10 -51
  117. package/.agent/skills/rust-pro/SKILL.md +623 -701
  118. package/.agent/skills/seo-fundamentals/SKILL.md +120 -154
  119. package/.agent/skills/server-management/SKILL.md +156 -190
  120. package/.agent/skills/shadcn-ui-expert/SKILL.md +172 -206
  121. package/.agent/skills/skill-creator/SKILL.md +18 -58
  122. package/.agent/skills/sql-pro/SKILL.md +579 -633
  123. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
  124. package/.agent/skills/swiftui-expert/SKILL.md +142 -176
  125. package/.agent/skills/systematic-debugging/SKILL.md +84 -118
  126. package/.agent/skills/tailwind-patterns/SKILL.md +516 -576
  127. package/.agent/skills/tdd-workflow/SKILL.md +103 -137
  128. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  129. package/.agent/skills/testing-patterns/SKILL.md +512 -573
  130. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  131. package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
  132. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  133. package/.agent/skills/vue-expert/SKILL.md +127 -866
  134. package/.agent/skills/vulnerability-scanner/SKILL.md +354 -269
  135. package/.agent/skills/web-accessibility-auditor/SKILL.md +159 -193
  136. package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
  137. package/.agent/skills/webapp-testing/SKILL.md +111 -145
  138. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  139. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  140. package/.agent/workflows/api-tester.md +151 -151
  141. package/.agent/workflows/audit.md +127 -138
  142. package/.agent/workflows/brainstorm.md +110 -110
  143. package/.agent/workflows/changelog.md +112 -112
  144. package/.agent/workflows/create.md +124 -124
  145. package/.agent/workflows/debug.md +165 -189
  146. package/.agent/workflows/deploy.md +180 -189
  147. package/.agent/workflows/enhance.md +128 -151
  148. package/.agent/workflows/fix.md +114 -135
  149. package/.agent/workflows/generate.md +12 -4
  150. package/.agent/workflows/migrate.md +160 -160
  151. package/.agent/workflows/orchestrate.md +168 -168
  152. package/.agent/workflows/performance-benchmarker.md +114 -123
  153. package/.agent/workflows/plan.md +173 -173
  154. package/.agent/workflows/preview.md +80 -80
  155. package/.agent/workflows/refactor.md +161 -183
  156. package/.agent/workflows/review-ai.md +101 -129
  157. package/.agent/workflows/review.md +116 -116
  158. package/.agent/workflows/session.md +94 -94
  159. package/.agent/workflows/status.md +79 -79
  160. package/.agent/workflows/strengthen-skills.md +138 -139
  161. package/.agent/workflows/swarm.md +179 -179
  162. package/.agent/workflows/test.md +189 -211
  163. package/.agent/workflows/tribunal-backend.md +93 -113
  164. package/.agent/workflows/tribunal-database.md +94 -115
  165. package/.agent/workflows/tribunal-frontend.md +95 -118
  166. package/.agent/workflows/tribunal-full.md +92 -133
  167. package/.agent/workflows/tribunal-mobile.md +94 -119
  168. package/.agent/workflows/tribunal-performance.md +109 -133
  169. package/.agent/workflows/ui-ux-pro-max.md +122 -143
  170. package/package.json +1 -1
  171. package/.agent/skills/api-patterns/api-style.md +0 -42
  172. package/.agent/skills/api-patterns/auth.md +0 -24
  173. package/.agent/skills/api-patterns/documentation.md +0 -26
  174. package/.agent/skills/api-patterns/graphql.md +0 -41
  175. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  176. package/.agent/skills/api-patterns/response.md +0 -37
  177. package/.agent/skills/api-patterns/rest.md +0 -40
  178. package/.agent/skills/api-patterns/security-testing.md +0 -122
  179. package/.agent/skills/api-patterns/trpc.md +0 -41
  180. package/.agent/skills/api-patterns/versioning.md +0 -22
  181. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  182. package/.agent/skills/app-builder/feature-building.md +0 -53
  183. package/.agent/skills/app-builder/project-detection.md +0 -34
  184. package/.agent/skills/app-builder/scaffolding.md +0 -118
  185. package/.agent/skills/app-builder/tech-stack.md +0 -40
  186. package/.agent/skills/architecture/context-discovery.md +0 -43
  187. package/.agent/skills/architecture/examples.md +0 -94
  188. package/.agent/skills/architecture/pattern-selection.md +0 -68
  189. package/.agent/skills/architecture/patterns-reference.md +0 -50
  190. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  191. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  192. package/.agent/skills/database-design/database-selection.md +0 -43
  193. package/.agent/skills/database-design/indexing.md +0 -39
  194. package/.agent/skills/database-design/migrations.md +0 -48
  195. package/.agent/skills/database-design/optimization.md +0 -36
  196. package/.agent/skills/database-design/orm-selection.md +0 -30
  197. package/.agent/skills/database-design/schema-design.md +0 -56
  198. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  199. package/.agent/skills/frontend-design/color-system.md +0 -329
  200. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  201. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  202. package/.agent/skills/frontend-design/typography-system.md +0 -363
  203. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  204. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  205. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  206. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  207. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  208. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  209. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  210. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  211. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  212. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  213. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  214. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  215. package/.agent/skills/mobile-design/platform-android.md +0 -666
  216. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  217. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  218. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  219. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  220. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  221. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  222. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  223. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  224. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  225. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  226. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
@@ -1,576 +1,516 @@
1
- ---
2
- name: tailwind-patterns
3
- description: Tailwind CSS v4+ mastery. CSS-first configuration, @theme directive, container queries, scroll-driven animations, logical properties, clamp(), fluid typography, responsive design, dark mode, custom variants, component extraction, and performance optimization. Use when styling with Tailwind, building design systems, or optimizing CSS output.
4
- allowed-tools: Read, Write, Edit, Glob, Grep
5
- version: 2.0.0
6
- last-updated: 2026-04-01
7
- applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
- ---
9
-
10
- # Tailwind CSS v4+ — CSS-First Mastery
11
-
12
- > Tailwind v4 is a ground-up rewrite. The config file is gone. JavaScript is gone.
13
- > Everything is CSS-first. If you're still writing `tailwind.config.js`, you're writing legacy.
14
-
15
- ---
16
-
17
- ## v4 Configuration (CSS-First)
18
-
19
- ### The @theme Directive
20
-
21
- ```css
22
- /* app.css — THE configuration file in Tailwind v4 */
23
- @import "tailwindcss";
24
-
25
- @theme {
26
- /* Colors */
27
- --color-primary-50: oklch(0.97 0.02 250);
28
- --color-primary-100: oklch(0.93 0.04 250);
29
- --color-primary-500: oklch(0.55 0.18 250);
30
- --color-primary-600: oklch(0.48 0.18 250);
31
- --color-primary-700: oklch(0.40 0.16 250);
32
- --color-primary-900: oklch(0.25 0.10 250);
33
-
34
- --color-surface: oklch(0.99 0.00 0);
35
- --color-surface-alt: oklch(0.96 0.00 0);
36
- --color-text: oklch(0.15 0.00 0);
37
- --color-text-muted: oklch(0.45 0.00 0);
38
-
39
- /* Typography */
40
- --font-sans: "Inter", "system-ui", sans-serif;
41
- --font-mono: "JetBrains Mono", monospace;
42
-
43
- /* Spacing (extends the default scale) */
44
- --spacing-18: 4.5rem;
45
- --spacing-88: 22rem;
46
-
47
- /* Border radius */
48
- --radius-pill: 9999px;
49
- --radius-card: 1rem;
50
-
51
- /* Shadows */
52
- --shadow-card: 0 1px 3px oklch(0 0 0 / 0.08), 0 1px 2px oklch(0 0 0 / 0.06);
53
- --shadow-elevated: 0 10px 25px oklch(0 0 0 / 0.1), 0 4px 10px oklch(0 0 0 / 0.05);
54
-
55
- /* Animations */
56
- --animate-fade-in: fade-in 0.3s ease-out;
57
- --animate-slide-up: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
58
- }
59
-
60
- @keyframes fade-in {
61
- from { opacity: 0; }
62
- to { opacity: 1; }
63
- }
64
-
65
- @keyframes slide-up {
66
- from { opacity: 0; transform: translateY(12px); }
67
- to { opacity: 1; transform: translateY(0); }
68
- }
69
-
70
- /* HALLUCINATION TRAP: Tailwind v4 does NOT use tailwind.config.js
71
- ❌ module.exports = { theme: { extend: { ... } } } ← REMOVED in v4
72
- ✅ Use @theme { } directive in your CSS file
73
- @import "tailwindcss" replaces the three @tailwind directives */
74
- ```
75
-
76
- ### Dark Mode
77
-
78
- ```css
79
- /* Tailwind v4 dark mode with @theme */
80
- @theme {
81
- --color-surface: oklch(0.99 0.00 0);
82
- --color-text: oklch(0.15 0.00 0);
83
- }
84
-
85
- /* Dark variant — override variables */
86
- @variant dark {
87
- @theme {
88
- --color-surface: oklch(0.13 0.02 260);
89
- --color-text: oklch(0.93 0.00 0);
90
- }
91
- }
92
-
93
- /* Usage in HTML: */
94
- /* <div class="bg-surface text-text dark:bg-surface dark:text-text"> */
95
- /* With the @variant dark override, classes "just work" in dark mode */
96
- ```
97
-
98
- ```html
99
- <!-- Dark mode toggle pattern -->
100
- <html class="dark">
101
- <body class="bg-surface text-text transition-colors duration-300">
102
- <!-- Automatically uses dark @theme values -->
103
- </body>
104
- </html>
105
- ```
106
-
107
- ### Custom Variants
108
-
109
- ```css
110
- /* @variant — custom selector-based variants */
111
- @variant scrolled (&:where([data-scrolled]));
112
- @variant hocus (&:hover, &:focus-visible);
113
-
114
- /* Usage: */
115
- /* <nav class="scrolled:shadow-elevated hocus:ring-2"> */
116
- ```
117
-
118
- ---
119
-
120
- ## Layout Patterns
121
-
122
- ### Flexbox
123
-
124
- ```html
125
- <!-- Centered hero -->
126
- <section class="flex min-h-svh flex-col items-center justify-center gap-6 px-6">
127
- <h1 class="text-5xl font-bold tracking-tight">Hero Title</h1>
128
- <p class="max-w-2xl text-center text-lg text-text-muted">Subtitle text</p>
129
- <div class="flex gap-3">
130
- <button class="rounded-pill bg-primary-600 px-6 py-3 text-white">Primary</button>
131
- <button class="rounded-pill border border-primary-600 px-6 py-3 text-primary-600">Secondary</button>
132
- </div>
133
- </section>
134
-
135
- <!-- Sidebar layout -->
136
- <div class="flex min-h-svh">
137
- <aside class="w-64 shrink-0 border-r border-gray-200 p-4">Sidebar</aside>
138
- <main class="flex-1 overflow-y-auto p-6">Content</main>
139
- </div>
140
-
141
- <!-- ❌ HALLUCINATION TRAP: Use min-h-svh (small viewport height), NOT min-h-screen
142
- min-h-screen = 100vh (broken on mobile — includes browser chrome)
143
- min-h-svh = 100svh (accounts for mobile browser chrome)
144
- min-h-dvh = 100dvh (dynamic — updates as chrome shows/hides) -->
145
- ```
146
-
147
- ### CSS Grid
148
-
149
- ```html
150
- <!-- Auto-fit responsive grid (no breakpoints needed) -->
151
- <div class="grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-6">
152
- <div class="rounded-card bg-surface p-6 shadow-card">Card 1</div>
153
- <div class="rounded-card bg-surface p-6 shadow-card">Card 2</div>
154
- <div class="rounded-card bg-surface p-6 shadow-card">Card 3</div>
155
- </div>
156
-
157
- <!-- Dashboard grid with named areas -->
158
- <div class="grid grid-cols-[240px_1fr] grid-rows-[64px_1fr] min-h-svh">
159
- <header class="col-span-2 border-b">Header</header>
160
- <aside class="border-r p-4">Sidebar</aside>
161
- <main class="overflow-y-auto p-6">Content</main>
162
- </div>
163
-
164
- <!-- Bento grid -->
165
- <div class="grid auto-rows-[180px] grid-cols-3 gap-4">
166
- <div class="col-span-2 row-span-2 rounded-2xl bg-primary-100">Large</div>
167
- <div class="rounded-2xl bg-surface-alt">Small 1</div>
168
- <div class="rounded-2xl bg-surface-alt">Small 2</div>
169
- <div class="col-span-3 rounded-2xl bg-primary-50">Full width</div>
170
- </div>
171
- ```
172
-
173
- ### Container Queries
174
-
175
- ```html
176
- <!-- Container queries — component-level responsiveness -->
177
- <div class="@container">
178
- <div class="flex flex-col gap-3 @sm:flex-row @sm:items-center @lg:gap-6">
179
- <img class="size-16 rounded-full @sm:size-20" src="avatar.jpg" alt="">
180
- <div>
181
- <h3 class="text-lg font-semibold @lg:text-xl">User Name</h3>
182
- <p class="text-sm text-text-muted @lg:text-base">Description</p>
183
- </div>
184
- </div>
185
- </div>
186
-
187
- <!-- Named container -->
188
- <div class="@container/card">
189
- <div class="@md/card:grid @md/card:grid-cols-2">
190
- <!-- Responds to the card container's width, not viewport -->
191
- </div>
192
- </div>
193
-
194
- <!-- ❌ HALLUCINATION TRAP: Container queries use @sm, @md, @lg (with @ prefix)
195
- NOT sm:, md:, lg: — those are VIEWPORT breakpoints
196
- @sm = container >= 320px (component-level)
197
- sm: = viewport >= 640px (page-level) -->
198
- ```
199
-
200
- ---
201
-
202
- ## Typography
203
-
204
- ### Fluid Typography with clamp()
205
-
206
- ```html
207
- <!-- Fluid heading — scales smoothly from 2rem to 4rem -->
208
- <h1 class="text-[clamp(2rem,5vw,4rem)] font-bold leading-tight tracking-tight">
209
- Responsive Heading
210
- </h1>
211
-
212
- <!-- Fluid body text -->
213
- <p class="text-[clamp(1rem,1.2vw,1.25rem)] leading-relaxed text-text-muted">
214
- Body text that scales with viewport
215
- </p>
216
-
217
- <!-- Prose (for long-form content) -->
218
- <article class="prose prose-lg mx-auto max-w-3xl dark:prose-invert">
219
- <!-- @tailwindcss/typography plugin handles all typography -->
220
- <h1>Article Title</h1>
221
- <p>Paragraph with <a href="#">links</a> and <code>code</code>.</p>
222
- </article>
223
- ```
224
-
225
- ### Font Loading
226
-
227
- ```css
228
- /* @font-face in your CSS (Tailwind v4 approach) */
229
- @font-face {
230
- font-family: "Inter";
231
- font-weight: 100 900;
232
- font-display: swap;
233
- src: url("/fonts/inter-variable.woff2") format("woff2");
234
- }
235
-
236
- @theme {
237
- --font-sans: "Inter", system-ui, sans-serif;
238
- }
239
- ```
240
-
241
- ---
242
-
243
- ## Component Patterns
244
-
245
- ### Button System
246
-
247
- ```html
248
- <!-- Base button with variants -->
249
- <button class="inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
250
- text-sm font-medium transition-all duration-150
251
- focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500
252
- active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50">
253
- Button Text
254
- </button>
255
-
256
- <!-- Primary variant -->
257
- <button class="... bg-primary-600 text-white shadow-sm hover:bg-primary-700">Primary</button>
258
-
259
- <!-- Ghost variant -->
260
- <button class="... text-text hover:bg-gray-100 dark:hover:bg-gray-800">Ghost</button>
261
-
262
- <!-- Destructive variant -->
263
- <button class="... bg-red-600 text-white hover:bg-red-700">Delete</button>
264
-
265
- <!-- Icon button -->
266
- <button class="grid size-10 place-items-center rounded-lg hover:bg-gray-100"
267
- aria-label="Settings">
268
- <svg class="size-5" ...></svg>
269
- </button>
270
- ```
271
-
272
- ### Input System
273
-
274
- ```html
275
- <!-- Text input -->
276
- <div class="space-y-1.5">
277
- <label for="email" class="text-sm font-medium text-text">Email</label>
278
- <input id="email" type="email" placeholder="you@example.com"
279
- class="w-full rounded-lg border border-gray-300 bg-surface px-3.5 py-2.5
280
- text-sm text-text placeholder:text-text-muted
281
- transition-colors duration-150
282
- focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20
283
- disabled:cursor-not-allowed disabled:bg-gray-50 disabled:opacity-60"
284
- />
285
- <p class="text-xs text-red-500">Error message here</p>
286
- </div>
287
-
288
- <!-- Checkbox -->
289
- <label class="flex items-center gap-2.5 text-sm">
290
- <input type="checkbox"
291
- class="size-4 rounded border-gray-300 text-primary-600
292
- focus:ring-2 focus:ring-primary-500/20" />
293
- Remember me
294
- </label>
295
- ```
296
-
297
- ### Card Pattern
298
-
299
- ```html
300
- <div class="group overflow-hidden rounded-card bg-surface shadow-card
301
- transition-shadow duration-200 hover:shadow-elevated">
302
- <div class="aspect-video overflow-hidden bg-gray-100">
303
- <img src="cover.jpg" alt="Cover"
304
- class="size-full object-cover transition-transform duration-300
305
- group-hover:scale-105" />
306
- </div>
307
- <div class="space-y-2 p-5">
308
- <span class="inline-block rounded-full bg-primary-100 px-2.5 py-0.5
309
- text-xs font-medium text-primary-700">Category</span>
310
- <h3 class="text-lg font-semibold text-text line-clamp-2">Card Title</h3>
311
- <p class="text-sm text-text-muted line-clamp-3">Description text...</p>
312
- </div>
313
- </div>
314
- ```
315
-
316
- ### Modal / Dialog
317
-
318
- ```html
319
- <!-- Backdrop -->
320
- <div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50
321
- backdrop-blur-sm animate-fade-in">
322
- <!-- Modal -->
323
- <div class="w-full max-w-md rounded-2xl bg-surface p-6 shadow-elevated animate-slide-up"
324
- role="dialog" aria-modal="true" aria-labelledby="modal-title">
325
- <h2 id="modal-title" class="text-lg font-semibold">Dialog Title</h2>
326
- <p class="mt-2 text-sm text-text-muted">Dialog description.</p>
327
-
328
- <div class="mt-6 flex justify-end gap-3">
329
- <button class="rounded-lg px-4 py-2 text-sm hover:bg-gray-100">Cancel</button>
330
- <button class="rounded-lg bg-primary-600 px-4 py-2 text-sm text-white
331
- hover:bg-primary-700">Confirm</button>
332
- </div>
333
- </div>
334
- </div>
335
- ```
336
-
337
- ---
338
-
339
- ## Responsive Design Rules
340
-
341
- ```html
342
- <!-- Tailwind breakpoints (mobile-first) -->
343
- <!-- sm: 640px │ md: 768px │ lg: 1024px │ xl: 1280px │ 2xl: 1536px -->
344
-
345
- <!-- Stack on mobile, row on tablet+ -->
346
- <div class="flex flex-col gap-4 md:flex-row md:items-center">
347
- <div class="md:w-1/2">Left</div>
348
- <div class="md:w-1/2">Right</div>
349
- </div>
350
-
351
- <!-- Hide/show at breakpoints -->
352
- <nav class="hidden lg:flex">Desktop nav</nav>
353
- <button class="lg:hidden">☰ Mobile menu</button>
354
-
355
- <!-- Responsive padding -->
356
- <section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-24">
357
- <div class="mx-auto max-w-7xl">Content</div>
358
- </section>
359
-
360
- <!-- Responsive grid -->
361
- <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
362
- <!-- Cards -->
363
- </div>
364
- ```
365
-
366
- ---
367
-
368
- ## Animations & Transitions
369
-
370
- ### Transition Utilities
371
-
372
- ```html
373
- <!-- Smooth hover transitions -->
374
- <a class="text-text-muted transition-colors duration-150 hover:text-primary-600">Link</a>
375
-
376
- <!-- Transform transitions -->
377
- <div class="transition-transform duration-300 hover:-translate-y-1 hover:scale-105">
378
- Hover me
379
- </div>
380
-
381
- <!-- Combined transition -->
382
- <button class="rounded-lg bg-primary-600 px-4 py-2 text-white
383
- transition-all duration-200
384
- hover:bg-primary-700 hover:shadow-lg
385
- active:scale-95">
386
- Click me
387
- </button>
388
- ```
389
-
390
- ### Custom Keyframe Animations
391
-
392
- ```css
393
- @theme {
394
- --animate-bounce-in: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
395
- --animate-spin-slow: spin 3s linear infinite;
396
- --animate-pulse-soft: pulse-soft 2s ease-in-out infinite;
397
- }
398
-
399
- @keyframes bounce-in {
400
- 0% { opacity: 0; transform: scale(0.3); }
401
- 50% { transform: scale(1.05); }
402
- 70% { transform: scale(0.9); }
403
- 100% { opacity: 1; transform: scale(1); }
404
- }
405
-
406
- @keyframes pulse-soft {
407
- 0%, 100% { opacity: 1; }
408
- 50% { opacity: 0.7; }
409
- }
410
- ```
411
-
412
- ### Scroll-Driven Animations (CSS Native)
413
-
414
- ```css
415
- /* Progress bar that fills as user scrolls */
416
- .scroll-progress {
417
- animation: grow-width linear;
418
- animation-timeline: scroll();
419
- }
420
-
421
- @keyframes grow-width {
422
- from { transform: scaleX(0); }
423
- to { transform: scaleX(1); }
424
- }
425
- ```
426
-
427
- ```html
428
- <div class="scroll-progress fixed top-0 left-0 z-50 h-1 w-full origin-left bg-primary-600"></div>
429
- ```
430
-
431
- ---
432
-
433
- ## Performance
434
-
435
- ### Purging & Bundle Size
436
-
437
- ```css
438
- /* Tailwind v4 automatically tree-shakes unused CSS at build time */
439
- /* No manual purge configuration needed */
440
-
441
- /* @source — explicitly add content paths for scanning */
442
- @source "../components/**/*.tsx";
443
- @source "../pages/**/*.tsx";
444
-
445
- /* HALLUCINATION TRAP: Tailwind v4 does NOT use purge: [] config
446
- ❌ purge: ['./src/**/*.{html,tsx}'] ← REMOVED in v4
447
- ✅ Uses automatic content detection based on your project structure
448
- Use @source directive for custom paths */
449
- ```
450
-
451
- ### Avoiding Bloat
452
-
453
- ```html
454
- <!-- GOOD: Use component extraction for repeated patterns -->
455
- <!-- Create a .btn class in CSS instead of repeating 15 utilities -->
456
-
457
- <!-- ❌ BAD: One-off arbitrary values everywhere -->
458
- <div class="mt-[13px] mr-[7px] p-[11px] text-[15px]">
459
- <!-- Every arbitrary value = unique CSS rule = bundle bloat -->
460
- </div>
461
-
462
- <!-- ✅ GOOD: Use your design scale -->
463
- <div class="mt-3 mr-2 p-3 text-sm">
464
- <!-- Maps to existing utilities = zero extra CSS -->
465
- </div>
466
- ```
467
-
468
- ### Component Extraction (When to @apply)
469
-
470
- ```css
471
- /* Use @apply ONLY for highly reused component patterns */
472
- /* Do NOT @apply everything it defeats Tailwind's purpose */
473
-
474
- .btn {
475
- @apply inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
476
- text-sm font-medium transition-all duration-150
477
- focus-visible:outline-2 focus-visible:outline-offset-2
478
- active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50;
479
- }
480
-
481
- .btn-primary {
482
- @apply btn bg-primary-600 text-white shadow-sm hover:bg-primary-700
483
- focus-visible:outline-primary-500;
484
- }
485
-
486
- /* ❌ HALLUCINATION TRAP: @apply is for component patterns shared across files
487
- If a pattern appears in only 1-2 places, just use inline utilities
488
- Over-extracting with @apply = recreating regular CSS with extra steps */
489
- ```
490
-
491
- ---
492
-
493
- ## Accessibility with Tailwind
494
-
495
- ```html
496
- <!-- Focus visible (keyboard only, not mouse click) -->
497
- <a class="rounded-lg focus-visible:outline-2 focus-visible:outline-primary-500
498
- focus-visible:outline-offset-2">
499
- Keyboard accessible link
500
- </a>
501
-
502
- <!-- Screen reader only text -->
503
- <button>
504
- <svg class="size-5" aria-hidden="true"></svg>
505
- <span class="sr-only">Close menu</span>
506
- </button>
507
-
508
- <!-- Motion-safe / motion-reduce -->
509
- <div class="motion-safe:animate-bounce-in motion-reduce:animate-none">
510
- <!-- Only animates if user hasn't enabled "reduce motion" -->
511
- </div>
512
-
513
- <!-- Forced colors mode (high contrast) -->
514
- <button class="bg-primary-600 forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]">
515
- Accessible button
516
- </button>
517
- ```
518
-
519
- ---
520
-
521
- ## Output Format
522
-
523
- ```
524
- ━━━ Tailwind Expert Report ━━━━━━━━━━━━━━━━━━━━━━━
525
- Skill: Tailwind Patterns
526
- Tailwind: v4+
527
- Scope: [N files · N components]
528
- ─────────────────────────────────────────────────
529
- ✅ Passed: [checks that passed, or "All clean"]
530
- ⚠️ Warnings: [non-blocking issues, or "None"]
531
- ❌ Blocked: [blocking issues requiring fix, or "None"]
532
- ─────────────────────────────────────────────────
533
- VBC status: PENDING → VERIFIED
534
- Evidence: [build output / visual verification]
535
- ```
536
-
537
- ---
538
-
539
- ## 🤖 LLM-Specific Traps
540
-
541
- 1. **`tailwind.config.js` in v4:** There is NO JavaScript config file in Tailwind v4. All configuration is CSS-first with `@theme {}`.
542
- 2. **`@tailwind base/components/utilities`:** Replaced by `@import "tailwindcss"` — a single import.
543
- 3. **`purge:` Configuration:** Tailwind v4 auto-detects content files. No purge config exists.
544
- 4. **`min-h-screen` on Mobile:** 100vh is broken on mobile browsers. Use `min-h-svh` (100svh) or `min-h-dvh` (100dvh).
545
- 5. **`@sm` vs `sm:`:** `@sm` = container query (width of parent). `sm:` = viewport breakpoint. They are NOT interchangeable.
546
- 6. **Arbitrary Value Overuse:** `mt-[13px]` generates a unique CSS rule. Use the spacing scale (`mt-3`) whenever possible.
547
- 7. **`@apply` for Everything:** Over-extracting utilities into `@apply` classes defeats Tailwind's purpose. Only extract highly reused patterns.
548
- 8. **Non-oklch Colors:** Tailwind v4 uses oklch for its default palette. Defining custom colors in hex/rgb limits color manipulation.
549
- 9. **Missing `font-display: swap`:** Custom `@font-face` rules without `font-display: swap` cause FOIT (Flash of Invisible Text).
550
- 10. **Ignoring `forced-colors`:** High-contrast mode overrides all colors. Interactive elements MUST have `forced-colors:` fallbacks.
551
-
552
- ---
553
-
554
- ## 🏛️ Tribunal Integration
555
-
556
- **Slash command: `/tribunal-frontend`**
557
-
558
- ### ✅ Pre-Flight Self-Audit
559
-
560
- ```
561
- ✅ Did I use @theme {} (not tailwind.config.js)?
562
- ✅ Did I use @import "tailwindcss" (not @tailwind directives)?
563
- ✅ Did I use min-h-svh/dvh (not min-h-screen)?
564
- ✅ Did I use the design scale (not arbitrary values)?
565
- ✅ Did I use oklch for custom colors?
566
- ✅ Did I add focus-visible styles to all interactive elements?
567
- ✅ Did I add sr-only labels to icon-only buttons?
568
- ✅ Did I use motion-safe/motion-reduce for animations?
569
- ✅ Did I use @container/@sm for component-level responsiveness?
570
- ✅ Does the CSS build without warnings?
571
- ```
572
-
573
- ### 🛑 VBC Protocol
574
-
575
- - ❌ **Forbidden:** Assuming Tailwind classes work without building.
576
- - ✅ **Required:** Provide build output or visual screenshot evidence.
1
+ ---
2
+ name: tailwind-patterns
3
+ description: Tailwind CSS v4+ mastery. CSS-first configuration, @theme directive, container queries, scroll-driven animations, logical properties, clamp(), fluid typography, responsive design, dark mode, custom variants, component extraction, and performance optimization. Use when styling with Tailwind, building design systems, or optimizing CSS output.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 2.0.0
6
+ last-updated: 2026-04-01
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
+ ---
9
+
10
+ # Tailwind CSS v4+ — CSS-First Mastery
11
+
12
+ ---
13
+
14
+ ## v4 Configuration (CSS-First)
15
+
16
+ ### The @theme Directive
17
+
18
+ ```css
19
+ /* app.css THE configuration file in Tailwind v4 */
20
+ @import "tailwindcss";
21
+
22
+ @theme {
23
+ /* Colors */
24
+ --color-primary-50: oklch(0.97 0.02 250);
25
+ --color-primary-100: oklch(0.93 0.04 250);
26
+ --color-primary-500: oklch(0.55 0.18 250);
27
+ --color-primary-600: oklch(0.48 0.18 250);
28
+ --color-primary-700: oklch(0.40 0.16 250);
29
+ --color-primary-900: oklch(0.25 0.10 250);
30
+
31
+ --color-surface: oklch(0.99 0.00 0);
32
+ --color-surface-alt: oklch(0.96 0.00 0);
33
+ --color-text: oklch(0.15 0.00 0);
34
+ --color-text-muted: oklch(0.45 0.00 0);
35
+
36
+ /* Typography */
37
+ --font-sans: "Inter", "system-ui", sans-serif;
38
+ --font-mono: "JetBrains Mono", monospace;
39
+
40
+ /* Spacing (extends the default scale) */
41
+ --spacing-18: 4.5rem;
42
+ --spacing-88: 22rem;
43
+
44
+ /* Border radius */
45
+ --radius-pill: 9999px;
46
+ --radius-card: 1rem;
47
+
48
+ /* Shadows */
49
+ --shadow-card: 0 1px 3px oklch(0 0 0 / 0.08), 0 1px 2px oklch(0 0 0 / 0.06);
50
+ --shadow-elevated: 0 10px 25px oklch(0 0 0 / 0.1), 0 4px 10px oklch(0 0 0 / 0.05);
51
+
52
+ /* Animations */
53
+ --animate-fade-in: fade-in 0.3s ease-out;
54
+ --animate-slide-up: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
55
+ }
56
+
57
+ @keyframes fade-in {
58
+ from { opacity: 0; }
59
+ to { opacity: 1; }
60
+ }
61
+
62
+ @keyframes slide-up {
63
+ from { opacity: 0; transform: translateY(12px); }
64
+ to { opacity: 1; transform: translateY(0); }
65
+ }
66
+
67
+ /* HALLUCINATION TRAP: Tailwind v4 does NOT use tailwind.config.js
68
+ ❌ module.exports = { theme: { extend: { ... } } } ← REMOVED in v4
69
+ ✅ Use @theme { } directive in your CSS file
70
+ @import "tailwindcss" replaces the three @tailwind directives */
71
+ ```
72
+
73
+ ### Dark Mode
74
+
75
+ ```css
76
+ /* Tailwind v4 dark mode with @theme */
77
+ @theme {
78
+ --color-surface: oklch(0.99 0.00 0);
79
+ --color-text: oklch(0.15 0.00 0);
80
+ }
81
+
82
+ /* Dark variant — override variables */
83
+ @variant dark {
84
+ @theme {
85
+ --color-surface: oklch(0.13 0.02 260);
86
+ --color-text: oklch(0.93 0.00 0);
87
+ }
88
+ }
89
+
90
+ /* Usage in HTML: */
91
+ /* <div class="bg-surface text-text dark:bg-surface dark:text-text"> */
92
+ /* With the @variant dark override, classes "just work" in dark mode */
93
+ ```
94
+
95
+ ```html
96
+ <!-- Dark mode toggle pattern -->
97
+ <html class="dark">
98
+ <body class="bg-surface text-text transition-colors duration-300">
99
+ <!-- Automatically uses dark @theme values -->
100
+ </body>
101
+ </html>
102
+ ```
103
+
104
+ ### Custom Variants
105
+
106
+ ```css
107
+ /* @variant — custom selector-based variants */
108
+ @variant scrolled (&:where([data-scrolled]));
109
+ @variant hocus (&:hover, &:focus-visible);
110
+
111
+ /* Usage: */
112
+ /* <nav class="scrolled:shadow-elevated hocus:ring-2"> */
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Layout Patterns
118
+
119
+ ### Flexbox
120
+
121
+ ```html
122
+ <!-- Centered hero -->
123
+ <section class="flex min-h-svh flex-col items-center justify-center gap-6 px-6">
124
+ <h1 class="text-5xl font-bold tracking-tight">Hero Title</h1>
125
+ <p class="max-w-2xl text-center text-lg text-text-muted">Subtitle text</p>
126
+ <div class="flex gap-3">
127
+ <button class="rounded-pill bg-primary-600 px-6 py-3 text-white">Primary</button>
128
+ <button class="rounded-pill border border-primary-600 px-6 py-3 text-primary-600">Secondary</button>
129
+ </div>
130
+ </section>
131
+
132
+ <!-- Sidebar layout -->
133
+ <div class="flex min-h-svh">
134
+ <aside class="w-64 shrink-0 border-r border-gray-200 p-4">Sidebar</aside>
135
+ <main class="flex-1 overflow-y-auto p-6">Content</main>
136
+ </div>
137
+
138
+ <!-- HALLUCINATION TRAP: Use min-h-svh (small viewport height), NOT min-h-screen
139
+ min-h-screen = 100vh (broken on mobile — includes browser chrome)
140
+ min-h-svh = 100svh (accounts for mobile browser chrome)
141
+ min-h-dvh = 100dvh (dynamic updates as chrome shows/hides) -->
142
+ ```
143
+
144
+ ### CSS Grid
145
+
146
+ ```html
147
+ <!-- Auto-fit responsive grid (no breakpoints needed) -->
148
+ <div class="grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-6">
149
+ <div class="rounded-card bg-surface p-6 shadow-card">Card 1</div>
150
+ <div class="rounded-card bg-surface p-6 shadow-card">Card 2</div>
151
+ <div class="rounded-card bg-surface p-6 shadow-card">Card 3</div>
152
+ </div>
153
+
154
+ <!-- Dashboard grid with named areas -->
155
+ <div class="grid grid-cols-[240px_1fr] grid-rows-[64px_1fr] min-h-svh">
156
+ <header class="col-span-2 border-b">Header</header>
157
+ <aside class="border-r p-4">Sidebar</aside>
158
+ <main class="overflow-y-auto p-6">Content</main>
159
+ </div>
160
+
161
+ <!-- Bento grid -->
162
+ <div class="grid auto-rows-[180px] grid-cols-3 gap-4">
163
+ <div class="col-span-2 row-span-2 rounded-2xl bg-primary-100">Large</div>
164
+ <div class="rounded-2xl bg-surface-alt">Small 1</div>
165
+ <div class="rounded-2xl bg-surface-alt">Small 2</div>
166
+ <div class="col-span-3 rounded-2xl bg-primary-50">Full width</div>
167
+ </div>
168
+ ```
169
+
170
+ ### Container Queries
171
+
172
+ ```html
173
+ <!-- Container queries — component-level responsiveness -->
174
+ <div class="@container">
175
+ <div class="flex flex-col gap-3 @sm:flex-row @sm:items-center @lg:gap-6">
176
+ <img class="size-16 rounded-full @sm:size-20" src="avatar.jpg" alt="">
177
+ <div>
178
+ <h3 class="text-lg font-semibold @lg:text-xl">User Name</h3>
179
+ <p class="text-sm text-text-muted @lg:text-base">Description</p>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <!-- Named container -->
185
+ <div class="@container/card">
186
+ <div class="@md/card:grid @md/card:grid-cols-2">
187
+ <!-- Responds to the card container's width, not viewport -->
188
+ </div>
189
+ </div>
190
+
191
+ <!-- ❌ HALLUCINATION TRAP: Container queries use @sm, @md, @lg (with @ prefix)
192
+ NOT sm:, md:, lg: — those are VIEWPORT breakpoints
193
+ @sm = container >= 320px (component-level)
194
+ sm: = viewport >= 640px (page-level) -->
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Typography
200
+
201
+ ### Fluid Typography with clamp()
202
+
203
+ ```html
204
+ <!-- Fluid heading scales smoothly from 2rem to 4rem -->
205
+ <h1 class="text-[clamp(2rem,5vw,4rem)] font-bold leading-tight tracking-tight">
206
+ Responsive Heading
207
+ </h1>
208
+
209
+ <!-- Fluid body text -->
210
+ <p class="text-[clamp(1rem,1.2vw,1.25rem)] leading-relaxed text-text-muted">
211
+ Body text that scales with viewport
212
+ </p>
213
+
214
+ <!-- Prose (for long-form content) -->
215
+ <article class="prose prose-lg mx-auto max-w-3xl dark:prose-invert">
216
+ <!-- @tailwindcss/typography plugin handles all typography -->
217
+ <h1>Article Title</h1>
218
+ <p>Paragraph with <a href="#">links</a> and <code>code</code>.</p>
219
+ </article>
220
+ ```
221
+
222
+ ### Font Loading
223
+
224
+ ```css
225
+ /* @font-face in your CSS (Tailwind v4 approach) */
226
+ @font-face {
227
+ font-family: "Inter";
228
+ font-weight: 100 900;
229
+ font-display: swap;
230
+ src: url("/fonts/inter-variable.woff2") format("woff2");
231
+ }
232
+
233
+ @theme {
234
+ --font-sans: "Inter", system-ui, sans-serif;
235
+ }
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Component Patterns
241
+
242
+ ### Button System
243
+
244
+ ```html
245
+ <!-- Base button with variants -->
246
+ <button class="inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
247
+ text-sm font-medium transition-all duration-150
248
+ focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500
249
+ active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50">
250
+ Button Text
251
+ </button>
252
+
253
+ <!-- Primary variant -->
254
+ <button class="... bg-primary-600 text-white shadow-sm hover:bg-primary-700">Primary</button>
255
+
256
+ <!-- Ghost variant -->
257
+ <button class="... text-text hover:bg-gray-100 dark:hover:bg-gray-800">Ghost</button>
258
+
259
+ <!-- Destructive variant -->
260
+ <button class="... bg-red-600 text-white hover:bg-red-700">Delete</button>
261
+
262
+ <!-- Icon button -->
263
+ <button class="grid size-10 place-items-center rounded-lg hover:bg-gray-100"
264
+ aria-label="Settings">
265
+ <svg class="size-5" ...></svg>
266
+ </button>
267
+ ```
268
+
269
+ ### Input System
270
+
271
+ ```html
272
+ <!-- Text input -->
273
+ <div class="space-y-1.5">
274
+ <label for="email" class="text-sm font-medium text-text">Email</label>
275
+ <input id="email" type="email" placeholder="you@example.com"
276
+ class="w-full rounded-lg border border-gray-300 bg-surface px-3.5 py-2.5
277
+ text-sm text-text placeholder:text-text-muted
278
+ transition-colors duration-150
279
+ focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20
280
+ disabled:cursor-not-allowed disabled:bg-gray-50 disabled:opacity-60"
281
+ />
282
+ <p class="text-xs text-red-500">Error message here</p>
283
+ </div>
284
+
285
+ <!-- Checkbox -->
286
+ <label class="flex items-center gap-2.5 text-sm">
287
+ <input type="checkbox"
288
+ class="size-4 rounded border-gray-300 text-primary-600
289
+ focus:ring-2 focus:ring-primary-500/20" />
290
+ Remember me
291
+ </label>
292
+ ```
293
+
294
+ ### Card Pattern
295
+
296
+ ```html
297
+ <div class="group overflow-hidden rounded-card bg-surface shadow-card
298
+ transition-shadow duration-200 hover:shadow-elevated">
299
+ <div class="aspect-video overflow-hidden bg-gray-100">
300
+ <img src="cover.jpg" alt="Cover"
301
+ class="size-full object-cover transition-transform duration-300
302
+ group-hover:scale-105" />
303
+ </div>
304
+ <div class="space-y-2 p-5">
305
+ <span class="inline-block rounded-full bg-primary-100 px-2.5 py-0.5
306
+ text-xs font-medium text-primary-700">Category</span>
307
+ <h3 class="text-lg font-semibold text-text line-clamp-2">Card Title</h3>
308
+ <p class="text-sm text-text-muted line-clamp-3">Description text...</p>
309
+ </div>
310
+ </div>
311
+ ```
312
+
313
+ ### Modal / Dialog
314
+
315
+ ```html
316
+ <!-- Backdrop -->
317
+ <div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50
318
+ backdrop-blur-sm animate-fade-in">
319
+ <!-- Modal -->
320
+ <div class="w-full max-w-md rounded-2xl bg-surface p-6 shadow-elevated animate-slide-up"
321
+ role="dialog" aria-modal="true" aria-labelledby="modal-title">
322
+ <h2 id="modal-title" class="text-lg font-semibold">Dialog Title</h2>
323
+ <p class="mt-2 text-sm text-text-muted">Dialog description.</p>
324
+
325
+ <div class="mt-6 flex justify-end gap-3">
326
+ <button class="rounded-lg px-4 py-2 text-sm hover:bg-gray-100">Cancel</button>
327
+ <button class="rounded-lg bg-primary-600 px-4 py-2 text-sm text-white
328
+ hover:bg-primary-700">Confirm</button>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ ```
333
+
334
+ ---
335
+
336
+ ## Responsive Design Rules
337
+
338
+ ```html
339
+ <!-- Tailwind breakpoints (mobile-first) -->
340
+ <!-- sm: 640px │ md: 768px │ lg: 1024px │ xl: 1280px │ 2xl: 1536px -->
341
+
342
+ <!-- Stack on mobile, row on tablet+ -->
343
+ <div class="flex flex-col gap-4 md:flex-row md:items-center">
344
+ <div class="md:w-1/2">Left</div>
345
+ <div class="md:w-1/2">Right</div>
346
+ </div>
347
+
348
+ <!-- Hide/show at breakpoints -->
349
+ <nav class="hidden lg:flex">Desktop nav</nav>
350
+ <button class="lg:hidden">☰ Mobile menu</button>
351
+
352
+ <!-- Responsive padding -->
353
+ <section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-24">
354
+ <div class="mx-auto max-w-7xl">Content</div>
355
+ </section>
356
+
357
+ <!-- Responsive grid -->
358
+ <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
359
+ <!-- Cards -->
360
+ </div>
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Animations & Transitions
366
+
367
+ ### Transition Utilities
368
+
369
+ ```html
370
+ <!-- Smooth hover transitions -->
371
+ <a class="text-text-muted transition-colors duration-150 hover:text-primary-600">Link</a>
372
+
373
+ <!-- Transform transitions -->
374
+ <div class="transition-transform duration-300 hover:-translate-y-1 hover:scale-105">
375
+ Hover me
376
+ </div>
377
+
378
+ <!-- Combined transition -->
379
+ <button class="rounded-lg bg-primary-600 px-4 py-2 text-white
380
+ transition-all duration-200
381
+ hover:bg-primary-700 hover:shadow-lg
382
+ active:scale-95">
383
+ Click me
384
+ </button>
385
+ ```
386
+
387
+ ### Custom Keyframe Animations
388
+
389
+ ```css
390
+ @theme {
391
+ --animate-bounce-in: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
392
+ --animate-spin-slow: spin 3s linear infinite;
393
+ --animate-pulse-soft: pulse-soft 2s ease-in-out infinite;
394
+ }
395
+
396
+ @keyframes bounce-in {
397
+ 0% { opacity: 0; transform: scale(0.3); }
398
+ 50% { transform: scale(1.05); }
399
+ 70% { transform: scale(0.9); }
400
+ 100% { opacity: 1; transform: scale(1); }
401
+ }
402
+
403
+ @keyframes pulse-soft {
404
+ 0%, 100% { opacity: 1; }
405
+ 50% { opacity: 0.7; }
406
+ }
407
+ ```
408
+
409
+ ### Scroll-Driven Animations (CSS Native)
410
+
411
+ ```css
412
+ /* Progress bar that fills as user scrolls */
413
+ .scroll-progress {
414
+ animation: grow-width linear;
415
+ animation-timeline: scroll();
416
+ }
417
+
418
+ @keyframes grow-width {
419
+ from { transform: scaleX(0); }
420
+ to { transform: scaleX(1); }
421
+ }
422
+ ```
423
+
424
+ ```html
425
+ <div class="scroll-progress fixed top-0 left-0 z-50 h-1 w-full origin-left bg-primary-600"></div>
426
+ ```
427
+
428
+ ---
429
+
430
+ ## Performance
431
+
432
+ ### Purging & Bundle Size
433
+
434
+ ```css
435
+ /* Tailwind v4 automatically tree-shakes unused CSS at build time */
436
+ /* No manual purge configuration needed */
437
+
438
+ /* @source explicitly add content paths for scanning */
439
+ @source "../components/**/*.tsx";
440
+ @source "../pages/**/*.tsx";
441
+
442
+ /* ❌ HALLUCINATION TRAP: Tailwind v4 does NOT use purge: [] config
443
+ purge: ['./src/**/*.{html,tsx}'] ← REMOVED in v4
444
+ ✅ Uses automatic content detection based on your project structure
445
+ Use @source directive for custom paths */
446
+ ```
447
+
448
+ ### Avoiding Bloat
449
+
450
+ ```html
451
+ <!-- GOOD: Use component extraction for repeated patterns -->
452
+ <!-- Create a .btn class in CSS instead of repeating 15 utilities -->
453
+
454
+ <!-- BAD: One-off arbitrary values everywhere -->
455
+ <div class="mt-[13px] mr-[7px] p-[11px] text-[15px]">
456
+ <!-- Every arbitrary value = unique CSS rule = bundle bloat -->
457
+ </div>
458
+
459
+ <!-- GOOD: Use your design scale -->
460
+ <div class="mt-3 mr-2 p-3 text-sm">
461
+ <!-- Maps to existing utilities = zero extra CSS -->
462
+ </div>
463
+ ```
464
+
465
+ ### Component Extraction (When to @apply)
466
+
467
+ ```css
468
+ /* Use @apply ONLY for highly reused component patterns */
469
+ /* Do NOT @apply everything — it defeats Tailwind's purpose */
470
+
471
+ .btn {
472
+ @apply inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5
473
+ text-sm font-medium transition-all duration-150
474
+ focus-visible:outline-2 focus-visible:outline-offset-2
475
+ active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50;
476
+ }
477
+
478
+ .btn-primary {
479
+ @apply btn bg-primary-600 text-white shadow-sm hover:bg-primary-700
480
+ focus-visible:outline-primary-500;
481
+ }
482
+
483
+ /* ❌ HALLUCINATION TRAP: @apply is for component patterns shared across files
484
+ If a pattern appears in only 1-2 places, just use inline utilities
485
+ Over-extracting with @apply = recreating regular CSS with extra steps */
486
+ ```
487
+
488
+ ---
489
+
490
+ ## Accessibility with Tailwind
491
+
492
+ ```html
493
+ <!-- Focus visible (keyboard only, not mouse click) -->
494
+ <a class="rounded-lg focus-visible:outline-2 focus-visible:outline-primary-500
495
+ focus-visible:outline-offset-2">
496
+ Keyboard accessible link
497
+ </a>
498
+
499
+ <!-- Screen reader only text -->
500
+ <button>
501
+ <svg class="size-5" aria-hidden="true"></svg>
502
+ <span class="sr-only">Close menu</span>
503
+ </button>
504
+
505
+ <!-- Motion-safe / motion-reduce -->
506
+ <div class="motion-safe:animate-bounce-in motion-reduce:animate-none">
507
+ <!-- Only animates if user hasn't enabled "reduce motion" -->
508
+ </div>
509
+
510
+ <!-- Forced colors mode (high contrast) -->
511
+ <button class="bg-primary-600 forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]">
512
+ Accessible button
513
+ </button>
514
+ ```
515
+
516
+ ---