@behavioral-agentic-design-system/core 0.1.4 → 0.2.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.
package/src/styles.css CHANGED
@@ -1,3 +1,6 @@
1
+ /* GENERATED FROM tokens.json — DO NOT EDIT BY HAND.
2
+ * Run `pnpm build:tokens` after changing tokens.json. */
3
+
1
4
  /* @behavioral-agentic-design-system/core — single-file theme import.
2
5
  *
3
6
  * Usage in your app's global stylesheet:
@@ -5,15 +8,8 @@
5
8
  * @import "tw-animate-css";
6
9
  * @import "@behavioral-agentic-design-system/core/styles.css";
7
10
  *
8
- * This file ships:
9
- * - Atkinson Hyperlegible from Google Fonts (default sans, zero setup)
10
- * - The full :root + .dark token set (shadcn neutral palette)
11
- * - The @theme inline mapping so Tailwind v4 picks up every token
12
- * - Accessibility floor: text-xs=14px, text-sm=16px, text-base=18px
13
- *
14
- * It does NOT ship Tailwind itself — your app must already have Tailwind v4.
15
- * Override any token by re-declaring it after this @import. See
16
- * ENGINEERING.md for customization patterns.
11
+ * Atkinson Hyperlegible loaded from Google Fonts; zero font setup required.
12
+ * Override any token by re-declaring it after this @import.
17
13
  */
18
14
 
19
15
  @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
@@ -22,86 +18,113 @@
22
18
 
