@hanzo/design 0.4.0 → 0.4.2
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/components/core/Avatar.jsx +1 -1
- package/components/core/Badge.jsx +10 -7
- package/components/core/Button.jsx +35 -10
- package/components/core/Card.jsx +20 -5
- package/components/core/Progress.jsx +1 -1
- package/components/core/Table.jsx +2 -2
- package/components/forms/Checkbox.jsx +1 -1
- package/components/forms/Input.jsx +15 -5
- package/components/forms/Select.jsx +3 -3
- package/components/forms/Slider.jsx +1 -1
- package/components/forms/Textarea.jsx +3 -3
- package/components/navigation/Accordion.jsx +2 -2
- package/components/navigation/Tabs.jsx +18 -7
- package/components/navigation/navigation.card.html +1 -1
- package/components/overlays/Dialog.jsx +2 -2
- package/components/overlays/DropdownMenu.jsx +10 -6
- package/components/overlays/Sheet.jsx +3 -3
- package/components/overlays/Toaster.jsx +1 -1
- package/dist/tokens.gen.d.ts +126 -76
- package/dist/tokens.gen.d.ts.map +1 -1
- package/dist/tokens.gen.js +126 -76
- package/package.json +1 -1
- package/scripts/check-tokens.mjs +71 -4
- package/src/tokens.gen.ts +126 -76
- package/styles.css +486 -84
- package/tailwind.css +486 -84
- package/tokens/base.css +146 -5
- package/tokens/colors.css +181 -66
- package/tokens/elevation.css +76 -5
- package/tokens/motion.css +15 -0
- package/tokens/spacing.css +46 -7
- package/tokens/typography.css +21 -0
package/styles.css
CHANGED
|
@@ -16,9 +16,25 @@
|
|
|
16
16
|
/* Hanzo is monochrome. One hue rendered through an opacity ladder.
|
|
17
17
|
Base ladder = Tailwind neutral (tailwind.config.ts). Semantic names match
|
|
18
18
|
hanzo.ai's CSS variables exactly, so code copies over 1:1.
|
|
19
|
-
DARK IS THE DEFAULT THEME (hanzo.ai mounts ThemeProvider defaultTheme="dark").
|
|
19
|
+
DARK IS THE DEFAULT THEME (hanzo.ai mounts ThemeProvider defaultTheme="dark").
|
|
20
|
+
|
|
21
|
+
The dark palette is derived from the chat surface in hanzoai/extension
|
|
22
|
+
(packages/browser/src/sidebar.css), which is the reference aesthetic: a
|
|
23
|
+
#0a0a0a ground, #fafafa ink, and boundaries drawn as LOW-ALPHA HAIRLINES.
|
|
24
|
+
Two properties of that reference are load-bearing and easy to lose:
|
|
25
|
+
|
|
26
|
+
1. Borders are alpha, not hex. rgb(255 255 255 / .10) composites correctly on
|
|
27
|
+
#0a0a0a AND on #262626; a solid #1f1f1f reads on the page and vanishes the
|
|
28
|
+
moment it lands on a lifted surface — which is why anyone who needed a
|
|
29
|
+
visible edge reached past it for the CONTROL rung and got a wireframe.
|
|
30
|
+
2. Surfaces lift by tiny steps (0a -> 0f -> 17 -> 26), and ink is a graded
|
|
31
|
+
ramp (#fafafa -> .78 -> .55 -> #a3a3a3), not one flat white. Pure #ffffff
|
|
32
|
+
on pure #000000 is 21:1 — the maximum-contrast pair that exists, and it
|
|
33
|
+
halates. #fafafa on #0a0a0a is 18.1:1: still far past AAA, visibly softer. */
|
|
20
34
|
|
|
21
35
|
:root{
|
|
36
|
+
color-scheme:dark;
|
|
37
|
+
|
|
22
38
|
/* ——— base neutral ladder ——— */
|
|
23
39
|
--neutral-50:#FAFAFA;
|
|
24
40
|
--neutral-100:#F5F5F5;
|
|
@@ -38,77 +54,160 @@
|
|
|
38
54
|
--hanzo-white:#FFFFFF;
|
|
39
55
|
|
|
40
56
|
/* ——— the opacity ladder: the real palette ——— */
|
|
57
|
+
/* Every rung below .30 is a HAIRLINE or a LIFT — the two things this system
|
|
58
|
+
draws with. The rungs are the reference's own values, not a rounded ramp. */
|
|
41
59
|
--white-05:rgb(255 255 255 / .05);
|
|
60
|
+
--white-06:rgb(255 255 255 / .06);
|
|
61
|
+
--white-08:rgb(255 255 255 / .08);
|
|
42
62
|
--white-10:rgb(255 255 255 / .10);
|
|
43
63
|
--white-15:rgb(255 255 255 / .15);
|
|
64
|
+
--white-16:rgb(255 255 255 / .16);
|
|
44
65
|
--white-20:rgb(255 255 255 / .20);
|
|
66
|
+
--white-22:rgb(255 255 255 / .22);
|
|
45
67
|
--white-30:rgb(255 255 255 / .30);
|
|
46
68
|
--white-40:rgb(255 255 255 / .40);
|
|
69
|
+
--white-55:rgb(255 255 255 / .55);
|
|
47
70
|
--white-60:rgb(255 255 255 / .60);
|
|
71
|
+
--white-78:rgb(255 255 255 / .78);
|
|
48
72
|
--white-80:rgb(255 255 255 / .80);
|
|
49
73
|
|
|
50
74
|
/* ——— semantic aliases (dark, the default) ——— */
|
|
51
|
-
--background:#
|
|
52
|
-
--foreground:#
|
|
53
|
-
--card:#
|
|
54
|
-
--card-foreground:#
|
|
55
|
-
--popover:#
|
|
56
|
-
--popover-foreground:#
|
|
57
|
-
--primary:#
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
--
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
--background:#0a0a0a;
|
|
76
|
+
--foreground:#fafafa;
|
|
77
|
+
--card:#0f0f0f;
|
|
78
|
+
--card-foreground:#fafafa;
|
|
79
|
+
--popover:#0f0f0f;
|
|
80
|
+
--popover-foreground:#fafafa;
|
|
81
|
+
--primary:#fafafa;
|
|
82
|
+
/* A 5% step, not the 16% this used to be. A filled button's fill is already
|
|
83
|
+
the top of the ink ramp, so the only directions available on hover are
|
|
84
|
+
"dimmer" and "brighter-around-the-edges" — and a 16% drop reads as the
|
|
85
|
+
button going DISABLED under the cursor, which is the one thing a hover must
|
|
86
|
+
never look like. The step is now small enough to register as pressure while
|
|
87
|
+
--bloom does the actual work of lighting it up. */
|
|
88
|
+
--primary-hover:#e5e5e5;
|
|
89
|
+
--primary-foreground:#0a0a0a;
|
|
90
|
+
--secondary:#262626;
|
|
91
|
+
/* One rung up, so a secondary button HAS a hover. It previously resolved to
|
|
92
|
+
--surface-3, which is --secondary — the same value it starts at. */
|
|
93
|
+
--secondary-hover:#333333;
|
|
94
|
+
--secondary-foreground:#fafafa;
|
|
95
|
+
--muted:#171717;
|
|
96
|
+
--muted-foreground:#a3a3a3;
|
|
97
|
+
--accent:#262626;
|
|
98
|
+
--accent-foreground:#fafafa;
|
|
99
|
+
/* Destructive is the ONE place the monochrome rule already yields, and it was
|
|
100
|
+
yielding in only half the system: a field that fails validation draws
|
|
101
|
+
--state-error (#ef4444, which DESIGN.md §2.4 lists as permitted precisely
|
|
102
|
+
for "destructive / blocking error"), while the button that performs the
|
|
103
|
+
destruction drew #666666 — a mid-grey that is indistinguishable from a
|
|
104
|
+
disabled control. "Delete everything" and "you cannot click this" must not
|
|
105
|
+
be the same colour. So the two converge on the one token that already
|
|
106
|
+
names this meaning, and the ramp stays monochrome everywhere else. */
|
|
107
|
+
--destructive:var(--state-error);
|
|
108
|
+
--destructive-hover:#dc2626; /* red-600 — deepens under the cursor */
|
|
109
|
+
--destructive-foreground:#fafafa;
|
|
110
|
+
|
|
111
|
+
/* ——— boundaries ———
|
|
112
|
+
ONE ladder, cut from alpha, graded by duty. Every rung is a rung of the
|
|
113
|
+
opacity ladder above, so every boundary composites correctly on the page,
|
|
114
|
+
on a card, and inside a popover — and every rung is the reference's own
|
|
115
|
+
measured value, not a rounded ramp:
|
|
116
|
+
|
|
117
|
+
--border .10 the hairline. Cards, panels, dividers, list rows.
|
|
118
|
+
--border-strong .16 the same hairline, one step up. Hover, emphasis.
|
|
119
|
+
--border-control .15 a control's resting edge — input, select, textarea.
|
|
120
|
+
--border-focus .22 that control, focused.
|
|
121
|
+
--border-selected .30 the thing that is currently CHOSEN — the active
|
|
122
|
+
tab, the current tile, the featured plan.
|
|
123
|
+
|
|
124
|
+
The previous release cut the last three from the NEUTRAL ladder instead,
|
|
125
|
+
because a boundary that clears WCAG 1.4.11's 3:1 on a near-black ground IS
|
|
126
|
+
a mid-grey and no amount of tuning changes that. It is true, and it is also
|
|
127
|
+
what a wireframe looks like: a 1px #737373 box around every field, four
|
|
128
|
+
times heavier than the hairline beside it, so a form read as a debug
|
|
129
|
+
overlay rather than a surface. Aesthetics decided it — the reference draws
|
|
130
|
+
an input at rgb(255 255 255 / .15) and a focused one at .22 (sidebar.css
|
|
131
|
+
--input-border / .composer-box:focus-within), and that is what ships here.
|
|
132
|
+
|
|
133
|
+
What replaces the ratio is the FOCUS INDICATOR, which is the thing a
|
|
134
|
+
keyboard user actually navigates by and the one boundary still pinned at
|
|
135
|
+
3:1 (--ring, below). A resting edge is an affordance; a focus ring is a
|
|
136
|
+
position. Only the second one is load-bearing when you cannot see well, and
|
|
137
|
+
spending the contrast budget there rather than on all four edges of every
|
|
138
|
+
idle field is what lets the system be quiet AND findable at once. */
|
|
139
|
+
--border:var(--white-10);
|
|
140
|
+
--border-strong:var(--white-16);
|
|
141
|
+
--border-control:var(--white-15); /* sidebar.css --input-border */
|
|
142
|
+
--border-focus:var(--white-22); /* .composer-box:focus-within */
|
|
143
|
+
--border-selected:var(--white-30); /* the current tab / tile / plan */
|
|
144
|
+
--input:var(--border-control); /* shadcn `border-input` — a control */
|
|
69
145
|
/* A focus indicator is a NON-TEXT CONTRAST target: WCAG 2.4.11/1.4.11 require
|
|
70
|
-
3:1 against every surface it can land on
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
146
|
+
3:1 against every surface it can land on, and unlike a resting edge it is
|
|
147
|
+
worth the loudness — it is transient, it only appears on keyboard focus,
|
|
148
|
+
and it is the whole of how a keyboard user knows where they are.
|
|
149
|
+
--white-40 clears it on every canvas in both themes precisely BECAUSE it is
|
|
150
|
+
alpha: on a lifted surface the ring lifts with it (3.77:1 on #0a0a0a,
|
|
151
|
+
3.66:1 on #262626), which a fixed grey cannot do. */
|
|
152
|
+
--ring:var(--white-40);
|
|
153
|
+
/* The soft halo that sits outside the ring — the reference's
|
|
154
|
+
`box-shadow: 0 0 0 2px rgb(255 255 255 / .06)` on a focused composer. It
|
|
155
|
+
carries no ratio; it is what makes focus read as designed rather than as a
|
|
156
|
+
browser default. Spent through --ring-focus (tokens/elevation.css). */
|
|
157
|
+
--ring-halo:var(--white-10);
|
|
75
158
|
--brand:#e4e4e7;
|
|
76
159
|
--brand-foreground:#09090b;
|
|
77
160
|
--brand-muted:#a3a3a3;
|
|
78
161
|
--black:#000000;
|
|
79
|
-
--white:#
|
|
80
|
-
|
|
81
|
-
|
|
162
|
+
--white:#fafafa;
|
|
163
|
+
--selection:var(--white-20);
|
|
164
|
+
|
|
165
|
+
/* ——— glass: the lift ———
|
|
166
|
+
How a surface rises WITHOUT a block fill. An alpha-white wash composites
|
|
167
|
+
over whatever it lands on, so one value works on the page, on a card and
|
|
168
|
+
inside a popover. This is the mechanism behind the reference's depth. */
|
|
169
|
+
--glass:var(--white-05);
|
|
170
|
+
--glass-strong:var(--white-08);
|
|
171
|
+
|
|
172
|
+
/* ——— surface recipes ———
|
|
173
|
+
A card has to be a SURFACE, which means you have to be able to see that it
|
|
174
|
+
is not the page. These were cut from neutral-900 (#171717) at .4/.5/.8, and
|
|
175
|
+
at .5 that composites to #101010 on a #0a0a0a ground — six levels above the
|
|
176
|
+
page, which is not a surface, it is a very slightly different black. Three
|
|
177
|
+
cards side by side then read as one flat field with hairlines ruled across
|
|
178
|
+
it, and no amount of shadow fixes it, because you cannot cast a shadow onto
|
|
179
|
+
black.
|
|
180
|
+
|
|
181
|
+
Cut from neutral-800 (#262626) instead, they land on 14 / 18 / 1f — the
|
|
182
|
+
reference's own panel (#171717 on a #0f0f0f container) with room either
|
|
183
|
+
side of it. They stay ALPHA so a card nested in a popover still lifts off
|
|
184
|
+
its parent rather than punching a hole in it; that is the whole reason
|
|
185
|
+
these are recipes and not just --surface-* rungs. */
|
|
82
186
|
--surface-page:var(--background);
|
|
83
|
-
--surface-card:rgb(
|
|
84
|
-
--surface-card-emphasis:rgb(
|
|
85
|
-
--surface-card-quiet:rgb(
|
|
86
|
-
|
|
187
|
+
--surface-card:rgb(38 38 38 / .5); /* -> #181818 on the page */
|
|
188
|
+
--surface-card-emphasis:rgb(38 38 38 / .75);/* -> #1f1f1f — featured */
|
|
189
|
+
--surface-card-quiet:rgb(38 38 38 / .35); /* -> #141414 — story cards */
|
|
190
|
+
/* A floating panel that is the SAME colour as the page is not floating. This
|
|
191
|
+
was rgb(10 10 10 / .95) — the page, at 95% of the page. */
|
|
192
|
+
--surface-overlay:rgb(23 23 23 / .92); /* dropdown / popover panels */
|
|
87
193
|
--surface-header:rgb(0 0 0 / .7); /* fixed nav, with backdrop blur */
|
|
88
194
|
--surface-scrim:rgb(0 0 0 / .8); /* the dialog / sheet backdrop */
|
|
89
|
-
/* Boundaries come in two kinds and they are NOT interchangeable.
|
|
90
|
-
DECORATIVE (--border, --border-hairline, --border-card): separates content;
|
|
91
|
-
WCAG imposes no ratio. Keep them quiet.
|
|
92
|
-
PERCEIVABLE (--border-strong): identifies a CONTROL — an input edge, a
|
|
93
|
-
switch, a checkbox — and must clear 3:1 (WCAG 1.4.11) on every surface.
|
|
94
|
-
Reach for --border-strong whenever the boundary IS the affordance. */
|
|
95
|
-
--border-hairline:var(--neutral-800);
|
|
96
|
-
--border-card:var(--white-10);
|
|
97
|
-
--border-strong:var(--neutral-500); /* 3.59:1 worst case — see --ring */
|
|
98
195
|
|
|
99
196
|
/* ——— the numeric surface ladder ——— */
|
|
100
197
|
/* Aliases onto the semantic canvases above, so a brand fork that retunes
|
|
101
198
|
--card/--muted/--secondary retunes the ladder with it and the light theme
|
|
102
|
-
inverts for free. Ascending lift: 0 is the page, 3 is a hovered control.
|
|
199
|
+
inverts for free. Ascending lift: 0 is the page, 3 is a hovered control.
|
|
200
|
+
Dark resolves to the reference's own ladder — 0a / 0f / 17 / 26. */
|
|
103
201
|
--surface-0:var(--background);
|
|
104
202
|
--surface-1:var(--card);
|
|
105
203
|
--surface-2:var(--muted);
|
|
106
204
|
--surface-3:var(--secondary);
|
|
107
205
|
|
|
108
|
-
/* ——— text ranks ———
|
|
109
|
-
|
|
110
|
-
--text-
|
|
111
|
-
--text-
|
|
206
|
+
/* ——— text ranks ———
|
|
207
|
+
A graded ramp, not one flat white. The steps are the reference's. */
|
|
208
|
+
--text-primary:#fafafa;
|
|
209
|
+
--text-secondary:var(--white-78);
|
|
210
|
+
--text-tertiary:var(--white-55);
|
|
112
211
|
--text-helper:var(--muted-foreground);
|
|
113
212
|
--text-disabled:var(--white-30);
|
|
114
213
|
|
|
@@ -123,47 +222,63 @@
|
|
|
123
222
|
--chrome-dot-green:rgb(34 197 94 / .6);
|
|
124
223
|
}
|
|
125
224
|
|
|
126
|
-
/* Light theme — the same tokens, inverted.
|
|
225
|
+
/* Light theme — the same tokens, inverted.
|
|
226
|
+
The white-opacity ladder does NOT invert: --white-16 is white-on-white here.
|
|
227
|
+
So EVERY token whose dark value is a --white-* rung must be restated below,
|
|
228
|
+
and check-tokens.mjs fails the build if one is missed — that class of bug is
|
|
229
|
+
silent (the border simply stops existing) and has shipped before. */
|
|
127
230
|
.light{
|
|
231
|
+
color-scheme:light;
|
|
128
232
|
--background:#ffffff;
|
|
129
233
|
--foreground:#0a0a0a;
|
|
130
|
-
|
|
234
|
+
/* A ladder, not four names for #f5f5f5. Light lifts by the same tiny steps
|
|
235
|
+
dark does — ~2% per rung — so --surface-0..3 mean something in both themes. */
|
|
236
|
+
--card:#fafafa;
|
|
131
237
|
--card-foreground:#0a0a0a;
|
|
132
238
|
--popover:#ffffff;
|
|
133
239
|
--popover-foreground:#0a0a0a;
|
|
134
240
|
--primary:#0a0a0a;
|
|
135
|
-
--primary-
|
|
136
|
-
--
|
|
241
|
+
--primary-hover:#262626;
|
|
242
|
+
--primary-foreground:#fafafa;
|
|
243
|
+
--secondary:#ededed;
|
|
244
|
+
--secondary-hover:#e0e0e0;
|
|
137
245
|
--secondary-foreground:#0a0a0a;
|
|
138
246
|
--muted:#f5f5f5;
|
|
139
247
|
--muted-foreground:#525252;
|
|
140
|
-
--accent:#
|
|
248
|
+
--accent:#ededed;
|
|
141
249
|
--accent-foreground:#0a0a0a;
|
|
142
|
-
--destructive
|
|
250
|
+
--destructive:var(--state-error);
|
|
251
|
+
--destructive-hover:#dc2626;
|
|
143
252
|
--destructive-foreground:#ffffff;
|
|
144
|
-
--border
|
|
145
|
-
--
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
253
|
+
--border:rgb(0 0 0 / .10);
|
|
254
|
+
--border-strong:rgb(0 0 0 / .16);
|
|
255
|
+
--border-control:rgb(0 0 0 / .15);
|
|
256
|
+
/* Focus and selection are pushed further here than the .22/.30 they sit at in
|
|
257
|
+
dark. Black-on-white at a given alpha reads FAINTER than white-on-black at
|
|
258
|
+
the same alpha — .22 black on #ffffff measures 1.69:1 where .22 white on
|
|
259
|
+
#0a0a0a measures 1.97:1 — so mirroring the number would quietly make the
|
|
260
|
+
light theme's focus state the weakest state in the system. */
|
|
261
|
+
--border-focus:rgb(0 0 0 / .32);
|
|
262
|
+
--border-selected:rgb(0 0 0 / .42);
|
|
263
|
+
--input:var(--border-control);
|
|
264
|
+
/* Same duty, same 3:1 floor, opposite direction: .50 black is 3.98:1 on
|
|
265
|
+
#ffffff and 3.67:1 on #f5f5f5. */
|
|
266
|
+
--ring:rgb(0 0 0 / .5);
|
|
267
|
+
--ring-halo:rgb(0 0 0 / .07);
|
|
150
268
|
--black:#0a0a0a;
|
|
151
269
|
--white:#ffffff;
|
|
152
|
-
--
|
|
270
|
+
--selection:rgb(0 0 0 / .16);
|
|
271
|
+
--glass:rgb(0 0 0 / .04);
|
|
272
|
+
--glass-strong:rgb(0 0 0 / .07);
|
|
273
|
+
--surface-card:#fafafa;
|
|
153
274
|
--surface-card-emphasis:#ffffff;
|
|
154
|
-
--surface-card-quiet:#
|
|
275
|
+
--surface-card-quiet:#fcfcfc;
|
|
155
276
|
--surface-overlay:rgb(255 255 255 / .95);
|
|
156
277
|
--surface-header:rgb(255 255 255 / .8);
|
|
157
278
|
--surface-scrim:rgb(0 0 0 / .5);
|
|
158
|
-
--border-hairline:var(--neutral-200);
|
|
159
|
-
--border-card:rgb(0 0 0 / .1);
|
|
160
|
-
--border-strong:var(--neutral-500); /* was --neutral-300 = 1.48:1 on white */
|
|
161
|
-
/* The white-opacity ladder does NOT invert, so --white-40 is white-on-white
|
|
162
|
-
here (1.00:1). Anything that needs a visible edge in BOTH themes must use
|
|
163
|
-
--border-strong, never a --white-* rung. */
|
|
164
279
|
--text-primary:var(--neutral-950);
|
|
165
|
-
--text-secondary:rgb(10 10 10 / .
|
|
166
|
-
--text-tertiary:rgb(10 10 10 / .
|
|
280
|
+
--text-secondary:rgb(10 10 10 / .78);
|
|
281
|
+
--text-tertiary:rgb(10 10 10 / .55);
|
|
167
282
|
--text-disabled:rgb(10 10 10 / .3);
|
|
168
283
|
}
|
|
169
284
|
|
|
@@ -206,6 +321,19 @@
|
|
|
206
321
|
--font-size-8xl:var(--text-8xl);
|
|
207
322
|
--font-size-9xl:var(--text-9xl);
|
|
208
323
|
|
|
324
|
+
/* The size a FORM CONTROL renders at — and the ONE step in this scale that is
|
|
325
|
+
not a constant. iOS Safari zooms the viewport whenever a focused input
|
|
326
|
+
computes below 16px, and this scale's base is 14px, so every surface that
|
|
327
|
+
sized a field from --text-sm or --text-base bought the zoom.
|
|
328
|
+
|
|
329
|
+
It has to be a TOKEN rather than a rule because a control's size is almost
|
|
330
|
+
always set inline (every component in components/forms does), and an inline
|
|
331
|
+
style outranks any stylesheet — including a media query. A var() resolves
|
|
332
|
+
per-device inside that inline style, so this is the only construction that
|
|
333
|
+
actually reaches the control. Fields ask for --text-control; nothing else
|
|
334
|
+
should. */
|
|
335
|
+
--text-control:var(--text-sm);
|
|
336
|
+
|
|
209
337
|
--weight-normal:400;
|
|
210
338
|
--weight-medium:500;
|
|
211
339
|
--weight-semibold:600;
|
|
@@ -234,6 +362,14 @@
|
|
|
234
362
|
--type-eyebrow:600 0.625rem/1 var(--font-sans);
|
|
235
363
|
}
|
|
236
364
|
|
|
365
|
+
/* On touch, a control goes to 16px. Below that iOS Safari zooms the viewport on
|
|
366
|
+
focus and never zooms back out, which is the single most common way a mobile
|
|
367
|
+
form feels broken. pointer:coarse is the real signal — a desktop mouse keeps
|
|
368
|
+
the compact 13px field. */
|
|
369
|
+
@media (pointer:coarse){
|
|
370
|
+
:root{--text-control:1rem}
|
|
371
|
+
}
|
|
372
|
+
|
|
237
373
|
/* ── tokens/spacing.css ─────────────────────────────────────── */
|
|
238
374
|
/* Spacing: the 4px Tailwind ramp is what ships. The golden-ratio ramp below is
|
|
239
375
|
declared in hanzo.ai's tailwind.config.ts (legacy v3 config, kept for
|
|
@@ -267,18 +403,57 @@
|
|
|
267
403
|
--golden-9:11.749rem;
|
|
268
404
|
--golden-split:38.2% 61.8%; /* @kind other */
|
|
269
405
|
|
|
270
|
-
/* layout rules (DESIGN.md §1.3)
|
|
406
|
+
/* layout rules (DESIGN.md §1.3) —
|
|
407
|
+
MOBILE-FIRST: the values authored here are the PHONE values, and the
|
|
408
|
+
min-width block at the bottom of this file scales them up. A surface that
|
|
409
|
+
uses the raw token therefore gets a layout that already breathes correctly
|
|
410
|
+
at 390px, with no media query of its own. (This is also the value the
|
|
411
|
+
generator captures for tokens.gen.ts — first occurrence wins, and the
|
|
412
|
+
authored default is the small one.) */
|
|
271
413
|
--container-max:80rem; /* max-w-7xl — grids */
|
|
272
414
|
--container-prose:48rem; /* max-w-3xl — centered text */
|
|
273
415
|
--container-wide:72rem; /* max-w-6xl — landing sections */
|
|
274
|
-
|
|
416
|
+
/* The page gutter also clears a notch. env() is 0px on every device without
|
|
417
|
+
one, so this is exactly `1rem` in the ordinary case and the safe inset when
|
|
418
|
+
there is something to avoid — no per-app work, no landscape clipping.
|
|
419
|
+
Requires `<meta name="viewport" content="…,viewport-fit=cover">` on the
|
|
420
|
+
host page; without it the UA reports 0 and the max() is inert, not wrong. */
|
|
421
|
+
--gutter:max(1rem,var(--safe-left),var(--safe-right));
|
|
275
422
|
--gutter-sm:1.5rem; /* sm:px-6 */
|
|
276
423
|
--gutter-lg:2rem; /* lg:px-8 */
|
|
277
|
-
--section-y:
|
|
278
|
-
--section-y-lg:
|
|
279
|
-
--hero-y:
|
|
280
|
-
--hero-y-lg:
|
|
281
|
-
--header-height:
|
|
424
|
+
--section-y:2.5rem; /* py-10 on a phone → py-16 at md */
|
|
425
|
+
--section-y-lg:3.5rem; /* py-14 on a phone → py-24 at md */
|
|
426
|
+
--hero-y:3rem; /* py-12 on a phone → py-20 at md */
|
|
427
|
+
--hero-y-lg:4.5rem; /* py-18 on a phone → py-32 at md */
|
|
428
|
+
--header-height:3.5rem; /* 56px is the phone bar; 64px from md */
|
|
429
|
+
|
|
430
|
+
/* ——— touch ——— */
|
|
431
|
+
/* 44px is the floor a pointer-coarse target may render at (Apple HIG 44pt /
|
|
432
|
+
WCAG 2.5.5 AAA / 2.5.8 AA's 24px, taken at the higher bar). base.css spends
|
|
433
|
+
it automatically under `@media (pointer:coarse)`, so a button does not have
|
|
434
|
+
to opt in. It was previously a bare `min-height:44px` literal in
|
|
435
|
+
hanzoai/id's stylesheet — one app knowing something the system did not. */
|
|
436
|
+
--tap-target:44px;
|
|
437
|
+
|
|
438
|
+
/* ——— safe areas ——— */
|
|
439
|
+
/* The notch/home-indicator insets, named once. Anything pinned to a viewport
|
|
440
|
+
edge — a fixed header, a bottom bar, a sheet — adds the matching one. */
|
|
441
|
+
--safe-top:env(safe-area-inset-top,0px);
|
|
442
|
+
--safe-right:env(safe-area-inset-right,0px);
|
|
443
|
+
--safe-bottom:env(safe-area-inset-bottom,0px);
|
|
444
|
+
--safe-left:env(safe-area-inset-left,0px);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Scale up from the phone. `md` (48rem) is the same breakpoint grid.css
|
|
448
|
+
declares and Tailwind compiles against — one value, not two that agree. */
|
|
449
|
+
@media (min-width:48rem){
|
|
450
|
+
:root{
|
|
451
|
+
--section-y:4rem; /* py-16 — content sections */
|
|
452
|
+
--section-y-lg:6rem; /* py-24 — landing sections */
|
|
453
|
+
--hero-y:5rem; /* py-20 … */
|
|
454
|
+
--hero-y-lg:8rem; /* … lg:py-32 */
|
|
455
|
+
--header-height:4rem;
|
|
456
|
+
}
|
|
282
457
|
}
|
|
283
458
|
|
|
284
459
|
/* ── tokens/grid.css ─────────────────────────────────────── */
|
|
@@ -346,14 +521,49 @@
|
|
|
346
521
|
}
|
|
347
522
|
|
|
348
523
|
/* ── tokens/elevation.css ─────────────────────────────────────── */
|
|
349
|
-
/*
|
|
350
|
-
|
|
351
|
-
|
|
524
|
+
/* Elevation on a near-black ground is NOT a drop shadow. A dark blur on a dark
|
|
525
|
+
page is nothing — you cannot cast a shadow onto black — which is why a system
|
|
526
|
+
that ships only `box-shadow` reads flat no matter how heavy the alphas get.
|
|
527
|
+
|
|
528
|
+
What actually lifts a surface here is LIGHT, and it arrives in three parts:
|
|
529
|
+
|
|
530
|
+
1. a hairline EDGE (tokens/colors.css --border)
|
|
531
|
+
2. an inset top HIGHLIGHT (--edge-highlight, below)
|
|
532
|
+
3. a wide, very dark DROP (--shadow-*)
|
|
533
|
+
|
|
534
|
+
(2) is the one that was missing and the one that does most of the work: a 1px
|
|
535
|
+
inset white line along the top edge reads as the surface catching the light
|
|
536
|
+
from above, and it is the whole difference between a panel that sits ON the
|
|
537
|
+
page and a rectangle that is merely a different colour than the page. The
|
|
538
|
+
reference spends it on its login card (`inset 0 1px 0 rgb(255 255 255 / .05)`)
|
|
539
|
+
and it is the single cheapest premium signal available on dark UI.
|
|
540
|
+
|
|
541
|
+
They are separate tokens rather than one baked shadow because a component
|
|
542
|
+
composes the ones it needs — `box-shadow: var(--edge-highlight), var(--shadow-lg)`
|
|
543
|
+
— and a card that wants the highlight without the drop should not have to
|
|
544
|
+
accept both. */
|
|
352
545
|
:root{
|
|
353
546
|
--shadow-none:none;
|
|
354
|
-
|
|
547
|
+
/* The floating surface: dropdowns, dialogs, sheets, the composer. Wide, soft,
|
|
548
|
+
and pushed well down. It was Tailwind's `shadow-2xl` at .25 alpha, which is
|
|
549
|
+
invisible on #0a0a0a — so the surfaces that float highest had the weakest
|
|
550
|
+
drop in the system while the t-shirt ramp below was correctly tuned. */
|
|
551
|
+
--shadow-floating:0 24px 60px -16px rgb(0 0 0 / .75);
|
|
355
552
|
--shadow-inset-hairline:inset 0 0 0 1px var(--white-10);
|
|
356
|
-
|
|
553
|
+
|
|
554
|
+
/* ——— the light ——— */
|
|
555
|
+
/* The top edge, catching light. Add it to any raised surface. */
|
|
556
|
+
--edge-highlight:inset 0 1px 0 0 rgb(255 255 255 / .10);
|
|
557
|
+
/* The bloom around a LIT action on hover — a filled primary button, the send
|
|
558
|
+
key. Monochrome brand: this is where "alive" comes from instead of a hue,
|
|
559
|
+
and it is the whole hover signal on a fill that is already at the top of
|
|
560
|
+
the ink ramp. It was .10, which is invisible: a white glow has to compete
|
|
561
|
+
with the white object casting it, so the alpha that reads around a WHITE
|
|
562
|
+
button is far higher than the one that reads around a dark one. */
|
|
563
|
+
--bloom:0 0 24px -2px rgb(255 255 255 / .28);
|
|
564
|
+
/* The focus halo: soft, outside the ring, carrying no ratio of its own. This
|
|
565
|
+
was `0 0 0 2px var(--ring)` — a second hard ring around the hard ring. */
|
|
566
|
+
--ring-focus:0 0 0 3px var(--ring-halo);
|
|
357
567
|
|
|
358
568
|
/* The t-shirt ramp. Named by size rather than by role, because that is how
|
|
359
569
|
every component library already asks for a shadow (and how @hanzo/brand
|
|
@@ -371,6 +581,11 @@
|
|
|
371
581
|
--glow-hero-blur:120px;
|
|
372
582
|
/* Card top-corner sheen used on the story cards. */
|
|
373
583
|
--sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(255 255 255 / .08) 0%,transparent 55%); /* @kind color */
|
|
584
|
+
/* The panel's top hairline, brightest at the centre and dissolving before it
|
|
585
|
+
reaches either corner — so an edge never terminates in a hard stop. One of
|
|
586
|
+
the two details that make the reference's panels look machined rather than
|
|
587
|
+
drawn (sidebar.css .panel::before). Paint it on a 1px-tall ::before. */
|
|
588
|
+
--sheen-edge:linear-gradient(90deg,transparent,rgb(255 255 255 / .14) 50%,transparent); /* @kind color */
|
|
374
589
|
/* Chrome text: the canonical headline gradient. Never a saturated rainbow. */
|
|
375
590
|
--gradient-chrome:linear-gradient(to right,#ffffff,var(--white-80),var(--white-60));
|
|
376
591
|
--gradient-chrome-2:linear-gradient(to right,#ffffff,var(--neutral-500));
|
|
@@ -378,6 +593,37 @@
|
|
|
378
593
|
--gradient-protect:linear-gradient(to bottom,var(--white-10),transparent);
|
|
379
594
|
}
|
|
380
595
|
|
|
596
|
+
/* Light theme — the same three parts, redistributed.
|
|
597
|
+
On white the order of work inverts: the DROP does almost all of it and the
|
|
598
|
+
inset highlight does none, because a white line on a white card is nothing.
|
|
599
|
+
Every token below is one whose dark value is white — i.e. one that silently
|
|
600
|
+
stops existing in `.light` unless it is restated here. check-tokens.mjs
|
|
601
|
+
scans this file for exactly that omission.
|
|
602
|
+
|
|
603
|
+
--edge-highlight is `inset 0 0 0 0 transparent` rather than `none` on
|
|
604
|
+
purpose: components compose these — `box-shadow: var(--edge-highlight),
|
|
605
|
+
var(--shadow-lg)` — and `none` is not a legal layer in a comma list, so the
|
|
606
|
+
obvious spelling would invalidate the whole declaration and take the drop
|
|
607
|
+
shadow down with it. A zero-size transparent shadow composes to nothing and
|
|
608
|
+
costs nothing. */
|
|
609
|
+
.light{
|
|
610
|
+
--shadow-floating:0 24px 60px -16px rgb(0 0 0 / .18);
|
|
611
|
+
--shadow-inset-hairline:inset 0 0 0 1px rgb(0 0 0 / .10);
|
|
612
|
+
--edge-highlight:inset 0 0 0 0 transparent;
|
|
613
|
+
--bloom:0 6px 20px -4px rgb(0 0 0 / .18);
|
|
614
|
+
--shadow-sm:0 1px 2px 0 rgb(0 0 0 / .06);
|
|
615
|
+
--shadow:0 1px 3px 0 rgb(0 0 0 / .08), 0 1px 2px -1px rgb(0 0 0 / .06);
|
|
616
|
+
--shadow-md:0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06);
|
|
617
|
+
--shadow-lg:0 10px 15px -3px rgb(0 0 0 / .09), 0 4px 6px -4px rgb(0 0 0 / .07);
|
|
618
|
+
--shadow-xl:0 20px 25px -5px rgb(0 0 0 / .10), 0 8px 10px -6px rgb(0 0 0 / .08);
|
|
619
|
+
--glow-hero:radial-gradient(circle,rgb(0 0 0 / .06) 0%,transparent 68%);
|
|
620
|
+
--sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(0 0 0 / .04) 0%,transparent 55%);
|
|
621
|
+
--sheen-edge:linear-gradient(90deg,transparent,rgb(0 0 0 / .08) 50%,transparent);
|
|
622
|
+
--gradient-chrome:linear-gradient(to right,#0a0a0a,rgb(10 10 10 / .8),rgb(10 10 10 / .6));
|
|
623
|
+
--gradient-chrome-2:linear-gradient(to right,#0a0a0a,var(--neutral-500));
|
|
624
|
+
--gradient-protect:linear-gradient(to bottom,rgb(0 0 0 / .10),transparent);
|
|
625
|
+
}
|
|
626
|
+
|
|
381
627
|
/* ── tokens/motion.css ─────────────────────────────────────── */
|
|
382
628
|
/* Motion is restrained: fade + small rise, CSS-only hovers, one breathing glow.
|
|
383
629
|
No springs, no bounce, no parallax, no autoplay carousels. */
|
|
@@ -387,8 +633,17 @@
|
|
|
387
633
|
--duration-slow:400ms; /* @kind other */ /* hero element entry */
|
|
388
634
|
--duration-slower:500ms; /* @kind other */ /* section entry */
|
|
389
635
|
--duration-glow:9s; /* @kind other */ /* ambient radial breathe */
|
|
636
|
+
--duration-press:90ms; /* @kind other */ /* the press-down on :active */
|
|
390
637
|
--ease-out:cubic-bezier(0,0,0.2,1); /* @kind other */
|
|
391
638
|
--ease-in-out:cubic-bezier(0.4,0,0.2,1); /* @kind other */
|
|
639
|
+
/* The entrance curve. Nearly all of the distance is covered in the first
|
|
640
|
+
third and it settles without overshooting, so a panel arrives DECIDED
|
|
641
|
+
rather than drifting in — the difference between 300ms that feels
|
|
642
|
+
immediate and 300ms that feels slow. Use it for anything that appears
|
|
643
|
+
(menus, dialogs, sheets, toasts); --ease-out stays the curve for a state
|
|
644
|
+
change on something already on screen. It is not a spring: this system has
|
|
645
|
+
no bounce anywhere. */
|
|
646
|
+
--ease-emphasis:cubic-bezier(0.16,1,0.3,1); /* @kind other */
|
|
392
647
|
--stagger:60ms; /* @kind other */ /* per-element delay in a group */
|
|
393
648
|
--entry-rise:16px; /* hero y-offset */
|
|
394
649
|
--entry-rise-lg:24px; /* card y-offset */
|
|
@@ -397,6 +652,12 @@
|
|
|
397
652
|
@keyframes hanzo-fade-up{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|
|
398
653
|
@keyframes hanzo-fade-down{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}
|
|
399
654
|
@keyframes hanzo-slide-up-fade{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
|
|
655
|
+
/* The entrance for anything that appears OVER the page — dialog, sheet, command
|
|
656
|
+
palette. It arrives from very slightly small and very slightly low, which is
|
|
657
|
+
what reads as "came forward" rather than "was toggled on". 3% and 8px: any
|
|
658
|
+
more and it is an animation you notice, which is the failure mode. Pair it
|
|
659
|
+
with --ease-emphasis. */
|
|
660
|
+
@keyframes hanzo-zoom-in{from{opacity:0;transform:scale(.97) translateY(8px)}to{opacity:1;transform:none}}
|
|
400
661
|
@keyframes hanzo-glow{0%,100%{transform:scale(1);opacity:.45}50%{transform:scale(1.08);opacity:.65}}
|
|
401
662
|
@keyframes hanzo-pulse-dot{0%,100%{opacity:1}50%{opacity:.35}}
|
|
402
663
|
|
|
@@ -486,19 +747,36 @@
|
|
|
486
747
|
The same trap already bit `text-decoration` here once (see the a:hover note
|
|
487
748
|
below). It was fixed by deleting that one declaration, which left the identical
|
|
488
749
|
defect in `color` untouched. Layering fixes the whole class: these are
|
|
489
|
-
DEFAULTS, and a default must lose to anything an app states deliberately.
|
|
750
|
+
DEFAULTS, and a default must lose to anything an app states deliberately.
|
|
751
|
+
|
|
752
|
+
The rules added for controls, media and touch go one step further and wrap
|
|
753
|
+
their selectors in :where(), which has ZERO specificity. @layer decides who
|
|
754
|
+
wins BETWEEN layers; :where() decides who wins INSIDE this one. An app that
|
|
755
|
+
ships its own reset — `input { … }`, `img { … }` — very often lands in the
|
|
756
|
+
same base layer, and these defaults have to lose that collision too. */
|
|
490
757
|
@layer base {
|
|
491
758
|
*{box-sizing:border-box;border-color:var(--border)}
|
|
492
|
-
html{
|
|
759
|
+
html{
|
|
760
|
+
-webkit-font-smoothing:antialiased;
|
|
761
|
+
text-rendering:optimizeLegibility;
|
|
762
|
+
scroll-behavior:smooth;
|
|
763
|
+
/* iOS inflates text when a phone is rotated to landscape unless this is
|
|
764
|
+
pinned. It is the single most common reason a mobile layout that was
|
|
765
|
+
verified in portrait comes apart on its side. */
|
|
766
|
+
-webkit-text-size-adjust:100%;
|
|
767
|
+
}
|
|
493
768
|
/* Each font-family carries the stack as a literal fallback. --font-sans lives in
|
|
494
769
|
tokens/fonts.css, which a surface may legitimately import separately; without
|
|
495
770
|
the fallback an unresolved var() makes font-family invalid and the UA drops to
|
|
496
771
|
its SERIF default — the whole console silently rendered in Times. */
|
|
497
|
-
body{margin:0;background:var(--background);color:var(--foreground);font-family:var(--font-sans,ui-sans-serif,system-ui,sans-serif);font-size:var(--text-base);line-height:var(--leading-base);font-feature-settings:var(--font-feature-settings)}
|
|
772
|
+
body{margin:0;background:var(--background);color:var(--foreground);font-family:var(--font-sans,ui-sans-serif,system-ui,sans-serif);font-size:var(--text-base);line-height:var(--leading-base);font-feature-settings:var(--font-feature-settings);overflow-wrap:break-word}
|
|
498
773
|
h1,h2,h3,h4{margin:0;font-family:var(--font-display,var(--font-sans,ui-sans-serif,system-ui,sans-serif));letter-spacing:var(--tracking-tight);color:var(--text-primary)}
|
|
499
774
|
p{margin:0;text-wrap:pretty}
|
|
500
775
|
code,pre,kbd{font-family:var(--font-mono,ui-monospace,SFMono-Regular,monospace)}
|
|
501
|
-
|
|
776
|
+
/* No `transition` here: the shared interactive rule below states one, and an
|
|
777
|
+
`a` selector (0,0,1) would outrank that :where() (0,0,0) and replace the
|
|
778
|
+
whole shorthand — anchors would transition colour and nothing else. */
|
|
779
|
+
a{color:var(--text-primary);text-decoration:none;text-underline-offset:4px}
|
|
502
780
|
/* Underline is the accessible affordance for a link in RUNNING TEXT and a visual
|
|
503
781
|
bug everywhere else: nav items, cards and anchor-buttons are all <a> too, so a
|
|
504
782
|
blanket `a:hover` underlined every one of them on every surface that imports
|
|
@@ -507,6 +785,130 @@
|
|
|
507
785
|
value `a` already has — a no-op that only served to outrank a component's own
|
|
508
786
|
hover colour. */
|
|
509
787
|
:is(p,li,blockquote,dd,dt,td,th,figcaption) a:hover{text-decoration:underline}
|
|
788
|
+
|
|
789
|
+
/* ——— the smooth ———
|
|
790
|
+
Every interactive element in the reference transitions its colour, its fill
|
|
791
|
+
and its EDGE. That is most of what separates "classy and smooth" from a
|
|
792
|
+
correct set of colours: a hairline that steps from .10 to .16 instantly
|
|
793
|
+
reads as a flicker, and over 150ms reads as a response. Granted once, here,
|
|
794
|
+
rather than restated on every component. tokens/motion.css already zeroes
|
|
795
|
+
all of it under prefers-reduced-motion. */
|
|
796
|
+
:where(a,button,[role=button],input,select,textarea,summary,[tabindex]){
|
|
797
|
+
transition:color var(--duration-fast) var(--ease-out),
|
|
798
|
+
background-color var(--duration-fast) var(--ease-out),
|
|
799
|
+
border-color var(--duration-fast) var(--ease-out),
|
|
800
|
+
box-shadow var(--duration-fast) var(--ease-out),
|
|
801
|
+
opacity var(--duration-fast) var(--ease-out),
|
|
802
|
+
transform var(--duration-press) var(--ease-out);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/* ——— the press ———
|
|
806
|
+
A button that moves under the finger is the cheapest "this is a real
|
|
807
|
+
control" signal there is, and its absence is most of why a correct-looking
|
|
808
|
+
button still feels like a picture of a button. 2% over 90ms — small enough
|
|
809
|
+
that it reads as pressure rather than as animation, and it is the
|
|
810
|
+
reference's own value (.auth-signin-btn:active). Inputs are excluded: a
|
|
811
|
+
text field does not depress, and scaling one mid-caret is a glitch. */
|
|
812
|
+
:where(button,[role=button],a[role=button],summary):active:not(:disabled){
|
|
813
|
+
transform:scale(.98);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/* ——— controls ———
|
|
817
|
+
A bare <input> renders in the UA's face (Arial) at the UA's size with the
|
|
818
|
+
UA's border, which puts two typefaces and a foreign blue focus ring inside
|
|
819
|
+
Hanzo cards on every surface that has not styled its own fields yet. The
|
|
820
|
+
rules below are what a control looks like here. --border-control, NOT
|
|
821
|
+
--border: the boundary IS the affordance, so it is the rung that owes 3:1. */
|
|
822
|
+
:where(input,select,textarea,button){font:inherit;color:inherit}
|
|
823
|
+
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea){
|
|
824
|
+
background:var(--surface-2);
|
|
825
|
+
border:1px solid var(--border-control);
|
|
826
|
+
/* --radius-md (8px), not --radius-sm (6px). On a 36px control the two are
|
|
827
|
+
one step apart and it is the step between "boxy" and "considered";
|
|
828
|
+
--radius-sm keeps its job on genuinely small parts — badges, chips, menu
|
|
829
|
+
rows — where 8px would look bubbly. The reference draws its composer and
|
|
830
|
+
its buttons at 8-10px and nothing at 6px except 22px chips. */
|
|
831
|
+
border-radius:var(--radius-md);
|
|
832
|
+
padding:0 var(--space-3);
|
|
833
|
+
}
|
|
834
|
+
:where(textarea){padding:var(--space-2) var(--space-3);resize:vertical}
|
|
835
|
+
/* ——— focus, on a control ———
|
|
836
|
+
Not the generic ring. A field already HAS an edge, so focus brightens that
|
|
837
|
+
edge (.15 -> .22) and adds a soft halo just outside it — which is what the
|
|
838
|
+
reference does (.composer-box:focus-within) and what separates a focused
|
|
839
|
+
field from a browser default. The generic `outline` is suppressed here
|
|
840
|
+
precisely because it would draw a second, harder box around this one. */
|
|
841
|
+
:where(input,select,textarea):focus-visible{
|
|
842
|
+
outline:none;
|
|
843
|
+
border-color:var(--border-focus);
|
|
844
|
+
box-shadow:var(--ring-focus);
|
|
845
|
+
}
|
|
846
|
+
/* A hovered field lifts its surface a rung. Nudging its EDGE from .15 to .16
|
|
847
|
+
is a state nobody can see. */
|
|
848
|
+
:where(input,select,textarea):hover:not(:focus-visible):not(:disabled){background:var(--surface-3)}
|
|
849
|
+
:where(input,textarea)::placeholder{color:var(--text-disabled)}
|
|
850
|
+
:where(input,select,textarea,button):disabled{opacity:.5;cursor:not-allowed}
|
|
851
|
+
:where(button,[role=button],summary,label,select){cursor:pointer}
|
|
852
|
+
|
|
853
|
+
/* ——— media ———
|
|
854
|
+
An image, a video or an embed at its intrinsic width is the usual cause of a
|
|
855
|
+
390px page that scrolls sideways. */
|
|
856
|
+
:where(img,svg,video,canvas,iframe,picture,object){max-width:100%}
|
|
857
|
+
:where(img,video){height:auto}
|
|
858
|
+
/* A code block scrolls ITSELF rather than widening the document. */
|
|
859
|
+
:where(pre){overflow-x:auto}
|
|
860
|
+
|
|
861
|
+
/* ——— touch ———
|
|
862
|
+
Everything a finger aims at clears 44px, and every field renders at 16px so
|
|
863
|
+
iOS does not zoom the viewport on focus. Both are keyed on pointer:coarse —
|
|
864
|
+
the actual signal — so a desktop mouse still gets compact controls. This is
|
|
865
|
+
the whole of "mobile-first without per-app work": an app that never thought
|
|
866
|
+
about phones still has hittable buttons and a viewport that stays put. */
|
|
867
|
+
@media (pointer:coarse){
|
|
868
|
+
:where(button,[role=button],a[role=button],summary,select,textarea,
|
|
869
|
+
input:not([type=checkbox]):not([type=radio]):not([type=hidden])){
|
|
870
|
+
min-height:var(--tap-target);
|
|
871
|
+
}
|
|
872
|
+
:where(input,select,textarea){font-size:var(--text-control)}
|
|
873
|
+
/* A checkbox, radio or switch must NOT grow to 44px — the box is 16px
|
|
874
|
+
because that is what a checkbox looks like. What has to reach 44px is the
|
|
875
|
+
area a finger may land in, so the target is expanded with a centred
|
|
876
|
+
pseudo-element that changes nothing about layout or paint. WCAG 2.5.8 puts
|
|
877
|
+
the floor at 24px; a 16px box misses it, and every one of these ships at
|
|
878
|
+
16px. */
|
|
879
|
+
:where([role=checkbox],[role=radio],[role=switch],input[type=checkbox],input[type=radio]){position:relative}
|
|
880
|
+
:where([role=checkbox],[role=radio],[role=switch],input[type=checkbox],input[type=radio])::after{
|
|
881
|
+
content:'';position:absolute;top:50%;left:50%;
|
|
882
|
+
width:var(--tap-target);height:var(--tap-target);
|
|
883
|
+
transform:translate(-50%,-50%);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
510
887
|
:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
|
|
511
|
-
|
|
888
|
+
/* --white-20 is white-on-white in the light theme, so selection reads through
|
|
889
|
+
--selection, which BOTH themes define. */
|
|
890
|
+
::selection{background:var(--selection);color:var(--text-primary)}
|
|
891
|
+
|
|
892
|
+
/* ——— the scrollbar ———
|
|
893
|
+
The single largest piece of UNSTYLED chrome left on a dark surface: a
|
|
894
|
+
default 15px light-grey scrollbar down the side of a #0a0a0a panel is the
|
|
895
|
+
one element on the page that did not get the memo, and it is visible on
|
|
896
|
+
every scrolling surface in the product. 6px, no track, thumb on the same
|
|
897
|
+
hairline ladder as everything else. Both syntaxes ship because they are
|
|
898
|
+
disjoint — `scrollbar-*` is Firefox and the `::-webkit-*` pseudos are
|
|
899
|
+
Chromium/Safari; neither engine reads the other. */
|
|
900
|
+
The thumb is a --white-* rung, so it does not invert; the `.light`
|
|
901
|
+
restatements sit here rather than in colors.css because a scrollbar is an
|
|
902
|
+
element default and this file is where element defaults live. Everything
|
|
903
|
+
stays INSIDE the layer — an unlayered rule here would outrank an app's own
|
|
904
|
+
utilities, which is the defect check 1c exists to catch. */
|
|
905
|
+
:where(html){scrollbar-color:var(--white-15) transparent;scrollbar-width:thin}
|
|
906
|
+
.light{scrollbar-color:rgb(0 0 0 / .18) transparent}
|
|
907
|
+
:where(*)::-webkit-scrollbar{width:6px;height:6px}
|
|
908
|
+
:where(*)::-webkit-scrollbar-track{background:transparent}
|
|
909
|
+
:where(*)::-webkit-scrollbar-thumb{background:var(--white-15);border-radius:var(--radius-full)}
|
|
910
|
+
:where(*)::-webkit-scrollbar-thumb:hover{background:var(--white-30)}
|
|
911
|
+
:where(*)::-webkit-scrollbar-corner{background:transparent}
|
|
912
|
+
.light :where(*)::-webkit-scrollbar-thumb{background:rgb(0 0 0 / .18)}
|
|
913
|
+
.light :where(*)::-webkit-scrollbar-thumb:hover{background:rgb(0 0 0 / .32)}
|
|
512
914
|
}
|