@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/tokens/base.css CHANGED
@@ -12,19 +12,36 @@
12
12
  The same trap already bit `text-decoration` here once (see the a:hover note
13
13
  below). It was fixed by deleting that one declaration, which left the identical
14
14
  defect in `color` untouched. Layering fixes the whole class: these are
15
- DEFAULTS, and a default must lose to anything an app states deliberately. */
15
+ DEFAULTS, and a default must lose to anything an app states deliberately.
16
+
17
+ The rules added for controls, media and touch go one step further and wrap
18
+ their selectors in :where(), which has ZERO specificity. @layer decides who
19
+ wins BETWEEN layers; :where() decides who wins INSIDE this one. An app that
20
+ ships its own reset — `input { … }`, `img { … }` — very often lands in the
21
+ same base layer, and these defaults have to lose that collision too. */
16
22
  @layer base {
17
23
  *{box-sizing:border-box;border-color:var(--border)}
18
- html{-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;scroll-behavior:smooth}
24
+ html{
25
+ -webkit-font-smoothing:antialiased;
26
+ text-rendering:optimizeLegibility;
27
+ scroll-behavior:smooth;
28
+ /* iOS inflates text when a phone is rotated to landscape unless this is
29
+ pinned. It is the single most common reason a mobile layout that was
30
+ verified in portrait comes apart on its side. */
31
+ -webkit-text-size-adjust:100%;
32
+ }
19
33
  /* Each font-family carries the stack as a literal fallback. --font-sans lives in
20
34
  tokens/fonts.css, which a surface may legitimately import separately; without
21
35
  the fallback an unresolved var() makes font-family invalid and the UA drops to
22
36
  its SERIF default — the whole console silently rendered in Times. */
23
- 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)}
37
+ 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}
24
38
  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)}
25
39
  p{margin:0;text-wrap:pretty}
26
40
  code,pre,kbd{font-family:var(--font-mono,ui-monospace,SFMono-Regular,monospace)}
27
- a{color:var(--text-primary);text-decoration:none;text-underline-offset:4px;transition:color var(--duration-fast) var(--ease-out)}
41
+ /* No `transition` here: the shared interactive rule below states one, and an
42
+ `a` selector (0,0,1) would outrank that :where() (0,0,0) and replace the
43
+ whole shorthand — anchors would transition colour and nothing else. */
44
+ a{color:var(--text-primary);text-decoration:none;text-underline-offset:4px}
28
45
  /* Underline is the accessible affordance for a link in RUNNING TEXT and a visual
29
46
  bug everywhere else: nav items, cards and anchor-buttons are all <a> too, so a
30
47
  blanket `a:hover` underlined every one of them on every surface that imports
@@ -33,6 +50,130 @@
33
50
  value `a` already has — a no-op that only served to outrank a component's own
34
51
  hover colour. */
35
52
  :is(p,li,blockquote,dd,dt,td,th,figcaption) a:hover{text-decoration:underline}