23
19
  :root {
24
20
  --font-sans: 'Atkinson Hyperlegible', ui-sans-serif, sans-serif, system-ui;
25
- --font-mono: ui-monospace, 'Menlo', 'Monaco', monospace;
21
+ --font-mono: 'JetBrains Mono', ui-monospace, monospace;
26
22
  --font-serif: ui-serif, Georgia, serif;
23
+ --font-size-scale: 1;
27
24
 
28
25
  --background: oklch(1 0 0);
29
- --foreground: oklch(0.145 0 0);
26
+ --foreground: oklch(0.1450 0 0);
30
27
  --card: oklch(1 0 0);
31
- --card-foreground: oklch(0.145 0 0);
28
+ --card-foreground: oklch(0.1450 0 0);
32
29
  --popover: oklch(1 0 0);
33
- --popover-foreground: oklch(0.145 0 0);
34
- --primary: oklch(0.205 0 0);
35
- --primary-foreground: oklch(0.985 0 0);
36
- --secondary: oklch(0.97 0 0);
37
- --secondary-foreground: oklch(0.205 0 0);
38
- --muted: oklch(0.97 0 0);
39
- --muted-foreground: oklch(0.556 0 0);
40
- --accent: oklch(0.97 0 0);
41
- --accent-foreground: oklch(0.205 0 0);
42
- --destructive: oklch(0.577 0.245 27.325);
43
- --destructive-foreground: oklch(0.985 0 0);
44
- --border: oklch(0.922 0 0);
45
- --input: oklch(0.922 0 0);
46
- --ring: oklch(0.708 0 0);
47
- --chart-1: oklch(0.646 0.222 41.116);
48
- --chart-2: oklch(0.6 0.118 184.704);
49
- --chart-3: oklch(0.398 0.07 227.392);
50
- --chart-4: oklch(0.828 0.189 84.429);
51
- --chart-5: oklch(0.769 0.188 70.08);
52
- --sidebar: oklch(0.985 0 0);
53
- --sidebar-foreground: oklch(0.145 0 0);
54
- --sidebar-primary: oklch(0.205 0 0);
55
- --sidebar-primary-foreground: oklch(0.985 0 0);
56
- --sidebar-accent: oklch(0.97 0 0);
57
- --sidebar-accent-foreground: oklch(0.205 0 0);
58
- --sidebar-border: oklch(0.922 0 0);
59
- --sidebar-ring: oklch(0.708 0 0);
30
+ --popover-foreground: oklch(0.1450 0 0);
31
+ --primary: #1F1F1F;
32
+ --primary-foreground: #FAFAFA;
33
+ --secondary: oklch(0.9700 0 0);
34
+ --secondary-foreground: oklch(0.2050 0 0);
35
+ --muted: oklch(0.9700 0 0);
36
+ --muted-foreground: oklch(0.3700 0 0);
37
+ --accent: oklch(0.9700 0 0);
38
+ --accent-foreground: oklch(0.2050 0 0);
39
+ --destructive: oklch(0.4400 0.2300 27.3250);
40
+ --destructive-foreground: oklch(1 0 0);
41
+ --border: oklch(0.6100 0 0);
42
+ --input: oklch(0.6100 0 0);
43
+ --ring: oklch(0.4500 0 0);
44
+ --chart-1: oklch(0.5800 0.2000 252);
45
+ --chart-2: oklch(0.5500 0.1800 145);
46
+ --chart-3: oklch(0.5800 0.1800 50);
47
+ --chart-4: oklch(0.5300 0.2100 320);
48
+ --chart-5: oklch(0.5500 0.2000 25);
49
+ --sidebar: oklch(0.9850 0 0);
50
+ --sidebar-foreground: oklch(0.1450 0 0);
51
+ --sidebar-primary: oklch(0.2050 0 0);
52
+ --sidebar-primary-foreground: oklch(0.9850 0 0);
53
+ --sidebar-accent: oklch(0.9700 0 0);
54
+ --sidebar-accent-foreground: oklch(0.2050 0 0);
55
+ --sidebar-border: oklch(0.6100 0 0);
56
+ --sidebar-ring: oklch(0.4500 0 0);
57
+ --semantic-text-primary: var(--foreground);
58
+ --semantic-text-secondary: var(--muted-foreground);
59
+ --semantic-text-on-primary: var(--primary-foreground);
60
+ --semantic-surface-page: var(--background);
61
+ --semantic-surface-card: var(--card);
62
+ --semantic-surface-overlay: oklch(0.145 0 0 / 0.8);
63
+ --semantic-border-default: var(--border);
64
+ --semantic-border-input: var(--input);
65
+ --semantic-border-focus: var(--ring);
66
+ --semantic-action-primary: var(--primary);
67
+ --semantic-action-primary-hover: oklch(from var(--primary) calc(l + 0.1) c h);
68
+ --semantic-action-destructive: var(--destructive);
60
69
 
61
70
  --radius: 0.625rem;
62
- --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
63
- --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
64
- --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
65
- --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
66
- --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
67
- --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
68
- --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
69
- --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
71
+ --shadow-opacity: 0.10;
72
+ --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / calc(var(--shadow-opacity) * 0.5));
73
+ --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / calc(var(--shadow-opacity) * 0.5));
74
+ --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / var(--shadow-opacity)), 0 1px 2px -1px hsl(0 0% 0% / var(--shadow-opacity));
75
+ --shadow: 0 1px 3px 0px hsl(0 0% 0% / var(--shadow-opacity)), 0 1px 2px -1px hsl(0 0% 0% / var(--shadow-opacity));
76
+ --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / var(--shadow-opacity)), 0 2px 4px -1px hsl(0 0% 0% / var(--shadow-opacity));
77
+ --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / var(--shadow-opacity)), 0 4px 6px -1px hsl(0 0% 0% / var(--shadow-opacity));
78
+ --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / var(--shadow-opacity)), 0 8px 10px -1px hsl(0 0% 0% / var(--shadow-opacity));
79
+ --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / calc(var(--shadow-opacity) * 2.5));
80
+ --spacing: 0.25rem;
81
+
82
+ /* Chart palette — derives from --primary so brand changes propagate.
83
+ Override individual --chart-N inline (documentElement.style) to opt out. */
84
+ --chart-lightness: 0.58;
85
+ --chart-1: oklch(from var(--primary) var(--chart-lightness) c h);
86
+ --chart-2: oklch(from var(--primary) var(--chart-lightness) calc(c * 0.65) calc(h + 35));
87
+ --chart-3: oklch(from var(--primary) var(--chart-lightness) c calc(h + 70));
88
+ --chart-4: oklch(from var(--primary) var(--chart-lightness) c calc(h + 105));
89
+ --chart-5: oklch(from var(--primary) var(--chart-lightness) c calc(h + 140));
70
90
  }
