trykeyline 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +117 -2
  4. package/bin/keyline.mjs +280 -0
  5. package/package.json +38 -4
  6. package/plugins/keyline/.claude-plugin/plugin.json +14 -0
  7. package/plugins/keyline/plugin.json +22 -0
  8. package/plugins/keyline/skills/keyline/SKILL.md +47 -0
  9. package/plugins/keyline/skills/keyline/commands/audit.md +30 -0
  10. package/plugins/keyline/skills/keyline/commands/color.md +7 -0
  11. package/plugins/keyline/skills/keyline/commands/critique.md +20 -0
  12. package/plugins/keyline/skills/keyline/commands/depth.md +7 -0
  13. package/plugins/keyline/skills/keyline/commands/init.md +16 -0
  14. package/plugins/keyline/skills/keyline/commands/layout.md +7 -0
  15. package/plugins/keyline/skills/keyline/commands/motion.md +7 -0
  16. package/plugins/keyline/skills/keyline/commands/patterns.md +7 -0
  17. package/plugins/keyline/skills/keyline/commands/polish.md +19 -0
  18. package/plugins/keyline/skills/keyline/commands/refine.md +19 -0
  19. package/plugins/keyline/skills/keyline/commands/sync.md +15 -0
  20. package/plugins/keyline/skills/keyline/commands/type.md +7 -0
  21. package/plugins/keyline/skills/keyline/commands/ux-laws.md +26 -0
  22. package/plugins/keyline/skills/keyline/domains/color/deriving-a-ramp.md +144 -0
  23. package/plugins/keyline/skills/keyline/domains/color/guide.md +207 -0
  24. package/plugins/keyline/skills/keyline/domains/color/status-and-exceptions.md +174 -0
  25. package/plugins/keyline/skills/keyline/domains/color/theming-mechanics.md +121 -0
  26. package/plugins/keyline/skills/keyline/domains/depth/elevation-recipes.md +185 -0
  27. package/plugins/keyline/skills/keyline/domains/depth/fallbacks-and-performance.md +132 -0
  28. package/plugins/keyline/skills/keyline/domains/depth/guide.md +226 -0
  29. package/plugins/keyline/skills/keyline/domains/depth/translucent-materials.md +159 -0
  30. package/plugins/keyline/skills/keyline/domains/layout/forks-gating-and-disclosures.md +201 -0
  31. package/plugins/keyline/skills/keyline/domains/layout/guide.md +259 -0
  32. package/plugins/keyline/skills/keyline/domains/layout/measure-and-rhythm.md +193 -0
  33. package/plugins/keyline/skills/keyline/domains/layout/radius-lines-and-layers.md +122 -0
  34. package/plugins/keyline/skills/keyline/domains/motion/guards.md +162 -0
  35. package/plugins/keyline/skills/keyline/domains/motion/guide.md +198 -0
  36. package/plugins/keyline/skills/keyline/domains/motion/ladder-and-curves.md +139 -0
  37. package/plugins/keyline/skills/keyline/domains/motion/patterns.md +196 -0
  38. package/plugins/keyline/skills/keyline/domains/motion/performance.md +121 -0
  39. package/plugins/keyline/skills/keyline/domains/patterns/actions-and-forms.md +204 -0
  40. package/plugins/keyline/skills/keyline/domains/patterns/agents-and-live-states.md +111 -0
  41. package/plugins/keyline/skills/keyline/domains/patterns/collections-and-dashboards.md +131 -0
  42. package/plugins/keyline/skills/keyline/domains/patterns/copy.md +123 -0
  43. package/plugins/keyline/skills/keyline/domains/patterns/guide.md +174 -0
  44. package/plugins/keyline/skills/keyline/domains/patterns/iteration.md +70 -0
  45. package/plugins/keyline/skills/keyline/domains/type/display-tier.md +108 -0
  46. package/plugins/keyline/skills/keyline/domains/type/guide.md +227 -0
  47. package/plugins/keyline/skills/keyline/domains/type/ladders.md +169 -0
  48. package/plugins/keyline/skills/keyline/domains/type/numerals-and-loading.md +107 -0
  49. package/plugins/keyline/skills/keyline/domains/type/prose-and-emphasis.md +125 -0
  50. package/plugins/keyline/skills/keyline/domains/type/type-audit.md +87 -0
  51. package/plugins/keyline/skills/keyline/glass/color/assets/color-tokens.css +299 -0
  52. package/plugins/keyline/skills/keyline/glass/color/assets/theme.ts +119 -0
  53. package/plugins/keyline/skills/keyline/glass/color/guide.md +195 -0
  54. package/plugins/keyline/skills/keyline/glass/color/intent-ramp.md +136 -0
  55. package/plugins/keyline/skills/keyline/glass/color/theming.md +106 -0
  56. package/plugins/keyline/skills/keyline/glass/depth/assets/GlassPanel.tsx +171 -0
  57. package/plugins/keyline/skills/keyline/glass/depth/assets/glass.css +322 -0
  58. package/plugins/keyline/skills/keyline/glass/depth/blur-and-tint.md +50 -0
  59. package/plugins/keyline/skills/keyline/glass/depth/depth-cues.md +87 -0
  60. package/plugins/keyline/skills/keyline/glass/depth/guide.md +147 -0
  61. package/plugins/keyline/skills/keyline/glass/depth/performance-and-fallbacks.md +37 -0
  62. package/plugins/keyline/skills/keyline/glass/layout/adaptive-presentations.md +231 -0
  63. package/plugins/keyline/skills/keyline/glass/layout/assets/SectionNav.tsx +244 -0
  64. package/plugins/keyline/skills/keyline/glass/layout/assets/layout-tokens.css +201 -0
  65. package/plugins/keyline/skills/keyline/glass/layout/guide.md +259 -0
  66. package/plugins/keyline/skills/keyline/glass/layout/measure-and-rhythm.md +134 -0
  67. package/plugins/keyline/skills/keyline/glass/layout/radius-and-elevation.md +103 -0
  68. package/plugins/keyline/skills/keyline/glass/motion/assets/DropMenu.tsx +106 -0
  69. package/plugins/keyline/skills/keyline/glass/motion/assets/motion-presets.ts +210 -0
  70. package/plugins/keyline/skills/keyline/glass/motion/assets/motion-tokens.css +176 -0
  71. package/plugins/keyline/skills/keyline/glass/motion/assets/useReveal.ts +65 -0
  72. package/plugins/keyline/skills/keyline/glass/motion/assets/useScrollTick.ts +183 -0
  73. package/plugins/keyline/skills/keyline/glass/motion/easing-and-duration.md +108 -0
  74. package/plugins/keyline/skills/keyline/glass/motion/guide.md +255 -0
  75. package/plugins/keyline/skills/keyline/glass/motion/reduced-motion.md +81 -0
  76. package/plugins/keyline/skills/keyline/glass/motion/scroll-performance.md +58 -0
  77. package/plugins/keyline/skills/keyline/glass/motion/shared-element.md +161 -0
  78. package/plugins/keyline/skills/keyline/glass/motion/sound.md +195 -0
  79. package/plugins/keyline/skills/keyline/glass/motion/springs.md +51 -0
  80. package/plugins/keyline/skills/keyline/glass/type/assets/prose.tsx +268 -0
  81. package/plugins/keyline/skills/keyline/glass/type/assets/type-tokens.css +416 -0
  82. package/plugins/keyline/skills/keyline/glass/type/guide.md +220 -0
  83. package/plugins/keyline/skills/keyline/glass/type/long-form-prose.md +151 -0
  84. package/plugins/keyline/skills/keyline/glass/type/scale.md +69 -0
  85. package/plugins/keyline/skills/keyline/glass/type/weight-and-tracking.md +61 -0
  86. package/plugins/keyline/skills/keyline/scripts/check/css.mjs +112 -0
  87. package/plugins/keyline/skills/keyline/scripts/check/design.mjs +67 -0
  88. package/plugins/keyline/skills/keyline/scripts/check/files.mjs +44 -0
  89. package/plugins/keyline/skills/keyline/scripts/check/markup.mjs +149 -0
  90. package/plugins/keyline/skills/keyline/scripts/check/rules.mjs +584 -0
  91. package/plugins/keyline/skills/keyline/scripts/check.mjs +297 -0
  92. package/plugins/keyline/skills/keyline/scripts/contrast.mjs +153 -0
  93. package/plugins/keyline/skills/keyline/scripts/scan.mjs +340 -0
  94. package/plugins/keyline/skills/keyline/system/design-md.md +136 -0
  95. package/plugins/keyline/skills/keyline/system/detection.md +53 -0
  96. package/plugins/keyline/skills/keyline/system/guide.md +97 -0
  97. package/plugins/keyline/skills/keyline/system/presets.md +58 -0
  98. package/plugins/keyline/skills/keyline/system/roles.md +150 -0
