@entifix/style 0.1.0-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 r10c Technologies
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@entifix/style",
3
+ "nx": {
4
+ "tags": [
5
+ "layer:entifix",
6
+ "scope:shared",
7
+ "entifix:style",
8
+ "tier:0"
9
+ ]
10
+ },
11
+ "version": "0.1.0-0",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/r10c-technologies/entifix.git",
16
+ "directory": "packages/style"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "type": "module",
22
+ "exports": {
23
+ "./package.json": "./package.json",
24
+ "./tokens.css": "./src/tokens.css",
25
+ "./theme.css": "./src/theme.css",
26
+ "./presets/fixed-scale.css": "./src/presets/fixed-scale.css",
27
+ "./presets/aurora.css": "./src/presets/aurora.css",
28
+ "./presets/sunset.css": "./src/presets/sunset.css",
29
+ "./presets/midnight.css": "./src/presets/midnight.css"
30
+ },
31
+ "files": [
32
+ "src",
33
+ "LICENSE"
34
+ ]
35
+ }
@@ -0,0 +1,16 @@
1
+ /* Aurora — cool blue light palette. Opt-in preset for the color contract. */
2
+ [data-theme='aurora'] {
3
+ --color-surface: #f7f9fc;
4
+ --color-surface-elevated: #ffffff;
5
+ --color-content: #1b2432;
6
+ --color-content-muted: #5a6b82;
7
+ --color-primary: #3b6ff5;
8
+ --color-primary-content: #ffffff;
9
+ --color-border: #dbe3ef;
10
+ --color-accent: #7c5cff;
11
+ --color-focus-ring: #2f5fe0;
12
+
13
+ --color-danger: #c0342b;
14
+ --color-danger-subtle: #fdf2f1;
15
+ --color-danger-content: #ffffff;
16
+ }
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Fixed scale — the dense operator scale, opted into per app.
3
+ *
4
+ * The default scale in tokens.css is fluid Utopia at an 18-20px prose base.
5
+ * That is right for the storefront and wrong for a back office: its steps land
6
+ * at 4.5 / 9 / 13.5 / 18 / 27px, so nothing sits on 4, 8, 12 or 16, `2xs → s`
7
+ * is a 2x jump, and the measured consequence is that the bottom three steps of
8
+ * a nine-step scale carry ~80% of every call site while the top half goes
9
+ * unused. A dense grid cannot express itself on a scale with no small
10
+ * increments, so it stops trying and reaches for whatever is nearest.
11
+ *
12
+ * Same token NAMES, different VALUES — the mechanism --color-* already uses.
13
+ * Tailwind emits `padding: var(--spacing-s)`, by reference, so importing this
14
+ * file re-scales every existing `p-s` / `gap-2xs` in the tree and not one call
15
+ * site changes. That is the whole design: a component must never learn which
16
+ * app it is running in.
17
+ *
18
+ * Importing this file changes NOTHING on its own — every rule is keyed to a
19
+ * `data-scale` / `data-density` attribute, exactly like `data-theme` on the
20
+ * palettes. An app opts in once, on <html>:
21
+ *
22
+ * @import '@entifix/style/tokens.css';
23
+ * @import '@entifix/style/presets/fixed-scale.css';
24
+ *
25
+ * <html data-scale="fixed" data-density="compact">
26
+ *
27
+ * Opt-in by attribute rather than by import is what makes the Storybook
28
+ * specimen possible: custom properties inherit, so the nearest ancestor that
29
+ * sets one wins for its subtree, and one page can show the fluid and the fixed
30
+ * scale side by side. It also lets a comfortable screen hold one compact
31
+ * region — a dense table inside a roomy page — without a second stylesheet.
32
+ *
33
+ * See ADR 0027.
34
+ */
35
+
36
+ [data-scale='fixed'] {
37
+ /* 4px grid. Every step is a multiple of 4, and the steps a dense screen
38
+ actually needs (4, 8, 12, 16) exist as distinct tokens instead of being
39
+ three roundings of the same 9px. */
40
+ --spacing-3xs: 0.25rem; /* 4px */
41
+ --spacing-2xs: 0.5rem; /* 8px */
42
+ --spacing-xs: 0.75rem; /* 12px */
43
+ --spacing-s: 1rem; /* 16px */
44
+ --spacing-m: 1.5rem; /* 24px */
45
+ --spacing-l: 2rem; /* 32px */
46
+ --spacing-xl: 3rem; /* 48px */
47
+ --spacing-2xl: 4rem; /* 64px */
48
+ --spacing-3xl: 6rem; /* 96px */
49
+
50
+ /* Type is fixed, not fluid: an operator screen is not read at arm's length
51
+ on a phone, and a size that interpolates with the viewport cannot be
52
+ aligned to a row height. Body is 14px — admin tables want 13-14px, and the
53
+ fluid scale's 18-20px body was a step or two too large before spacing was
54
+ ever considered.
55
+
56
+ Line-height and tracking are restated per step because the modifiers are
57
+ part of the step, not of the scale: at 14px, body wants more leading than
58
+ the 18px fluid version, and a 32px heading wants less. */
59
+ --text-step-xs: 0.6875rem; /* 11px */
60
+ --text-step-xs--line-height: 1.45;
61
+ --text-step-xs--letter-spacing: 0.01em;
62
+ --text-step-sm: 0.75rem; /* 12px */
63
+ --text-step-sm--line-height: 1.45;
64
+ --text-step-sm--letter-spacing: 0.005em;
65
+ --text-step-0: 0.875rem; /* 14px — body */
66
+ --text-step-0--line-height: 1.5;
67
+ --text-step-0--letter-spacing: 0em;
68
+ --text-step-1: 1rem; /* 16px */
69
+ --text-step-1--line-height: 1.45;
70
+ --text-step-1--letter-spacing: -0.005em;
71
+ --text-step-2: 1.25rem; /* 20px */
72
+ --text-step-2--line-height: 1.3;
73
+ --text-step-2--letter-spacing: -0.01em;
74
+ --text-step-3: 1.5rem; /* 24px */
75
+ --text-step-3--line-height: 1.25;
76
+ --text-step-3--letter-spacing: -0.015em;
77
+ --text-step-4: 2rem; /* 32px */
78
+ --text-step-4--line-height: 1.15;
79
+ --text-step-4--letter-spacing: -0.02em;
80
+ }
81
+
82
+ /*
83
+ * Density.
84
+ *
85
+ * `[data-density]` on the root element, set by the app. Not a per-component
86
+ * prop — that is combinatorial, and every control would carry it forever. Not
87
+ * a media query either: density is a property of the work, not of the
88
+ * viewport, which is why it does not violate the flex-first / no-media-query
89
+ * rule in FRONTEND.md.
90
+ *
91
+ * Only SPACING compacts. Type deliberately does not: shrinking text is how a
92
+ * compact mode becomes an accessibility problem, and the base size is already
93
+ * corrected above. This matches the prior art — Cloudscape reduces spacing in
94
+ * increments of 4 and leaves type alone.
95
+ *
96
+ * `comfortable` is spelled out rather than left implicit so an app can set it
97
+ * explicitly and mean it.
98
+ */
99
+ [data-density='comfortable'] {
100
+ --spacing-3xs: 0.25rem; /* 4px */
101
+ --spacing-2xs: 0.5rem; /* 8px */
102
+ --spacing-xs: 0.75rem; /* 12px */
103
+ --spacing-s: 1rem; /* 16px */
104
+ --spacing-m: 1.5rem; /* 24px */
105
+ --spacing-l: 2rem; /* 32px */
106
+ --spacing-xl: 3rem; /* 48px */
107
+ }
108
+
109
+ [data-density='compact'] {
110
+ --spacing-3xs: 0.125rem; /* 2px */
111
+ --spacing-2xs: 0.25rem; /* 4px */
112
+ --spacing-xs: 0.5rem; /* 8px */
113
+ --spacing-s: 0.75rem; /* 12px */
114
+ --spacing-m: 1.25rem; /* 20px */
115
+ --spacing-l: 1.75rem; /* 28px */
116
+ --spacing-xl: 2.5rem; /* 40px */
117
+ /* 2xl and 3xl are untouched on purpose: they carry page-level rhythm — the
118
+ gap between major regions — and compacting those buys nothing per row
119
+ while making a screen feel cramped rather than dense. */
120
+ }
121
+
122
+ /*
123
+ * The exclusion list.
124
+ *
125
+ * Density is selective, not blanket. These surfaces keep comfortable spacing
126
+ * even in a compact app, because compacting them works against what they are
127
+ * for: an alert must interrupt, help text is read rather than scanned, and a
128
+ * date picker is a hit-target grid whose cells are already at the floor.
129
+ *
130
+ * Marked by data attribute rather than class so the opt-out survives a
131
+ * component being restyled, and so it is greppable.
132
+ */
133
+ [data-density='compact'] [data-density-exclude] {
134
+ --spacing-3xs: 0.25rem;
135
+ --spacing-2xs: 0.5rem;
136
+ --spacing-xs: 0.75rem;
137
+ --spacing-s: 1rem;
138
+ --spacing-m: 1.5rem;
139
+ --spacing-l: 2rem;
140
+ --spacing-xl: 3rem;
141
+ }
@@ -0,0 +1,27 @@
1
+ /* Midnight — dark palette with deeper elevation. Opt-in preset. */
2
+ [data-theme='midnight'] {
3
+ color-scheme: dark;
4
+ --color-surface: #0f141c;
5
+ --color-surface-elevated: #1a222e;
6
+ --color-content: #e6ecf5;
7
+ --color-content-muted: #93a1b5;
8
+ --color-primary: #5b8cff;
9
+ --color-primary-content: #0b1220;
10
+ --color-border: #2a3546;
11
+ --color-accent: #a17cff;
12
+ --color-focus-ring: #7ea6ff;
13
+
14
+ --color-danger: #ff8b80;
15
+ --color-danger-subtle: #2c1a1a;
16
+ --color-danger-content: #0b1220;
17
+
18
+ /* Deeper elevation for dark surfaces. Black at the light scale's alphas is
19
+ invisible on a dark ground, so the tint carries a strength multiplier —
20
+ and the two large shadows are restated because a dark surface needs
21
+ different blur GEOMETRY, not just more opacity. */
22
+ --shadow-tint: 0 0 0;
23
+ --shadow-strength: 6.5;
24
+ --shadow-card:
25
+ 0 8px 24px -6px rgb(0 0 0 / 0.55), 0 2px 8px -2px rgb(0 0 0 / 0.4);
26
+ --shadow-overlay: 0 20px 48px -12px rgb(0 0 0 / 0.65);
27
+ }
@@ -0,0 +1,21 @@
1
+ /* Sunset — warm light palette with warm-tinted elevation. Opt-in preset. */
2
+ [data-theme='sunset'] {
3
+ --color-surface: #fdf6f0;
4
+ --color-surface-elevated: #fffdfb;
5
+ --color-content: #3a2417;
6
+ --color-content-muted: #8a6b57;
7
+ --color-primary: #e5622d;
8
+ --color-primary-content: #fff8f3;
9
+ --color-border: #f0dccb;
10
+ --color-accent: #d9316b;
11
+ --color-focus-ring: #c2481c;
12
+
13
+ --color-danger: #c23b1e;
14
+ --color-danger-subtle: #fdeee8;
15
+ --color-danger-content: #fff8f3;
16
+
17
+ /* Warm-tinted elevation. One line, and it now actually applies: these
18
+ tokens are plain custom properties, not @theme entries Tailwind bakes. */
19
+ --shadow-tint: 120 60 20;
20
+ --shadow-strength: 1.3;
21
+ }
package/src/theme.css ADDED
@@ -0,0 +1,13 @@
1
+ /*
2
+ * @entifix/style / theme.css — convenience barrel.
3
+ *
4
+ * Pulls the structural tokens + color contract and all three shipped palette
5
+ * presets in one import. Handy for demos or apps that just want the defaults.
6
+ *
7
+ * For per-app personalization, import `tokens.css` plus only the presets you
8
+ * want (or an app-local themes.css), rather than this file. See tokens.css.
9
+ */
10
+ @import './tokens.css';
11
+ @import './presets/aurora.css';
12
+ @import './presets/sunset.css';
13
+ @import './presets/midnight.css';
package/src/tokens.css ADDED
@@ -0,0 +1,267 @@
1
+ /*
2
+ * @entifix/style / tokens.css — the shared, immutable base.
3
+ *
4
+ * Two things live here and only here:
5
+ * 1. Structural tokens (typeface, spacing, type, radius, border, shadow,
6
+ * motion, focus) — the NAMES are universal and never vary per app.
7
+ * 2. The color *contract*: the semantic --color-* NAMES, with neutral
8
+ * fallback values. Declaring them in @theme is what makes bg-surface,
9
+ * text-content, border-border, … exist as utilities.
10
+ *
11
+ * Apps override the VALUES; the names stay constant so components never care
12
+ * which app they run in. There are two override surfaces, and they are the
13
+ * same mechanism:
14
+ * - palette → presets/*.css or an app-local themes.css, on [data-theme]
15
+ * - scale → presets/fixed-scale.css, on :root, opted into by an app
16
+ *
17
+ * Consumed by an app stylesheet that has already run `@import "tailwindcss"`.
18
+ *
19
+ * The DEFAULT scale here is the fluid one: spacing and type generated with the
20
+ * Utopia calculator (viewport 360..1240, base 18px/1.2 .. 20px/1.25). It is
21
+ * built for reading, and the storefront keeps it. Dense operator UI imports
22
+ * `presets/fixed-scale.css` instead — see ADR 0027.
23
+ */
24
+
25
+ @theme {
26
+ /* Typeface. The --font-* value each app injects (next/font) comes first and
27
+ the stack behind it is a real fallback, not decoration: it is what renders
28
+ during the swap and on any surface that cannot load a webfont.
29
+ Tailwind's --default-font-family reads --font-sans, so setting it here is
30
+ what puts Inter on <body> — no `html { font-family }` needed anywhere. */
31
+ --font-sans:
32
+ var(--font-inter), ui-sans-serif, system-ui, -apple-system,
33
+ BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
34
+ 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
35
+ --font-mono:
36
+ var(--font-jetbrains-mono), ui-monospace, SFMono-Regular, 'SF Mono', Menlo,
37
+ Consolas, 'Liberation Mono', monospace;
38
+
39
+ /* Tabular figures are NOT set on the face. A column of money must align, but
40
+ proportional figures are correct in prose, and putting `tnum` on --font-sans
41
+ would apply it to every paragraph in the storefront to fix a table. The
42
+ `tabular-nums` utility carries it, applied once in the table atom and in
43
+ CellValue rather than per call site. */
44
+
45
+ /* Weight — THREE, deliberately. 400 body, 500 secondary emphasis, 600
46
+ headings and labels. A fourth needs a stated reason; `bold` (700) was
47
+ removed because "heading" and "emphatic heading" were never distinct
48
+ roles here, only different authors. Tailwind still generates font-bold
49
+ from its own defaults — the rule is a review rule, and the specimen in
50
+ Storybook is where it is visible. */
51
+ --font-weight-normal: 400;
52
+ --font-weight-medium: 500;
53
+ --font-weight-semibold: 600;
54
+
55
+ /* Fluid spacing — Tailwind's --spacing-* namespace emits p-s, gap-l, m-xl, …
56
+ Utility output is `padding: var(--spacing-s)`, by reference, which is what
57
+ lets `presets/fixed-scale.css` and [data-density] swap the whole scale at
58
+ runtime without a single call site changing. */
59
+ --spacing-3xs: clamp(0.2813rem, 0.2685rem + 0.0568vw, 0.3125rem);
60
+ --spacing-2xs: clamp(0.5625rem, 0.5369rem + 0.1136vw, 0.625rem);
61
+ --spacing-xs: clamp(0.8438rem, 0.8054rem + 0.1705vw, 0.9375rem);
62
+ --spacing-s: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem);
63
+ --spacing-m: clamp(1.6875rem, 1.6108rem + 0.3409vw, 1.875rem);
64
+ --spacing-l: clamp(2.25rem, 2.1477rem + 0.4545vw, 2.5rem);
65
+ --spacing-xl: clamp(3.375rem, 3.2216rem + 0.6818vw, 3.75rem);
66
+ --spacing-2xl: clamp(4.5rem, 4.2955rem + 0.9091vw, 5rem);
67
+ --spacing-3xl: clamp(6.75rem, 6.4432rem + 1.3636vw, 7.5rem);
68
+
69
+ /* Fluid type — Tailwind's --text-* namespace emits text-step-0 … text-step-4.
70
+ Down-steps (sm, xs) taper below body for captions/fine print.
71
+ Each step carries its own line-height and tracking through Tailwind's
72
+ `--text-*--line-height` / `--text-*--letter-spacing` modifiers, so a size
73
+ utility brings its whole typographic setting with it: headings track
74
+ tighter and lead shorter than body, which is the entire reason a type
75
+ scale is not just a list of sizes. */
76
+ --text-step-xs: clamp(0.78125rem, 0.7736rem + 0.0341vw, 0.8rem);
77
+ --text-step-xs--line-height: 1.5;
78
+ --text-step-xs--letter-spacing: 0.01em;
79
+ --text-step-sm: clamp(0.9375rem, 0.9119rem + 0.1136vw, 1rem);
80
+ --text-step-sm--line-height: 1.5;
81
+ --text-step-sm--letter-spacing: 0.005em;
82
+ --text-step-0: clamp(1.125rem, 1.0739rem + 0.2273vw, 1.25rem);
83
+ --text-step-0--line-height: 1.5;
84
+ --text-step-0--letter-spacing: 0em;
85
+ --text-step-1: clamp(1.35rem, 1.2631rem + 0.3864vw, 1.5625rem);
86
+ --text-step-1--line-height: 1.35;
87
+ --text-step-1--letter-spacing: -0.01em;
88
+ --text-step-2: clamp(1.62rem, 1.4837rem + 0.6057vw, 1.9531rem);
89
+ --text-step-2--line-height: 1.25;
90
+ --text-step-2--letter-spacing: -0.015em;
91
+ --text-step-3: clamp(1.944rem, 1.7405rem + 0.9044vw, 2.4414rem);
92
+ --text-step-3--line-height: 1.2;
93
+ --text-step-3--letter-spacing: -0.02em;
94
+ /* step-4 is new. The storefront's product page has been asking for it since
95
+ it was written — `text-step-4` was used there against a scale that stopped
96
+ at step-3, so Tailwind emitted no utility and the price rendered at
97
+ inherited size. */
98
+ --text-step-4: clamp(2.3328rem, 2.0886rem + 1.0853vw, 2.9297rem);
99
+ --text-step-4--line-height: 1.15;
100
+ --text-step-4--letter-spacing: -0.025em;
101
+
102
+ /* Layout — measures for the flex-first layout primitives (Every Layout).
103
+ `--measure` caps line length (Center); `--grid-min` is the minimum card
104
+ column before the auto-fill Grid wraps. Consumed via arbitrary-value
105
+ classes (max-w-[var(--measure)], grid-cols-[repeat(auto-fill,…)]) and
106
+ overridable per-instance through an inline custom property. */
107
+ --measure: 65ch;
108
+ --grid-min: 16rem;
109
+
110
+ /* Border radius — --radius-* namespace emits rounded-md, rounded-2xl, … */
111
+ --radius-sm: 0.375rem;
112
+ --radius-md: 0.625rem;
113
+ --radius-lg: 0.875rem;
114
+ --radius-xl: 1.125rem;
115
+ --radius-2xl: 1.5rem;
116
+
117
+ /* Motion — a three-step duration scale plus an enter/exit easing split.
118
+ `--default-transition-*` still tunes every bare `transition` utility, so
119
+ nothing that already transitions changes. Enter decelerates (fast in,
120
+ settle), exit accelerates (leave decisively): the asymmetry is what makes
121
+ a menu feel responsive rather than sluggish in both directions. */
122
+ --duration-fast: 120ms;
123
+ --duration-base: 200ms;
124
+ --duration-slow: 320ms;
125
+ --default-transition-duration: 200ms;
126
+ --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
127
+ --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
128
+ --ease-enter: cubic-bezier(0, 0, 0.2, 1);
129
+ --ease-exit: cubic-bezier(0.4, 0, 1, 1);
130
+
131
+ /* Color CONTRACT — semantic --color-* names with NEUTRAL fallbacks.
132
+ Unbranded on purpose: an app with no palette still renders legibly, and
133
+ the fallback signals "no theme applied". Real brands come from a preset
134
+ or app-local [data-theme] block. */
135
+ --color-surface: #f4f5f7;
136
+ --color-surface-elevated: #ffffff;
137
+ --color-content: #1c2024;
138
+ --color-content-muted: #626b76;
139
+ --color-primary: #3d4653;
140
+ --color-primary-content: #ffffff;
141
+ --color-border: #dfe3e8;
142
+ --color-accent: #6b7480;
143
+
144
+ /* The focus ring is a color in the contract, not a reuse of --color-accent.
145
+ Operator efficiency IS keyboard use, so where the ring lands must be
146
+ decidable per palette against that palette's surfaces — it has to clear
147
+ 3:1 non-text contrast, and an accent chosen to look good as a link does
148
+ not automatically do that. */
149
+ --color-focus-ring: #2f3742;
150
+
151
+ /* Failure. Part of the contract rather than an app-local choice: "this did
152
+ not work" is the one message a component must never render in the same
153
+ voice as ordinary content — a listing that reports a dead backend the way
154
+ it reports an empty result is indistinguishable from a working one.
155
+ `-subtle` is the surface it sits on; `-content` the text on that surface. */
156
+ --color-danger: #b42318;
157
+ --color-danger-subtle: #fef3f2;
158
+ --color-danger-content: #ffffff;
159
+ }
160
+
161
+ /*
162
+ * Elevation — deliberately NOT in @theme, and NOT named after sizes.
163
+ *
164
+ * Two things forced this shape, both measured rather than assumed.
165
+ *
166
+ * First, Tailwind parses a @theme shadow at BUILD time so it can support the
167
+ * `shadow-<color>` modifier, and inlines the resolved color into the utility:
168
+ *
169
+ * .shadow-card { --tw-shadow: 0 4px 16px -4px var(--tw-shadow-color,#0f172a1a) }
170
+ *
171
+ * A [data-theme] block redefining --shadow-card therefore changed nothing —
172
+ * which is exactly what every palette in this package was doing, in dead CSS,
173
+ * from the day it was written. Plain custom properties plus hand-written
174
+ * utilities cost the color modifier (nothing uses it) and buy back the one
175
+ * property elevation actually needs: a palette re-tints in ONE line.
176
+ *
177
+ * Second, the names. `xs`/`sm`/`lg` are Tailwind's OWN namespace, and a custom
178
+ * @utility does not win against a theme-generated one — `shadow-sm` kept
179
+ * resolving to Tailwind's default while looking like ours. So the ladder is
180
+ * named for what each rung means instead, which is what it should have been:
181
+ *
182
+ * edge a control barely off the surface — inputs, secondary buttons
183
+ * raised a primary control, or one under the pointer
184
+ * card a panel that owns its own region
185
+ * overlay something floating over the page — menus, dialogs, popovers
186
+ *
187
+ * `--shadow-tint` is a bare rgb triple so it can carry an alpha per layer;
188
+ * `--shadow-strength` scales every layer at once, which is what a dark palette
189
+ * needs (black at 0.06 is invisible on a dark surface).
190
+ */
191
+ :root {
192
+ --shadow-tint: 15 23 42;
193
+ --shadow-strength: 1;
194
+
195
+ --shadow-edge: 0 1px 2px
196
+ rgb(var(--shadow-tint) / calc(0.06 * var(--shadow-strength)));
197
+ --shadow-raised:
198
+ 0 1px 3px rgb(var(--shadow-tint) / calc(0.08 * var(--shadow-strength))),
199
+ 0 1px 2px rgb(var(--shadow-tint) / calc(0.06 * var(--shadow-strength)));
200
+ --shadow-card:
201
+ 0 4px 16px -4px rgb(var(--shadow-tint) / calc(0.1 * var(--shadow-strength))),
202
+ 0 2px 6px -2px rgb(var(--shadow-tint) / calc(0.06 * var(--shadow-strength)));
203
+ --shadow-overlay: 0 16px 40px -12px
204
+ rgb(var(--shadow-tint) / calc(0.18 * var(--shadow-strength)));
205
+ }
206
+
207
+ @utility shadow-edge {
208
+ box-shadow: var(--shadow-edge);
209
+ }
210
+ @utility shadow-raised {
211
+ box-shadow: var(--shadow-raised);
212
+ }
213
+ @utility shadow-card {
214
+ box-shadow: var(--shadow-card);
215
+ }
216
+ @utility shadow-overlay {
217
+ box-shadow: var(--shadow-overlay);
218
+ }
219
+
220
+ /*
221
+ * Border width. Tailwind v4 has no --border-width-* theme namespace (widths are
222
+ * static utilities), so these are plain custom properties with named utilities
223
+ * over them — the point being that "the emphatic border" has one value, not a
224
+ * `border-2` guessed per component.
225
+ */
226
+ :root {
227
+ --border-width-hairline: 1px;
228
+ --border-width-strong: 2px;
229
+ }
230
+
231
+ @utility border-hairline {
232
+ border-width: var(--border-width-hairline);
233
+ }
234
+ @utility border-strong {
235
+ border-width: var(--border-width-strong);
236
+ }
237
+
238
+ /*
239
+ * The focus ring.
240
+ *
241
+ * One utility replaces the three-class incantation
242
+ * (`focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`) that
243
+ * was copied into six controls and forgotten in the rest — nine call sites
244
+ * killed the outline and only six put anything back.
245
+ *
246
+ * `outline` rather than a box-shadow ring, for three reasons that all matter on
247
+ * a dense screen: it follows border-radius, it is not clipped by an ancestor's
248
+ * `overflow: hidden` (a table cell, a menu), and it costs no layout.
249
+ * `:focus-visible` alone, so a mouse click does not ring.
250
+ */
251
+ @utility focus-ring {
252
+ &:focus-visible {
253
+ outline: var(--border-width-strong) solid var(--color-focus-ring);
254
+ outline-offset: 2px;
255
+ }
256
+
257
+ /* HeadlessUI drives some of its controls (Radio, MenuItem, ComboboxOption)
258
+ with a `data-focus` attribute rather than native focus, and it applies it
259
+ on keyboard interaction only — the same intent as :focus-visible. Covering
260
+ both here is what keeps ONE utility true for every control; without it a
261
+ HeadlessUI control silently has no ring while wearing the class that says
262
+ it does. */
263
+ &[data-focus] {
264
+ outline: var(--border-width-strong) solid var(--color-focus-ring);
265
+ outline-offset: 2px;
266
+ }
267
+ }