71
91
 
72
92
  .dark {
73
- --background: oklch(0.145 0 0);
74
- --foreground: oklch(0.985 0 0);
75
- --card: oklch(0.205 0 0);
76
- --card-foreground: oklch(0.985 0 0);
77
- --popover: oklch(0.205 0 0);
78
- --popover-foreground: oklch(0.985 0 0);
79
- --primary: oklch(0.922 0 0);
80
- --primary-foreground: oklch(0.205 0 0);
81
- --secondary: oklch(0.269 0 0);
82
- --secondary-foreground: oklch(0.985 0 0);
83
- --muted: oklch(0.269 0 0);
84
- --muted-foreground: oklch(0.708 0 0);
85
- --accent: oklch(0.269 0 0);
86
- --accent-foreground: oklch(0.985 0 0);
87
- --destructive: oklch(0.704 0.191 22.216);
88
- --destructive-foreground: oklch(0.985 0 0);
89
- --border: oklch(1 0 0 / 10%);
90
- --input: oklch(1 0 0 / 15%);
91
- --ring: oklch(0.556 0 0);
92
- --chart-1: oklch(0.488 0.243 264.376);
93
- --chart-2: oklch(0.696 0.17 162.48);
94
- --chart-3: oklch(0.769 0.188 70.08);
95
- --chart-4: oklch(0.627 0.265 303.9);
96
- --chart-5: oklch(0.645 0.246 16.439);
97
- --sidebar: oklch(0.205 0 0);
98
- --sidebar-foreground: oklch(0.985 0 0);
99
- --sidebar-primary: oklch(0.488 0.243 264.376);
100
- --sidebar-primary-foreground: oklch(0.985 0 0);
101
- --sidebar-accent: oklch(0.269 0 0);
102
- --sidebar-accent-foreground: oklch(0.985 0 0);
103
- --sidebar-border: oklch(1 0 0 / 10%);
104
- --sidebar-ring: oklch(0.556 0 0);
93
+ --background: oklch(0.1450 0 0);
94
+ --foreground: oklch(0.9850 0 0);
95
+ --card: oklch(0.2050 0 0);
96
+ --card-foreground: oklch(0.9850 0 0);
97
+ --popover: oklch(0.2690 0 0);
98
+ --popover-foreground: oklch(0.9850 0 0);
99
+ --primary: #FAFAFA;
100
+ --primary-foreground: #1F1F1F;
101
+ --secondary: oklch(0.2690 0 0);
102
+ --secondary-foreground: oklch(0.9850 0 0);
103
+ --muted: oklch(0.2690 0 0);
104
+ --muted-foreground: oklch(0.7800 0 0);
105
+ --accent: oklch(0.3710 0 0);
106
+ --accent-foreground: oklch(0.9850 0 0);
107
+ --destructive: oklch(0.7500 0.1600 22.2160);
108
+ --destructive-foreground: oklch(0.1500 0 0);
109
+ --border: oklch(0.5500 0 0);
110
+ --input: oklch(0.5500 0 0);
111
+ --ring: oklch(0.7000 0 0);
112
+ --chart-1: oklch(0.7800 0.1600 220);
113
+ --chart-2: oklch(0.7400 0.1800 145);
114
+ --chart-3: oklch(0.8000 0.1700 80);
115
+ --chart-4: oklch(0.7200 0.2000 320);
116
+ --chart-5: oklch(0.7400 0.1900 35);
117
+ --sidebar: oklch(0.2050 0 0);
118
+ --sidebar-foreground: oklch(0.9850 0 0);
119
+ --sidebar-primary: oklch(0.4200 0.2000 264.3760);
120
+ --sidebar-primary-foreground: oklch(0.9850 0 0);
121
+ --sidebar-accent: oklch(0.2690 0 0);
122
+ --sidebar-accent-foreground: oklch(0.9850 0 0);
123
+ --sidebar-border: oklch(0.5500 0 0);
124
+ --sidebar-ring: oklch(0.7000 0 0);
125
+
126
+ /* Lift lightness on dark backgrounds so charts stay readable. */
127
+ --chart-lightness: 0.78;
105
128
  }
