The user wants a responsive typography scale design.
The requirements are specific:
Responsive: It must scale across different screen sizes (mobile, tablet, desktop).
Readability: It needs to consider legibility (line height, measure, font size).
Localization: It must handle different languages (some require larger heights, some expand text significantly like German).
Theming Hooks: It needs to integrate with a design system/theming approach (CSS variables, semantic naming).
Initial Thoughts & Strategy:
The Mathematical Base: I need a modular scale. Major Third (1.25) or Perfect Fourth (1.333) usually works well for UI. Let's go with Major Third for a balanced feel.
Breakpoints: I need to define standard breakpoints (Mobile, Tablet, Desktop).
Readability Mechanics:
Font Size: Base size 16px (1rem) is standard.
Line Height: Needs to decrease as size increases (Titles need less, body needs more). Desktop needs slightly tighter leading than mobile.
Measure (Line Length): Max-width constraints.
Localization Strategy:
Vertical Rhythm: Some Asian scripts (CJK) need more line height. Some scripts (Arabic/Devanagari) have ascenders/descenders that clash with tight leading.
Horizontal expansion: German/Spanish take more space. The scale needs fluid sizing or container queries, but specifically, the truncation and wrapping logic needs to be robust.
Language-specific overrides: I should propose a mechanism to tweak line-height based on lang attributes.
Theming Hooks: CSS Custom Properties (Variables) are the standard. I need a naming convention. Maybe --text-{role}-{size}.
Implementation: CSS/SCSS structure.
Drafting the Design:
Define the Scale (The "Typescale"):
Base: 16px.
Ratio: 1.25 (Major Third).
Sizes: xs, sm, base, md, lg, xl, 2xl, 3xl.
Responsive Adjustments:
Mobile is smaller/simpler.
Desktop scales up the headings.
Fluid Typography? Using clamp() is better than media queries for smooth scaling. Let's use clamp().
Readability Logic:
Body text: 1.5 line height.
Headings: 1.1 - 1.2 line height.
Spacing: Margin-bottom should be related to the baseline grid (e.g., 8px or 16px increments).
Localization Logic (The "Gotchas"):
CJK (Chinese, Japanese, Korean): Needs ~1.7 line height for readability.
Arabic: Needs slightly larger font size or line height for distinct letter forms.
Solution: A "Prose" class that handles body text, with language overrides.
I'll stick to a T-shirt sizing (xs-3xl) + Semantic (heading, body) hybrid.
Self-Correction during drafting:
I initially thought about just media queries. But modern responsive design uses clamp(). I should provide a hybrid approach or stick to clamp() for the scale values. Let's use clamp() for the fluid sizing, it's the most "responsive" modern approach.
Detailed Plan for the Output:
Core Principles: Define the ratios and base values.
The Fluid Scale (CSS): A code block defining the sizes using clamp().
Readability Rules: Line-height calculations.
Localization Adaptations: The :lang() CSS logic.
Theming Interface: How to plug this into a design token system.
Let's write the code snippets mentally first.
--text-base: clamp(1rem, 2vw, 1.125rem) -> Nice fluid scaling.
Line heights: Body 1.6, Headings 1.2.
CJK: :lang(ja) { line-height: 1.8 }.
Final Polish:
Make sure to mention "Vertical Rhythm". That is crucial for readability.
Ensure the distinction between "UI Typography" (buttons, inputs) and "Editorial Typography" (long form articles).
Let's assemble.
This design specification outlines a typography system engineered for modern web applications. It prioritizes fluid responsiveness (scaling smoothly between breakpoints), internationalization (supporting CJK, Arabic, and complex scripts), and theming architecture (CSS variables for dark/light modes).
1. The Mathematical Model
Instead of rigid pixel steps, we use a Fluid Modular Scale. This uses CSS clamp() to scale text smoothly based on the viewport width, rather than "jumping" at breakpoints.
Base Ratio: Major Third (1.25). This provides enough distinction between hierarchy levels without causing awkward line lengths.
Base Size:16px (1rem) at mobile, scaling up to approx 19px on desktop.
Readability is not just about size; it is about measure (line length), leading (line height), and tracking (letter spacing).
The Logic:
Line Height: As font size increases, line height must decrease (tighter) to keep the visual density consistent.
Line Length: We restrict the maximum width of text containers to ~65-75 characters.
css
:root {
/* Line Heights (Unitless) */
--leading-tight: 1.15; /* For large headlines */
--leading-snug: 1.35; /* For subheads */
--leading-normal: 1.55; /* For body text (optimized for readability) */
--leading-loose: 1.75; /* For small text or dense languages */
}
/* Readability Constraint Container */
.text-container {
max-width: 70ch; /* Limit line length to 70 characters */
margin-inline: auto;
}
/* Automatic Leading Calibration */
h1, h2, h3 { line-height: var(--leading-tight); }
body, p { line-height: var(--leading-normal); }
small, caption { line-height: var(--leading-loose); }
4. Localization Constraints (L10n)
Different scripts have different density and verticality requirements. A static line-height often crops CJK (Chinese/Japanese/Korean) characters or disconnects Arabic diacritics.
We use the :lang() pseudo-class to override vertical rhythms dynamically.
css
/* 1. CJK Adjustment (Chinese, Japanese, Korean) */
/* Needs more vertical space than Latin because characters are denser/blockier */
:lang(zh), :lang(ja), :lang(ko) {
--leading-normal: 1.8; /* Increase line-height globally for CJK */
letter-spacing: 0.05em; /* Slight breathing room */
}
/* 2. Arabic / Hebrew Adjustment (RTL) */
/* Needs specific line-height to prevent diacritics from being clipped */
:lang(ar), :lang(he) {
--leading-normal: 1.8;
--leading-tight: 1.4;
/* Ensure fonts have enough headroom */
}
/* 3. Thai / Devanagari */
/* Tall scripts often require looser leading */
:lang(th), :lang(hi) {
--leading-normal: 1.75;
}
5. Theming Hooks
A robust scale must handle Dark Mode (where contrast causes eye strain) and High Contrast modes (accessibility).
Dark Mode Logic:
White text on a black background creates "halation" (glare). We must decrease contrast and slightly increase font weight or letter-spacing to maintain legibility.
css
:root {
--text-primary: #111111;
--text-secondary: #444444;
--text-muted: #666666;
--font-weight-normal: 400;
}
@media (prefers-color-scheme: dark) {
:root {
/* Soften pure white to prevent eye strain */
--text-primary: #e0e0e0;
--text-secondary: #b0b0b0;
/* Bump font weight slightly for better rendering on dark backgrounds */
--font-weight-normal: 425;
}
}
/* Accessibility Hook: Increased Font Size */
@media (prefers-reduced-data: reduce) {
/* If user has "Large Text" enabled in OS settings, ensure containers expand */
.text-container {
max-width: 100%;
}
}
6. Implementation Cheat Sheet
Here is how you apply this system to actual HTML components.