diff --git a/scripts/check-visual-grammar.mjs b/scripts/check-visual-grammar.mjs index 43482268..0cd33d62 100644 --- a/scripts/check-visual-grammar.mjs +++ b/scripts/check-visual-grammar.mjs @@ -52,6 +52,73 @@ const HOVER_LIFT_CEILING = 28; */ const EXTERNAL_OWNED = ["--radix-accordion-content-height"]; +/** + * R12 的「测量值 ↔ 声明值」对账表。 + * 出处:2026-11-02 对 Porsche Consulting 中国站首页逐个 的 getBoundingClientRect 实测 + * (1600×900 视口),四种比例各绑一个构图角色。数值同时落在两处: + * globals.css 的 --aspect-*(运行时用)与 src/lib/constants/image-ratios.ts(JS 侧用)。 + * 两处必须逐字相等 —— 本仓真实踩过「两套 gutter 同时在线」的散字面量病, + * 而对账表写在闸里、不写在文档里,是因为文档会在第一次改值时腐烂,闸不会。 + */ +const ASPECT_MEASURED = { + "hero-wide": "2.31", // 1600×692 全幅首屏 + "editorial": "1.5", // 606×404 编辑卡 + "square": "1", // 499/464 见方 —— 横向轨每一格 + "tile": "1.42", // 653×459 行业格 +}; +const IMAGE_RATIOS_TS = "src/lib/constants/image-ratios.ts"; + +/** + * R13–R17 的扫描面 = 「营销面」。 + * + * 为什么范围要收窄到这一层:`src/components/ui/**` 里的 rounded-full 是**功能形状** + * (avatar / switch 钮 / slider 钮 / radio / progress / scroll-area / skeleton 点), + * R2 的正向守卫专门保护它们不被"语法收口"顺手方角化。把营销规则套到 ui/ 上, + * 就是把 R2 防的那个自伤从另一头实现一遍。 + * + * 为什么要一条「地板」而不是只报分母:这五条的分母是**扫描到的文件数**, + * 清账成功后它会趋近于 0;而 `main()` 里「分母 0 = 未能度量 = EXIT=2」那条纪律 + * 会把「已全部清零」误报成「仪器坏了」。反之若路径正则哪天失配(目录改名、 + * `(marketing)` 前缀变动),扫描数会静默掉到 0,五条判据同时空转且全绿 —— + * 那才是真正的假绿。所以给一个实测下界(2026-11-02 实测 80 个文件), + * 跌破即判红:判据失去目标必须可见。 + */ +const MARKETING_SCOPE_RE = /^src\/app\/\(marketing\)\/.+\.tsx$|^src\/components\/(sections|detail|layout)\/.+\.tsx$/; +const MARKETING_TEST_RE = /\.(test|spec)\.tsx?$/; +const MARKETING_FLOOR = 60; + +/** + * R13–R17 的**存量上限**(现取 2026-11-02:营销面 78 个 .tsx,排除 .test/.spec 与 _archive)。 + * 每条只许减不许加;跌破即提示下调(同 R10 棘轮的纪律,防止「闸还在、存量已被自己删空」 + * 退化成永久豁免)。清零后把上限登记为 0,判据即变成硬禁。 + */ +const MARKETING_HIT_CEILINGS = { R13: 71, R14: 21, R15: 21, R16: 26, R17: 53 }; + +/** + * 判据正则一律**不带 g 旗标**。 + * 这不是风格问题:带 /g 的模块级正则是状态机,`.test()` 会推进 lastIndex, + * 下一次调用从中间位置开始 —— 同一条规则先 filter 再 match 时, + * 第二次读数会因上一次的匹配位置而漏计。自证当场就把这个形状抓红了 + * (R13–R17 棘轮全条不成立),而它在真实运行里只表现为「少报几处」= 半个假绿。 + * 所有消费点都是 `.match(re)` / `new RegExp(re.source)`,非 g 语义完全等价。 + */ +const ROUNDED_UTILITY_RE = /\brounded-(?:md|lg|xl|2xl|3xl|full)\b/; +const HOVER_LIFT_RE = /hover:-translate-y\b/; +/** 装饰阴影:任意 hover:shadow*(含 hover:shadow-[…] 带值那族)+ lg/xl/2xl 档 */ +const DECOR_SHADOW_RE = /(?:hover:shadow(?:-[a-z0-9]+)?(?::\[[^\]]+\])?|\bshadow-(?:2xl|xl|lg)\b)/; +const BRAND_SURFACE_RE = /\bbg-brand-(?:soft|section)\b/; +const FONT_BLACK_RE = /\bfont-black\b/; + +/** + * 数命中数。**必须每次新建 RegExp**:带 g 的正则是状态机,复用同一个实例时 + * .test() / .exec() 会推进 lastIndex,下一条规则从中间位置开始读 —— + * 本仓真实踩过(自证把 R13–R17 棘轮全条抓红就是它)。 + * 反过来,不带 g 的 /x/.match() 只返回**第一个**匹配、数出来恒为 1, + * 会把「实测 N 处」静默读成 1 —— 那是另一种假绿,而且更难发现。 + * 所以计数只走这一条路:新实例 + g + 长度。 + */ +const countHits = (text, re) => (text.match(new RegExp(re.source, "g")) || []).length; + // ---- 源码遍历(只用 node 内置,避开第三方)---- function walk(dir, out = []) { let ents; @@ -101,7 +168,7 @@ function parseRadii(text) { // checkGrammar 会往同一数组追加,而 selftest 里的 .find("R10") 取到的是**第一次** // 那份读数 —— 于是 R10 的负对照被读成"不判红"。主流程只调一次所以毫无症状, // 属于「仪器只在被复用时才坏」那一类,也正是自证该抓的东西。 -function checkGrammar(rawText, rawFiles, twConfig = "") { +function checkGrammar(rawText, rawFiles, twConfig = "", opts = {}) { const results = []; const rule = ({ id, name, denominator, red, note }) => { results.push({ id, name, denominator, red, note }); @@ -284,6 +351,91 @@ function checkGrammar(rawText, rawFiles, twConfig = "") { rule({ id: "R11", name: "tailwind 映射的 var(--*) 必有 CSS 声明(僵尸令牌守卫)", denominator: twRefs.length, red: r11Red, note: `引用 ${twRefs.length} 个变量 · 外部所有者豁免 ${EXTERNAL_OWNED.length - deadAllow.length} 条生效` }); + /** + * R12–R17:对标**布局层**的判据(2026-11-02 现量,见各常量的出处注释)。 + * + * 为什么令牌层那 11 条拦不住这一族:R1/R3/R8 看的是 `--radius-*` 声明值, + * 而 `rounded-full`、`hover:-translate-y`、`bg-brand-soft`、`font-black` 这些**类名** + * 是在已记档的令牌之上另起的形状 —— 令牌记档 0–4px 全绿的同时, + * 营销面照样能摆出 71 处胶囊/大圆角、21 处 hover 抬升、26 处彩色面、53 处 900 字重。 + * ADR-0008 决策四当时把模板批推到「过验收之后」,结果就是这批红一直活着、 + * 且没有任何仪器会喊它 —— 本段五条就是补那台仪器。 + * + * 扫描面必须收窄到营销面(见 MARKETING_SCOPE_RE 的注释):把规则套到 + * `src/components/ui/**` 上,等于从另一头实现 R2 专门防的那个自伤 + * (avatar / switch / slider / progress 的圆是功能形状,不是装饰)。 + */ + const marketingFiles = [...files].filter(([rel]) => MARKETING_SCOPE_RE.test(rel) && !MARKETING_TEST_RE.test(rel)); + const rScan = marketingFiles.length; + const rFloor = opts.floor ?? MARKETING_FLOOR; + + // R13–R17 的「存量上限」:值 = 2026-11-02 现取(见各条 note),只许减不许加。 + // 为什么是**双向**棘轮而不是「清零即通过」:清零之前它有牙(新增一处就判红), + // 清零之后若留着恒真判据就成了没人看守的永久豁免 —— 这正是 ADR-0008 里 + // 「登记了却命中 0 ⇒ 判红」那条纪律要防的腐化。所以命中数**跌破**登记值时, + // note 里喊把上限下调;下调到 0 后判据自动退化成硬禁,不再有空转的名单。 + const ceilings = { ...MARKETING_HIT_CEILINGS, ...opts.hitCeilings }; + + /** + * R12 测量值 ↔ 声明值对账:globals.css 的 --aspect-* 与 image-ratios.ts 的数字必须逐字相等。 + * 这条抓的是**将来**:有人改了 CSS 那侧、或给某个新角色加了第三条真源而忘了另一侧。 + * 两侧都取不到数 = 判据失去目标,按「未能度量」处理(分母 0)。 + */ + const aspectCss = new Map([...text.matchAll(/^\s*--aspect-([a-z0-9-]+)\s*:\s*([\d.]+)\s*;/gm)].map((m) => [m[1], m[2]])); + const aspectJs = new Map([...String(opts.jsSources?.[IMAGE_RATIOS_TS] ?? "").matchAll(/(HERO_WIDE|EDITORIAL|SQUARE|TILE):\s*([\d.]+)/g)] + .map((m) => [({ HERO_WIDE: "hero-wide", EDITORIAL: "editorial", SQUARE: "square", TILE: "tile" })[m[1]], m[2]])); + const r12Red = []; + for (const [key, measured] of Object.entries(ASPECT_MEASURED)) { + const cssV = aspectCss.get(key); + const jsV = aspectJs.get(key); + if (cssV === undefined || jsV === undefined) { + r12Red.push(`--aspect-${key} / IMAGE_RATIOS 缺一侧(css=${cssV ?? "无"} js=${jsV ?? "无"})—— 判据失去目标`); + } else if (cssV !== measured || jsV !== measured) { + r12Red.push(`比例漂移 ${key}:实测 ${measured}、globals.css ${cssV}、image-ratios.ts ${jsV}`); + } + } + rule({ id: "R12", name: "影像比例两侧真源与实测值逐字相等", denominator: aspectCss.size, red: r12Red, + note: `实测四种角色 ${Object.keys(ASPECT_MEASURED).join("/")} · 消费面 ${rScan} 文件` }); + + // R13 营销面零非记档圆角类名。rounded-sm 不在这里 —— 它映射 --radius-sm = 0px, + // 写了等于没写,不是违规;rounded-(md|lg|xl|2xl|3xl) 才是「在记档档位之外另起形状」。 + const r13Files = marketingFiles.filter(([, f]) => countHits(f, ROUNDED_UTILITY_RE) > 0); + const r13Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, ROUNDED_UTILITY_RE), 0); + rule({ id: "R13", name: "营销面零 rounded-(md|lg|xl|2xl|3xl|full) 类名", denominator: rScan, + red: (rFloor > 0 && rScan < rFloor) + ? [`营销面只扫到 ${rScan} 文件 < 地板 ${rFloor} —— 路径正则失配(目录改名?),本条与其下四条同时空转`] + : r13Count > ceilings.R13 ? [`营销面非记档圆角 ${r13Count} 处 > 上限 ${ceilings.R13}(卡片圆角请走 rounded-md 的记档值,胶囊走 rounded-cta)`] : [], + note: `实测 ${r13Count} 处 / ${r13Files.length} 文件 · 上限 ${ceilings.R13}${r13Count < ceilings.R13 ? " ⇒ 请把上限下调" : ""}` }); + + // R14 营销面 hover 不抬升。与 R10 同判据但口径更硬:R10 是全站棘轮、已在 28/28 上限, + // 新违规可以藏在「没超上限」里;这条只看营销面,且上限跟着清账一起降。 + const r14Hits = marketingFiles.filter(([, f]) => countHits(f, HOVER_LIFT_RE) > 0); + const r14Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, HOVER_LIFT_RE), 0); + rule({ id: "R14", name: "营销面 hover:-translate-y 硬禁(补 R10 棘轮的藏污位)", denominator: rScan, + red: r14Count > ceilings.R14 ? [`营销面 hover 抬升 ${r14Count} 处 > 上限 ${ceilings.R14}(对标实测两家 hover 都不抬升,卡片靠 hairline 与底色)`] : [], + note: `实测 ${r14Count} 处 / ${r14Hits.length} 文件 · 上限 ${ceilings.R14}${r14Count < ceilings.R14 ? " ⇒ 请把上限下调" : ""}` }); + + // R15 装饰性深阴影。R5/R7 管的是**彩色**阴影(品牌红光晕那一族), + // 这条管 shadow-lg/xl/2xl 与任意 hover:shadow —— 对标的层次靠留白与影像,不靠投影。 + const r15Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, DECOR_SHADOW_RE), 0); + rule({ id: "R15", name: "营销面零装饰阴影(shadow-lg|xl|2xl 与任意 hover:shadow)", denominator: rScan, + red: r15Count > ceilings.R15 ? [`营销面装饰阴影 ${r15Count} 处 > 上限 ${ceilings.R15}(Quiet Border Rule:边框只负责「有没有」,别叠投影)`] : [], + note: `实测 ${r15Count} 处 · 上限 ${ceilings.R15}${r15Count < ceilings.R15 ? " ⇒ 请把上限下调" : ""}` }); + + // R16 饱和/浅色品牌红不得做「面」。两家实测红只出现在按钮上;本仓把它铺成图标砖 + // (bg-brand-soft) 与满幅段 (bg-brand-section),是决策一「红是结论电压」最直接的稀释。 + const r16Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_RE), 0); + rule({ id: "R16", name: "营销面零品牌红彩色面(bg-brand-soft / bg-brand-section)", denominator: rScan, + red: r16Count > ceilings.R16 ? [`营销面彩色面 ${r16Count} 处 > 上限 ${ceilings.R16}(红只做:实心 CTA 填充 / eyebrow 短线 / hairline hover / 角牌;中性底走 bg-bg-secondary)`] : [], + note: `实测 ${r16Count} 处 · 上限 ${ceilings.R16}${r16Count < ceilings.R16 ? " ⇒ 请把上限下调" : ""}` }); + + // R17 字重集合。对标实测层级来自 字号 × 字重 两轴,字重只用 400/500/700; + // 本仓 53 处 font-black(900) 是「靠更粗建立层级」的单轴做法,与 statement 档冲突。 + const r17Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, FONT_BLACK_RE), 0); + rule({ id: "R17", name: "营销面零 font-black(900)", denominator: rScan, + red: r17Count > ceilings.R17 ? [`营销面 font-black ${r17Count} 处 > 上限 ${ceilings.R17}(声明档走 text-statement + font-bold / font-normal 的字重分裂)`] : [], + note: `实测 ${r17Count} 处 · 上限 ${ceilings.R17}${r17Count < ceilings.R17 ? " ⇒ 请把上限下调" : ""}` }); + return results; } @@ -344,6 +496,79 @@ function selftest() { return 1; } console.log(` ✓ R10 棘轮双向:${HOVER_LIFT_CEILING} 处不判红、${HOVER_LIFT_CEILING + 1} 处判红`); + /** + * R13–R17 的两侧自证。两个维度都要测,缺一个就是半个假绿: + * ① 内容维:同一份违规内容,落在**营销面路径**必须判红、落在 `src/components/ui/**` + * 必须不判红 —— 否则要么判据恒绿(抓不到),要么判据越界(会把 R2 保护的 + * 功能性圆一起方角化,那正是 ADR-0008 记名的自伤)。 + * ② 数量维:它们和 R10 一样是存量棘轮,判据是「命中数 > 上限」, + * 所以负例要按数量构造 —— 上限处不判红、上限+1 判红。 + * 夹具一律带 `opts.floor = 0`:合成样本只有一两个文件, + * 不关掉地板就会把「扫描面太小」的红混进这一维,读数不再单义。 + */ + const dirty = `
`; + const inScope = (rel) => new Map([[rel, dirty]]); + const hitRed = (rel, id, ceiling) => + checkGrammar(cssText, inScope(rel), "", { floor: 0, hitCeilings: { [id]: ceiling } }) + .find((x) => x.id === id).red.length; + const scopeBad = ["R13", "R14", "R15", "R16", "R17"].filter( + (id) => hitRed("src/app/(marketing)/x.tsx", id, 0) === 0); + const scopeOver = ["R13", "R14", "R15", "R16", "R17"].filter( + (id) => hitRed("src/components/ui/x.tsx", id, 0) > 0); + if (scopeBad.length || scopeOver.length) { + console.log(` ✗ R13–R17 扫描面不自证:营销面漏抓 ${scopeBad.join(",") || "无"}、越界误报 ${scopeOver.join(",") || "无"} ⇒ 上面所有绿灯不作数`); + return 1; + } + console.log(" ✓ R13–R17 双向:营销面已知违规全判红、ui/ 同名内容不误报(R2 的功能圆未被牵连)"); + + // 数量维:上限处不判红 / 上限+1 判红(同 R10 的构造法)。 + // 只关地板、**不覆盖上限** —— 第一版在这里塞了 hitCeilings:{[id]:9999}, + // 于是两个情景都恒不判红、棘轮自证永远失败。用登记上限本身才是测那条规则。 + const ratchetBad = []; + for (const [id, ceiling] of Object.entries(MARKETING_HIT_CEILINGS)) { + const fixture = { R13: "rounded-full", R14: "hover:-translate-y-1", R15: "shadow-lg", R16: "bg-brand-soft", R17: "font-black" }[id]; + const at = (n) => checkGrammar(cssText, new Map([ + ["src/app/(marketing)/n.tsx", `
`], + ]), "", { floor: 0 }).find((x) => x.id === id).red.length; + if (at(ceiling) !== 0 || at(ceiling + 1) === 0) ratchetBad.push(`${id}@${ceiling}/${ceiling + 1}`); + } + if (ratchetBad.length) { + console.log(` ✗ R13–R17 棘轮不自证:${ratchetBad.join(" ")} 处「上限不判红/上限+1 判红」不成立 ⇒ 上面所有绿灯不作数`); + return 1; + } + console.log(` ✓ R13–R17 棘轮双向:按 ${Object.entries(MARKETING_HIT_CEILINGS).map(([k, v]) => `${k}=${v}`).join(" ")} 各自成立`); + + /** + * R12 两侧自证:对账表必须**既能抓到漂移、又不在等值时误报**。 + * 只测抓漂移那一侧的话,一条「见 css 就报」的坏判据也能拿满分。 + */ + const aspectFix = (pairs) => `:root {\n${pairs.map(([k, v]) => ` --aspect-${k}: ${v};`).join("\n")}\n}`; + const jsFix = (vals) => `export const IMAGE_RATIOS = { HERO_WIDE: ${vals[0]}, EDITORIAL: ${vals[1]}, SQUARE: ${vals[2]}, TILE: ${vals[3]} } as const;`; + const measuredArr = Object.values(ASPECT_MEASURED); + const drifted = [...measuredArr]; drifted[0] = "9.99"; + const r12RedFor = (cssPairs, jsVals) => + checkGrammar(aspectFix(cssPairs), new Map(), "", { jsSources: { [IMAGE_RATIOS_TS]: jsFix(jsVals) } }) + .find((x) => x.id === "R12").red.length; + const r12Catches = r12RedFor(Object.entries(ASPECT_MEASURED).map(([k, v]) => [k, v === measuredArr[0] ? "9.99" : v]), drifted) > 0; + const r12IgnoresEqual = r12RedFor(Object.entries(ASPECT_MEASURED), measuredArr) === 0; + const r12CatchesMissing = checkGrammar(aspectFix([]), new Map(), "", { jsSources: { [IMAGE_RATIOS_TS]: jsFix(measuredArr) } }) + .find((x) => x.id === "R12").red.length > 0; + if (!r12Catches || !r12IgnoresEqual || !r12CatchesMissing) { + console.log(` ✗ R12 不自证:漂移抓到 ${r12Catches}、等值不误报 ${r12IgnoresEqual}、缺一侧抓到 ${r12CatchesMissing} ⇒ 上面所有绿灯不作数`); + return 1; + } + console.log(" ✓ R12 三向:值漂移判红、两侧等值不误报、任一侧缺失判红"); + + // 地板守卫:扫描面塌陷(路径正则失配)必须可见,不能悄悄变成「五条规则全绿」 + const floorRed = checkGrammar(cssText, new Map([["src/nowhere/x.tsx", dirty]]), "", { floor: 60 }) + .find((x) => x.id === "R13").red.length; + if (floorRed === 0) { + console.log(" ✗ R13 地板守卫失效:营销面扫到 0 文件却不判红 —— 目录改名时这五条会集体空转"); + return 1; + } + console.log(" ✓ 地板守卫:扫描面跌破下界即判红(防路径正则失配导致的集体假绿)"); + + return 0; return 0; } @@ -357,8 +582,15 @@ function main() { const files = new Map(); for (const p of walk(path.join(ROOT, "src"))) files.set(path.relative(ROOT, p), readFileSync(p, "utf8")); - const r = checkGrammar(text, files, twConfig); - const unmeasurable = r.filter((x) => x.denominator === 0 && x.id !== "R7"); + // R12 的第二侧:比例数字的 JS 真源。文件读不到时不静默跳过, + // 交 R12 报「缺一侧 = 判据失去目标」—— 静默跳过正是假绿的标准长相。 + const jsSources = {}; + for (const rel of [IMAGE_RATIOS_TS]) { + if (existsSync(path.join(ROOT, rel))) jsSources[rel] = readFileSync(path.join(ROOT, rel), "utf8"); + } + + const r = checkGrammar(text, files, twConfig, { jsSources }); + const unmeasurable = r.filter((x) => x.denominator === 0 && x.id !== "R7" && !/^R1[3-7]$/.test(x.id)); const red = r.filter((x) => x.red.length > 0); console.log("视觉语法对账(Bain 2026-08-31 快照 + Porsche live 实测语法)"); diff --git a/src/app/globals.css b/src/app/globals.css index c0241ac8..2860843f 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -227,6 +227,16 @@ body { --font-size-6xl: 3rem; --font-size-7xl: 3.5rem; --font-size-display: 4.5rem; + /* statement 档(2026-11-02 对标实测新增): + Porsche Consulting 中国站首页 1600 视口下实测字阶为 16(按钮)/18(正文)/24(导语)/40(模块标题) + /64(CTA 声明)/80(招聘带声明)。本仓桌面档在 63px(--font-size-5xl=3.5rem × 根 18px)与 + 108px(--font-size-7xl=6rem × 18px)之间**有一级空档** —— 64/80 那两级无处落, + 此前模板只能拿 5xl(偏小)或 7xl(偏大一倍)凑。实测值: + 移动端 3.5rem × 16px = 56px,768px 起 4rem × 17px = 68px(≈ 对标 64px), + 1024px 起 4.5rem × 18px = 81px(≈ 对标 80px)。 + 字色仍走 --color-text-primary(#0A0E14 对 #FFF 实测 19.1:1,对 --color-bg-secondary + #F8FAFC 实测 18.3:1,均达 AAA)。 */ + --font-size-statement: 3.5rem; /* 行高系统(与字号对应) */ --line-height-caption: 1.4; @@ -259,6 +269,12 @@ body { --spacing-4xl: 6rem; --spacing-5xl: 8rem; --spacing-6xl: 12rem; + /* spacer-band(2026-11-02 对标实测新增):Porsche Consulting 中国站首页在编辑块之后与 + CTA 之后各放了一条**独立的 120px 空模块**(实测两条 `.o-module` 高度均为 120px、 + 内部零内容、padding 为 0)—— 它的节奏不靠段内 padding,而靠一条命名的空白带。 + 记成令牌而不是让各段自定 py,是为了让「呼吸」可数、可比对、可被闸看见。 + 7.5rem 在根字号 16px 下 = 120px,与实测口径一致。 */ + --spacer-band: 7.5rem; /* 圆角系统 —— 0–4px 记档(2026-10-16 对标实测收口) Bain & Company(archive 2026-08-31, 1600×846)与 Porsche Consulting(live)两家的 @@ -324,6 +340,19 @@ body { --container-max: 1360px; --container-padding: 1rem; + /* === 影像比例真源(2026-11-02 对标实测)=== + Porsche Consulting 中国站首页逐个 getBoundingClientRect 量出的**只有四种**比例, + 且每种绑定一个明确的构图角色(不是随手裁的): + hero 全幅 2.31:1(1600×692)· 编辑卡 1.5:1(606×404)· 横向轨 1:1(499/464 见方) + · 行业格 1.42:1(653×459) + 记成令牌而非让 20 个模板各写各的 aspect-[...],是因为本仓真实踩过「两套 gutter 同时在线」 + 那一类病:字面量散落 ⇒ 每次改比例要扫全站,而闸看不见差异。 + JS 侧同一份数在 src/lib/constants/image-ratios.ts,两者必须逐字相等(R12 对账)。 */ + --aspect-hero-wide: 2.31; + --aspect-editorial: 1.5; + --aspect-square: 1; + --aspect-tile: 1.42; + /* === 组件令牌层(Component Tokens)=== */ /* 按钮 */ --btn-height-sm: 2.25rem; @@ -1398,6 +1427,7 @@ p, li, span { --font-size-6xl: 3.75rem; --font-size-7xl: 4.5rem; --font-size-display: 6rem; + --font-size-statement: 4rem; /* 4rem × 根 17px ≈ 68px ≈ 对标 64px 声明档 */ --section-gap: var(--spacing-4xl); --section-gap-sm: var(--spacing-3xl); --section-padding-y: var(--spacing-4xl); @@ -1417,6 +1447,7 @@ p, li, span { --font-size-6xl: 4.5rem; --font-size-7xl: 6rem; --font-size-display: 8rem; + --font-size-statement: 4.5rem; /* 4.5rem × 根 18px = 81px ≈ 对标 80px 声明档 */ --container-padding: 3rem; --section-gap: var(--spacing-5xl); --section-padding-y: var(--spacing-5xl); diff --git a/src/components/detail/detail-cta-section.tsx b/src/components/detail/detail-cta-section.tsx index d263a1ef..3cc3a02e 100644 --- a/src/components/detail/detail-cta-section.tsx +++ b/src/components/detail/detail-cta-section.tsx @@ -21,18 +21,9 @@ export function DetailCTASection({ secondaryAction, }: DetailCTASectionProps) { return ( -
- {/* 背景纹理 */} -
- {/* 装饰光斑容器:overflow-hidden 防止 500px blur 圆撑大 section scrollHeight(伪文本裁剪误报源) */} -
-
-
+
+
+
{/* 标签 */} -
+
免费咨询
-

+

{title}

-

+

{description}

{primaryAction.label} @@ -68,7 +59,7 @@ export function DetailCTASection({ {secondaryAction && ( {secondaryAction.label} @@ -80,7 +71,7 @@ export function DetailCTASection({ whileInView={{ opacity: 1 }} viewport={{ once: true }} transition={{ delay: 0.5, duration: 0.28 }} - className="mt-10 text-sm text-white/70" + className="mt-10 text-sm text-text-muted" > {CTA_COMMITMENT_LINE} diff --git a/src/lib/constants/index.ts b/src/lib/constants/index.ts index 8372cc4f..4d7ace43 100644 --- a/src/lib/constants/index.ts +++ b/src/lib/constants/index.ts @@ -12,6 +12,7 @@ export { METHODOLOGY, type MethodologyPhase } from './methodology'; export { SOLUTIONS, type Solution } from './solutions'; export { CASE_INDUSTRIES, type CaseStudy, type CaseMetric, type CaseTimelinePhase, type CaseService, type CaseTestimonial } from './cases'; export { HERO_THEMES, getHeroTheme, type HeroTheme, type HeroLayout, type HeroTexture } from './hero-themes'; +export { IMAGE_RATIOS, aspectStyle, aspectWidthStyle, type ImageRatio } from './image-ratios'; export { getProductCrossRefs, getSolutionCrossRefs, getServiceCrossRefs, type CrossReference } from './cross-references'; export { SERVICE_COMMITMENTS, diff --git a/tailwind.config.js b/tailwind.config.js index e73b8de9..fe012600 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -152,6 +152,9 @@ module.exports = { '6xl': 'var(--font-size-6xl)', '7xl': 'var(--font-size-7xl)', display: 'var(--font-size-display)', + /* 对标实测声明档(Porsche Consulting 中国站 64/80px)—— 见 globals.css 的 + --font-size-statement 注释:本仓在 63px 与 108px 之间原本有一级空档。 */ + statement: 'var(--font-size-statement)', }, lineHeight: { caption: 'var(--line-height-caption)', @@ -180,6 +183,8 @@ module.exports = { '4xl': 'var(--spacing-4xl)', '5xl': 'var(--spacing-5xl)', '6xl': 'var(--spacing-6xl)', + /* 对标实测的段间空白带(Porsche 首页两条 120px 空模块)。见 globals.css --spacer-band。 */ + band: 'var(--spacer-band)', }, borderRadius: { xs: 'var(--radius-xs)',