106
129
 
107
130
  @theme inline {
@@ -147,15 +170,60 @@
147
170
  --radius-lg: var(--radius);
148
171
  --radius-xl: calc(var(--radius) + 4px);
149
172
 
173
+ /* Map Tailwind's shadow-* utilities through to the :root --shadow-* tokens
174
+ so the Customize tab's Shadow Opacity slider takes effect. Without this
175
+ mapping, shadow-sm / shadow-md / shadow-lg etc. resolve to Tailwind's
176
+ built-in box-shadow values and ignore --shadow-opacity entirely. */
177
+ --shadow-2xs: var(--shadow-2xs);
178
+ --shadow-xs: var(--shadow-xs);
179
+ --shadow-sm: var(--shadow-sm);
180
+ --shadow: var(--shadow);
181
+ --shadow-md: var(--shadow-md);
182
+ --shadow-lg: var(--shadow-lg);
183
+ --shadow-xl: var(--shadow-xl);
184
+ --shadow-2xl: var(--shadow-2xl);
185
+
150
186
  /* Accessibility floor — minimum 14px for text-xs (vs Tailwind's 12px default).
151
- * See ENGINEERING.md "Accessibility" for the full WCAG AA contract. */
152
- --text-xs: 14px;
153
- --text-sm: 16px;
154
- --text-base: 18px;
155
- --text-lg: 20px;
156
- --text-xl: 24px;
157
- --text-2xl: 28px;
158
- --text-3xl: 32px;
187
+ Font sizes are dynamically computed by useGlobalTypeScale hook and set as
188
+ --text-xs-size, --text-sm-size, etc. These are then scaled by --font-size-scale
189
+ (1 = 100%, 0.8 = 80%, etc) so the Customize tab slider affects all text. */
190
+ --text-xs: calc(var(--text-xs-size, 14px) * var(--font-size-scale, 1));
191
+ --text-sm: calc(var(--text-sm-size, 16px) * var(--font-size-scale, 1));
192
+ --text-base: calc(var(--text-base-size, 18px) * var(--font-size-scale, 1));
193
+ --text-lg: calc(var(--text-lg-size, 20px) * var(--font-size-scale, 1));
194
+ --text-xl: calc(var(--text-xl-size, 24px) * var(--font-size-scale, 1));
195
+ --text-2xl: calc(var(--text-2xl-size, 28px) * var(--font-size-scale, 1));
196
+ --text-3xl: calc(var(--text-3xl-size, 32px) * var(--font-size-scale, 1));
197
+
198
+ /* Marketing tier — display sizes for landing pages, hero blocks, editorial.
199
+ Tailwind only emits utilities that get used, so a non-marketing fork pays
200
+ nothing for these. line-height drops to 1.1 at scale to keep big type
201
+ readable; tracking tightens slightly to compensate for optical loosening. */
202
+ --text-4xl: calc(36px * var(--font-size-scale, 1));
203
+ --text-5xl: calc(48px * var(--font-size-scale, 1));
204
+ --text-6xl: calc(60px * var(--font-size-scale, 1));
205
+ --text-7xl: calc(72px * var(--font-size-scale, 1));
206
+ --text-8xl: calc(96px * var(--font-size-scale, 1));
207
+ --text-4xl--line-height: 1.15;
208
+ --text-5xl--line-height: 1.10;
209
+ --text-6xl--line-height: 1.05;
210
+ --text-7xl--line-height: 1.02;
211
+ --text-8xl--line-height: 1.00;
212
+ --text-4xl--letter-spacing: -0.015em;
213
+ --text-5xl--letter-spacing: -0.020em;
214
+ --text-6xl--letter-spacing: -0.025em;
215
+ --text-7xl--letter-spacing: -0.030em;
216
+ --text-8xl--letter-spacing: -0.035em;
217
+
218
+ /* Tracking — every Tailwind tracking-* utility folds in the runtime
219
+ --tracking-offset offset, so the Customize tab slider moves the
220
+ entire app (headlines included), not just unstyled text. */
221
+ --tracking-tighter: calc(-0.05em + var(--tracking-offset, 0em));
222
+ --tracking-tight: calc(-0.025em + var(--tracking-offset, 0em));
223
+ --tracking-normal: var(--tracking-offset, 0em);
224
+ --tracking-wide: calc(0.025em + var(--tracking-offset, 0em));
225
+ --tracking-wider: calc(0.05em + var(--tracking-offset, 0em));
226
+ --tracking-widest: calc(0.1em + var(--tracking-offset, 0em));
159
227
  }
