gral-frontend-skill 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.
@@ -0,0 +1,142 @@
1
+ # Typography
2
+
3
+ ## Classic Typography Principles
4
+
5
+ ### Vertical Rhythm
6
+
7
+ Your line-height should be the base unit for ALL vertical spacing. If body text has `line-height: 1.5` on `16px` type (= 24px), spacing values should be multiples of 24px. This creates subconscious harmony—text and space share a mathematical foundation.
8
+
9
+ ### Modular Scale & Hierarchy
10
+
11
+ The common mistake: too many font sizes that are too close together (14px, 15px, 16px, 18px...). This creates muddy hierarchy.
12
+
13
+ **Use fewer sizes with more contrast.** A 5-size system covers most needs:
14
+
15
+ | Role | Typical Ratio | Use Case |
16
+ |------|---------------|----------|
17
+ | xs | 0.75rem | Captions, legal |
18
+ | sm | 0.875rem | Secondary UI, metadata |
19
+ | base | 1rem | Body text |
20
+ | lg | 1.25-1.5rem | Subheadings, lead text |
21
+ | xl+ | 2-4rem | Headlines, hero text |
22
+
23
+ Popular ratios: 1.25 (major third), 1.333 (perfect fourth), 1.5 (perfect fifth). Pick one and commit.
24
+
25
+ ### Readability & Measure
26
+
27
+ Use `ch` units for character-based measure (`max-width: 65ch`). Line-height scales inversely with line length—narrow columns need tighter leading, wide columns need more.
28
+
29
+ **Non-obvious**: Increase line-height for light text on dark backgrounds. The perceived weight is lighter, so text needs more breathing room. Add 0.05-0.1 to your normal line-height.
30
+
31
+ ## Font Selection & Pairing
32
+
33
+ ### Choosing Distinctive Fonts
34
+
35
+ **Avoid the invisible defaults**: Inter, Roboto, Open Sans, Lato, Montserrat. These are everywhere, making your design feel generic. They're fine for documentation or tools where personality isn't the goal—but if you want distinctive design, look elsewhere.
36
+
37
+ **Pick the font from the brief, not from a category preset.** The most common AI typography failure is reaching for the same "tasteful" font for every editorial brief, the same "modern" font for every tech brief, the same "elegant serif" for every premium brief. Those reflexes produce monoculture across projects. The right font is one whose physical character matches *this specific* brand, audience, and moment.
38
+
39
+ A working selection process:
40
+
41
+ 1. Read the brief once. Write down three concrete words for the brand voice. Not "modern" or "elegant" — those are dead categories. Try "warm and mechanical and opinionated" or "calm and clinical and careful" or "fast and dense and unimpressed" or "handmade and a little weird."
42
+ 2. Now imagine the font as a physical object the brand could ship: a typewriter ribbon, a hand-lettered shop sign, a 1970s mainframe terminal manual, a fabric label on the inside of a coat, a museum exhibit caption, a tax form, a children's book printed on cheap newsprint. Whichever physical object fits the three words is pointing at the right *kind* of typeface.
43
+ 3. Browse a font catalog (Google Fonts, Pangram Pangram, Adobe Fonts, Future Fonts, ABC Dinamo) with that physical object in mind. **Reject the first thing that "looks designy."** That's your trained-everywhere reflex. Keep looking.
44
+ 4. Avoid your defaults from previous projects. If you find yourself reaching for the same display font you used last time, make yourself pick something else.
45
+
46
+ **Anti-reflexes worth defending against**:
47
+ - A technical/utilitarian brief does NOT need a serif "for warmth." Most tech tools should look like tech tools.
48
+ - An editorial/premium brief does NOT need the same expressive serif everyone is using right now. Premium can be Swiss-modern, can be neo-grotesque, can be a literal monospace, can be a quiet humanist sans.
49
+ - A children's product does NOT need a rounded display font. Kids' books use real type.
50
+ - A "modern" brief does NOT need a geometric sans. The most modern thing you can do in 2026 is not use the font everyone else is using.
51
+
52
+ **System fonts are underrated**: `-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui` looks native, loads instantly, and is highly readable. Consider this for apps where performance > personality.
53
+
54
+ ### Pairing Principles
55
+
56
+ **The non-obvious truth**: You often don't need a second font. One well-chosen font family in multiple weights creates cleaner hierarchy than two competing typefaces. Only add a second font when you need genuine contrast (e.g., display headlines + body serif).
57
+
58
+ When pairing, contrast on multiple axes:
59
+ - Serif + Sans (structure contrast)
60
+ - Geometric + Humanist (personality contrast)
61
+ - Condensed display + Wide body (proportion contrast)
62
+
63
+ **Never pair fonts that are similar but not identical** (e.g., two geometric sans-serifs). They create visual tension without clear hierarchy.
64
+
65
+ ### Web Font Loading
66
+
67
+ The layout shift problem: fonts load late, text reflows, and users see content jump. Here's the fix:
68
+
69
+ ```css
70
+ /* 1. Use font-display: swap for visibility */
71
+ @font-face {
72
+ font-family: 'CustomFont';
73
+ src: url('font.woff2') format('woff2');
74
+ font-display: swap;
75
+ }
76
+
77
+ /* 2. Match fallback metrics to minimize shift */
78
+ @font-face {
79
+ font-family: 'CustomFont-Fallback';
80
+ src: local('Arial');
81
+ size-adjust: 105%;
82
+ ascent-override: 90%;
83
+ descent-override: 20%;
84
+ line-gap-override: 10%;
85
+ }
86
+
87
+ body {
88
+ font-family: 'CustomFont', 'CustomFont-Fallback', sans-serif;
89
+ }
90
+ ```
91
+
92
+ Tools like [Fontaine](https://github.com/unjs/fontaine) calculate these overrides automatically.
93
+
94
+ ## Modern Web Typography
95
+
96
+ ### Fluid Type
97
+
98
+ Fluid typography via `clamp(min, preferred, max)` scales text smoothly with the viewport. The middle value (e.g., `5vw + 1rem`) controls scaling rate—higher vw = faster scaling. Add a rem offset so it doesn't collapse to 0 on small screens.
99
+
100
+ **Use fluid type for**: Headings and display text on marketing/content pages where text dominates the layout and needs to breathe across viewport sizes.
101
+
102
+ **Use fixed `rem` scales for**: App UIs, dashboards, and data-dense interfaces. No major app design system (Material, Polaris, Primer, Carbon) uses fluid type in product UI — fixed scales with optional breakpoint adjustments give the spatial predictability that container-based layouts need. Body text should also be fixed even on marketing pages, since the size difference across viewports is too small to warrant it.
103
+
104
+ ### OpenType Features
105
+
106
+ Most developers don't know these exist. Use them for polish:
107
+
108
+ ```css
109
+ /* Tabular numbers for data alignment */
110
+ .data-table { font-variant-numeric: tabular-nums; }
111
+
112
+ /* Proper fractions */
113
+ .recipe-amount { font-variant-numeric: diagonal-fractions; }
114
+
115
+ /* Small caps for abbreviations */
116
+ abbr { font-variant-caps: all-small-caps; }
117
+
118
+ /* Disable ligatures in code */
119
+ code { font-variant-ligatures: none; }
120
+
121
+ /* Enable kerning (usually on by default, but be explicit) */
122
+ body { font-kerning: normal; }
123
+ ```
124
+
125
+ Check what features your font supports at [Wakamai Fondue](https://wakamaifondue.com/).
126
+
127
+ ## Typography System Architecture
128
+
129
+ Name tokens semantically (`--text-body`, `--text-heading`), not by value (`--font-size-16`). Include font stacks, size scale, weights, line-heights, and letter-spacing in your token system.
130
+
131
+ ## Accessibility Considerations
132
+
133
+ Beyond contrast ratios (which are well-documented), consider:
134
+
135
+ - **Never disable zoom**: `user-scalable=no` breaks accessibility. If your layout breaks at 200% zoom, fix the layout.
136
+ - **Use rem/em for font sizes**: This respects user browser settings. Never `px` for body text.
137
+ - **Minimum 16px body text**: Smaller than this strains eyes and fails WCAG on mobile.
138
+ - **Adequate touch targets**: Text links need padding or line-height that creates 44px+ tap targets.
139
+
140
+ ---
141
+
142
+ **Avoid**: More than 2-3 font families per project. Skipping fallback font definitions. Ignoring font loading performance (FOUT/FOIT). Using decorative fonts for body text.
@@ -0,0 +1,107 @@
1
+ # UX Writing
2
+
3
+ ## The Button Label Problem
4
+
5
+ **Never use "OK", "Submit", or "Yes/No".** These are lazy and ambiguous. Use specific verb + object patterns:
6
+
7
+ | Bad | Good | Why |
8
+ |-----|------|-----|
9
+ | OK | Save changes | Says what will happen |
10
+ | Submit | Create account | Outcome-focused |
11
+ | Yes | Delete message | Confirms the action |
12
+ | Cancel | Keep editing | Clarifies what "cancel" means |
13
+ | Click here | Download PDF | Describes the destination |
14
+
15
+ **For destructive actions**, name the destruction:
16
+ - "Delete" not "Remove" (delete is permanent, remove implies recoverable)
17
+ - "Delete 5 items" not "Delete selected" (show the count)
18
+
19
+ ## Error Messages: The Formula
20
+
21
+ Every error message should answer: (1) What happened? (2) Why? (3) How to fix it? Example: "Email address isn't valid. Please include an @ symbol." not "Invalid input".
22
+
23
+ ### Error Message Templates
24
+
25
+ | Situation | Template |
26
+ |-----------|----------|
27
+ | **Format error** | "[Field] needs to be [format]. Example: [example]" |
28
+ | **Missing required** | "Please enter [what's missing]" |
29
+ | **Permission denied** | "You don't have access to [thing]. [What to do instead]" |
30
+ | **Network error** | "We couldn't reach [thing]. Check your connection and [action]." |
31
+ | **Server error** | "Something went wrong on our end. We're looking into it. [Alternative action]" |
32
+
33
+ ### Don't Blame the User
34
+
35
+ Reframe errors: "Please enter a date in MM/DD/YYYY format" not "You entered an invalid date".
36
+
37
+ ## Empty States Are Opportunities
38
+
39
+ Empty states are onboarding moments: (1) Acknowledge briefly, (2) Explain the value of filling it, (3) Provide a clear action. "No projects yet. Create your first one to get started." not just "No items".
40
+
41
+ ## Voice vs Tone
42
+
43
+ **Voice** is your brand's personality—consistent everywhere.
44
+ **Tone** adapts to the moment.
45
+
46
+ | Moment | Tone Shift |
47
+ |--------|------------|
48
+ | Success | Celebratory, brief: "Done! Your changes are live." |
49
+ | Error | Empathetic, helpful: "That didn't work. Here's what to try..." |
50
+ | Loading | Reassuring: "Saving your work..." |
51
+ | Destructive confirm | Serious, clear: "Delete this project? This can't be undone." |
52
+
53
+ **Never use humor for errors.** Users are already frustrated. Be helpful, not cute.
54
+
55
+ ## Writing for Accessibility
56
+
57
+ **Link text** must have standalone meaning—"View pricing plans" not "Click here". **Alt text** describes information, not the image—"Revenue increased 40% in Q4" not "Chart". Use `alt=""` for decorative images. **Icon buttons** need `aria-label` for screen reader context.
58
+
59
+ ## Writing for Translation
60
+
61
+ ### Plan for Expansion
62
+
63
+ German text is ~30% longer than English. Allocate space:
64
+
65
+ | Language | Expansion |
66
+ |----------|-----------|
67
+ | German | +30% |
68
+ | French | +20% |
69
+ | Finnish | +30-40% |
70
+ | Chinese | -30% (fewer chars, but same width) |
71
+
72
+ ### Translation-Friendly Patterns
73
+
74
+ Keep numbers separate ("New messages: 3" not "You have 3 new messages"). Use full sentences as single strings (word order varies by language). Avoid abbreviations ("5 minutes ago" not "5 mins ago"). Give translators context about where strings appear.
75
+
76
+ ## Consistency: The Terminology Problem
77
+
78
+ Pick one term and stick with it:
79
+
80
+ | Inconsistent | Consistent |
81
+ |--------------|------------|
82
+ | Delete / Remove / Trash | Delete |
83
+ | Settings / Preferences / Options | Settings |
84
+ | Sign in / Log in / Enter | Sign in |
85
+ | Create / Add / New | Create |
86
+
87
+ Build a terminology glossary and enforce it. Variety creates confusion.
88
+
89
+ ## Avoid Redundant Copy
90
+
91
+ If the heading explains it, the intro is redundant. If the button is clear, don't explain it again. Say it once, say it well.
92
+
93
+ ## Loading States
94
+
95
+ Be specific: "Saving your draft..." not "Loading...". For long waits, set expectations ("This usually takes 30 seconds") or show progress.
96
+
97
+ ## Confirmation Dialogs: Use Sparingly
98
+
99
+ Most confirmation dialogs are design failures—consider undo instead. When you must confirm: name the action, explain consequences, use specific button labels ("Delete project" / "Keep project", not "Yes" / "No").
100
+
101
+ ## Form Instructions
102
+
103
+ Show format with placeholders, not instructions. For non-obvious fields, explain why you're asking.
104
+
105
+ ---
106
+
107
+ **Avoid**: Jargon without explanation. Blaming users ("You made an error" → "This field is required"). Vague errors ("Something went wrong"). Varying terminology for variety. Humor for errors.