53
+
54
+ /* ——— the smooth ———
55
+ Every interactive element in the reference transitions its colour, its fill
56
+ and its EDGE. That is most of what separates "classy and smooth" from a
57
+ correct set of colours: a hairline that steps from .10 to .16 instantly
58
+ reads as a flicker, and over 150ms reads as a response. Granted once, here,
59
+ rather than restated on every component. tokens/motion.css already zeroes
60
+ all of it under prefers-reduced-motion. */
61
+ :where(a,button,[role=button],input,select,textarea,summary,[tabindex]){
62
+ transition:color var(--duration-fast) var(--ease-out),
63
+ background-color var(--duration-fast) var(--ease-out),
64
+ border-color var(--duration-fast) var(--ease-out),
65
+ box-shadow var(--duration-fast) var(--ease-out),
66
+ opacity var(--duration-fast) var(--ease-out),
67
+ transform var(--duration-press) var(--ease-out);
68
+ }
69
+
70
+ /* ——— the press ———
71
+ A button that moves under the finger is the cheapest "this is a real
72
+ control" signal there is, and its absence is most of why a correct-looking
73
+ button still feels like a picture of a button. 2% over 90ms — small enough
74
+ that it reads as pressure rather than as animation, and it is the
75
+ reference's own value (.auth-signin-btn:active). Inputs are excluded: a
76
+ text field does not depress, and scaling one mid-caret is a glitch. */
77
+ :where(button,[role=button],a[role=button],summary):active:not(:disabled){
78
+ transform:scale(.98);
79
+ }
80
+
81
+ /* ——— controls ———
82
+ A bare <input> renders in the UA's face (Arial) at the UA's size with the
83
+ UA's border, which puts two typefaces and a foreign blue focus ring inside
84
+ Hanzo cards on every surface that has not styled its own fields yet. The
85
+ rules below are what a control looks like here. --border-control, NOT
86
+ --border: the boundary IS the affordance, so it is the rung that owes 3:1. */
87
+ :where(input,select,textarea,button){font:inherit;color:inherit}
88
+ :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea){
89
+ background:var(--surface-2);
90
+ border:1px solid var(--border-control);
91
+ /* --radius-md (8px), not --radius-sm (6px). On a 36px control the two are
92
+ one step apart and it is the step between "boxy" and "considered";
93
+ --radius-sm keeps its job on genuinely small parts — badges, chips, menu
94
+ rows — where 8px would look bubbly. The reference draws its composer and
95
+ its buttons at 8-10px and nothing at 6px except 22px chips. */
96
+ border-radius:var(--radius-md);
97
+ padding:0 var(--space-3);
98
+ }
99
+ :where(textarea){padding:var(--space-2) var(--space-3);resize:vertical}
100
+ /* ——— focus, on a control ———
101
+ Not the generic ring. A field already HAS an edge, so focus brightens that
102
+ edge (.15 -> .22) and adds a soft halo just outside it — which is what the
103
+ reference does (.composer-box:focus-within) and what separates a focused
104
+ field from a browser default. The generic `outline` is suppressed here
105
+ precisely because it would draw a second, harder box around this one. */
106
+ :where(input,select,textarea):focus-visible{
107
+ outline:none;
108
+ border-color:var(--border-focus);
109
+ box-shadow:var(--ring-focus);
110
+ }
111
+ /* A hovered field lifts its surface a rung. Nudging its EDGE from .15 to .16
112
+ is a state nobody can see. */
113
+ :where(input,select,textarea):hover:not(:focus-visible):not(:disabled){background:var(--surface-3)}
114
+ :where(input,textarea)::placeholder{color:var(--text-disabled)}
115
+ :where(input,select,textarea,button):disabled{opacity:.5;cursor:not-allowed}
116
+ :where(button,[role=button],summary,label,select){cursor:pointer}
117
+
118
+ /* ——— media ———
119
+ An image, a video or an embed at its intrinsic width is the usual cause of a
120
+ 390px page that scrolls sideways. */
121
+ :where(img,svg,video,canvas,iframe,picture,object){max-width:100%}
122
+ :where(img,video){height:auto}
123
+ /* A code block scrolls ITSELF rather than widening the document. */
124
+ :where(pre){overflow-x:auto}
125
+
126
+ /* ——— touch ———
127
+ Everything a finger aims at clears 44px, and every field renders at 16px so
128
+ iOS does not zoom the viewport on focus. Both are keyed on pointer:coarse —
129
+ the actual signal — so a desktop mouse still gets compact controls. This is
130
+ the whole of "mobile-first without per-app work": an app that never thought
131
+ about phones still has hittable buttons and a viewport that stays put. */
132
+ @media (pointer:coarse){
133
+ :where(button,[role=button],a[role=button],summary,select,textarea,
134
+ input:not([type=checkbox]):not([type=radio]):not([type=hidden])){
135
+ min-height:var(--tap-target);
136
+ }
137
+ :where(input,select,textarea){font-size:var(--text-control)}
138
+ /* A checkbox, radio or switch must NOT grow to 44px — the box is 16px
139
+ because that is what a checkbox looks like. What has to reach 44px is the
140
+ area a finger may land in, so the target is expanded with a centred
141
+ pseudo-element that changes nothing about layout or paint. WCAG 2.5.8 puts
142
+ the floor at 24px; a 16px box misses it, and every one of these ships at
143
+ 16px. */
144
+ :where([role=checkbox],[role=radio],[role=switch],input[type=checkbox],input[type=radio]){position:relative}
145
+ :where([role=checkbox],[role=radio],[role=switch],input[type=checkbox],input[type=radio])::after{
146
+ content:'';position:absolute;top:50%;left:50%;
147
+ width:var(--tap-target);height:var(--tap-target);
148
+ transform:translate(-50%,-50%);
149
+ }
150
+ }
151
+
36
152
  :focus-visible{outline:2px solid var(--ring);outline-offset:2px}
37
- ::selection{background:var(--white-20);color:#fff}
153
+ /* --white-20 is white-on-white in the light theme, so selection reads through
154
+ --selection, which BOTH themes define. */
155
+ ::selection{background:var(--selection);color:var(--text-primary)}
156
+
157
+ /* ——— the scrollbar ———
158
+ The single largest piece of UNSTYLED chrome left on a dark surface: a
159
+ default 15px light-grey scrollbar down the side of a #0a0a0a panel is the
160
+ one element on the page that did not get the memo, and it is visible on
161
+ every scrolling surface in the product. 6px, no track, thumb on the same
162
+ hairline ladder as everything else. Both syntaxes ship because they are
163
+ disjoint — `scrollbar-*` is Firefox and the `::-webkit-*` pseudos are
164
+ Chromium/Safari; neither engine reads the other. */
165
+ The thumb is a --white-* rung, so it does not invert; the `.light`
166
+ restatements sit here rather than in colors.css because a scrollbar is an
167
+ element default and this file is where element defaults live. Everything
168
+ stays INSIDE the layer — an unlayered rule here would outrank an app's own
169
+ utilities, which is the defect check 1c exists to catch. */
170
+ :where(html){scrollbar-color:var(--white-15) transparent;scrollbar-width:thin}
171
+ .light{scrollbar-color:rgb(0 0 0 / .18) transparent}
172
+ :where(*)::-webkit-scrollbar{width:6px;height:6px}
173
+ :where(*)::-webkit-scrollbar-track{background:transparent}
174
+ :where(*)::-webkit-scrollbar-thumb{background:var(--white-15);border-radius:var(--radius-full)}
175
+ :where(*)::-webkit-scrollbar-thumb:hover{background:var(--white-30)}
176
+ :where(*)::-webkit-scrollbar-corner{background:transparent}
177
+ .light :where(*)::-webkit-scrollbar-thumb{background:rgb(0 0 0 / .18)}
178
+ .light :where(*)::-webkit-scrollbar-thumb:hover{background:rgb(0 0 0 / .32)}
38
179
  }