160
228
 
161
229
  @layer base {
@@ -166,5 +234,77 @@
166
234
  @apply bg-background text-foreground;
167
235
  -webkit-font-smoothing: antialiased;
168
236
  -moz-osx-font-smoothing: grayscale;
237
+ /* WCAG AAA 1.4.8 Visual Presentation: body line-height ≥ 1.5. */
238
+ line-height: 1.5;
239
+ /* WCAG AAA 1.4.8: avoid full-justified body — uneven word spacing
240
+ hurts readability. Components opt-in to justify only when needed. */
241
+ text-align: start;
242
+ }
243
+ /* WCAG AAA 1.4.8: paragraph spacing ≥ 1.5× line-height inside running
244
+ text. Scope to <p> only — UI primitives stay tight. Last-child has
245
+ no trailing margin so containers don't get extra padding. */
246
+ p:not(:last-child) {
247
+ margin-bottom: 1.5em;
248
+ }
249
+ /* WCAG AAA 2.4.13 Focus Appearance: focus indicator must be ≥ 2 CSS
250
+ pixels thick AND have ≥ 3:1 contrast against adjacent colors. The
251
+ --ring token is luminance-tuned for 3:1 against every surface in
252
+ the system. Always show a 2px offset so the ring isn't visually
253
+ obscured by the component's own border. */
254
+ :focus-visible {
255
+ outline-offset: 2px;
256
+ }
257
+ /* WCAG AAA 2.3.3 Animation from Interactions: respect the user's
258
+ reduced-motion preference globally. Components with essential
259
+ motion (loading spinners, progress bars) opt back in via
260
+ `motion-safe:` Tailwind utilities or scoped @media queries. */
261
+ @media (prefers-reduced-motion: reduce) {
262
+ *,
263
+ *::before,
264
+ *::after {
265
+ animation-duration: 0.01ms !important;
266
+ animation-iteration-count: 1 !important;
267
+ transition-duration: 0.01ms !important;
268
+ scroll-behavior: auto !important;
269
+ }
270
+ }
271
+ }
272
+
273
+ /* Global tracking offset — the Letter Spacing slider in the Customize
274
+ tab writes --tracking-offset on documentElement (via use-global-design-
275
+ controls). Both the @theme inline tracking-* tokens AND this body rule
276
+ fold it in, so every element retracks live: utilities-styled elements
277
+ via the Tailwind classes, unstyled text via inheritance from body. */
278
+ html, body {
279
+ letter-spacing: var(--tracking-offset, 0em);
280
+ }
281
+
282
+ /* Theme toggle: iris reveal via View Transitions API. The click coords are
283
+ written to --x / --y on <html> before startViewTransition fires (see
284
+ app/page.tsx toggleDark). */
285
+ ::view-transition-old(root),
286
+ ::view-transition-new(root) {
287
+ animation: none;
288
+ mix-blend-mode: normal;
289
+ }
290
+ ::view-transition-old(root) { z-index: 0; }
291
+ ::view-transition-new(root) { z-index: 1; }
292
+
293
+ @keyframes theme-reveal {
294
+ from {
295
+ clip-path: circle(0% at var(--x, 50%) var(--y, 50%));
296
+ opacity: 0.7;
169
297
  }
298
+ to {
299
+ clip-path: circle(150% at var(--x, 50%) var(--y, 50%));
300
+ opacity: 1;
301
+ }
302
+ }
303
+
304
+ ::view-transition-new(root) {
305
+ animation: theme-reveal 0.4s ease-in-out forwards;
306
+ }
307
+
308
+ @media (prefers-reduced-motion: reduce) {
309
+ ::view-transition-new(root) { animation: none; }
170
310
  }