@@ -0,0 +1,259 @@
1
+ # Glass Layout
2
+
3
+ > **Glass preset.** This is the layout system running on [modimihir.com](https://modimihir.com), with its real values, meant to be copied whole. Read it beside `domains/layout/guide.md`, which holds the laws; this guide holds glass's values, recipes and decisions for them, and says where glass differs. Under any other preset, `domains/layout/guide.md` leads and this guide is only a worked example.
4
+
5
+ For mostly-text interfaces, where layout should get out of the way. One decision drives the rest: **a single 640px reading measure on every page**, so moving between pages never moves the text.
6
+
7
+ ## 1. One measure
8
+
9
+ ```css
10
+ .col {
11
+ max-width: 640px;
12
+ margin: 0 auto;
13
+ padding: 0 32px;
14
+ }
15
+ ```
16
+
17
+ At most 576px of text, about 90 characters a line (85–95) at the 14px prose size: past comfortable on purpose, with prose leading opened to match. **Every page uses the class** (layout law 1).
18
+
19
+ - **Non-text content may leave the column**: a masonry image wall has no reading measure, so it goes full-bleed.
20
+ - **An article's cover image stays in it.** Bled wide, it becomes a banner *above* the article, not part of it.
21
+ - **Dividers are column width** (layout law 1).
22
+
23
+ ## 2. Rails live outside the column, anchored to a wider frame
24
+
25
+ ```tsx
26
+ <div className="relative mx-auto max-w-[1280px]">
27
+ {/* Absolute, so it sits outside the reading column entirely */}
28
+ <div className="absolute inset-y-0 left-8 hidden w-[196px] xl:block">
29
+ <div className="sticky top-28 max-h-[calc(100dvh-11rem)] overflow-y-auto">
30
+ <SectionNav … />
31
+ </div>
32
+ </div>
33
+
34
+ <div className="col">{/* the reading column, untouched */}</div>
35
+ </div>
36
+ ```
37
+
38
+ Rail and column share one centred 1280px frame, so their gap holds from 1280px up (layout law 4, which explains the absolute wrapper, the sticky child and the `dvh` cap). **`xl:block`**: below 1280px there's no margin, and the rail becomes a disclosure above the text (§6).
39
+
40
+ ## 3. Spacing groups; asymmetry is the mechanism
41
+
42
+ ```
43
+ mt-10 (40px) ← heading
44
+ mb-3 (12px)
45
+ ← the paragraph it introduces
46
+ ```
47
+
48
+ ~3.3:1 above to below makes them one unit (layout law 2). It holds at every scale:
49
+
50
+ | Relationship | Inner | Outer | Ratio |
51
+ |---|---|---|---|
52
+ | Heading → its paragraph | 12px below | 40px above | 3.3:1 |
53
+ | List items → the next block | 8px between | 24px below | 3:1 |
54
+ | Bio paragraphs → the links after | 16px between | 32px after last | 2:1 |
55
+ | Section heading → its content | 16–32px | 36px+ between sections | ~2:1 |
56
+
57
+ **Home sections** use `py-9` (36px each side), symmetric, since they're peers. Long pages use `mt-16 border-t pt-10` (64px, hairline, 40px): the rule marks a real change of subject.
58
+
59
+ **Glass's divider** (layout law 3): the home page rules off its three substantial sections — Work, Experience, Life — and lets the two that read as a coda to Life, Watching and Socials, follow on without a rule.
60
+
61
+ → The full spacing scale and where each value is used: `glass/layout/measure-and-rhythm.md`
62
+
63
+ ## 4. The radius ladder nests
64
+
65
+ ```
66
+ rounded-full pills, tags, dots
67
+ rounded-md 6 tooltips
68
+ rounded-[9px] 9 small cards in a stack
69
+ rounded-[10px]10 an avatar inside a button
70
+ rounded-xl 12 cards, hover panels, disclosures
71
+ rounded-[12px]12 icon buttons, highlight bars
72
+ rounded-2xl 16 the outer container (a dock, a sheet)
73
+ ```
74
+
75
+ Each nesting is derived by layout law 5; the dock and the sheet are worked through in `glass/layout/radius-and-elevation.md`.
76
+
77
+ ```css
78
+ * , *::before, *::after {
79
+ corner-shape: superellipse(1.5);
80
+ }
81
+ ```
82
+
83
+ Glass sets the corner shape on everything, pseudo-elements included, with no exception for pills and circles.
84
+
85
+ ## 5. Hairlines: 0.5px vs 1px
86
+
87
+ | Weight | For |
88
+ |---|---|
89
+ | `0.5px` | Chrome borders, dividers, glass edges |
90
+ | `1px` | Card borders, rings, disclosure outlines |
91
+ | `2px` | Focus rings, an imported Markdown quote's rule |
92
+ | `3px` | The pull-quote bar: a rounded flex child, not a border |
93
+ | `1px` (`h-px`) | Table-of-contents markers |
94
+
95
+ Weight follows the job (layout law 6): dividing icon groups inside one dock, 0.5px; defining a card's edge, 1px. On translucent surfaces the edge is the **alpha ramp** (`border-gray-alpha-400`; see `glass/color/guide.md`).
96
+
97
+ ## 6. Two presentations, not one responsive layout
98
+
99
+ Where pointer and touch interact differently, glass ships **two components** (layout law 8):
100
+
101
+ ```tsx
102
+ <nav aria-label="Primary" className="pointer-events-none fixed inset-x-0 bottom-5 z-50 flex justify-center">
103
+ <MobileDock /> {/* sm:hidden — avatar + a menu button opening a sheet */}
104
+ <DesktopDock /> {/* hidden sm:block — hover-revealed icons, sliding highlight */}
105
+ </nav>
106
+ ```
107
+
108
+ The desktop dock reveals pages and settings **on hover**, collapsing on scroll; touch fires none of it. `SectionNav` (a sticky rail) and `SectionNavCompact` (a `<details>` disclosure) likewise render one tree through a shared `Rows`.
109
+
110
+ ### The same fork, chosen by the reader
111
+
112
+ Galleries offer a masonry **wall** (everything at once) or a **roll** (one photograph above a filmstrip), picked from a small dock: same data, same route. The state lives in a module both sides subscribe to, as with theme or sound:
113
+
114
+ ```ts
115
+ let current: GalleryLayout = "grid";
116
+ export function setGalleryLayout(layout: GalleryLayout) {
117
+ current = layout;
118
+ for (const fn of listeners) fn(layout);
119
+ }
120
+ ```
121
+
122
+ **The gallery layout doesn't persist** (layout law 9). The theme persists forever; the gallery layout lives in module memory and resets to the wall as each collection mounts. *The wall shows the whole collection, what you want on arrival; the roll is somewhere you go on purpose, and neither a previous visit nor the other gallery should decide it for you.* The switch opens on the photograph nearest the viewport's centre (`glass/motion/shared-element.md`), and each tile declares its own aspect ratio so one image travels between layouts undistorted.
123
+
124
+ → Both docks, the table of contents, the gallery, the touch audit and the breakpoints in use: `glass/layout/adaptive-presentations.md`
125
+
126
+ ## 7. Content gating: no empty states
127
+
128
+ One flag, three places (layout law 10):
129
+
130
+ ```ts
131
+ // content/index.ts — one derivation, everything else reads it.
132
+ export const has = { writing: posts.length > 0, /* … */ };
133
+
134
+ export const sectionHasContent = { /* home-page sections */ };
135
+ /** Route path → whether it should exist. Unlisted paths always exist. */
136
+ export const routeEnabled: Record<string, boolean> = { "/writing": has.writing, /* … */ };
137
+ ```
138
+
139
+ ```ts
140
+ const PAGES = [
141
+ has.experience && { to: "/experience", … },
142
+ has.playground && { to: "/playground", … },
143
+ has.writing && { to: "/writing", … },
144
+ ].filter(Boolean);
145
+ ```
146
+
147
+ An empty collection loses its **nav icon**, **route** and **home-page entry** from one flag. On the file-based router the gate is in the page, and a catch-all sends the rest, old links included, somewhere real:
148
+
149
+ ```tsx
150
+ // app/writing/page.tsx
151
+ export default function Page() {
152
+ if (!has.writing) redirect("/");
153
+ return <Writing />;
154
+ }
155
+
156
+ // app/[...rest]/page.tsx — anything that isn't a real route lands somewhere real.
157
+ export default function CatchAll() {
158
+ redirect("/");
159
+ }
160
+ ```
161
+
162
+ **`routeEnabled` outlived the client router**: the sitemap, metadata and nav still read it. Sections drop out *before* dividers are placed:
163
+
164
+ ```tsx
165
+ const shown = site.sections.filter((name) => SECTIONS[name] && sectionHasContent[name]);
166
+ ```
167
+
168
+ ```tsx
169
+ // One or two folders stay folder-sized and centred rather than stretching
170
+ // across a three-up grid. (640px column − gaps) ÷ 3 ≈ 200px each.
171
+ const COLS = ["", "grid-cols-1", "grid-cols-2", "grid-cols-3"];
172
+ const WIDTH = ["", "max-w-[200px]", "max-w-[420px]", ""];
173
+ ```
174
+
175
+ Asked to shrink the folders by a quarter, shrink them and keep three to a row (layout law 8).
176
+
177
+ ## 8. The z-index ladder
178
+
179
+ | z | Layer |
180
+ |---|---|
181
+ | 100 | Skip link — must beat everything |
182
+ | 60 | A once-a-session overlay — over the dock, under the skip link |
183
+ | 50 | Fixed navigation |
184
+ | 40 | Tap-outside catcher — under the nav, over the page |
185
+ | 30 | A pocket front, over its own contents |
186
+ | 20 | Hover cards, dropdowns |
187
+ | 10 | A hovered item lifting above its siblings |
188
+ | −10 | A sliding highlight, behind content inside `isolate` |
189
+
190
+ Ordered by permanence (layout law 7). The gaps paid off: a later greeting overlay took 60 without renumbering, covering the dock — or it wouldn't cover the page — but never the skip link, so keyboard users can tab past a two-second greeting. The pocket front at 30 is glass's own rung.
191
+
192
+ The nav strip spans the viewport for centring, so it passes clicks through:
193
+
194
+ ```tsx
195
+ <nav className="pointer-events-none fixed inset-x-0 bottom-5 z-50 flex justify-center">
196
+ <div className="pointer-events-auto">{/* the dock */}</div>
197
+ </nav>
198
+ ```
199
+
200
+ The strip carries **no transform**, which would trap the mobile sheet's full-bleed overlay inside it (layout law 7).
201
+
202
+ → The radius nestings, hairline classes and stacking-context code: `glass/layout/radius-and-elevation.md`
203
+
204
+ ## 9. Structural accessibility
205
+
206
+ Layout law 12, in glass's markup:
207
+
208
+ ```tsx
209
+ <a href="#main" className="skip">Skip to content</a>
210
+ ```
211
+
212
+ - **`<nav>` labels**: "Primary", "On this page".
213
+ - **Heading levels**: `h1` page, `h2` sections, `h3` sub-sections, `h4` cards; two elements at 14px/500 can be `h3` and `h4`.
214
+ - **Menu triggers** carry `aria-haspopup` beside `aria-expanded` and `aria-controls`.
215
+
216
+ ### A disclosure should hide its content, not remove it
217
+
218
+ Where a custom animation rules out `<details>`, glass collapses height to zero (layout law 11):
219
+
220
+ ```tsx
221
+ <motion.div
222
+ initial={false}
223
+ animate={{ height: open ? "auto" : 0 }}
224
+ inert={!open}
225
+ aria-hidden={!open}
226
+ className="overflow-hidden"
227
+ >
228
+ ```
229
+
230
+ The content stays in the served HTML, for crawlers, `llms.txt` and find-in-page.
231
+
232
+ ```css
233
+ @media print {
234
+ nav, footer, .skip { display: none; }
235
+ .reveal { opacity: 1; transform: none; }
236
+ a { color: inherit; text-decoration: none; }
237
+ }
238
+ ```
239
+
240
+ ## Assets
241
+
242
+ - `glass/layout/assets/layout-tokens.css` — column, spacing, radius ladder, continuous corners, hairlines, skip link, print.
243
+ - `glass/layout/assets/SectionNav.tsx` — two presentations of one tree, with shared row rendering.
244
+
245
+ ## Checklist
246
+
247
+ The domain checklist applies in full; these are glass's values for it.
248
+
249
+ - [ ] `.col` — 640px, 32px padding — on every page; article covers stay in it.
250
+ - [ ] Rails in the 1280px frame: `left-8`, `w-[196px]`, `sticky top-28`, `max-h-[calc(100dvh-11rem)]`, shown from `xl`.
251
+ - [ ] Prose headings `mt-10` / `mb-3`; home sections `py-9`; long pages `mt-16 border-t pt-10`, the first `mt-14`.
252
+ - [ ] Rules between Work, Experience and Life only; Watching and Socials follow on.
253
+ - [ ] Radii from the ladder: 6 / 9 / 10 / 12 / 16px and full; `superellipse(1.5)` on everything.
254
+ - [ ] 0.5px chrome, 1px object edges, 2px focus rings, the pull quote's 3px rounded bar; `gray-alpha` on translucent surfaces.
255
+ - [ ] `MobileDock` / `DesktopDock` and `SectionNav` / `SectionNavCompact`, sharing data and rows.
256
+ - [ ] The gallery opens on the wall; its layout lives in module memory.
257
+ - [ ] `pb-28` under the dock on every page that can end near the viewport bottom.
258
+ - [ ] z-index on the ladder: 100 / 60 / 50 / 40 / 30 / 20 / 10 / −10.
259
+ - [ ] Dynamic Tailwind classes written as literal strings.
@@ -0,0 +1,134 @@
1
+ # Measure and rhythm
2
+
3
+ Glass's values for layout laws 1–3; the derivations and reasons every preset shares are in `domains/layout/measure-and-rhythm.md`.
4
+
5
+ ## The measure
6
+
7
+ `.col` (§1 of the guide) is 640px outer with 32px padding each side → **576px of text**.
8
+
9
+ At the 14px prose size that's about 90 characters a line (85–95, measured in Archivo), past the comfortable range on purpose: long lines are efficient once the reader is committed, and 1.75 leading compensates for the longer return sweep. At 16px the same column would hold 75–85.
10
+
11
+ The padding does double duty: on a 375px phone the column is `375 − 64 = 311px`, and on desktop the 32px keeps text off the edge of a maximised window.
12
+
13
+ That 311px once forced a responsive type step (a 30px title wrapping to three lines) until an 18px type ceiling removed it: layout law 1's narrowest-measure check, settled in the scale.
14
+
15
+ 640px also equals Tailwind's `sm` breakpoint — convenient, not meaningful: below it the column is padding-limited, so the two coincide naturally.
16
+
17
+ The summary and detail pairs it keeps still: home-page role summary → `/experience`, writing index → article.
18
+
19
+ ## What's allowed outside the column
20
+
21
+ **Non-text content.** The image galleries are a full-bleed CSS-columns masonry on a grey field with 4px gaps; confining it to 640px would only make the images small.
22
+
23
+ ```tsx
24
+ <main className="min-h-[100dvh] bg-gray-100 p-1 pb-28">
25
+ <div className="columns-3 gap-1 sm:columns-4">
26
+ ```
27
+
28
+ Note `columns-3` then `sm:columns-4`: fewer columns on a phone, more on desktop — against the mobile-first instinct for grids, and right here because the tiles are photographs.
29
+
30
+ **Rails**, anchored to a wider frame (§2 of the guide), and **fixed chrome**: the nav strip spans the viewport for centring.
31
+
32
+ ## Dividers at column width
33
+
34
+ ```tsx
35
+ export function Divider() {
36
+ return (
37
+ <div className="col my-3" aria-hidden>
38
+ <hr className="border-0 h-[0.5px] bg-gray-alpha-300" />
39
+ </div>
40
+ );
41
+ }
42
+ ```
43
+
44
+ Reusing `.col` makes it exactly as wide as the text it separates. The `<hr>` reset and `aria-hidden` are layout law 6's; the half-pixel box is a gap the site still has (`glass/layout/radius-and-elevation.md`).
45
+
46
+ `my-3` (12px) on top of the sections' own `py-9` (36px) → 48px between the content of adjacent sections, the hairline centred in it.
47
+
48
+ ## The spacing scale
49
+
50
+ Tailwind's 4px scale, with a preference for a few well-worn values:
51
+
52
+ | Value | px | Typical use |
53
+ |---|---|---|
54
+ | `0.5` | 2 | Nudges between adjacent icons |
55
+ | `1` | 4 | Gallery gaps, dock padding |
56
+ | `1.5` | 6 | Sub-title under a heading |
57
+ | `2` | 8 | List items, tag gaps |
58
+ | `2.5` | 10 | Row padding, marker gaps |
59
+ | `3` | 12 | Heading → paragraph, container padding |
60
+ | `3.5` | 14 | Heading → list |
61
+ | `4` | 16 | Paragraph gaps, grid gaps |
62
+ | `5` | 20 | Quote indent, section heading → content |
63
+ | `6` | 24 | Prose paragraph gaps, meta rows |
64
+ | `7` | 28 | Capability groups |
65
+ | `8` | 32 | Section heading → content, column padding |
66
+ | `9` | 36 | Home section padding |
67
+ | `10` | 40 | Prose heading top margin, section content after a rule |
68
+ | `11` | 44 | Between roles on the experience page |
69
+ | `14` | 56 | First section on a long page |
70
+ | `16` | 64 | Between major sections on a long page |
71
+ | `20`/`28` | 80/112 | Page top/bottom padding |
72
+
73
+ The values in heaviest use are `2.5`, `3.5`, `9`, `10` — mostly half-steps and odd numbers. They exist because 10/14/36/40 are where the *asymmetry ratios* land, not because the scale demanded them.
74
+
75
+ ## Asymmetry, in detail
76
+
77
+ Layout law 2 at glass's values, beyond the guide's table (§3):
78
+
79
+ | Relationship | Inner | Outer | Ratio |
80
+ |---|---|---|---|
81
+ | Role title → its description | 2px | 6px | 3:1 |
82
+ | Case study title → body | 6px | 20px (between cards) | 3.3:1 |
83
+ | Capability heading → body | 8px | 32px (between capabilities) | 4:1 |
84
+
85
+ ## Section rhythm
86
+
87
+ **Home page — peers.**
88
+
89
+ ```tsx
90
+ <section className="py-9"> {/* 36px symmetric */}
91
+ ```
92
+
93
+ **Long pages — hierarchy.**
94
+
95
+ ```tsx
96
+ <section className="mt-16 border-t border-gray-alpha-300 pt-10">
97
+ ```
98
+
99
+ 64px above the rule, 40px below. The first section on such a page uses `mt-14` (56px) with no rule — there's nothing above it to separate from.
100
+
101
+ ## Not every boundary gets a rule
102
+
103
+ ```tsx
104
+ const SECTIONS = {
105
+ work: { node: <Work />, rule: true },
106
+ experience: { node: <Experience />, rule: true },
107
+ life: { node: <MyLife />, rule: true },
108
+ watching: { node: <Watching />, rule: false },
109
+ socials: { node: <Socials />, rule: false },
110
+ };
111
+ ```
112
+
113
+ Glass's divider decision (layout law 3): Work, Experience and Life are the substantial blocks and get separated; Watching and Socials read as a **coda** to Life, so they follow without a rule. The flag lives in layout code beside the sections, never in config (`domains/layout/measure-and-rhythm.md`, section rhythm).
114
+
115
+ ## Page padding
116
+
117
+ ```tsx
118
+ className="pb-20 pt-28 sm:pt-20" // long page
119
+ className="pb-28 pt-28 sm:pt-20" // index page
120
+ className="pt-28 pb-14 sm:pt-20 sm:pb-11" // hero
121
+ ```
122
+
123
+ **Top padding is generous** — 112px, 80px on phones; a long top margin signals "this is a document."
124
+
125
+ **Bottom padding accounts for the fixed dock.** `pb-28` (112px) on pages whose content can end near the viewport bottom, so the last line is never under the nav. A page ending in a footer can use less, because the footer's own `pb-28` covers it.
126
+
127
+ ## `dvh` over `vh`
128
+
129
+ Anything sized to the viewport uses `dvh` (`domains/layout/measure-and-rhythm.md`, viewport units):
130
+
131
+ ```tsx
132
+ className="min-h-[100dvh]"
133
+ className="max-h-[calc(100dvh-11rem)]"
134
+ ```
@@ -0,0 +1,103 @@
1
+ # Radius, corners, and stacking
2
+
3
+ Glass's values for layout laws 5–7; the rules themselves, and the nesting worked through in general, are in `domains/layout/radius-lines-and-layers.md`.
4
+
5
+ ## The nesting rule, through the site
6
+
7
+ Layout law 5, in the reference implementation's dock:
8
+
9
+ ```
10
+ Dock: rounded-2xl (16px) p-1 (4px padding)
11
+ Icon button: rounded-[12px] (12px) 16 − 4 = 12 ✓
12
+ Avatar: rounded-[10px] (10px) inset ~2px 12 − 2 = 10 ✓
13
+ ```
14
+
15
+ Three levels, each derived. The avatar is `h-9 w-9` inside an `h-10 w-10` button — a 2px inset all round, so 10px.
16
+
17
+ The mobile sheet snaps to the ladder:
18
+
19
+ ```
20
+ Sheet: rounded-2xl (16px) p-1.5 (6px)
21
+ Row: rounded-xl (12px) 16 − 6 = 10, rounded up to 12
22
+ ```
23
+
24
+ ## The ladder
25
+
26
+ | Radius | Class | For |
27
+ |---|---|---|
28
+ | full | `rounded-full` | Pills, tags, dots, markers |
29
+ | 2px | — | The focus ring's own radius |
30
+ | 5px | `rounded-[5px]` | A lettermark box (tiny, so a small radius) |
31
+ | 6px | `rounded-md` | Tooltips, the skip link |
32
+ | 9px | `rounded-[9px]` | Small cards in a stack |
33
+ | 10px | `rounded-[10px]` | Avatar inside a button; a list highlight bar |
34
+ | 12px | `rounded-xl` / `rounded-[12px]` | Cards, hover panels, disclosures, icon buttons |
35
+ | 16px | `rounded-2xl` / `rounded-[16px]` | Outer containers — a dock, a sheet, a pocket |
36
+
37
+ Radius scales with size, not importance (layout law 5): a 40px icon button gets 12px; a 300px panel gets 16px.
38
+
39
+ ## Continuous corners
40
+
41
+ The rule is in §4 of the guide: `superellipse(1.5)` on every element and pseudo-element. **1.5 rather than 2** because a full squircle is noticeable — at small sizes it looks like a slightly swollen rectangle. Halfway reads as a well-drawn corner rather than an effect.
42
+
43
+ ## Hairline weights
44
+
45
+ | Weight | Class | For |
46
+ |---|---|---|
47
+ | 0.5px | `border-[0.5px]`, `h-[0.5px]` | Chrome borders, dividers, glass edges |
48
+ | 1px | `border`, `ring-1`, `h-px` | Card borders, TOC markers |
49
+ | 2px | `outline-2`, `border-l-2` | Focus rings, an imported Markdown quote's rule |
50
+ | 3px | `w-[3px] rounded-full` | The pull-quote bar |
51
+
52
+ By job (layout law 6): two groups of icons within one dock, 0.5px; where a card ends, 1px; a focus ring, 2px. The authored pull quote's bar is 3px and rounded, so a flex child rather than a border (`glass/type/long-form-prose.md`, Quotes); imported Markdown, which can't take classes, keeps a 2px `gray-alpha-300` border.
53
+
54
+ Vertical dividers use `w-[0.5px]` with an explicit height and `self-center`:
55
+
56
+ ```tsx
57
+ <span aria-hidden className="mx-0.5 h-6 w-[0.5px] self-center bg-gray-alpha-300" />
58
+ ```
59
+
60
+ A 24px line in a 40px-tall row, one step lighter than the dock's `alpha-400` edge, because it's an internal articulation, not a boundary.
61
+
62
+ **The box form is a gap the reference implementation still has.** `h-[0.5px]` and `w-[0.5px]` with a background are boxes, which layout law 6 says a 1x screen can drop. Draw every hairline as a border instead: `border-t-[0.5px]` on the element, or an empty span carrying `border-l-[0.5px]` for a vertical divider, the same weight and colour by the more reliable route.
63
+
64
+ ## Elevation tiers
65
+
66
+ Glass's shadow tiers — chrome, pocket, panel, card, transient — are depth's: `glass/depth/depth-cues.md`.
67
+
68
+ ## The z-index ladder
69
+
70
+ The ladder is in §8 of the guide. **The 40/50 pair** in code:
71
+
72
+ ```tsx
73
+ {open && (
74
+ <div aria-hidden onClick={() => setOpen(false)}
75
+ className="pointer-events-auto fixed inset-0 z-40 sm:hidden" />
76
+ )}
77
+ <div className="pointer-events-auto relative z-50 sm:hidden">
78
+ {/* the menu */}
79
+ </div>
80
+ ```
81
+
82
+ **`z-index: 10` for a hover lift:**
83
+
84
+ ```tsx
85
+ <Link className="group relative block transition-[z-index] hover:z-10 focus-within:z-10">
86
+ ```
87
+
88
+ Folder cards rising out of a pocket would otherwise be clipped by the next folder; `focus-within:z-10` gives keyboard focus the same lift.
89
+
90
+ ## Stacking-context techniques
91
+
92
+ The general techniques are in `domains/layout/radius-lines-and-layers.md`. Glass's cases:
93
+
94
+ - **`isolate` plus negative z** scopes the dock's sliding highlight behind its icons but in front of the glass: the code is in `glass/depth/depth-cues.md`.
95
+ - **The nav strip** passes clicks through and carries no transform (§8 of the guide); a transform would trap the mobile sheet's full-bleed `w-screen` overlay inside the strip.
96
+
97
+ ### `transform-origin` for menus
98
+
99
+ ```tsx
100
+ const anchor = placement === "up" ? "origin-bottom" : "origin-top";
101
+ ```
102
+
103
+ A menu scales **from its trigger's edge**, or it seems to detach and drift; off one side, use the corner: `origin-top-left`.
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The squash-and-stretch floating menu — the shared open/close motion for
3
+ * every menu in the system (a phone nav sheet, a settings drop-up, a socials
4
+ * pill). All of them grow out of a trigger sitting against one edge, so all
5
+ * of them stretch from that edge.
6
+ *
7
+ * The effect comes from letting two springs DISAGREE. See motion-presets.ts
8
+ * for the numbers and the reasoning.
9
+ *
10
+ * Two structural decisions worth keeping:
11
+ *
12
+ * 1. The panel mounts only while open, so a closed menu is out of the tab
13
+ * order and off the paint. That matters here because the panel carries
14
+ * backdrop-filter, which is expensive even when invisible.
15
+ *
16
+ * 2. The wrapper is ALWAYS present, so a trigger's aria-controls still
17
+ * resolves to a real element when the menu is closed.
18
+ *
19
+ * Note this component animates a bare m.div and expects its child to carry
20
+ * the glass. A transform on an ancestor weakens backdrop-filter in its
21
+ * subtree — the wrapper scales, the child blurs, and they must be different
22
+ * elements.
23
+ */
24
+
25
+ import { AnimatePresence, LazyMotion, domAnimation, m, useReducedMotion } from "motion/react";
26
+ import type { CSSProperties, ReactNode } from "react";
27
+ import { GROW, CROSS, CLOSE } from "./motion-presets";
28
+
29
+ export type DropPlacement = "up" | "down";
30
+
31
+ export function DropMenu({
32
+ open,
33
+ placement = "up",
34
+ origin,
35
+ id,
36
+ className = "",
37
+ style,
38
+ onMouseEnter,
39
+ onMouseLeave,
40
+ children,
41
+ }: {
42
+ open: boolean;
43
+ placement?: DropPlacement;
44
+ /** transform-origin class — defaults to the edge the menu grows from. */
45
+ origin?: string;
46
+ id?: string;
47
+ className?: string;
48
+ style?: CSSProperties;
49
+ onMouseEnter?: () => void;
50
+ onMouseLeave?: () => void;
51
+ children: ReactNode;
52
+ }) {
53
+ const reduce = useReducedMotion();
54
+
55
+ // Start nudged back toward the trigger, so it reads as coming out of it.
56
+ const away = placement === "up" ? 4 : -4;
57
+
58
+ // Scale from the anchored edge, or the caller's corner for a menu that
59
+ // hangs off one side of its trigger (e.g. origin-top-left).
60
+ const anchor = origin ?? (placement === "up" ? "origin-bottom" : "origin-top");
61
+
62
+ return (
63
+ <div
64
+ id={id}
65
+ style={style}
66
+ onMouseEnter={onMouseEnter}
67
+ onMouseLeave={onMouseLeave}
68
+ // Empty and inert when closed, so it can't sit over the page as a trap.
69
+ className={`${className} ${open ? "" : "pointer-events-none"}`}
70
+ >
71
+ <LazyMotion features={domAnimation} strict>
72
+ <AnimatePresence>
73
+ {open && (
74
+ <m.div
75
+ className={anchor}
76
+ /* Open squashes from a real offset; exit only travels part of
77
+ the way back, because it's disappearing anyway. */
78
+ initial={
79
+ reduce ? { opacity: 0 } : { opacity: 0, scaleY: 0.82, scaleX: 0.94, y: away }
80
+ }
81
+ animate={reduce ? { opacity: 1 } : { opacity: 1, scaleY: 1, scaleX: 1, y: 0 }}
82
+ exit={
83
+ reduce
84
+ ? { opacity: 0, transition: CLOSE }
85
+ : { opacity: 0, scaleY: 0.9, scaleX: 0.97, y: away, transition: CLOSE }
86
+ }
87
+ transition={
88
+ reduce
89
+ ? { duration: 0.15 }
90
+ : {
91
+ scaleY: GROW, // the grow axis overshoots
92
+ y: GROW, // travel rides the same spring, or the
93
+ // anchored edge detaches mid-overshoot
94
+ scaleX: CROSS, // the cross axis arrives late
95
+ opacity: { duration: 0.14, ease: "easeOut" },
96
+ }
97
+ }
98
+ >
99
+ {children}
100
+ </m.div>
101
+ )}
102
+ </AnimatePresence>
103
+ </LazyMotion>
104
+ </div>
105
+ );
106
+ }