package/tokens/colors.css CHANGED
@@ -1,9 +1,25 @@
1
1
  /* Hanzo is monochrome. One hue rendered through an opacity ladder.
2
2
  Base ladder = Tailwind neutral (tailwind.config.ts). Semantic names match
3
3
  hanzo.ai's CSS variables exactly, so code copies over 1:1.
4
- DARK IS THE DEFAULT THEME (hanzo.ai mounts ThemeProvider defaultTheme="dark"). */
4
+ DARK IS THE DEFAULT THEME (hanzo.ai mounts ThemeProvider defaultTheme="dark").
5
+
6
+ The dark palette is derived from the chat surface in hanzoai/extension
7
+ (packages/browser/src/sidebar.css), which is the reference aesthetic: a
8
+ #0a0a0a ground, #fafafa ink, and boundaries drawn as LOW-ALPHA HAIRLINES.
9
+ Two properties of that reference are load-bearing and easy to lose:
10
+
11
+ 1. Borders are alpha, not hex. rgb(255 255 255 / .10) composites correctly on
12
+ #0a0a0a AND on #262626; a solid #1f1f1f reads on the page and vanishes the
13
+ moment it lands on a lifted surface — which is why anyone who needed a
14
+ visible edge reached past it for the CONTROL rung and got a wireframe.
15
+ 2. Surfaces lift by tiny steps (0a -> 0f -> 17 -> 26), and ink is a graded
16
+ ramp (#fafafa -> .78 -> .55 -> #a3a3a3), not one flat white. Pure #ffffff
17
+ on pure #000000 is 21:1 — the maximum-contrast pair that exists, and it
18
+ halates. #fafafa on #0a0a0a is 18.1:1: still far past AAA, visibly softer. */
5
19
 
6
20
  :root{
21
+ color-scheme:dark;
22
+
7
23
  /* ——— base neutral ladder ——— */
8
24
  --neutral-50:#FAFAFA;
9
25
  --neutral-100:#F5F5F5;
@@ -23,77 +39,160 @@
23
39
  --hanzo-white:#FFFFFF;
24
40
 
25
41
  /* ——— the opacity ladder: the real palette ——— */
42
+ /* Every rung below .30 is a HAIRLINE or a LIFT — the two things this system
43
+ draws with. The rungs are the reference's own values, not a rounded ramp. */
26
44
  --white-05:rgb(255 255 255 / .05);
45
+ --white-06:rgb(255 255 255 / .06);
46
+ --white-08:rgb(255 255 255 / .08);
27
47
  --white-10:rgb(255 255 255 / .10);
28
48
  --white-15:rgb(255 255 255 / .15);
49
+ --white-16:rgb(255 255 255 / .16);
29
50
  --white-20:rgb(255 255 255 / .20);
51
+ --white-22:rgb(255 255 255 / .22);
30
52
  --white-30:rgb(255 255 255 / .30);
31
53
  --white-40:rgb(255 255 255 / .40);
54
+ --white-55:rgb(255 255 255 / .55);
32
55
  --white-60:rgb(255 255 255 / .60);
56
+ --white-78:rgb(255 255 255 / .78);
33
57
  --white-80:rgb(255 255 255 / .80);
34
58
 
35
59
  /* ——— semantic aliases (dark, the default) ——— */
36
- --background:#000000;
37
- --foreground:#ededed;
38
- --card:#0a0a0a;
39
- --card-foreground:#f5f5f5;
40
- --popover:#0a0a0a;
41
- --popover-foreground:#f5f5f5;
42
- --primary:#ffffff;
43
- --primary-foreground:#000000;
44
- --secondary:#1a1a1a;
45
- --secondary-foreground:#f5f5f5;
46
- --muted:#101010;
47
- --muted-foreground:#888888;
48
- --accent:#1a1a1a;
49
- --accent-foreground:#f5f5f5;
50
- --destructive:#666666;
51
- --destructive-foreground:#f5f5f5;
52
- --border:#1f1f1f;
53
- --input:#1f1f1f;
60
+ --background:#0a0a0a;
61
+ --foreground:#fafafa;
62
+ --card:#0f0f0f;
63
+ --card-foreground:#fafafa;
64
+ --popover:#0f0f0f;
65
+ --popover-foreground:#fafafa;
66
+ --primary:#fafafa;
67
+ /* A 5% step, not the 16% this used to be. A filled button's fill is already
68
+ the top of the ink ramp, so the only directions available on hover are
69
+ "dimmer" and "brighter-around-the-edges" — and a 16% drop reads as the
70
+ button going DISABLED under the cursor, which is the one thing a hover must
71
+ never look like. The step is now small enough to register as pressure while
72
+ --bloom does the actual work of lighting it up. */
73
+ --primary-hover:#e5e5e5;
74
+ --primary-foreground:#0a0a0a;
75
+ --secondary:#262626;
76
+ /* One rung up, so a secondary button HAS a hover. It previously resolved to
77
+ --surface-3, which is --secondary — the same value it starts at. */
78
+ --secondary-hover:#333333;
79
+ --secondary-foreground:#fafafa;
80
+ --muted:#171717;
81
+ --muted-foreground:#a3a3a3;
82
+ --accent:#262626;
83
+ --accent-foreground:#fafafa;
84
+ /* Destructive is the ONE place the monochrome rule already yields, and it was
85
+ yielding in only half the system: a field that fails validation draws
86
+ --state-error (#ef4444, which DESIGN.md §2.4 lists as permitted precisely
87
+ for "destructive / blocking error"), while the button that performs the
88
+ destruction drew #666666 — a mid-grey that is indistinguishable from a
89
+ disabled control. "Delete everything" and "you cannot click this" must not
90
+ be the same colour. So the two converge on the one token that already
91
+ names this meaning, and the ramp stays monochrome everywhere else. */
92
+ --destructive:var(--state-error);
93
+ --destructive-hover:#dc2626; /* red-600 — deepens under the cursor */
94
+ --destructive-foreground:#fafafa;
95
+
96
+ /* ——— boundaries ———
97
+ ONE ladder, cut from alpha, graded by duty. Every rung is a rung of the
98
+ opacity ladder above, so every boundary composites correctly on the page,
99
+ on a card, and inside a popover — and every rung is the reference's own
100
+ measured value, not a rounded ramp:
101
+
102
+ --border .10 the hairline. Cards, panels, dividers, list rows.
103
+ --border-strong .16 the same hairline, one step up. Hover, emphasis.
104
+ --border-control .15 a control's resting edge — input, select, textarea.
105
+ --border-focus .22 that control, focused.
106
+ --border-selected .30 the thing that is currently CHOSEN — the active
107
+ tab, the current tile, the featured plan.
108
+
109
+ The previous release cut the last three from the NEUTRAL ladder instead,
110
+ because a boundary that clears WCAG 1.4.11's 3:1 on a near-black ground IS
111
+ a mid-grey and no amount of tuning changes that. It is true, and it is also
112
+ what a wireframe looks like: a 1px #737373 box around every field, four
113
+ times heavier than the hairline beside it, so a form read as a debug
114
+ overlay rather than a surface. Aesthetics decided it — the reference draws
115
+ an input at rgb(255 255 255 / .15) and a focused one at .22 (sidebar.css
116
+ --input-border / .composer-box:focus-within), and that is what ships here.
117
+
118
+ What replaces the ratio is the FOCUS INDICATOR, which is the thing a
119
+ keyboard user actually navigates by and the one boundary still pinned at
120
+ 3:1 (--ring, below). A resting edge is an affordance; a focus ring is a
121
+ position. Only the second one is load-bearing when you cannot see well, and
122
+ spending the contrast budget there rather than on all four edges of every
123
+ idle field is what lets the system be quiet AND findable at once. */
124
+ --border:var(--white-10);
125
+ --border-strong:var(--white-16);
126
+ --border-control:var(--white-15); /* sidebar.css --input-border */
127
+ --border-focus:var(--white-22); /* .composer-box:focus-within */
128
+ --border-selected:var(--white-30); /* the current tab / tile / plan */
129
+ --input:var(--border-control); /* shadcn `border-input` — a control */
54
130
  /* A focus indicator is a NON-TEXT CONTRAST target: WCAG 2.4.11/1.4.11 require
55
- 3:1 against every surface it can land on. --neutral-500 is the only rung on
56
- this ladder that clears 3:1 on all of them #000000, #0a0a0a, #101010,
57
- #1a1a1a, AND the light theme's #ffffff/#f5f5f5 so one value serves both
58
- themes. (Was #333333 = 1.66:1 on --background: not a focus indicator.) */
59
- --ring:var(--neutral-500);
131
+ 3:1 against every surface it can land on, and unlike a resting edge it is
132
+ worth the loudness it is transient, it only appears on keyboard focus,
133
+ and it is the whole of how a keyboard user knows where they are.
134
+ --white-40 clears it on every canvas in both themes precisely BECAUSE it is
135
+ alpha: on a lifted surface the ring lifts with it (3.77:1 on #0a0a0a,
136
+ 3.66:1 on #262626), which a fixed grey cannot do. */
137
+ --ring:var(--white-40);
138
+ /* The soft halo that sits outside the ring — the reference's
139
+ `box-shadow: 0 0 0 2px rgb(255 255 255 / .06)` on a focused composer. It
140
+ carries no ratio; it is what makes focus read as designed rather than as a
141
+ browser default. Spent through --ring-focus (tokens/elevation.css). */
142
+ --ring-halo:var(--white-10);
60
143
  --brand:#e4e4e7;
61
144
  --brand-foreground:#09090b;
62
145
  --brand-muted:#a3a3a3;
63
146
  --black:#000000;
64
- --white:#f5f5f5;
147
+ --white:#fafafa;
148
+ --selection:var(--white-20);
149
+
150
+ /* ——— glass: the lift ———
151
+ How a surface rises WITHOUT a block fill. An alpha-white wash composites
152
+ over whatever it lands on, so one value works on the page, on a card and
153
+ inside a popover. This is the mechanism behind the reference's depth. */
154
+ --glass:var(--white-05);
155
+ --glass-strong:var(--white-08);
156
+
157
+ /* ——— surface recipes ———
158
+ A card has to be a SURFACE, which means you have to be able to see that it
159
+ is not the page. These were cut from neutral-900 (#171717) at .4/.5/.8, and
160
+ at .5 that composites to #101010 on a #0a0a0a ground — six levels above the
161
+ page, which is not a surface, it is a very slightly different black. Three
162
+ cards side by side then read as one flat field with hairlines ruled across
163
+ it, and no amount of shadow fixes it, because you cannot cast a shadow onto
164
+ black.
65
165
 
66
- /* ——— surface recipes (card fills used across hanzo.ai) ——— */
166
+ Cut from neutral-800 (#262626) instead, they land on 14 / 18 / 1f — the
167
+ reference's own panel (#171717 on a #0f0f0f container) with room either
168
+ side of it. They stay ALPHA so a card nested in a popover still lifts off
169
+ its parent rather than punching a hole in it; that is the whole reason
170
+ these are recipes and not just --surface-* rungs. */
67
171
  --surface-page:var(--background);
68
- --surface-card:rgb(23 23 23 / .5); /* bg-neutral-900/50 grid tiles */
69
- --surface-card-emphasis:rgb(23 23 23 / .8);/* bg-neutral-900/80 — featured */
70
- --surface-card-quiet:rgb(23 23 23 / .4); /* bg-neutral-900/40 — story cards */
71
- --surface-overlay:rgb(10 10 10 / .95); /* dropdown / popover panels */
172
+ --surface-card:rgb(38 38 38 / .5); /* -> #181818 on the page */
173
+ --surface-card-emphasis:rgb(38 38 38 / .75);/* -> #1f1f1f — featured */
174
+ --surface-card-quiet:rgb(38 38 38 / .35); /* -> #141414 — story cards */
175
+ /* A floating panel that is the SAME colour as the page is not floating. This
176
+ was rgb(10 10 10 / .95) — the page, at 95% of the page. */
177
+ --surface-overlay:rgb(23 23 23 / .92); /* dropdown / popover panels */
72
178
  --surface-header:rgb(0 0 0 / .7); /* fixed nav, with backdrop blur */
73
179
  --surface-scrim:rgb(0 0 0 / .8); /* the dialog / sheet backdrop */
74
- /* Boundaries come in two kinds and they are NOT interchangeable.
75
- DECORATIVE (--border, --border-hairline, --border-card): separates content;
76
- WCAG imposes no ratio. Keep them quiet.
77
- PERCEIVABLE (--border-strong): identifies a CONTROL — an input edge, a
78
- switch, a checkbox — and must clear 3:1 (WCAG 1.4.11) on every surface.
79
- Reach for --border-strong whenever the boundary IS the affordance. */
80
- --border-hairline:var(--neutral-800);
81
- --border-card:var(--white-10);
82
- --border-strong:var(--neutral-500); /* 3.59:1 worst case — see --ring */
83
180
 
84
181
  /* ——— the numeric surface ladder ——— */
85
182
  /* Aliases onto the semantic canvases above, so a brand fork that retunes
86
183
  --card/--muted/--secondary retunes the ladder with it and the light theme
87
- inverts for free. Ascending lift: 0 is the page, 3 is a hovered control. */
184
+ inverts for free. Ascending lift: 0 is the page, 3 is a hovered control.
185
+ Dark resolves to the reference's own ladder — 0a / 0f / 17 / 26. */
88
186
  --surface-0:var(--background);
89
187
  --surface-1:var(--card);
90
188
  --surface-2:var(--muted);
91
189
  --surface-3:var(--secondary);
92
190
 
93
- /* ——— text ranks ——— */
94
- --text-primary:var(--pure-white);
95
- --text-secondary:var(--white-80);
96
- --text-tertiary:var(--white-60);
191
+ /* ——— text ranks ———
192
+ A graded ramp, not one flat white. The steps are the reference's. */
193
+ --text-primary:#fafafa;
194
+ --text-secondary:var(--white-78);
195
+ --text-tertiary:var(--white-55);
97
196
  --text-helper:var(--muted-foreground);
98
197
  --text-disabled:var(--white-30);
99
198
 
@@ -108,46 +207,62 @@
108
207
  --chrome-dot-green:rgb(34 197 94 / .6);
109
208
  }
110
209
 
111
- /* Light theme — the same tokens, inverted. Rare: only /brand-style docs pages. */
210
+ /* Light theme — the same tokens, inverted.
211
+ The white-opacity ladder does NOT invert: --white-16 is white-on-white here.
212
+ So EVERY token whose dark value is a --white-* rung must be restated below,
213
+ and check-tokens.mjs fails the build if one is missed — that class of bug is
214
+ silent (the border simply stops existing) and has shipped before. */
112
215
  .light{
216
+ color-scheme:light;
113
217
  --background:#ffffff;
114
218
  --foreground:#0a0a0a;
115
- --card:#f5f5f5;
219
+ /* A ladder, not four names for #f5f5f5. Light lifts by the same tiny steps
220
+ dark does — ~2% per rung — so --surface-0..3 mean something in both themes. */
221
+ --card:#fafafa;
116
222
  --card-foreground:#0a0a0a;
117
223
  --popover:#ffffff;
118
224
  --popover-foreground:#0a0a0a;
119
225
  --primary:#0a0a0a;
120
- --primary-foreground:#ffffff;
121
- --secondary:#f5f5f5;
226
+ --primary-hover:#262626;
227
+ --primary-foreground:#fafafa;
228
+ --secondary:#ededed;
229
+ --secondary-hover:#e0e0e0;
122
230
  --secondary-foreground:#0a0a0a;
123
231
  --muted:#f5f5f5;
124
232
  --muted-foreground:#525252;
125
- --accent:#f5f5f5;
233
+ --accent:#ededed;
126
234
  --accent-foreground:#0a0a0a;
127
- --destructive:#999999;
235
+ --destructive:var(--state-error);
236
+ --destructive-hover:#dc2626;
128
237
  --destructive-foreground:#ffffff;
129
- --border:#e5e5e5;
130
- --input:#e5e5e5;
131
- /* Same rung as dark: #d4d4d4 measured 1.48:1 on white and could not carry a
132
- focus indicator either. --neutral-500 is 4.74:1 on #ffffff / 4.38:1 on
133
- #f5f5f5, so ONE value is conformant in both themes. */
134
- --ring:var(--neutral-500);
238
+ --border:rgb(0 0 0 / .10);
239
+ --border-strong:rgb(0 0 0 / .16);
240
+ --border-control:rgb(0 0 0 / .15);
241
+ /* Focus and selection are pushed further here than the .22/.30 they sit at in
242
+ dark. Black-on-white at a given alpha reads FAINTER than white-on-black at
243
+ the same alpha — .22 black on #ffffff measures 1.69:1 where .22 white on
244
+ #0a0a0a measures 1.97:1 — so mirroring the number would quietly make the
245
+ light theme's focus state the weakest state in the system. */
246
+ --border-focus:rgb(0 0 0 / .32);
247
+ --border-selected:rgb(0 0 0 / .42);
248
+ --input:var(--border-control);
249
+ /* Same duty, same 3:1 floor, opposite direction: .50 black is 3.98:1 on
250
+ #ffffff and 3.67:1 on #f5f5f5. */
251
+ --ring:rgb(0 0 0 / .5);
252
+ --ring-halo:rgb(0 0 0 / .07);
135
253
  --black:#0a0a0a;
136
254
  --white:#ffffff;
137
- --surface-card:#f5f5f5;
255
+ --selection:rgb(0 0 0 / .16);
256
+ --glass:rgb(0 0 0 / .04);
257
+ --glass-strong:rgb(0 0 0 / .07);
258
+ --surface-card:#fafafa;
138
259
  --surface-card-emphasis:#ffffff;
139
- --surface-card-quiet:#fafafa;
260
+ --surface-card-quiet:#fcfcfc;
140
261
  --surface-overlay:rgb(255 255 255 / .95);
141
262
  --surface-header:rgb(255 255 255 / .8);
142
263
  --surface-scrim:rgb(0 0 0 / .5);
143
- --border-hairline:var(--neutral-200);
144
- --border-card:rgb(0 0 0 / .1);
145
- --border-strong:var(--neutral-500); /* was --neutral-300 = 1.48:1 on white */
146
- /* The white-opacity ladder does NOT invert, so --white-40 is white-on-white
147
- here (1.00:1). Anything that needs a visible edge in BOTH themes must use
148
- --border-strong, never a --white-* rung. */
149
264
  --text-primary:var(--neutral-950);
150
- --text-secondary:rgb(10 10 10 / .8);
151
- --text-tertiary:rgb(10 10 10 / .6);
265
+ --text-secondary:rgb(10 10 10 / .78);
266
+ --text-tertiary:rgb(10 10 10 / .55);
152
267
  --text-disabled:rgb(10 10 10 / .3);
153
268
  }
@@ -1,11 +1,46 @@
1
- /* Hanzo barely uses shadow: on black, elevation reads as a hairline border plus
2
- a wide, very dark drop. Only two levels ship (Tailwind's shadow-2xl for
3
- floating surfaces) plus the ambient radial glow used behind heroes. */
1
+ /* Elevation on a near-black ground is NOT a drop shadow. A dark blur on a dark
2
+ page is nothing you cannot cast a shadow onto black — which is why a system
3
+ that ships only `box-shadow` reads flat no matter how heavy the alphas get.
4
+
5
+ What actually lifts a surface here is LIGHT, and it arrives in three parts:
6
+
7
+ 1. a hairline EDGE (tokens/colors.css --border)
8
+ 2. an inset top HIGHLIGHT (--edge-highlight, below)
9
+ 3. a wide, very dark DROP (--shadow-*)
10
+
11
+ (2) is the one that was missing and the one that does most of the work: a 1px
12
+ inset white line along the top edge reads as the surface catching the light
13
+ from above, and it is the whole difference between a panel that sits ON the
14
+ page and a rectangle that is merely a different colour than the page. The
15
+ reference spends it on its login card (`inset 0 1px 0 rgb(255 255 255 / .05)`)
16
+ and it is the single cheapest premium signal available on dark UI.
17
+
18
+ They are separate tokens rather than one baked shadow because a component
19
+ composes the ones it needs — `box-shadow: var(--edge-highlight), var(--shadow-lg)`
20
+ — and a card that wants the highlight without the drop should not have to
21
+ accept both. */
4
22
  :root{
5
23
  --shadow-none:none;
6
- --shadow-floating:0 25px 50px -12px rgb(0 0 0 / .25); /* shadow-2xl: composer, dropdowns, mega panel */
24
+ /* The floating surface: dropdowns, dialogs, sheets, the composer. Wide, soft,
25
+ and pushed well down. It was Tailwind's `shadow-2xl` at .25 alpha, which is
26
+ invisible on #0a0a0a — so the surfaces that float highest had the weakest
27
+ drop in the system while the t-shirt ramp below was correctly tuned. */
28
+ --shadow-floating:0 24px 60px -16px rgb(0 0 0 / .75);
7
29
  --shadow-inset-hairline:inset 0 0 0 1px var(--white-10);
8
- --ring-focus:0 0 0 2px var(--ring);
30
+
31
+ /* ——— the light ——— */
32
+ /* The top edge, catching light. Add it to any raised surface. */
33
+ --edge-highlight:inset 0 1px 0 0 rgb(255 255 255 / .10);
34
+ /* The bloom around a LIT action on hover — a filled primary button, the send
35
+ key. Monochrome brand: this is where "alive" comes from instead of a hue,
36
+ and it is the whole hover signal on a fill that is already at the top of
37
+ the ink ramp. It was .10, which is invisible: a white glow has to compete
38
+ with the white object casting it, so the alpha that reads around a WHITE
39
+ button is far higher than the one that reads around a dark one. */
40
+ --bloom:0 0 24px -2px rgb(255 255 255 / .28);
41
+ /* The focus halo: soft, outside the ring, carrying no ratio of its own. This
42
+ was `0 0 0 2px var(--ring)` — a second hard ring around the hard ring. */
43
+ --ring-focus:0 0 0 3px var(--ring-halo);
9
44
 
10
45
  /* The t-shirt ramp. Named by size rather than by role, because that is how
11
46
  every component library already asks for a shadow (and how @hanzo/brand
@@ -23,9 +58,45 @@
23
58
  --glow-hero-blur:120px;
24
59
  /* Card top-corner sheen used on the story cards. */
25
60
  --sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(255 255 255 / .08) 0%,transparent 55%); /* @kind color */
61
+ /* The panel's top hairline, brightest at the centre and dissolving before it
62
+ reaches either corner — so an edge never terminates in a hard stop. One of
63
+ the two details that make the reference's panels look machined rather than
64
+ drawn (sidebar.css .panel::before). Paint it on a 1px-tall ::before. */
65
+ --sheen-edge:linear-gradient(90deg,transparent,rgb(255 255 255 / .14) 50%,transparent); /* @kind color */
26
66
  /* Chrome text: the canonical headline gradient. Never a saturated rainbow. */
27
67
  --gradient-chrome:linear-gradient(to right,#ffffff,var(--white-80),var(--white-60));
28
68
  --gradient-chrome-2:linear-gradient(to right,#ffffff,var(--neutral-500));
29
69
  /* Section-top protection gradient (hero overlays). */
30
70
  --gradient-protect:linear-gradient(to bottom,var(--white-10),transparent);
31
71
  }
72
+
73
+ /* Light theme — the same three parts, redistributed.
74
+ On white the order of work inverts: the DROP does almost all of it and the
75
+ inset highlight does none, because a white line on a white card is nothing.
76
+ Every token below is one whose dark value is white — i.e. one that silently
77
+ stops existing in `.light` unless it is restated here. check-tokens.mjs
78
+ scans this file for exactly that omission.
79
+
80
+ --edge-highlight is `inset 0 0 0 0 transparent` rather than `none` on
81
+ purpose: components compose these — `box-shadow: var(--edge-highlight),
82
+ var(--shadow-lg)` — and `none` is not a legal layer in a comma list, so the
83
+ obvious spelling would invalidate the whole declaration and take the drop
84
+ shadow down with it. A zero-size transparent shadow composes to nothing and
85
+ costs nothing. */
86
+ .light{
87
+ --shadow-floating:0 24px 60px -16px rgb(0 0 0 / .18);
88
+ --shadow-inset-hairline:inset 0 0 0 1px rgb(0 0 0 / .10);
89
+ --edge-highlight:inset 0 0 0 0 transparent;
90
+ --bloom:0 6px 20px -4px rgb(0 0 0 / .18);
91
+ --shadow-sm:0 1px 2px 0 rgb(0 0 0 / .06);
92
+ --shadow:0 1px 3px 0 rgb(0 0 0 / .08), 0 1px 2px -1px rgb(0 0 0 / .06);
93
+ --shadow-md:0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06);
94
+ --shadow-lg:0 10px 15px -3px rgb(0 0 0 / .09), 0 4px 6px -4px rgb(0 0 0 / .07);
95
+ --shadow-xl:0 20px 25px -5px rgb(0 0 0 / .10), 0 8px 10px -6px rgb(0 0 0 / .08);
96
+ --glow-hero:radial-gradient(circle,rgb(0 0 0 / .06) 0%,transparent 68%);
97
+ --sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(0 0 0 / .04) 0%,transparent 55%);
98
+ --sheen-edge:linear-gradient(90deg,transparent,rgb(0 0 0 / .08) 50%,transparent);
99
+ --gradient-chrome:linear-gradient(to right,#0a0a0a,rgb(10 10 10 / .8),rgb(10 10 10 / .6));
100
+ --gradient-chrome-2:linear-gradient(to right,#0a0a0a,var(--neutral-500));
101
+ --gradient-protect:linear-gradient(to bottom,rgb(0 0 0 / .10),transparent);
102
+ }
package/tokens/motion.css CHANGED
@@ -6,8 +6,17 @@
6
6
  --duration-slow:400ms; /* @kind other */ /* hero element entry */
7
7
  --duration-slower:500ms; /* @kind other */ /* section entry */
8
8
  --duration-glow:9s; /* @kind other */ /* ambient radial breathe */
9
+ --duration-press:90ms; /* @kind other */ /* the press-down on :active */
9
10
  --ease-out:cubic-bezier(0,0,0.2,1); /* @kind other */
10
11
  --ease-in-out:cubic-bezier(0.4,0,0.2,1); /* @kind other */
12
+ /* The entrance curve. Nearly all of the distance is covered in the first
13
+ third and it settles without overshooting, so a panel arrives DECIDED
14
+ rather than drifting in — the difference between 300ms that feels
15
+ immediate and 300ms that feels slow. Use it for anything that appears
16
+ (menus, dialogs, sheets, toasts); --ease-out stays the curve for a state
17
+ change on something already on screen. It is not a spring: this system has
18
+ no bounce anywhere. */
19
+ --ease-emphasis:cubic-bezier(0.16,1,0.3,1); /* @kind other */
11
20
  --stagger:60ms; /* @kind other */ /* per-element delay in a group */
12
21
  --entry-rise:16px; /* hero y-offset */
13
22
  --entry-rise-lg:24px; /* card y-offset */
@@ -16,6 +25,12 @@
16
25
  @keyframes hanzo-fade-up{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
17
26
  @keyframes hanzo-fade-down{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}
18
27
  @keyframes hanzo-slide-up-fade{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
28
+ /* The entrance for anything that appears OVER the page — dialog, sheet, command
29
+ palette. It arrives from very slightly small and very slightly low, which is
30
+ what reads as "came forward" rather than "was toggled on". 3% and 8px: any
31
+ more and it is an animation you notice, which is the failure mode. Pair it
32
+ with --ease-emphasis. */
33
+ @keyframes hanzo-zoom-in{from{opacity:0;transform:scale(.97) translateY(8px)}to{opacity:1;transform:none}}
19
34
  @keyframes hanzo-glow{0%,100%{transform:scale(1);opacity:.45}50%{transform:scale(1.08);opacity:.65}}
20
35
  @keyframes hanzo-pulse-dot{0%,100%{opacity:1}50%{opacity:.35}}
21
36