Skip to content

The design language that makes your AI harness better at design.

JavaScript

Give DESIGN.md a real type ramp so the design hook stops crying wolf (#390)

Paul Bakaus373039a837be
diff --git a/.impeccable/config.json b/.impeccable/config.json
index b2df55f0d..74aa56664 100644
--- a/.impeccable/config.json
+++ b/.impeccable/config.json
@@ -5,6 +5,8 @@
"tests/fixtures/**",
"tests/detect-antipatterns.test.js",
"site/pages/slop/**",
+ "site/public/antipattern-examples/**",
+ "site/public/neo-mirai/**",
"site/data/anti-patterns-catalog.js",
"site/pages/shader-lab/**",
"site/scripts/demos/commands/**",
@@ -80,6 +82,24 @@
],
"createdAt": "2026-07-17T00:00:00.000Z",
"reason": "Live overlay chrome is injected over arbitrary host pages and builds a self-contained UI with its own small type scale; DESIGN.md's ramp describes the impeccable website, not this widget"
+ },
+ {
+ "rule": "overused-font",
+ "value": "Inter",
+ "files": [
+ "site/styles/workflow.css"
+ ],
+ "createdAt": "2026-07-19T00:00:00.000Z",
+ "reason": "User confirmed the .why-slop-* before-state card intentionally uses Inter; extends the existing design-system-font waiver for the same card"
+ },
+ {
+ "rule": "gradient-text",
+ "value": "*",
+ "files": [
+ "site/styles/workflow.css"
+ ],
+ "createdAt": "2026-07-19T00:00:00.000Z",
+ "reason": "User confirmed the .why-slop-title gradient is an intentional AI-tell demo in the before-state comparison"
}
]
},
diff --git a/.impeccable/design.json b/.impeccable/design.json
index 43478a3eb..fcd783ff6 100644
--- a/.impeccable/design.json
+++ b/.impeccable/design.json
@@ -1,6 +1,6 @@
{
"schemaVersion": 2,
- "generatedAt": "2026-06-15T23:30:35.569Z",
+ "generatedAt": "2026-07-19T18:55:00.000Z",
"title": "Design System: Impeccable",
"extensions": {
"colorMeta": {
@@ -172,6 +172,10 @@
}
},
"typographyMeta": {
+ "scale": {
+ "displayName": "Type Ramp",
+ "purpose": "The enumerated 21-step ramp at a 16px root, 8px through 88px. Roles below pick from it; display and headline are fluid and interpolate between clamp endpoints."
+ },
"wordmark": {
"displayName": "Wordmark",
"purpose": "IMPECCABLE lockup only. Alumni Sans at weight 400."
@@ -190,7 +194,7 @@
},
"body": {
"displayName": "Body",
- "purpose": "Long copy. Albert Sans, line-height 1.8, max 65–75ch."
+ "purpose": "Long copy. Albert Sans, line-height 1.8, max 65\u201375ch."
},
"eyebrow": {
"displayName": "Eyebrow",
@@ -365,7 +369,7 @@
{
"name": "The Two-Face Rule",
"section": "typography",
- "body": "Display sizes use Alumni Sans — thin (100) for the h1, heavier (300) for h2s. Anything sized below 1.2rem uses Albert Sans. The thin display cut reads too light at small sizes, so it never carries body or UI text."
+ "body": "Display sizes use Alumni Sans \u2014 thin (100) for the h1, heavier (300) for h2s. Anything sized below 1.2rem uses Albert Sans. The thin display cut reads too light at small sizes, so it never carries body or UI text."
},
{
"name": "The Tracked Labels Are Short Rule",
diff --git a/DESIGN.md b/DESIGN.md
index dbeeb12ec..36669b8a5 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -103,12 +103,46 @@ colors:
success-soft: "oklch(95% 0.05 145)"
typography:
+ scale:
+ # The enumerated type ramp, at a 16px root. Keys are the px value; values
+ # are the rem form to author with. Every literal font-size in the codebase
+ # lands on one of these steps, and the detector allows +/-0.5px around each,
+ # so the px and rem spellings of a step are interchangeable.
+ #
+ # The named roles below pick from this ramp. The two fluid roles (display,
+ # headline) are the exception: they interpolate between clamp endpoints and
+ # are free to land between steps, which is what makes them fluid.
+ #
+ # Adding a step is a design decision, not a convenience. The tail this ramp
+ # replaced had 86 distinct sizes, including six near-identical steps between
+ # 13.7px and 15.4px that no reader could tell apart.
+ "8": "0.5rem" # decorative micro-type: badges, superscript markers
+ "9": "0.5625rem" # dense chrome, viz tick labels
+ "10": "0.625rem" # overline, smallest legible caps
+ "11": "0.6875rem" # eyebrow, badge, tag
+ "12": "0.75rem" # meta lines, table chrome, inline code
+ "13": "0.8125rem" # secondary UI text, card meta
+ "14": "0.875rem" # dense body, list rows, controls
+ "15": "0.9375rem" # long-form secondary text
+ "16": "1rem" # default body
+ "18": "1.125rem" # lead paragraph, card heading
+ "20": "1.25rem" # card and panel titles
+ "24": "1.5rem" # subsection heads
+ "28": "1.75rem" # section heads
+ "32": "2rem" # large section heads
+ "40": "2.5rem" # sub-display
+ "48": "3rem" # small display
+ "56": "3.5rem" # display
+ "64": "4rem" # large display
+ "72": "4.5rem" # hero display
+ "80": "5rem" # hero display, wide viewports
+ "88": "5.5rem" # largest hero display
wordmark:
# Alumni Sans (token --ks-font-wordmark), the same face as display, held
# at weight 400 for the small brand lockup where the thin display cut
# would read too light.
fontFamily: "Alumni Sans, Albert Sans, Arial, sans-serif"
- fontSize: "1.3rem"
+ fontSize: "1.125rem"
fontWeight: 400
letterSpacing: "0.15em"
lineHeight: 1
@@ -126,22 +160,22 @@ typography:
lineHeight: 1.04
title:
fontFamily: "Albert Sans, Avenir Next, Helvetica Neue, Arial, system-ui, sans-serif"
- fontSize: "1.18rem"
+ fontSize: "1.125rem"
fontWeight: 500
lineHeight: 1.35
body:
fontFamily: "Albert Sans, Avenir Next, Helvetica Neue, Arial, system-ui, sans-serif"
- fontSize: "1.02rem"
+ fontSize: "1rem"
fontWeight: 400
lineHeight: 1.8
eyebrow:
fontFamily: "SFMono-Regular, Roboto Mono, Consolas, monospace"
- fontSize: "0.7rem"
+ fontSize: "0.6875rem"
fontWeight: 500
letterSpacing: "0.18em"
mono:
fontFamily: "SFMono-Regular, Roboto Mono, Consolas, monospace"
- fontSize: "0.72rem"
+ fontSize: "0.6875rem"
fontWeight: 500
letterSpacing: "0.22em"
diff --git a/cli/engine/design-system.mjs b/cli/engine/design-system.mjs
index fdbf74e69..874b346d7 100644
--- a/cli/engine/design-system.mjs
+++ b/cli/engine/design-system.mjs
@@ -288,15 +288,74 @@ function addTypographyFonts(out, typography) {
}
}
+function addFontSizeStep(out, raw, { fluid = false } = {}) {
+ const text = String(raw ?? '').trim().toLowerCase();
+ if (!FONT_SIZE_LITERAL_RE.test(text)) return;
+ const px = resolveLengthPx(text, 16);
+ if (px == null || !Number.isFinite(px) || px <= 0) return;
+ out.allowedFontSizes.push({ value: text, px, fluid });
+}
+
+// Split a fluid value into its three terms, or null when it is not a
+// well-formed clamp(). Used both to read DESIGN.md's fluid roles and to
+// validate fluid values in source, so the two stay symmetric.
+function parseClampArgs(raw) {
+ const match = /^clamp\(\s*([\s\S]+)\s*\)$/i.exec(String(raw ?? '').trim());
+ if (!match) return null;
+ const args = splitTopLevelArgs(match[1]);
+ return args.length === 3 ? args : null;
+}
+
+// A fluid role declares its two fixed endpoints and interpolates between them
+// with a viewport unit. Both endpoints are documented sizes, so they belong in
+// the allowlist; the middle term is viewport-relative and never a fixed step.
+// Endpoints are marked `fluid` because they do not *enumerate* a ramp: see
+// `hasFontSizes` below for why that distinction has to survive.
+function addClampEndpoints(out, raw) {
+ const args = parseClampArgs(raw);
+ if (!args) return false;
+ addFontSizeStep(out, args[0], { fluid: true });
+ addFontSizeStep(out, args[2], { fluid: true });
+ return true;
+}
+
+function splitTopLevelArgs(s) {
+ const args = [];
+ let depth = 0;
+ let current = '';
+ for (const ch of String(s)) {
+ if (ch === '(') depth++;
+ else if (ch === ')') depth--;
+ if (ch === ',' && depth === 0) {
+ args.push(current.trim());
+ current = '';
+ continue;
+ }
+ current += ch;
+ }
+ if (current.trim()) args.push(current.trim());
+ return args;
+}
+
function addTypographySizes(out, typography) {
if (!typography || typeof typography !== 'object') return;
- for (const role of Object.values(typography)) {
+
+ // `scale` is the enumerated ramp: a name -> size map, since the frontmatter
+ // parser has no list support. It sits alongside the named roles.
+ const scale = typography.scale;
+ if (scale && typeof scale === 'object') {
+ for (const value of Object.values(scale)) {
+ if (typeof value !== 'string' && typeof value !== 'number') continue;
+ addFontSizeStep(out, value);
+ }
+ }
+
+ for (const [name, role] of Object.entries(typography)) {
+ if (name === 'scale') continue;
if (!role || typeof role !== 'object') continue;
const raw = String(role.fontSize ?? '').trim().toLowerCase();
- if (!FONT_SIZE_LITERAL_RE.test(raw)) continue;
- const px = resolveLengthPx(raw, 16);
- if (px == null || !Number.isFinite(px) || px <= 0) continue;
- out.allowedFontSizes.push({ value: raw, px });
+ if (addClampEndpoints(out, raw)) continue;
+ addFontSizeStep(out, raw);
}
}
@@ -371,7 +430,10 @@ function normalizeDesignSystem(input = {}) {
out.hasFonts = out.allowedFonts.size > 0;
out.hasColors = out.allowedColorKeys.size > 0;
out.hasRadii = out.allowedRadii.length > 0;
- out.hasFontSizes = out.allowedFontSizes.length > 0;
+ // Gate on *enumerated* steps only. A fully fluid system declares clamp
+ // endpoints but no discrete ramp, so treating those endpoints as the whole
+ // allowlist would flag every intermediate size. Abstain instead.
+ out.hasFontSizes = out.allowedFontSizes.some(entry => !entry.fluid);
return out;
}
@@ -438,17 +500,43 @@ function isAllowedRadiusRaw(raw, designSystem) {
return designSystem.allowedRadii.some(entry => Math.abs(entry.px - px) <= RADIUS_TOLERANCE_PX);
}
-function isAllowedFontSizeRaw(raw, designSystem) {
- if (!designSystem?.hasFontSizes) return true;
- const text = String(raw || '').trim().toLowerCase().replace(/\s*!important\s*$/, '');
- if (!FONT_SIZE_LITERAL_RE.test(text)) return true;
+// One term of a font-size value. `unjudgeable` covers var(), calc(), percentages
+// and units the ramp cannot resolve (em is parent-relative, not root-relative);
+// those abstain rather than guess.
+function fontSizeStepStatus(raw, designSystem) {
+ const text = String(raw || '').trim().toLowerCase();
+ if (!FONT_SIZE_LITERAL_RE.test(text)) return 'unjudgeable';
const px = resolveLengthPx(text, 16);
- if (px == null || !Number.isFinite(px) || px <= 0) return true;
+ if (px == null || !Number.isFinite(px) || px <= 0) return 'unjudgeable';
return designSystem.allowedFontSizes.some(
entry => Math.abs(entry.px - px) <= FONT_SIZE_TOLERANCE_PX,
+ ) ? 'on-ramp' : 'off-ramp';
+}
+
+// The off-ramp endpoints of a fluid value, or null when `raw` is not a fluid
+// value at all. Only the min and max are judged: the viewport term interpolates
+// between them and is never a fixed step.
+//
+// Reading clamp endpoints as documented steps without also checking them in
+// usage would let `clamp(99rem, 1vw, 200rem)` through, which is how a fluid
+// declaration stayed invisible until someone measured computed styles.
+export function offRampClampEndpoints(raw, designSystem) {
+ if (!designSystem?.hasFontSizes) return null;
+ const args = parseClampArgs(String(raw || '').trim().replace(/\s*!important\s*$/i, ''));
+ if (!args) return null;
+ return [args[0], args[2]].filter(
+ endpoint => fontSizeStepStatus(endpoint, designSystem) === 'off-ramp',
);
}
+function isAllowedFontSizeRaw(raw, designSystem) {
+ if (!designSystem?.hasFontSizes) return true;
+ const text = String(raw || '').trim().toLowerCase().replace(/\s*!important\s*$/, '');
+ const offRampEndpoints = offRampClampEndpoints(text, designSystem);
+ if (offRampEndpoints) return offRampEndpoints.length === 0;
+ return fontSizeStepStatus(text, designSystem) !== 'off-ramp';
+}
+
function lineLooksCommented(line) {
const trimmed = String(line || '').trim();
return trimmed.startsWith('//') || trimmed.startsWith('/*') || trimmed.startsWith('*') || trimmed.startsWith('<!--');
@@ -543,12 +631,31 @@ function checkRadiusValue(value, filePath, line, designSystem, context) {
function checkFontSizeValue(value, filePath, line, designSystem, context) {
const token = String(value || '').trim();
if (isAllowedFontSizeRaw(token, designSystem)) return [];
+
+ // Name the offending endpoint on a fluid value; the whole clamp() string is
+ // not actionable on its own, and it makes a poor ignore-value.
+ const offRampEndpoints = offRampClampEndpoints(token, designSystem) || [];
+ if (offRampEndpoints.length > 0) {
+ const plural = offRampEndpoints.length > 1 ? 's' : '';
+ return [makeDesignFinding(
+ 'design-system-font-size',
+ filePath,
+ `${context}: ${token} has fluid endpoint${plural} ${offRampEndpoints.join(' and ')} off the DESIGN.md type ramp`,
+ line,
+ { ignoreValue: offRampEndpoints[0] },
+ )];
+ }
+
+ // The snippet shows the declaration as authored, but the ignoreValue has to
+ // be what a `hooks ignore-value` waiver can match, so the priority marker is
+ // stripped. Otherwise the same size needs two different waivers depending on
+ // whether it carries !important. font-family already behaves this way.
return [makeDesignFinding(
'design-system-font-size',
filePath,
`${context}: ${token} is off the DESIGN.md type ramp`,
line,
- { ignoreValue: token },
+ { ignoreValue: token.replace(/\s*!important\s*$/i, '').trim() },
)];
}
diff --git a/site/pages/design-system/explorations.astro b/site/pages/design-system/explorations.astro
index fcc8db8b0..ce0fde6b1 100644
--- a/site/pages/design-system/explorations.astro
+++ b/site/pages/design-system/explorations.astro
@@ -257,7 +257,7 @@ const mockupCandidates = listCandidates('mockups');
margin: 0 0 8px;
font-family: var(--ks-font-display);
font-weight: var(--ks-type-headline-weight);
- font-size: 1.4rem;
+ font-size: 1.5rem;
color: var(--ks-champagne);
}
.logo-dir-idea {
@@ -284,7 +284,7 @@ const mockupCandidates = listCandidates('mockups');
.logo-dir-word {
color: var(--ks-kinpaku);
font-family: var(--ks-font-display);
- font-size: 1.05rem;
+ font-size: 1rem;
text-transform: uppercase;
line-height: 1;
-webkit-font-smoothing: auto;
diff --git a/site/pages/privacy.astro b/site/pages/privacy.astro
index 83b33a896..e81b36c44 100644
--- a/site/pages/privacy.astro
+++ b/site/pages/privacy.astro
@@ -7,7 +7,7 @@ import '../styles/sub-pages.css';
<style>
.privacy-content { max-width: 680px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
- .privacy-content h1 { font-family: var(--font-display); font-size: 2.25rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; color: var(--color-ink); }
+ .privacy-content h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 0.5rem; letter-spacing: -0.01em; color: var(--color-ink); }
.privacy-content h2 { font-size: 1.125rem; margin-top: 2rem; font-weight: 600; color: var(--color-ink); }
.privacy-content p, .privacy-content ul { color: var(--color-charcoal); margin-top: 0.5rem; }
.privacy-content ul { padding-left: 1.25rem; }
diff --git a/site/scripts/components/framework-viz.js b/site/scripts/components/framework-viz.js
index f8dd0674e..82d50e3d7 100644
--- a/site/scripts/components/framework-viz.js
+++ b/site/scripts/components/framework-viz.js
@@ -260,7 +260,7 @@ export class PeriodicTable {
top: 3px;
left: 5px;
font-family: var(--font-mono);
- font-size: 7px;
+ font-size: 7px; /* impeccable-disable-line design-system-font-size -- atomic number is cell geometry, not ramp type */
color: ${colors.text};
opacity: 0.5;
`;
@@ -313,7 +313,7 @@ export class PeriodicTable {
top: 2px;
right: 3px;
font-family: var(--font-mono);
- font-size: 5px;
+ font-size: 5px; /* impeccable-disable-line design-system-font-size -- alpha badge is cell geometry, not ramp type */
letter-spacing: 0.05em;
color: ${colors.text};
opacity: 0.45;
diff --git a/site/styles/changelog-faq-kinpaku.css b/site/styles/changelog-faq-kinpaku.css
index b820a34e7..806fe73fc 100644
--- a/site/styles/changelog-faq-kinpaku.css
+++ b/site/styles/changelog-faq-kinpaku.css
@@ -37,7 +37,7 @@
}
.cf-lede {
- font-size: 1.05rem;
+ font-size: 1.125rem;
line-height: 1.65;
color: var(--ks-text);
margin: 0 0 clamp(28px, 4vw, 40px);
@@ -158,7 +158,7 @@
.cf-entry-lead {
margin: 0 0 20px;
color: var(--ks-champagne);
- font-size: 1.05rem;
+ font-size: 1.125rem;
line-height: 1.5;
}
@@ -240,7 +240,7 @@
.cf-stat-num {
font-family: var(--ks-font-display);
font-weight: var(--ks-type-display-weight);
- font-size: clamp(2.2rem, 5vw, 3rem);
+ font-size: clamp(2rem, 5vw, 3rem);
line-height: 1;
color: var(--ks-kinpaku);
}
@@ -294,7 +294,7 @@
top: 50%;
transform: translateY(-50%);
color: var(--ks-patina);
- font-size: 1.4rem;
+ font-size: 1.5rem;
line-height: 1;
transition: transform 160ms ease;
}
diff --git a/site/styles/design-system.css b/site/styles/design-system.css
index 5fea74177..352a13c0f 100644
--- a/site/styles/design-system.css
+++ b/site/styles/design-system.css
@@ -181,7 +181,7 @@
color: var(--ks-kinpaku);
font-family: var(--ks-font-display);
font-weight: 100;
- font-size: clamp(3.2rem, 7.2vw, 5.6rem);
+ font-size: clamp(3rem, 7.2vw, 5.6rem);
line-height: 1;
letter-spacing: 0.22em;
margin: 0;
@@ -192,7 +192,7 @@
margin: 28px 0 0;
max-width: 540px;
color: var(--ks-champagne);
- font-size: clamp(1.05rem, 1.4vw, 1.25rem);
+ font-size: clamp(1rem, 1.4vw, 1.25rem);
font-weight: 300;
line-height: 1.55;
}
@@ -933,7 +933,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font);
font-weight: 300;
- font-size: 1.6rem;
+ font-size: 1.5rem;
line-height: 1.15;
letter-spacing: -0.005em;
}
@@ -958,7 +958,7 @@
color: var(--ks-kinpaku);
font-family: var(--ks-font);
font-weight: 300;
- font-size: 4.4rem;
+ font-size: 4.5rem;
line-height: 0.9;
letter-spacing: -0.02em;
}
@@ -1204,7 +1204,7 @@
.ks-audit-stat-value {
font-weight: 300;
- font-size: clamp(2.4rem, 4vw, 3.2rem);
+ font-size: clamp(2.5rem, 4vw, 3rem);
line-height: 1;
letter-spacing: -0.01em;
}
diff --git a/site/styles/designing-kinpaku.css b/site/styles/designing-kinpaku.css
index aa984259c..bcdb247aa 100644
--- a/site/styles/designing-kinpaku.css
+++ b/site/styles/designing-kinpaku.css
@@ -210,7 +210,7 @@
/* Bring the display size down for narrow viewports — the token's 3.4rem
minimum is sized for hero impact at desktop and tablet, too big when
the line has to wrap into a 320-400px column. */
- font-size: clamp(2.2rem, 11vw, 3rem);
+ font-size: clamp(2rem, 11vw, 3rem);
}
}
@@ -377,7 +377,7 @@
}
.designing-kinpaku .designing-page-title {
- font-size: clamp(2.1rem, 12vw, 2.8rem);
+ font-size: clamp(2rem, 12vw, 2.5rem);
line-height: 1.02;
margin-bottom: 18px;
}
@@ -424,7 +424,7 @@
}
.designing-kinpaku .designing-loop-name {
- font-size: 1.45rem;
+ font-size: 1.5rem;
}
.designing-kinpaku .designing-loop-hint {
@@ -827,7 +827,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font);
font-weight: 600;
- font-size: 1.2rem;
+ font-size: 1.25rem;
line-height: 1.3;
letter-spacing: -0.01em;
margin: 0;
@@ -1214,7 +1214,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font);
font-weight: 600;
- font-size: 1.2rem;
+ font-size: 1.25rem;
line-height: 1.3;
letter-spacing: -0.01em;
margin: 0;
@@ -1315,7 +1315,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font);
font-weight: 600;
- font-size: 1.2rem;
+ font-size: 1.25rem;
line-height: 1.3;
letter-spacing: -0.01em;
margin: 0;
@@ -1355,7 +1355,7 @@
.designing-kinpaku .designing-extract-arrow {
color: var(--ks-kinpaku);
font-family: var(--ks-mono);
- font-size: 1.2rem;
+ font-size: 1.25rem;
}
.designing-kinpaku .designing-extract-after {
justify-self: end;
@@ -1484,7 +1484,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font);
font-weight: 500;
- font-size: 1.35rem;
+ font-size: 1.25rem;
line-height: 1.15;
}
.designing-kinpaku .designing-lane-mock-accent {
@@ -1639,7 +1639,7 @@
color: var(--ks-champagne);
font-family: var(--ks-font-display);
font-weight: 100;
- font-size: clamp(1.8rem, 3vw, 2.4rem);
+ font-size: clamp(1.75rem, 3vw, 2.5rem);
line-height: 1.1;
margin: 0;
letter-spacing: 0.01em;
diff --git a/site/styles/detector-lab.css b/site/styles/detector-lab.css
index ac10a4cea..947ec713b 100644
--- a/site/styles/detector-lab.css
+++ b/site/styles/detector-lab.css
@@ -53,7 +53,7 @@
.detector-home-link .ks-mark svg { width: 26px; height: 26px; }
.detector-home-link .ks-wordmark {
- font-size: 1.05rem;
+ font-size: 1rem;
letter-spacing: 0.16em;
}
diff --git a/site/styles/docs-kinpaku.css b/site/styles/docs-kinpaku.css
index 83ad7d612..c974655b5 100644
--- a/site/styles/docs-kinpaku.css
+++ b/site/styles/docs-kinpaku.css
@@ -284,7 +284,7 @@ html.light .docs-kinpaku {
}
.docs-kinpaku .docs-start-rail-title {
- font-size: 2.15rem;
+ font-size: 2rem;
}
}
@@ -345,7 +345,7 @@ html.light .docs-kinpaku {
font-family: var(--ks-font);
font-style: normal;
font-weight: 650;
- font-size: 1.55rem;
+ font-size: 1.5rem;
line-height: 1.25;
letter-spacing: 0;
color: var(--ks-champagne);
@@ -633,7 +633,7 @@ html.light .docs-kinpaku {
font-family: var(--ks-font-display);
font-style: normal;
font-weight: var(--ks-type-headline-weight);
- font-size: 1.4rem;
+ font-size: 1.5rem;
line-height: 1.15;
color: var(--ks-champagne);
}
@@ -824,7 +824,7 @@ html.light .docs-kinpaku {
gap: 14px;
margin: 0;
font-family: var(--ks-mono);
- font-size: 1.06rem;
+ font-size: 1rem;
line-height: 1.2;
}
@@ -1011,7 +1011,7 @@ html.light .docs-kinpaku {
}
.docs-kinpaku .sub-page-lede {
- font-size: 1.08rem;
+ font-size: 1.125rem;
line-height: 1.65;
color: var(--ks-text);
margin: 0;
diff --git a/site/styles/docs-visuals.css b/site/styles/docs-visuals.css
index 985391a3e..f0207d700 100644
--- a/site/styles/docs-visuals.css
+++ b/site/styles/docs-visuals.css
@@ -472,7 +472,7 @@
.docs-viz-designmd-type-display {
font-family: var(--font-display);
font-style: italic;
- font-size: 26px;
+ font-size: 1.5rem;
line-height: 1;
color: var(--color-ink);
}
@@ -687,7 +687,7 @@
.docs-viz-register-frame--product .docs-viz-reg-title {
font-family: var(--font-body);
font-weight: 600;
- font-size: 17px;
+ font-size: 1.125rem;
line-height: 1.3;
color: var(--color-ink);
margin: 0 0 6px 0;
@@ -867,7 +867,7 @@
.docs-viz-report-score-num {
font-family: var(--font-display);
font-style: italic;
- font-size: 36px;
+ font-size: 2rem;
line-height: 1;
color: var(--color-ink);
}
@@ -1328,7 +1328,7 @@
.live-mode-page-lede {
font-family: var(--font-body);
- font-size: 1.0625rem;
+ font-size: 1.125rem;
line-height: 1.55;
color: var(--color-charcoal);
margin: 0;
@@ -1480,7 +1480,7 @@
font-family: var(--font-display);
font-style: italic;
font-weight: 400;
- font-size: 1.375rem;
+ font-size: 1.25rem;
color: var(--color-ink);
margin: 0;
line-height: 1.15;
@@ -1729,7 +1729,7 @@
font-family: var(--font-display);
font-weight: 300;
font-style: italic;
- font-size: clamp(2.75rem, 6vw, 4rem);
+ font-size: clamp(2.5rem, 6vw, 4rem);
line-height: 1;
letter-spacing: -0.01em;
color: var(--color-ink);
@@ -1987,7 +1987,7 @@
font-family: var(--font-display);
font-style: italic;
font-weight: 400;
- font-size: clamp(1.125rem, 2.2vw, 1.375rem);
+ font-size: clamp(1.125rem, 2.2vw, 1.25rem);
line-height: 1;
color: var(--color-ink);
}
@@ -2058,7 +2058,7 @@
font-family: var(--font-display);
font-weight: 400;
font-style: italic;
- font-size: clamp(1.875rem, 3.5vw, 2.5rem);
+ font-size: clamp(1.75rem, 3.5vw, 2.5rem);
line-height: 1.15;
color: var(--color-ink);
margin: 0 0 var(--spacing-sm, 16px) 0;
@@ -2066,14 +2066,14 @@
}
.designing-phase--appendix .designing-phase-title {
- font-size: clamp(1.25rem, 2.2vw, 1.625rem);
+ font-size: clamp(1.25rem, 2.2vw, 1.5rem);
font-style: normal;
max-width: 32ch;
}
.designing-phase-sub {
font-family: var(--font-body);
- font-size: 1.0625rem;
+ font-size: 1.125rem;
line-height: 1.65;
color: var(--color-charcoal);
margin: 0;
@@ -2325,7 +2325,7 @@
.designing-iterate-name {
font-family: var(--font-display);
font-style: italic;
- font-size: 1.375rem;
+ font-size: 1.25rem;
line-height: 1.2;
color: var(--color-ink);
margin: 0;
@@ -2788,7 +2788,7 @@
.designing-lane-mock--brand .designing-lane-mock-title {
font-family: var(--font-display);
font-style: italic;
- font-size: 22px;
+ font-size: 1.25rem;
color: var(--color-ink);
line-height: 1.1;
}
@@ -2952,7 +2952,7 @@
.designing-cta-card-title {
font-family: var(--font-display);
font-style: italic;
- font-size: clamp(1.5rem, 2.5vw, 1.875rem);
+ font-size: clamp(1.5rem, 2.5vw, 1.75rem);
line-height: 1.1;
color: var(--color-ink);
margin: 0;
@@ -3034,7 +3034,7 @@
.craft-case-copy h2 {
margin: 0.6rem 0 0.9rem;
font-family: var(--font-display);
- font-size: clamp(1.8rem, 4vw, 2.5rem);
+ font-size: clamp(1.75rem, 4vw, 2.5rem);
font-style: italic;
font-weight: 500;
line-height: 1;
@@ -3288,7 +3288,7 @@
.neon-case-command h2 {
margin: 0.8rem 0 0;
font-family: var(--ks-font-display);
- font-size: clamp(2.2rem, 4vw, 3.4rem);
+ font-size: clamp(2rem, 4vw, 3.4rem);
font-weight: var(--ks-type-headline-weight);
letter-spacing: -0.005em;
line-height: var(--ks-type-headline-line);
@@ -3311,7 +3311,7 @@
.neon-case-notes h3 {
margin: 0 0 0.6rem;
font-family: var(--ks-font);
- font-size: 1.05rem;
+ font-size: 1rem;
font-weight: 600;
color: var(--ks-champagne);
}
diff --git a/site/styles/home-kinpaku.css b/site/styles/home-kinpaku.css
index 91b5b0e9d..23256197f 100644
--- a/site/styles/home-kinpaku.css
+++ b/site/styles/home-kinpaku.css
@@ -404,7 +404,7 @@
.home-kinpaku .hero-title-combined {
max-width: 760px;
color: var(--ks-champagne);
- font-size: clamp(3.4rem, 5.5vw, 5.2rem);
+ font-size: clamp(3.4rem, 5.5vw, 5rem);
font-weight: 300;
line-height: 1.02;
letter-spacing: 0;
@@ -794,7 +794,7 @@
.home-kinpaku .impeccable-title {
color: var(--ks-kinpaku-pale);
font-family: var(--ks-font);
- font-size: 1.7rem;
+ font-size: 1.75rem;
font-style: normal;
font-weight: 400;
}
@@ -921,7 +921,7 @@
.home-kinpaku .foundation-card-label {
color: var(--ks-champagne);
font-family: var(--ks-font);
- font-size: 1.18rem;
+ font-size: 1.125rem;
font-weight: 400;
}
@@ -1004,7 +1004,7 @@
.home-kinpaku .fisheye-item {
color: var(--ks-text);
font-family: var(--ks-font);
- font-size: 1.18rem;
+ font-size: 1.125rem;
}
.home-kinpaku .fisheye-item.is-active {
@@ -1019,7 +1019,7 @@
.home-kinpaku .spread-command-name {
color: var(--ks-kinpaku);
font-family: var(--ks-font-display);
- font-size: 4.2rem;
+ font-size: 4rem;
font-weight: 100;
letter-spacing: 0;
}
@@ -1075,7 +1075,7 @@
padding: clamp(24px, 4vw, 48px);
color: var(--ks-text);
font-family: var(--ks-font);
- font-size: clamp(1rem, 1.5vw, 1.3rem);
+ font-size: clamp(1rem, 1.5vw, 1.25rem);
font-style: normal;
font-weight: 300;
letter-spacing: 0.02em;
@@ -1205,7 +1205,7 @@
}
.home-kinpaku #framework-viz-container .ptable-symbol {
- font-size: clamp(1.45rem, 1.8vw, 1.8rem) !important;
+ font-size: clamp(1.5rem, 1.8vw, 1.75rem) !important;
font-weight: 400 !important;
letter-spacing: 0.01em;
color: var(--ks-champagne) !important;
@@ -2615,7 +2615,7 @@ html.light .home-kinpaku :is(.spread-demo-area, .terminal-preview, .mobile-demo-
.home-kinpaku .load-error-title {
color: var(--ks-champagne);
font-family: var(--ks-font);
- font-size: 1.45rem;
+ font-size: 1.5rem;
font-weight: 400;
}
@@ -2863,7 +2863,7 @@ body.home-kinpaku .footer-social-link:hover {
}
.home-kinpaku .hero-title-combined {
- font-size: 4.35rem;
+ font-size: 4.5rem;
}
.home-kinpaku .why-layout {
@@ -2908,12 +2908,12 @@ body.home-kinpaku .footer-social-link:hover {
}
.home-kinpaku .hero-title-combined {
- font-size: 3.1rem;
+ font-size: 3rem;
letter-spacing: 0;
}
.home-kinpaku .hero-tagline-combined {
- font-size: 1.08rem;
+ font-size: 1.125rem;
letter-spacing: 0.08em;
}
@@ -3051,7 +3051,7 @@ body.home-kinpaku .footer-social-link:hover {
because they hid items the drawer is meant to show.) */
.home-kinpaku .hero-title-combined {
- font-size: 2.4rem;
+ font-size: 2.5rem;
letter-spacing: 0;
}
diff --git a/site/styles/home-rebuild.css b/site/styles/home-rebuild.css
index 1484c44d4..c15510d24 100644
--- a/site/styles/home-rebuild.css
+++ b/site/styles/home-rebuild.css
@@ -101,7 +101,7 @@
.hero-rebuild-body {
margin: 0;
color: var(--ks-text);
- font-size: 1.05rem;
+ font-size: 1rem;
line-height: 1.6;
font-weight: 300;
max-width: 56ch;
@@ -982,7 +982,7 @@ svg.downloads-rebuild-tab-logo {
.home-kinpaku .downloads-rebuild-prompt {
flex: none;
font-family: var(--ks-mono);
- font-size: 1.18rem;
+ font-size: 1.125rem;
font-weight: 500;
line-height: 1;
color: var(--card-prompt);
@@ -1258,7 +1258,7 @@ svg.downloads-rebuild-tab-logo {
color: var(--card-fg-strong);
font-family: var(--ks-font);
font-weight: 400;
- font-size: 1.05rem;
+ font-size: 1rem;
}
.downloads-rebuild-extras span {
@@ -1330,7 +1330,7 @@ svg.downloads-rebuild-tab-logo {
}
.home-kinpaku .downloads-rebuild-prompt {
- font-size: 1.05rem;
+ font-size: 1rem;
}
.home-kinpaku .downloads-rebuild-copy {
@@ -1568,7 +1568,7 @@ svg.downloads-rebuild-tab-logo {
margin: 0;
font-family: var(--h-serif);
font-weight: 500;
- font-size: 31px;
+ font-size: 2rem;
line-height: 1.05;
letter-spacing: -0.01em;
color: oklch(98% 0.01 85);
@@ -1602,7 +1602,7 @@ svg.downloads-rebuild-tab-logo {
.hotel-hero--slop .hotel-hero-title {
font-family: ui-sans-serif, system-ui, sans-serif;
font-weight: 800;
- font-size: 27px;
+ font-size: 1.75rem;
letter-spacing: -0.02em;
color: oklch(32% 0.02 285);
}
@@ -1715,7 +1715,7 @@ svg.downloads-rebuild-tab-logo {
margin: 0;
font-family: var(--h-serif);
font-weight: 600;
- font-size: 23px;
+ font-size: 1.5rem;
line-height: 1.05;
color: var(--c-ink);
}
@@ -1778,7 +1778,7 @@ svg.downloads-rebuild-tab-logo {
.hotel-card--slop .hotel-card-name {
font-family: inherit;
font-weight: 700;
- font-size: 17px;
+ font-size: 1.125rem;
letter-spacing: -0.01em;
color: oklch(32% 0.02 290);
}
@@ -1829,14 +1829,14 @@ svg.downloads-rebuild-tab-logo {
}
.hotel-card--2 .hotel-card-photo { display: none; }
.hotel-card--2 .hotel-card-body { gap: 7px; padding: 22px 18px; align-items: center; }
-.hotel-card--2 .hotel-card-name { font-size: 30px; font-style: italic; }
+.hotel-card--2 .hotel-card-name { font-size: 2rem; font-style: italic; }
.hotel-card--2 .hotel-card-foot {
flex-direction: column;
gap: 10px;
border-top: 1px solid var(--h-line);
margin-top: 12px;
}
-.hotel-card--2 .hotel-card-price { font-size: 26px; }
+.hotel-card--2 .hotel-card-price { font-size: 1.5rem; }
.hotel-card--2 .hotel-card-btn {
background: transparent;
color: var(--c-accent);
@@ -2018,7 +2018,7 @@ svg.downloads-rebuild-tab-logo {
margin: 0;
font-family: var(--ks-font-display);
font-weight: var(--ks-type-headline-weight);
- font-size: 1.18rem;
+ font-size: 1.125rem;
color: var(--ks-champagne);
}
.live-how-copy {
diff --git a/site/styles/kinpaku-kit.css b/site/styles/kinpaku-kit.css
index a65db442a..badbb9567 100644
--- a/site/styles/kinpaku-kit.css
+++ b/site/styles/kinpaku-kit.css
@@ -39,8 +39,8 @@
color: var(--ks-kinpaku);
font-family: var(--ks-font-wordmark);
font-weight: 400;
- font-size: 1.3rem;
- letter-spacing: 0.15em;
+ font-size: var(--ks-type-wordmark-size);
+ letter-spacing: var(--ks-type-wordmark-track);
text-transform: uppercase;
line-height: 1;
-webkit-font-smoothing: auto;
@@ -81,7 +81,7 @@
margin: 0;
color: var(--ks-champagne);
font-family: var(--ks-font-display);
- font-size: clamp(2.2rem, 3.6vw, 3rem);
+ font-size: clamp(2rem, 3.6vw, 3rem);
font-weight: var(--ks-type-headline-weight);
line-height: 1.06;
letter-spacing: -0.005em;
@@ -883,8 +883,8 @@
color: var(--ks-kinpaku);
font-family: var(--ks-font-wordmark);
font-weight: 400;
- font-size: 1.3rem;
- letter-spacing: 0.15em;
+ font-size: var(--ks-type-wordmark-size);
+ letter-spacing: var(--ks-type-wordmark-track);
text-transform: uppercase;
line-height: 1;
/* main.css / sub-pages.css set -webkit-font-smoothing: antialiased on
diff --git a/site/styles/kinpaku-tokens.css b/site/styles/kinpaku-tokens.css
index 18993ef40..4389db3ca 100644
--- a/site/styles/kinpaku-tokens.css
+++ b/site/styles/kinpaku-tokens.css
@@ -118,24 +118,24 @@
--ks-type-headline-line: 1.04;
/* Title — card and panel headings (h3). */
- --ks-type-title-size: 1.18rem;
+ --ks-type-title-size: 1.125rem;
--ks-type-title-weight: 500;
--ks-type-title-line: 1.35;
/* Body. */
- --ks-type-body-size: 1.02rem;
+ --ks-type-body-size: 1rem;
--ks-type-body-line: 1.8;
/* Eyebrow — small mono labels above titles. */
- --ks-type-eyebrow-size: 0.7rem;
+ --ks-type-eyebrow-size: 0.6875rem;
--ks-type-eyebrow-track: 0.18em;
/* Wordmark — IMPECCABLE in the header. */
- --ks-type-wordmark-size: 1.15rem;
- --ks-type-wordmark-track: 0.42em;
+ --ks-type-wordmark-size: 1.125rem;
+ --ks-type-wordmark-track: 0.15em;
/* Mono — code, terminal, audit lines. */
- --ks-type-mono-size: 0.72rem;
+ --ks-type-mono-size: 0.6875rem;
--ks-type-mono-track: 0.22em;
/* ============================================================
diff --git a/site/styles/live-mode.css b/site/styles/live-mode.css
index 7ec40e170..52d9c0f6b 100644
--- a/site/styles/live-mode.css
+++ b/site/styles/live-mode.css
@@ -938,7 +938,7 @@
.live-demo-card--v3 h3 {
font-family: var(--font-display);
font-weight: 400;
- font-size: 22px;
+ font-size: 1.25rem;
line-height: 1.2;
color: var(--color-ink);
}
diff --git a/site/styles/main.css b/site/styles/main.css
index d542460c3..ae3073a43 100644
--- a/site/styles/main.css
+++ b/site/styles/main.css
@@ -974,7 +974,7 @@ code {
.foundation-card-label {
font-family: var(--font-display);
- font-size: 1.35rem;
+ font-size: 1.125rem;
color: var(--color-ink);
line-height: 1.16;
}
diff --git a/site/styles/sub-pages.css b/site/styles/sub-pages.css
index 5418126cf..f54b11872 100644
--- a/site/styles/sub-pages.css
+++ b/site/styles/sub-pages.css
@@ -208,7 +208,7 @@ a {
}
.site-header-brand {
- font-size: 1.0625rem;
+ font-size: 1.125rem;
}
.site-header-brand-logo {
@@ -539,7 +539,7 @@ main#main {
.docs-home-card-title {
font-family: var(--font-display);
- font-size: clamp(2rem, 4vw, 2.75rem);
+ font-size: clamp(2rem, 4vw, 2.5rem);
font-weight: 500;
color: var(--color-ink);
letter-spacing: -0.02em;
@@ -954,7 +954,7 @@ main#main {
.slop-section-heading {
font-family: var(--font-display);
- font-size: clamp(2rem, 3.5vw, 2.75rem);
+ font-size: clamp(2rem, 3.5vw, 2.5rem);
font-weight: 500;
font-style: italic;
color: var(--color-ink);
@@ -1266,7 +1266,7 @@ main#main {
.tutorial-card-title {
font-family: var(--font-display);
- font-size: 1.375rem;
+ font-size: 1.25rem;
font-style: italic;
font-weight: 500;
color: var(--color-ink);
@@ -1372,7 +1372,7 @@ main#main {
.tutorial-detail-tagline {
font-family: var(--font-body);
- font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
+ font-size: clamp(1.125rem, 1.5vw, 1.25rem);
line-height: 1.55;
color: var(--color-charcoal);
max-width: 60ch;
@@ -1457,7 +1457,7 @@ main#main {
.slop-then-now-lede {
color: var(--color-charcoal);
- font-size: 1.0625rem;
+ font-size: 1.125rem;
line-height: 1.6;
max-width: 52ch;
margin: 0;
@@ -1551,7 +1551,7 @@ main#main {
.visual-mode-method-name {
font-family: var(--font-display);
- font-size: 1.375rem;
+ font-size: 1.25rem;
font-style: italic;
font-weight: 500;
color: var(--color-ink);
@@ -2224,7 +2224,7 @@ main#main {
margin-bottom: 0.6em;
}
-.prose h1 { font-family: var(--font-display); font-size: 1.875rem; font-weight: 500; }
+.prose h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 500; }
.prose h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; margin-top: 2.2em; }
.prose h3 { font-size: 1.125rem; margin-top: 1.8em; }
.prose h4 { font-size: 1rem; }
diff --git a/site/styles/workflow.css b/site/styles/workflow.css
index 6e9013e0c..36193fddb 100644
--- a/site/styles/workflow.css
+++ b/site/styles/workflow.css
@@ -98,7 +98,7 @@
.fisheye-beta {
font-family: var(--font-body);
- font-size: 0.45rem;
+ font-size: 0.5rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
@@ -1556,7 +1556,7 @@
.why-panel-body {
font-family: var(--font-body);
- font-size: 1.0625rem;
+ font-size: 1rem;
line-height: 1.65;
color: var(--color-charcoal);
margin: 0 0 var(--spacing-md);
@@ -1849,7 +1849,7 @@
}
.why-impeccable-title {
font-family: var(--font-display);
- font-size: 22px;
+ font-size: 1.25rem;
line-height: 1.05;
color: var(--color-ink);
}
@@ -3197,7 +3197,7 @@
font-family: var(--font-display);
font-style: italic;
font-weight: 400;
- font-size: 1.375rem;
+ font-size: 1.25rem;
line-height: 1.1;
color: var(--color-ink);
letter-spacing: -0.01em;
@@ -3347,7 +3347,7 @@
font-family: var(--font-display);
font-style: italic;
font-weight: 400;
- font-size: 52px;
+ font-size: 3rem;
line-height: 1;
color: var(--color-ink);
letter-spacing: -0.03em;
diff --git a/tests/design-system.test.mjs b/tests/design-system.test.mjs
index 00f65680e..f10a3765f 100644
--- a/tests/design-system.test.mjs
+++ b/tests/design-system.test.mjs
@@ -105,8 +105,150 @@ describe('normalizeDesignSystem()', () => {
assert.equal(isAllowedFontSizeRaw('14px', designSystem), true);
assert.equal(isAllowedFontSizeRaw('12.5px', designSystem), false);
assert.equal(isAllowedFontSizeRaw('1.2em', designSystem), true);
- assert.equal(isAllowedFontSizeRaw('clamp(1rem, 2vw, 2rem)', designSystem), true);
assert.equal(isAllowedFontSizeRaw('var(--text-body)', designSystem), true);
+
+ // Fluid values are judged on their endpoints. This fixture documents 14px,
+ // 16px, and the display role's 40px/64px endpoints, so a 2rem (32px) max is
+ // off the ramp even though the 1rem min is on it.
+ assert.equal(isAllowedFontSizeRaw('clamp(1rem, 2vw, 2rem)', designSystem), false);
+ assert.equal(isAllowedFontSizeRaw('clamp(2.5rem, 6vw, 4rem)', designSystem), true);
+ });
+
+ it('reads a typography.scale map as literal ramp steps', () => {
+ const designSystem = normalizeDesignSystem({
+ frontmatter: {
+ typography: {
+ scale: {
+ micro: '0.5625rem', // 9px
+ body: '1rem', // 16px
+ title: '1.5rem', // 24px
+ },
+ body: { fontFamily: 'IBM Plex Sans, Arial, sans-serif', fontSize: '1rem' },
+ },
+ },
+ });
+
+ assert.equal(designSystem.hasFontSizes, true);
+ assert.equal(isAllowedFontSizeRaw('9px', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('0.5625rem', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('24px', designSystem), true);
+ // Off every step by more than the 0.5px tolerance.
+ assert.equal(isAllowedFontSizeRaw('0.82rem', designSystem), false);
+ assert.equal(isAllowedFontSizeRaw('20px', designSystem), false);
+ });
+
+ it('accepts both clamp() endpoints as ramp steps', () => {
+ const designSystem = normalizeDesignSystem({
+ frontmatter: {
+ typography: {
+ scale: { body: '1rem' },
+ display: { fontFamily: 'Alumni Sans, sans-serif', fontSize: 'clamp(3.4rem, 6.5vw, 5.6rem)' },
+ },
+ },
+ });
+
+ // 3.4rem = 54.4px (min) and 5.6rem = 89.6px (max) are both documented.
+ assert.equal(isAllowedFontSizeRaw('3.4rem', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('5.6rem', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('54.4px', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('89.6px', designSystem), true);
+ // The vw middle term is viewport-relative, never a fixed step.
+ assert.equal(isAllowedFontSizeRaw('6.5px', designSystem), false);
+ // An arbitrary size between the endpoints is still off the ramp.
+ assert.equal(isAllowedFontSizeRaw('4.2rem', designSystem), false);
+ });
+
+ it('validates clamp() endpoints in usage, not just in DESIGN.md', () => {
+ const designSystem = normalizeDesignSystem({
+ frontmatter: {
+ typography: {
+ scale: { body: '1rem', title: '1.5rem' }, // 16px, 24px
+ },
+ },
+ });
+
+ // Both endpoints documented.
+ assert.equal(isAllowedFontSizeRaw('clamp(1rem, 2vw, 1.5rem)', designSystem), true);
+ // Neither endpoint is a step: 23.2px and 28.8px.
+ assert.equal(isAllowedFontSizeRaw('clamp(1.45rem, 1.8vw, 1.8rem)', designSystem), false);
+ // One bad endpoint is enough.
+ assert.equal(isAllowedFontSizeRaw('clamp(1rem, 2vw, 1.8rem)', designSystem), false);
+ // The viewport term interpolates and is never judged as a step.
+ assert.equal(isAllowedFontSizeRaw('clamp(1rem, 6.5vw, 1.5rem)', designSystem), true);
+ // Unjudgeable endpoints abstain rather than guess.
+ assert.equal(isAllowedFontSizeRaw('clamp(var(--a), 2vw, 1.5rem)', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('clamp(var(--a), 2vw, var(--b))', designSystem), true);
+ // Malformed or unparseable fluid values abstain.
+ assert.equal(isAllowedFontSizeRaw('clamp(1.45rem, 1.8vw)', designSystem), true);
+ // Non-clamp functional values keep abstaining.
+ assert.equal(isAllowedFontSizeRaw('calc(1rem + 3px)', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('var(--text-body)', designSystem), true);
+ });
+
+ it("accepts DESIGN.md's own fluid roles when used verbatim in source", () => {
+ // The endpoints a fluid role declares are documented sizes, so authoring
+ // that exact clamp must not flag. Regression guard for the asymmetry where
+ // the extractor read clamp endpoints but the checker never validated them.
+ const designSystem = normalizeDesignSystem({
+ frontmatter: {
+ typography: {
+ scale: { body: '1rem' },
+ display: { fontFamily: 'Alumni Sans, sans-serif', fontSize: 'clamp(3.4rem, 6.5vw, 5.6rem)' },
+ },
+ },
+ });
+
+ assert.equal(isAllowedFontSizeRaw('clamp(3.4rem, 6.5vw, 5.6rem)', designSystem), true);
+ assert.equal(isAllowedFontSizeRaw('clamp(3.4rem, 6.5vw, 6rem)', designSystem), false);
+ });
+
+ it('strips CSS priority markers from the font-size ignore value', () => {
+ // The ignoreValue is what a `hooks ignore-value` waiver has to match, so a
+ // size must not need two different waivers depending on whether the
+ // declaration carries !important. font-family already behaves this way.
+ const designSystem = normalizeDesignSystem({
+ frontmatter: { typography: { scale: { body: '1rem' } } },
+ });
+ const findings = checkSourceDesignSystem(
+ '.a { font-size: 1.4rem !important; }\n.b { font-size: 1.4rem; }',
+ '/tmp/important.css',
+ { designSystem },
+ );
+ const sizes = findings.filter((f) => f.antipattern === 'design-system-font-size');
+ assert.equal(sizes.length, 2);
+ assert.deepEqual(sizes.map((f) => f.ignoreValue), ['1.4rem', '1.4rem']);
+ });
+
+ it('reports which fluid endpoint is off the ramp', () => {
+ const designSystem = normalizeDesignSystem({
+ frontmatter: { typography: { scale: { body: '1rem' } } },
+ });
+ const findings = checkSourceDesignSystem(
+ '.a { font-size: clamp(1.45rem, 1.8vw, 1.8rem) !important; }',
+ '/tmp/fluid.css',
+ { designSystem },
+ );
+ const sizes = findings.filter((f) => f.antipattern === 'design-system-font-size');
+ assert.equal(sizes.length, 1);
+ assert.match(sizes[0].snippet, /1\.45rem/);
+ assert.match(sizes[0].snippet, /1\.8rem/);
+ assert.equal(sizes[0].ignoreValue, '1.45rem');
+ });
+
+ it('does not let clamp() endpoints alone switch the font-size rule on', () => {
+ // A fully fluid system enumerates no discrete ramp, so inferring one from
+ // clamp endpoints would flag every intermediate size. Keep abstaining.
+ const designSystem = normalizeDesignSystem({
+ frontmatter: {
+ typography: {
+ display: { fontFamily: 'Avenir Next, Georgia, serif', fontSize: 'clamp(2.5rem, 6vw, 4rem)' },
+ body: { fontFamily: 'IBM Plex Sans, Arial, sans-serif', fontSize: 'clamp(1rem, 2vw, 1.125rem)' },
+ },
+ },
+ });
+
+ assert.equal(designSystem.hasFontSizes, false);
+ assert.equal(isAllowedFontSizeRaw('12.5px', designSystem), true);
});
});