impeccable 3.3.1 → 3.5.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.
@@ -109,9 +109,21 @@ function checkColors(opts) {
109
109
  const findings = [];
110
110
 
111
111
  if (hasDirectText && textColor && !isEmojiOnly) {
112
+ // Gradient-clipped text (`background-clip: text`, typically with a
113
+ // transparent text-fill) paints its glyphs *with* the element's own
114
+ // gradient. The `color` value the cascade still reports is never painted,
115
+ // and the gradient is the fill, not a backdrop — so measuring `color`
116
+ // against that gradient (which resolveGradientStops picks up as the
117
+ // element's own background-image) is a guaranteed false positive
118
+ // (issue #409 Case A). Skip the backdrop-contrast checks; the gradient-text
119
+ // rule below still flags the pattern itself. Skipping a rule beats a false
120
+ // positive here — the true painted contrast can't be measured from `color`.
121
+ const isGradientClippedText = bgClip === 'text';
112
122
  // Run background-dependent checks against either a solid bg or, if the
113
123
  // ancestor is a gradient, against every gradient stop (use the worst case).
114
- const bgs = effectiveBg ? [effectiveBg] : (effectiveBgStops && effectiveBgStops.length ? effectiveBgStops : null);
124
+ const bgs = isGradientClippedText
125
+ ? null
126
+ : (effectiveBg ? [effectiveBg] : (effectiveBgStops && effectiveBgStops.length ? effectiveBgStops : null));
115
127
  if (bgs) {
116
128
  // Gray on colored background — flag if every stop is chromatic
117
129
  const textLum = relativeLuminance(textColor);
@@ -444,12 +456,15 @@ function checkHeroEyebrow(opts) {
444
456
  }];
445
457
  }
446
458
 
447
- function checkRepeatedSectionKickers(opts) {
448
- const { candidates, minCount = 3 } = opts;
449
- if (!Array.isArray(candidates) || candidates.length < minCount) return [];
459
+ // Outright ban: one kicker is one too many, so every collected candidate is
460
+ // a finding. The judgment lives in the candidate gate (isKickerCandidate) and
461
+ // the collector's context skips, not in a repetition count.
462
+ function checkKickerAboveHeading(opts) {
463
+ const { candidates } = opts;
464
+ if (!Array.isArray(candidates)) return [];
450
465
  return candidates.map(candidate => ({
451
- id: 'repeated-section-kickers',
452
- snippet: `repeated section kicker "${candidate.kickerText}" before ${candidate.headingTag} "${candidate.headingText}" (${candidates.length} on page)`,
466
+ id: 'kicker-above-heading',
467
+ snippet: `kicker "${candidate.kickerText}" above ${candidate.headingTag} "${candidate.headingText}"`,
453
468
  }));
454
469
  }
455
470
 
@@ -811,7 +826,13 @@ function isZeroOffset(value) {
811
826
  // never see it — pseudo-elements aren't part of the DOM the cascade walks —
812
827
  // so this scans stylesheet text directly, mirroring the border rule's
813
828
  // gates: >= 3px thick, chromatic fill, full height against a side edge.
814
- function scanCssTextForPseudoStripe(content) {
829
+ function scanCssTextForPseudoStripe(rawContent) {
830
+ // Blank comment bodies byte-for-byte so commented-out rules are not
831
+ // scanned as live CSS and every rule keeps its source offset (each
832
+ // finding carries `index` so line-based callers can attribute it and
833
+ // line-scoped inline ignores can match).
834
+ const content = String(rawContent || '').replace(/\/\*[\s\S]*?\*\//g,
835
+ (block) => block.replace(/[^\n]/g, ' '));
815
836
  const customProps = collectCssCustomProps(content);
816
837
  const findings = [];
817
838
  const seen = new Set();
@@ -920,9 +941,13 @@ function scanCssTextForPseudoStripe(content) {
920
941
 
921
942
  if (seen.has(selector)) continue;
922
943
  seen.add(selector);
944
+ // The selector group absorbs whitespace trailing the previous rule;
945
+ // advance past it so `index` points at the selector itself.
946
+ const selectorStart = m.index + (m[1].length - m[1].trimStart().length);
923
947
  findings.push({
924
948
  id: 'side-tab',
925
949
  snippet: `${selector} — absolute ${thicknessPx}px pseudo-element stripe (${edge}: 0)`,
950
+ index: selectorStart,
926
951
  });
927
952
  }
928
953
  return findings;
@@ -1037,9 +1062,11 @@ function collectMarqueeKeyframes(content) {
1037
1062
  // bound to a keyframe loop that travels a large horizontal distance.
1038
1063
  // Rotation/opacity animations never qualify (no X travel); JS-driven
1039
1064
  // carousels with user controls have no infinite CSS X-loop to match.
1040
- function scanCssTextForMarquee(content) {
1065
+ // `content` is CSS-bearing text; `markup` (defaulting to the same string
1066
+ // for single-corpus callers) is where the <marquee> tag itself lives.
1067
+ function scanCssTextForMarquee(content, markup = content) {
1041
1068
  const findings = [];
1042
- if (/<marquee\b/i.test(content)) {
1069
+ if (/<marquee\b/i.test(markup)) {
1043
1070
  findings.push({ id: 'marquee', snippet: '<marquee> element' });
1044
1071
  }
1045
1072
  const marqueeKeyframes = collectMarqueeKeyframes(content);
@@ -1218,10 +1245,14 @@ function selectorHitsLandmark(content, selector, ranges) {
1218
1245
  // element sits inside a header/nav landmark is the hero liveness cliché
1219
1246
  // and is promoted to error severity; occurrences elsewhere keep the
1220
1247
  // registry default severity.
1221
- function scanCssTextForPulsingDot(content) {
1248
+ //
1249
+ // `content` is CSS-bearing text (rules and keyframes); `markup` — defaulting
1250
+ // to the same string for single-corpus callers like the regex source
1251
+ // engine — is where landmark ranges and Tailwind class attributes live.
1252
+ function scanCssTextForPulsingDot(content, markup = content) {
1222
1253
  const customProps = collectCssCustomProps(content);
1223
1254
  const keyframes = collectPulseKeyframes(content);
1224
- const heroRanges = landmarkSourceRanges(content);
1255
+ const heroRanges = landmarkSourceRanges(markup);
1225
1256
  const findings = [];
1226
1257
  const seen = new Set();
1227
1258
 
@@ -1270,7 +1301,7 @@ function scanCssTextForPulsingDot(content) {
1270
1301
 
1271
1302
  if (seen.has(selector)) continue;
1272
1303
  seen.add(selector);
1273
- const inLandmark = selectorHitsLandmark(content, selector, heroRanges);
1304
+ const inLandmark = selectorHitsLandmark(markup, selector, heroRanges);
1274
1305
  findings.push({
1275
1306
  id: 'pulsing-dot',
1276
1307
  snippet: `${selector} — ${w}x${h}px dot with infinite "${pulseName}" animation${inLandmark ? ' in header/nav' : ''}`,
@@ -1280,10 +1311,11 @@ function scanCssTextForPulsingDot(content) {
1280
1311
  }
1281
1312
 
1282
1313
  // Tailwind utilities: animate-ping / animate-pulse on a tiny rounded-full
1283
- // element declared entirely in the class attribute.
1314
+ // element declared entirely in the class attribute. Scanned in the markup
1315
+ // corpus so the match index lines up with the landmark ranges.
1284
1316
  const classRe = /class\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;
1285
1317
  let cm;
1286
- while ((cm = classRe.exec(content)) !== null) {
1318
+ while ((cm = classRe.exec(markup)) !== null) {
1287
1319
  const cls = cm[1] || cm[2] || '';
1288
1320
  const anim = cls.match(/\banimate-(ping|pulse)\b/);
1289
1321
  if (!anim) continue;
@@ -1364,20 +1396,64 @@ function scanHtmlForShapeAssembledIllustration(html) {
1364
1396
  return findings;
1365
1397
  }
1366
1398
 
1399
+ // Scoped scan corpora for the page-level pattern checks. CSS-property
1400
+ // regexes run over the whole source string fire on documentation ABOUT
1401
+ // css — `<code>background-clip: text</code>` prose, <pre> samples, HTML
1402
+ // comments — so the checks scan only the strings that actually style the
1403
+ // page:
1404
+ // styleText — <style> block contents plus style="…" attribute values.
1405
+ // Attribute values keep their `style="…"` form so block-scoped
1406
+ // scanners (grid background) keep treating each attribute as one
1407
+ // declaration block, exactly as they did against raw source. Engines
1408
+ // that already read more CSS (linked stylesheets) prepend it.
1409
+ // classText — class attribute values, for utility-class scans.
1410
+ // Markup-shaped checks (inline <svg> scenes, <img> tags, <marquee>,
1411
+ // landmark ranges) and rendered-text checks (theater phrases) keep the
1412
+ // full source. This extraction serves callers without a parsed document
1413
+ // (the browser bundle scanning outerHTML); attribute reads are tag-scoped
1414
+ // so escaped code samples (&lt;div style="…"&gt;) never contribute. The
1415
+ // static engine passes richer corpora built from its parsed document.
1416
+ // Bare CSS input (no markup at all) is its own style text, which keeps
1417
+ // direct checkHtmlPatterns(css) callers behaving as before.
1418
+ function buildHtmlPatternCorpora(html) {
1419
+ const source = String(html || '');
1420
+ if (!/<[a-zA-Z!/]/.test(source)) {
1421
+ return { styleText: source, classText: source };
1422
+ }
1423
+ const styleParts = [];
1424
+ const classParts = [];
1425
+ const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
1426
+ let m;
1427
+ while ((m = styleBlockRe.exec(source)) !== null) styleParts.push(m[1]);
1428
+ const tagRe = /<[a-zA-Z][^>]*>/g;
1429
+ while ((m = tagRe.exec(source)) !== null) {
1430
+ const tag = m[0];
1431
+ const sm = tag.match(/\bstyle\s*=\s*("[^"]*"|'[^']*')/i);
1432
+ if (sm) styleParts.push(`style=${sm[1]}`);
1433
+ const cm = tag.match(/\bclass\s*=\s*(?:"([^"]*)"|'([^']*)')/i);
1434
+ if (cm) classParts.push(cm[1] ?? cm[2] ?? '');
1435
+ }
1436
+ return { styleText: styleParts.join('\n'), classText: classParts.join('\n') };
1437
+ }
1438
+
1367
1439
  /**
1368
1440
  * Regex-on-HTML checks shared between browser and Node page-level detection.
1369
- * These don't need DOM access, just the raw HTML string.
1441
+ * These don't need DOM access, just the raw HTML string. CSS-property and
1442
+ * utility-class patterns scan the scoped corpora (styleText / classText —
1443
+ * see buildHtmlPatternCorpora) so prose about css never flags; only the
1444
+ * markup-shaped and rendered-text checks read the full source.
1370
1445
  */
1371
- function checkHtmlPatterns(html) {
1446
+ function checkHtmlPatterns(html, corpora) {
1447
+ const { styleText, classText } = corpora || buildHtmlPatternCorpora(html);
1372
1448
  const findings = [];
1373
1449
 
1374
1450
  // --- Color ---
1375
1451
 
1376
1452
  // AI color palette: purple/violet
1377
1453
  const purpleHexRe = /#(?:7c3aed|8b5cf6|a855f7|9333ea|7e22ce|6d28d9|6366f1|764ba2|667eea)\b/gi;
1378
- if (purpleHexRe.test(html)) {
1454
+ if (purpleHexRe.test(styleText)) {
1379
1455
  const purpleTextRe = /(?:(?:^|;)\s*color\s*:\s*(?:.*?)(?:#(?:7c3aed|8b5cf6|a855f7|9333ea|7e22ce|6d28d9))|gradient.*?#(?:7c3aed|8b5cf6|a855f7|764ba2|667eea))/gi;
1380
- if (purpleTextRe.test(html)) {
1456
+ if (purpleTextRe.test(styleText)) {
1381
1457
  findings.push({ id: 'ai-color-palette', snippet: 'Purple/violet accent colors detected' });
1382
1458
  }
1383
1459
  }
@@ -1385,15 +1461,15 @@ function checkHtmlPatterns(html) {
1385
1461
  // Gradient text (background-clip: text + gradient)
1386
1462
  const gradientRe = /(?:-webkit-)?background-clip\s*:\s*text/gi;
1387
1463
  let gm;
1388
- while ((gm = gradientRe.exec(html)) !== null) {
1464
+ while ((gm = gradientRe.exec(styleText)) !== null) {
1389
1465
  const start = Math.max(0, gm.index - 200);
1390
- const context = html.substring(start, gm.index + gm[0].length + 200);
1466
+ const context = styleText.substring(start, gm.index + gm[0].length + 200);
1391
1467
  if (/gradient/i.test(context)) {
1392
1468
  findings.push({ id: 'gradient-text', snippet: 'background-clip: text + gradient' });
1393
1469
  break;
1394
1470
  }
1395
1471
  }
1396
- if (/\bbg-clip-text\b/.test(html) && /\bbg-gradient-to-/.test(html)) {
1472
+ if (/\bbg-clip-text\b/.test(classText) && /\bbg-gradient-to-/.test(classText)) {
1397
1473
  findings.push({ id: 'gradient-text', snippet: 'bg-clip-text + bg-gradient (Tailwind)' });
1398
1474
  }
1399
1475
 
@@ -1402,10 +1478,10 @@ function checkHtmlPatterns(html) {
1402
1478
  // Side-tab accent stripe drawn as an absolutely-positioned pseudo-element
1403
1479
  // (no border property involved, so the element-level border checks and
1404
1480
  // the border-left regexes never see it).
1405
- findings.push(...scanCssTextForPseudoStripe(html));
1481
+ findings.push(...scanCssTextForPseudoStripe(styleText));
1406
1482
 
1407
1483
  // Side-tab accent stripe drawn as a single-edge inset box-shadow.
1408
- findings.push(...scanCssTextForInsetStripe(html));
1484
+ findings.push(...scanCssTextForInsetStripe(styleText));
1409
1485
 
1410
1486
  // --- Layout ---
1411
1487
 
@@ -1413,20 +1489,20 @@ function checkHtmlPatterns(html) {
1413
1489
  const spacingValues = [];
1414
1490
  const spacingRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*(\d+)px/gi;
1415
1491
  let sm;
1416
- while ((sm = spacingRe.exec(html)) !== null) {
1492
+ while ((sm = spacingRe.exec(styleText)) !== null) {
1417
1493
  const v = parseInt(sm[1], 10);
1418
1494
  if (v > 0 && v < 200) spacingValues.push(v);
1419
1495
  }
1420
1496
  const gapRe = /gap\s*:\s*(\d+)px/gi;
1421
- while ((sm = gapRe.exec(html)) !== null) {
1497
+ while ((sm = gapRe.exec(styleText)) !== null) {
1422
1498
  spacingValues.push(parseInt(sm[1], 10));
1423
1499
  }
1424
1500
  const twSpaceRe = /\b(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)-(\d+)\b/g;
1425
- while ((sm = twSpaceRe.exec(html)) !== null) {
1501
+ while ((sm = twSpaceRe.exec(classText)) !== null) {
1426
1502
  spacingValues.push(parseInt(sm[1], 10) * 4);
1427
1503
  }
1428
1504
  const remSpacingRe = /(?:padding|margin)(?:-(?:top|right|bottom|left))?\s*:\s*([\d.]+)rem/gi;
1429
- while ((sm = remSpacingRe.exec(html)) !== null) {
1505
+ while ((sm = remSpacingRe.exec(styleText)) !== null) {
1430
1506
  const v = Math.round(parseFloat(sm[1]) * 16);
1431
1507
  if (v > 0 && v < 200) spacingValues.push(v);
1432
1508
  }
@@ -1450,7 +1526,7 @@ function checkHtmlPatterns(html) {
1450
1526
 
1451
1527
  // Bounce/elastic animation names
1452
1528
  const bounceRe = /animation(?:-name)?\s*:\s*([^;{}]*(?:bounce|elastic|wobble|jiggle|spring)[^;{}]*)/gi;
1453
- const bounceMatch = bounceRe.exec(html);
1529
+ const bounceMatch = bounceRe.exec(styleText);
1454
1530
  if (bounceMatch) {
1455
1531
  const animationToken = bounceMatch[1]
1456
1532
  .split(/[,\s]+/)
@@ -1461,7 +1537,7 @@ function checkHtmlPatterns(html) {
1461
1537
  // Overshoot cubic-bezier
1462
1538
  const bezierRe = /cubic-bezier\(\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*,\s*([\d.-]+)\s*\)/g;
1463
1539
  let bm;
1464
- while ((bm = bezierRe.exec(html)) !== null) {
1540
+ while ((bm = bezierRe.exec(styleText)) !== null) {
1465
1541
  const y1 = parseFloat(bm[2]), y2 = parseFloat(bm[4]);
1466
1542
  if (y1 < -0.1 || y1 > 1.1 || y2 < -0.1 || y2 > 1.1) {
1467
1543
  findings.push({ id: 'bounce-easing', snippet: `cubic-bezier(${bm[1]}, ${bm[2]}, ${bm[3]}, ${bm[4]})` });
@@ -1472,7 +1548,7 @@ function checkHtmlPatterns(html) {
1472
1548
  // Layout property transitions
1473
1549
  const transRe = /transition(?:-property)?\s*:\s*([^;{}]+)/gi;
1474
1550
  let tm;
1475
- while ((tm = transRe.exec(html)) !== null) {
1551
+ while ((tm = transRe.exec(styleText)) !== null) {
1476
1552
  const val = tm[1].toLowerCase();
1477
1553
  if (/\ball\b/.test(val)) continue;
1478
1554
  const found = val.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
@@ -1482,30 +1558,32 @@ function checkHtmlPatterns(html) {
1482
1558
  }
1483
1559
  }
1484
1560
 
1485
- // Pulsing status dots (tiny circular elements on infinite pulse animations)
1486
- findings.push(...scanCssTextForPulsingDot(html));
1561
+ // Pulsing status dots (tiny circular elements on infinite pulse animations).
1562
+ // The CSS rules come from styleText; the markup carries the landmark
1563
+ // ranges and Tailwind class attributes.
1564
+ findings.push(...scanCssTextForPulsingDot(styleText, html));
1487
1565
 
1488
1566
  // Shape-assembled illustrations (large pictorial SVGs built from primitives)
1489
1567
  findings.push(...scanHtmlForShapeAssembledIllustration(html));
1490
1568
 
1491
1569
  // Auto-scrolling marquees (<marquee> or infinite horizontal loop animations)
1492
- findings.push(...scanCssTextForMarquee(html));
1570
+ findings.push(...scanCssTextForMarquee(styleText, html));
1493
1571
 
1494
1572
  // --- Dark glow / chromatic halo shadows ---
1495
1573
 
1496
- const glowHits = scanCssTextForGlow(html);
1574
+ const glowHits = scanCssTextForGlow(styleText);
1497
1575
  if (glowHits.length > 0) {
1498
1576
  findings.push({ id: 'dark-glow', snippet: glowHits[0].snippet });
1499
1577
  }
1500
1578
 
1501
1579
  // Radial-gradient background halo (gradient-drawn sibling of dark-glow)
1502
- const haloHits = scanCssTextForRadialHalo(html);
1580
+ const haloHits = scanCssTextForRadialHalo(styleText);
1503
1581
  if (haloHits.length > 0) {
1504
1582
  findings.push({ id: 'radial-halo', snippet: haloHits[0].snippet });
1505
1583
  }
1506
1584
 
1507
1585
  // --- Generated-UI tells: repeating-gradient stripes ---
1508
- if (/repeating-(?:linear|radial|conic)-gradient\s*\(/i.test(html)) {
1586
+ if (/repeating-(?:linear|radial|conic)-gradient\s*\(/i.test(styleText)) {
1509
1587
  findings.push({ id: 'repeating-stripes-gradient', snippet: 'repeating-gradient decorative stripes' });
1510
1588
  }
1511
1589
 
@@ -1522,7 +1600,7 @@ function checkHtmlPatterns(html) {
1522
1600
  // in for the second axis. Colors like `oklch(96% 0.012 82 / 0.055)` carry
1523
1601
  // nested parens, so match the hairline stop directly rather than parsing
1524
1602
  // whole gradient layers.
1525
- const gridHits = scanCssTextForGridBackground(html);
1603
+ const gridHits = scanCssTextForGridBackground(styleText);
1526
1604
  if (gridHits.length > 0) {
1527
1605
  findings.push({ id: 'codex-grid-background', snippet: gridHits[0].snippet });
1528
1606
  }
@@ -1544,7 +1622,7 @@ function checkHtmlPatterns(html) {
1544
1622
  // hover:rotate / hover:translate utility on an <img>. Each distinct
1545
1623
  // mechanism is its own finding.
1546
1624
  const imgHoverCss = /\bimg\b[^,{}]*:hover\b[^{}]*\{[^}]*\btransform\s*:\s*(?:scale|rotate|translate|matrix|skew)/i;
1547
- if (imgHoverCss.test(html)) {
1625
+ if (imgHoverCss.test(styleText)) {
1548
1626
  findings.push({ id: 'image-hover-transform', snippet: 'img:hover { transform } rule' });
1549
1627
  }
1550
1628
  const imgTagRe = /<img\b[^>]*\bclass\s*=\s*"([^"]*)"/gi;
@@ -1669,29 +1747,54 @@ function resolveBackground(el, win, customPropMap) {
1669
1747
  // Walk parents looking for a gradient background and return its color stops.
1670
1748
  // Used as a fallback when resolveBackground() returns null because the
1671
1749
  // effective background is a gradient (no single solid color to compare against).
1672
- function resolveGradientStops(el, win) {
1750
+ function resolveGradientStops(el, win, customPropMap) {
1673
1751
  let current = el;
1674
1752
  while (current && current.nodeType === 1) {
1675
1753
  const style = DETECTOR_IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
1676
1754
  const bgImage = style.backgroundImage || '';
1755
+ let stops = null;
1677
1756
  if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
1678
- const stops = parseGradientColors(bgImage);
1679
- if (stops.length > 0) return stops;
1757
+ const parsed = parseGradientColors(bgImage);
1758
+ if (parsed.length > 0) stops = parsed;
1680
1759
  }
1681
- if (!DETECTOR_IS_BROWSER) {
1760
+ if (!stops && !DETECTOR_IS_BROWSER) {
1682
1761
  // jsdom doesn't decompose `background:` shorthand — peek at the raw inline style
1683
1762
  const rawStyle = current.getAttribute?.('style') || '';
1684
1763
  const bgMatch = rawStyle.match(/background(?:-image)?\s*:\s*([^;]+)/i);
1685
1764
  if (bgMatch && /gradient/i.test(bgMatch[1])) {
1686
- const stops = parseGradientColors(bgMatch[1]);
1687
- if (stops.length > 0) return stops;
1765
+ const parsed = parseGradientColors(bgMatch[1]);
1766
+ if (parsed.length > 0) stops = parsed;
1688
1767
  }
1689
1768
  }
1769
+ if (stops) return compositeGradientStops(stops, current, win, customPropMap);
1690
1770
  current = current.parentElement;
1691
1771
  }
1692
1772
  return null;
1693
1773
  }
1694
1774
 
1775
+ // A translucent gradient stop (e.g. a faint `rgba(52,192,168,0.09)` accent
1776
+ // glow) paints over whatever surface sits beneath the gradient — the browser
1777
+ // composites it, so its effective color is far closer to the base than to the
1778
+ // full-opacity accent. Treating the stop as opaque flags every text child of a
1779
+ // softly-glowing section as low-contrast (issue #409 Case B). Composite each
1780
+ // alpha stop over the resolved surface beneath the gradient element. When that
1781
+ // surface isn't resolvable (another gradient above, no opaque ancestor), drop
1782
+ // the translucent stop rather than guess: a dropped stop can't manufacture a
1783
+ // false finding, and skipping beats a wrong ratio.
1784
+ function compositeGradientStops(stops, gradientEl, win, customPropMap) {
1785
+ const hasAlpha = stops.some(s => (s.a ?? 1) < 0.99);
1786
+ if (!hasAlpha) return stops;
1787
+ const base = resolveBackground(gradientEl.parentElement || gradientEl, win, customPropMap);
1788
+ const out = [];
1789
+ for (const s of stops) {
1790
+ const a = s.a ?? 1;
1791
+ if (a >= 0.99) { out.push(s); continue; }
1792
+ if (base) out.push(compositeColorOver(s, base));
1793
+ // else: unresolvable base — drop the translucent stop (skip, don't guess).
1794
+ }
1795
+ return out.length ? out : null;
1796
+ }
1797
+
1695
1798
  // Parse a single CSS length token to pixels. Accepts "12px", "50%", a
1696
1799
  // shorthand like "12px 4px" (uses the first value), or empty / null.
1697
1800
  // Returns the pixel value, or null when the input is unparseable.
@@ -2341,7 +2444,7 @@ function parseColorResolved(str, customPropMap) {
2341
2444
  return parseAnyColor(resolved);
2342
2445
  }
2343
2446
 
2344
- const REPEATED_KICKER_SKIP_SELECTOR = [
2447
+ const KICKER_SKIP_SELECTOR = [
2345
2448
  'nav',
2346
2449
  'form',
2347
2450
  'table',
@@ -2360,7 +2463,7 @@ const REPEATED_KICKER_SKIP_SELECTOR = [
2360
2463
  '[data-impeccable-allow-kickers]',
2361
2464
  ].join(',');
2362
2465
 
2363
- const REPEATED_KICKER_CARD_CONTEXT_SELECTOR = [
2466
+ const KICKER_CARD_CONTEXT_SELECTOR = [
2364
2467
  'article',
2365
2468
  'button',
2366
2469
  'a',
@@ -2378,23 +2481,32 @@ function cleanInlineText(el) {
2378
2481
  .trim();
2379
2482
  }
2380
2483
 
2381
- function isRepeatedKickerCardContext(heading, kicker) {
2382
- const item = heading.closest?.(REPEATED_KICKER_CARD_CONTEXT_SELECTOR);
2484
+ function isKickerCardContext(heading, kicker) {
2485
+ const item = heading.closest?.(KICKER_CARD_CONTEXT_SELECTOR);
2383
2486
  return Boolean(item && (!item.contains || item.contains(kicker)));
2384
2487
  }
2385
2488
 
2386
- function isRepeatedKickerCandidate(opts) {
2489
+ // Meta lines above headlines join category and date (or path crumbs) with
2490
+ // separator glyphs, or carry a year. A kicker is one short phrase; metadata
2491
+ // keeps its markers.
2492
+ const KICKER_META_TEXT_RE = /[·•|]|\s[\/›»>]\s|\b(19|20)\d{2}\b/;
2493
+ // Legal and document numbering: "Section 4.2", "Article IX", "§ 12.3",
2494
+ // dotted decimal outlines. The label identifies the clause, so it stays.
2495
+ const KICKER_DOC_NUMBERING_RE = /^(§|\d+(\.\d+)+\b|(section|article|clause|appendix|exhibit|schedule|chapter|part|rule|title)\s+([\divxlc]+\b|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b)/i;
2496
+
2497
+ function isKickerCandidate(opts) {
2387
2498
  const {
2388
- headingTag,
2499
+ headingLevel,
2389
2500
  headingText,
2390
2501
  headingFontSize,
2391
2502
  kickerTag,
2392
2503
  kickerText,
2393
2504
  kickerTextTransform,
2505
+ kickerFontVariant,
2394
2506
  kickerFontSize,
2395
2507
  kickerLetterSpacing,
2396
2508
  } = opts;
2397
- if (!['h2', 'h3', 'h4'].includes(headingTag)) return false;
2509
+ if (!headingLevel || headingLevel > 4) return false;
2398
2510
  if (!headingText || headingText.length < 3) return false;
2399
2511
  if (/^\/[\w-]+/i.test(headingText.replace(/^"|"$/g, '').trim())) return false;
2400
2512
  if (!(headingFontSize >= 20)) return false;
@@ -2402,47 +2514,82 @@ function isRepeatedKickerCandidate(opts) {
2402
2514
  if (!['p', 'span', 'div', 'small'].includes(kickerTag)) return false;
2403
2515
  if (!kickerText || kickerText.length < 2 || kickerText.length > 34) return false;
2404
2516
  if (/^step\s*\d+/i.test(kickerText) || /^\d{1,2}$/.test(kickerText)) return false;
2517
+ if (KICKER_META_TEXT_RE.test(kickerText)) return false;
2518
+ if (KICKER_DOC_NUMBERING_RE.test(kickerText)) return false;
2405
2519
 
2520
+ const isSmallCaps = /small-caps/.test(kickerFontVariant || '');
2406
2521
  const isUppercased = kickerTextTransform === 'uppercase'
2407
- || (/[A-Z]/.test(kickerText) && !/[a-z]/.test(kickerText));
2522
+ || (/[A-Z]/.test(kickerText) && !/[a-z]/.test(kickerText))
2523
+ || isSmallCaps;
2408
2524
  if (!isUppercased) return false;
2409
2525
  if (!(kickerFontSize > 0 && kickerFontSize <= 14)) return false;
2410
- const minTrackedSpacing = Math.max(1, kickerFontSize * 0.08);
2526
+ // Proportional only, no absolute floor: the wild's most common recipe is
2527
+ // 0.08em at a sub-13px size, which computes to under 1px and sailed past
2528
+ // the old Math.max(1, ...) floor (observed live: a page whose kickers were
2529
+ // literally class="kicker" produced zero findings).
2530
+ const minTrackedSpacing = kickerFontSize * 0.06;
2411
2531
  if (!(kickerLetterSpacing >= minTrackedSpacing)) return false;
2412
2532
  return true;
2413
2533
  }
2414
2534
 
2415
- function collectRepeatedSectionKickerCandidates(doc, getStyle, resolveLetterSpacing) {
2535
+ // Resolve a heading level for the anchor element: 1-4 for h1-h4, aria-level
2536
+ // (default 2) for role="heading" elements, 0 otherwise.
2537
+ function kickerHeadingLevel(heading) {
2538
+ const tag = heading.tagName.toLowerCase();
2539
+ const byTag = /^h([1-6])$/.exec(tag);
2540
+ if (byTag) return parseInt(byTag[1], 10);
2541
+ const role = heading.getAttribute?.('role') || '';
2542
+ if (role.toLowerCase() !== 'heading') return 0;
2543
+ const ariaLevel = parseInt(heading.getAttribute?.('aria-level') || '', 10);
2544
+ return Number.isFinite(ariaLevel) && ariaLevel >= 1 ? ariaLevel : 2;
2545
+ }
2546
+
2547
+ function collectKickerCandidates(doc, getStyle, resolveLetterSpacing) {
2416
2548
  const candidates = [];
2417
- for (const heading of doc.querySelectorAll('h2, h3, h4')) {
2418
- if (heading.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
2549
+ for (const heading of doc.querySelectorAll('h1, h2, h3, h4, [role="heading"]')) {
2550
+ const headingLevel = kickerHeadingLevel(heading);
2551
+ if (!headingLevel || headingLevel > 4) continue;
2552
+ if (heading.closest?.(KICKER_SKIP_SELECTOR)) continue;
2553
+ // Application contexts (tab panels, dialogs) use compact context labels
2554
+ // above headings to describe state, not to decorate. Same carve-out the
2555
+ // hero-eyebrow rule makes.
2556
+ if (heading.closest?.('[role="tabpanel"], [role="dialog"], [role="application"], dialog')) continue;
2419
2557
  const kicker = heading.previousElementSibling;
2420
- if (!kicker || kicker.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
2421
- if (isRepeatedKickerCardContext(heading, kicker)) continue;
2558
+ if (!kicker || kicker.closest?.(KICKER_SKIP_SELECTOR)) continue;
2559
+ if (isKickerCardContext(heading, kicker)) continue;
2422
2560
 
2423
2561
  const headingStyle = getStyle(heading);
2424
2562
  const kickerStyle = getStyle(kicker);
2563
+ const headingTag = heading.tagName.toLowerCase();
2425
2564
  const headingText = (heading.textContent || '').replace(/\s+/g, ' ').trim();
2426
2565
  const kickerText = cleanInlineText(kicker) || (kicker.textContent || '').replace(/\s+/g, ' ').trim();
2427
2566
  const headingFontSize = resolveLetterSpacing(headingStyle.fontSize || '', 16) || parseFloat(headingStyle.fontSize) || 0;
2428
2567
  const kickerFontSize = resolveLetterSpacing(kickerStyle.fontSize || '', 16) || parseFloat(kickerStyle.fontSize) || 0;
2429
2568
  const kickerLetterSpacing = resolveLetterSpacing(kickerStyle.letterSpacing || '', kickerFontSize);
2430
2569
 
2431
- if (!isRepeatedKickerCandidate({
2432
- headingTag: heading.tagName.toLowerCase(),
2570
+ if (!isKickerCandidate({
2571
+ headingLevel,
2433
2572
  headingText,
2434
2573
  headingFontSize,
2435
2574
  kickerTag: kicker.tagName.toLowerCase(),
2436
2575
  kickerText,
2437
2576
  kickerTextTransform: kickerStyle.textTransform || '',
2577
+ kickerFontVariant: `${kickerStyle.fontVariant || ''} ${kickerStyle.fontVariantCaps || ''}`,
2438
2578
  kickerFontSize,
2439
2579
  kickerLetterSpacing,
2440
2580
  })) {
2441
2581
  continue;
2442
2582
  }
2443
2583
 
2584
+ // A tracked-caps eyebrow above a hero-scale h1 belongs to
2585
+ // hero-eyebrow-chip (which also covers the accent-bold and dash-prefix
2586
+ // stylings there). Stand down so one element gets one finding.
2587
+ if (headingTag === 'h1' && headingFontSize >= 48 && kickerLetterSpacing >= 1.6) {
2588
+ continue;
2589
+ }
2590
+
2444
2591
  candidates.push({
2445
- headingTag: heading.tagName.toLowerCase(),
2592
+ headingTag,
2446
2593
  headingText: headingText.replace(/^"|"$/g, '').slice(0, 60),
2447
2594
  kickerText: kickerText.slice(0, 40),
2448
2595
  });
@@ -2450,17 +2597,17 @@ function collectRepeatedSectionKickerCandidates(doc, getStyle, resolveLetterSpac
2450
2597
  return candidates;
2451
2598
  }
2452
2599
 
2453
- function checkRepeatedSectionKickersDOM() {
2454
- const candidates = collectRepeatedSectionKickerCandidates(
2600
+ function checkKickerAboveHeadingDOM() {
2601
+ const candidates = collectKickerCandidates(
2455
2602
  document,
2456
2603
  (el) => getComputedStyle(el),
2457
2604
  (value, fontSize) => resolveLengthPx(value, fontSize) || 0,
2458
2605
  );
2459
- return checkRepeatedSectionKickers({ candidates });
2606
+ return checkKickerAboveHeading({ candidates });
2460
2607
  }
2461
2608
 
2462
2609
  // ── Numbered section labels ─────────────────────────────────────────────────
2463
- // Sibling of the repeated-kicker rule: instead of a tracked uppercase word,
2610
+ // Sibling of the kicker-above-heading rule: instead of a tracked uppercase word,
2464
2611
  // the section scaffold is a tiny numeric index riding beside each section
2465
2612
  // heading — bare and zero-padded, or an index joined to a short micro-label
2466
2613
  // by a separator glyph. The kicker rule deliberately excludes bare 1-2 digit
@@ -2514,7 +2661,7 @@ function collectNumberedSectionLabelCandidates(doc, getStyle, resolveLetterSpaci
2514
2661
  const candidates = [];
2515
2662
  const seenLabels = new Set();
2516
2663
  for (const heading of doc.querySelectorAll('h2, h3, h4')) {
2517
- if (heading.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
2664
+ if (heading.closest?.(KICKER_SKIP_SELECTOR)) continue;
2518
2665
  // The index sits either directly before the heading, or before the
2519
2666
  // wrapper the heading leads (label | <div><h2>…</h2>…</div>).
2520
2667
  let label = heading.previousElementSibling;
@@ -2524,9 +2671,9 @@ function collectNumberedSectionLabelCandidates(doc, getStyle, resolveLetterSpaci
2524
2671
  if (firstChild === heading) label = parent.previousElementSibling;
2525
2672
  }
2526
2673
  if (!label || seenLabels.has(label)) continue;
2527
- if (label.closest?.(REPEATED_KICKER_SKIP_SELECTOR)) continue;
2674
+ if (label.closest?.(KICKER_SKIP_SELECTOR)) continue;
2528
2675
  if (HEADING_TAGS.has(label.tagName.toLowerCase())) continue;
2529
- if (isRepeatedKickerCardContext(heading, label)) continue;
2676
+ if (isKickerCardContext(heading, label)) continue;
2530
2677
 
2531
2678
  const labelText = cleanInlineText(label) || (label.textContent || '').replace(/\s+/g, ' ').trim();
2532
2679
  const parsed = parseNumberedLabelText(labelText);
@@ -2729,6 +2876,131 @@ function checkElementAIPaletteDOM(el) {
2729
2876
  return findings;
2730
2877
  }
2731
2878
 
2879
+ // ─── Decorative radial spotlight glow ───────────────────────────────────────
2880
+ // A soft, low-opacity chromatic radial-gradient fading to transparent, painted
2881
+ // as a decorative wash behind a hero or section. The translucent sibling of the
2882
+ // `radial-halo` tell: `radial-halo` requires a saturated, near-opaque center on
2883
+ // a dark page; this catches the low-alpha "spotlight" the halo gate lets slip
2884
+ // (e.g. `radial-gradient(circle at 52% 38%, rgba(80,111,255,0.26),
2885
+ // transparent 44%)`). The two alpha bands are disjoint, so they never
2886
+ // double-report the same declaration.
2887
+ const SPOTLIGHT_COLOR_TOKEN_RE = /(?:rgba?|hsla?|oklch|oklab|lab|lch|hwb|color-mix)\([^)]*(?:\([^)]*\))?[^)]*\)|#[0-9a-f]{3,8}\b|\btransparent\b/i;
2888
+
2889
+ // Parse the FIRST non-repeating radial-gradient in a background value into its
2890
+ // ordered color stops. Each stop is { color: {r,g,b,a} | null, transparent }.
2891
+ // Returns null when there is no plain radial-gradient to read.
2892
+ function parseRadialGradientStops(value) {
2893
+ if (!value || !/radial-gradient/i.test(value)) return null;
2894
+ const gradRe = /(repeating-)?radial-gradient\(/gi;
2895
+ let g;
2896
+ while ((g = gradRe.exec(value)) !== null) {
2897
+ if (g[1]) continue; // repeating-* is a pattern, not a spotlight
2898
+ let depth = 0, end = -1;
2899
+ const open = value.indexOf('(', g.index);
2900
+ for (let i = open; i < value.length; i++) {
2901
+ if (value[i] === '(') depth++;
2902
+ else if (value[i] === ')') { depth--; if (depth === 0) { end = i; break; } }
2903
+ }
2904
+ if (end < 0) return null;
2905
+ const args = splitTopLevelCommas(value.slice(open + 1, end));
2906
+ // The optional prelude (shape / size / `at <pos>`) carries no color token.
2907
+ const stopArgs = args.filter(a => SPOTLIGHT_COLOR_TOKEN_RE.test(a));
2908
+ if (stopArgs.length < 2) return null;
2909
+ return stopArgs.map(a => {
2910
+ const tok = a.match(SPOTLIGHT_COLOR_TOKEN_RE);
2911
+ if (!tok) return { color: null, transparent: false };
2912
+ if (/^transparent$/i.test(tok[0])) return { color: null, transparent: true };
2913
+ const color = parseAnyColor(tok[0]);
2914
+ return { color, transparent: !!color && (color.a ?? 1) <= 0.05 };
2915
+ });
2916
+ }
2917
+ return null;
2918
+ }
2919
+
2920
+ // Pure gate. `label` is a stable identifier the fixture test keys on.
2921
+ function checkRadialSpotlight({ gradientValue, width, height, label }) {
2922
+ const stops = parseRadialGradientStops(gradientValue);
2923
+ if (!stops || stops.length < 2) return [];
2924
+
2925
+ // Must fade OUT: the last stop is transparent / near-zero alpha. A gradient
2926
+ // between two visible surfaces is a real background, not a floating glow.
2927
+ const last = stops[stops.length - 1];
2928
+ const lastAlpha = last.transparent ? 0 : (last.color ? (last.color.a ?? 1) : 1);
2929
+ if (lastAlpha > 0.05) return [];
2930
+
2931
+ // The visible (non-transparent, parseable) color stops.
2932
+ const colored = stops.filter(s => !s.transparent && s.color && (s.color.a ?? 1) > 0.05);
2933
+ if (colored.length === 0) return [];
2934
+ // One soft glow, not a multi-color composition: at most two visible stops.
2935
+ if (colored.length > 2) return [];
2936
+ // Every visible stop must be LOW opacity. Any opaque stop means a real fill
2937
+ // or a saturated halo (`radial-halo`'s job), not this translucent spotlight.
2938
+ if (colored.some(s => (s.color.a ?? 1) >= 0.45)) return [];
2939
+ // At least one visible stop must be chromatic. A neutral (grayscale)
2940
+ // near-black / near-white vignette is a legitimate lighting move, exempt.
2941
+ const chromatic = colored.find(s => hasChroma(s.color, 24));
2942
+ if (!chromatic) return [];
2943
+
2944
+ // Decorative-scale gate. Badges, avatars, and actual small "lights" are
2945
+ // exempt; a spotlight glow only reads as slop when it washes a large surface.
2946
+ if (!(width >= 240 && height >= 160)) return [];
2947
+
2948
+ const alpha = (chromatic.color.a ?? 1).toFixed(2);
2949
+ const name = label || 'section';
2950
+ return [{
2951
+ id: 'radial-spotlight-glow',
2952
+ snippet: `radial-gradient spotlight glow "${name}" (${colorToHex(chromatic.color)} a${alpha} → transparent) on ${Math.round(width)}x${Math.round(height)} surface`,
2953
+ }];
2954
+ }
2955
+
2956
+ // Read the raw radial-gradient source off an element's computed style, with a
2957
+ // fallback to the `background` shorthand and the inline style attribute for
2958
+ // engines that don't decompose the shorthand into backgroundImage.
2959
+ function elementGradientValue(style, el) {
2960
+ const bgImage = style.backgroundImage && style.backgroundImage !== 'none' ? style.backgroundImage : '';
2961
+ if (/radial-gradient/i.test(bgImage)) return bgImage;
2962
+ const bg = style.background || '';
2963
+ if (/radial-gradient/i.test(bg)) return bg;
2964
+ const rawStyle = el?.getAttribute?.('style') || '';
2965
+ const m = rawStyle.match(/background(?:-image)?\s*:\s*([^;]+)/i);
2966
+ if (m && /radial-gradient/i.test(m[1])) return m[1];
2967
+ return '';
2968
+ }
2969
+
2970
+ function spotlightLabel(el) {
2971
+ const dataName = el.getAttribute?.('data-name');
2972
+ if (dataName) return dataName;
2973
+ if (typeof el.id === 'string' && el.id) return el.id;
2974
+ const cls = typeof el.className === 'string' ? el.className.trim().split(/\s+/)[0] : '';
2975
+ if (cls) return cls;
2976
+ return el.tagName ? el.tagName.toLowerCase() : 'section';
2977
+ }
2978
+
2979
+ function checkElementRadialSpotlightDOM(el) {
2980
+ const style = getComputedStyle(el);
2981
+ const gradientValue = elementGradientValue(style, el);
2982
+ if (!gradientValue) return [];
2983
+ const rect = el.getBoundingClientRect();
2984
+ return checkRadialSpotlight({
2985
+ gradientValue,
2986
+ width: rect.width,
2987
+ height: rect.height,
2988
+ label: spotlightLabel(el),
2989
+ });
2990
+ }
2991
+
2992
+ function checkElementRadialSpotlight(el, style, tag, window) {
2993
+ const gradientValue = elementGradientValue(style, el);
2994
+ if (!gradientValue) return [];
2995
+ // Static engine does no layout — read explicit pixel dimensions from CSS.
2996
+ return checkRadialSpotlight({
2997
+ gradientValue,
2998
+ width: parseFloat(style.width) || 0,
2999
+ height: parseFloat(style.height) || 0,
3000
+ label: spotlightLabel(el),
3001
+ });
3002
+ }
3003
+
2732
3004
  const QUALITY_TEXT_TAGS = new Set(['p', 'li', 'td', 'th', 'dd', 'blockquote', 'figcaption']);
2733
3005
 
2734
3006
  // Resolve a CSS font-size value to pixels by walking up the parent chain.
@@ -2871,6 +3143,34 @@ function isVisuallyHidden(el, style) {
2871
3143
  return false;
2872
3144
  }
2873
3145
 
3146
+ // Elements whose text is never painted: document metadata and script/style
3147
+ // payloads. Their JS / CSS / JSON-LD text satisfies `hasDirectText`, and on
3148
+ // sites that set `html { font-size: 62.5% }` their inherited computed size is
3149
+ // 10px — so the text-size floors flag them as tiny body copy even though
3150
+ // nothing renders (issue #408: dozens of phantom "10px body text" findings on
3151
+ // every Shopify page). Exclude them, plus anything the cascade resolves to
3152
+ // display:none / visibility:hidden. The jsdom path can't lay out, so the
3153
+ // tag/attribute-based exclusions carry the weight there; the display checks are
3154
+ // computed-style reads that resolve without layout in both adapters.
3155
+ const NON_RENDERED_TAGS = new Set([
3156
+ 'script', 'style', 'title', 'noscript', 'template', 'head',
3157
+ 'meta', 'link', 'base', 'param', 'source', 'track', 'datalist',
3158
+ 'col', 'colgroup', 'map', 'area',
3159
+ ]);
3160
+ function isNonRenderedText(el, tag, style) {
3161
+ const t = (tag || '').toLowerCase();
3162
+ if (NON_RENDERED_TAGS.has(t)) return true;
3163
+ // Descendants of <head> never render even when the tag itself would
3164
+ // (some sites nest <noscript>/<template> content there).
3165
+ if (el && el.closest && el.closest('head')) return true;
3166
+ if (style) {
3167
+ if (style.display === 'none') return true;
3168
+ const vis = style.visibility;
3169
+ if (vis === 'hidden' || vis === 'collapse') return true;
3170
+ }
3171
+ return false;
3172
+ }
3173
+
2874
3174
  // Pure quality checks. Most run on computed CSS and DOM-only inputs (work in
2875
3175
  // jsdom and the browser). Two checks (line-length, cramped-padding) gate on
2876
3176
  // element rect dimensions, which jsdom can't compute — pass `rect: null` from
@@ -2881,8 +3181,13 @@ function isVisuallyHidden(el, style) {
2881
3181
  function checkQuality(opts) {
2882
3182
  const { el, tag, style, hasDirectText, textLen, fontSize, lineHeightPx, letterSpacingPx, rect, lineMax = 80, viewportWidth = 0, win = null } = opts;
2883
3183
  const findings = [];
2884
- // Skip browser extension injected elements
2885
- const elId = el.id || '';
3184
+ // Skip browser extension injected elements. Read the id via getAttribute
3185
+ // whenever `el.id` is not a string: on a <form> (and other
3186
+ // [LegacyOverrideBuiltIns] hosts) a named control like <input name="id">
3187
+ // shadows the builtin `id` getter and returns the control element, whose
3188
+ // `.startsWith` is undefined and throws (issue #407 — every Shopify product
3189
+ // form ships an <input name="id">).
3190
+ const elId = typeof el.id === 'string' ? el.id : (el.getAttribute?.('id') || '');
2886
3191
  if (elId.startsWith('claude-') || elId.startsWith('cic-')) return findings;
2887
3192
 
2888
3193
  // --- Line length too long --- (browser-only: needs rect.width)
@@ -3150,7 +3455,7 @@ function checkQuality(opts) {
3150
3455
  const skipTags = ['sub', 'sup', 'code', 'kbd', 'samp', 'var', 'caption', 'figcaption'];
3151
3456
  const inUIContext = el.closest && el.closest('button, a, label, summary, pre, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="option"], nav, footer, [aria-hidden="true"], [class*="badge" i], [class*="caption" i], [class*="chip" i], [class*="code" i], [class*="console" i], [class*="diff" i], [class*="label" i], [class*="meta" i], [class*="mock" i], [class*="pill" i], [class*="preview" i], [class*="tag" i], [class*="terminal" i], [class*="writes" i]');
3152
3457
  const isUppercase = style.textTransform === 'uppercase';
3153
- if (!skipTags.includes(tag) && !inUIContext && !isUppercase) {
3458
+ if (!skipTags.includes(tag) && !inUIContext && !isUppercase && !isNonRenderedText(el, tag, style)) {
3154
3459
  findings.push({ id: 'tiny-text', snippet: `${fontSize}px body text` });
3155
3460
  }
3156
3461
  }
@@ -3180,13 +3485,15 @@ function checkQuality(opts) {
3180
3485
  .replace(/\s+/g, ' ')
3181
3486
  .trim();
3182
3487
  const dtLen = directText.length;
3183
- const UI_SKIP_TAGS = new Set(['sub', 'sup', 'script', 'style', 'title', 'option']);
3184
- const notRendered = style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse';
3488
+ // `option` renders (in native select popups) so it stays a local skip;
3489
+ // script/style/title/noscript/head-descendants and display:none /
3490
+ // visibility:hidden are handled by isNonRenderedText (shared with tiny-text).
3491
+ const UI_SKIP_TAGS = new Set(['sub', 'sup', 'option']);
3185
3492
  // jsdom resolves the parent chain in resolveFontSizePx, so em/rem/%-sized
3186
3493
  // text that computes at or above the floor never reaches here. The browser
3187
3494
  // adapter additionally catches values only resolvable with real layout
3188
3495
  // (e.g. viewport-relative units, cascade winners set in linked sheets).
3189
- if (fontSize > 0 && fontSize < 11 && dtLen >= 2 && !UI_SKIP_TAGS.has(tag) && !notRendered) {
3496
+ if (fontSize > 0 && fontSize < 11 && dtLen >= 2 && !UI_SKIP_TAGS.has(tag) && !isNonRenderedText(el, tag, style)) {
3190
3497
  const EXEMPT_CONTEXT = 'pre, code, kbd, samp, var, svg, [aria-hidden="true"], [class*="terminal" i], [class*="console" i], [class*="code" i], [class*="mock" i], [class*="editor" i], [class*="syntax" i], [class*="diff" i]';
3191
3498
  const isExemptContext = (el.matches && el.matches(EXEMPT_CONTEXT)) || (el.closest && el.closest(EXEMPT_CONTEXT));
3192
3499
  if (!isExemptContext && !isVisuallyHidden(el, style)) {
@@ -3399,7 +3706,7 @@ function checkElementColors(el, style, tag, window, customPropMap, hasAnchorInhe
3399
3706
  textColor,
3400
3707
  bgColor: ownBg,
3401
3708
  effectiveBg: finalEffectiveBg,
3402
- effectiveBgStops: finalEffectiveBg ? null : resolveGradientStops(el, window),
3709
+ effectiveBgStops: finalEffectiveBg ? null : resolveGradientStops(el, window, customPropMap),
3403
3710
  fontSize: parseFloat(style.fontSize) || 16,
3404
3711
  fontWeight: parseInt(style.fontWeight) || 400,
3405
3712
  hasDirectText,
@@ -3539,13 +3846,13 @@ function checkElementHeroEyebrow(el, style, tag, window, customPropMap) {
3539
3846
  });
3540
3847
  }
3541
3848
 
3542
- function checkRepeatedSectionKickersFromDoc(doc, win) {
3543
- const candidates = collectRepeatedSectionKickerCandidates(
3849
+ function checkKickerAboveHeadingFromDoc(doc, win) {
3850
+ const candidates = collectKickerCandidates(
3544
3851
  doc,
3545
3852
  (el) => win.getComputedStyle(el),
3546
3853
  (value, fontSize) => resolveLengthPx(value, fontSize) || 0,
3547
3854
  );
3548
- return checkRepeatedSectionKickers({ candidates });
3855
+ return checkKickerAboveHeading({ candidates });
3549
3856
  }
3550
3857
 
3551
3858
  function checkElementMotion(tag, style) {
@@ -3604,12 +3911,6 @@ function checkTypography() {
3604
3911
  if (isBrandFontOnOwnDomain(font)) continue;
3605
3912
  findings.push({ type: 'overused-font', detail: `Primary font: ${font} (${Math.round(share * 100)}% of text)` });
3606
3913
  }
3607
-
3608
- // Single-font check: only one distinct primary font across all text
3609
- if (fontUsage.size === 1) {
3610
- const only = [...fontUsage.keys()][0];
3611
- findings.push({ type: 'single-font', detail: `only font used is ${only}` });
3612
- }
3613
3914
  }
3614
3915
 
3615
3916
  const sizes = new Set();
@@ -3871,14 +4172,6 @@ function checkPageTypography(doc, win) {
3871
4172
  findings.push({ id: 'overused-font', snippet: `Primary font: ${font}` });
3872
4173
  }
3873
4174
 
3874
- // Single font
3875
- if (fonts.size === 1) {
3876
- const els = doc.querySelectorAll('*');
3877
- if (els.length >= 20) {
3878
- findings.push({ id: 'single-font', snippet: `only font used is ${[...fonts][0]}` });
3879
- }
3880
- }
3881
-
3882
4175
  // Flat type hierarchy
3883
4176
  const sizes = new Set();
3884
4177
  const textEls = doc.querySelectorAll('h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, label, button, div');
@@ -5172,6 +5465,7 @@ function checkFirstViewportColumnOverflowDOM() {
5172
5465
  }
5173
5466
 
5174
5467
  export {
5468
+ CSS_NAMED_COLORS,
5175
5469
  checkBorders,
5176
5470
  isEmojiOnlyText,
5177
5471
  checkColors,
@@ -5185,7 +5479,7 @@ export {
5185
5479
  checkItalicSerif,
5186
5480
  isAccentColor,
5187
5481
  checkHeroEyebrow,
5188
- checkRepeatedSectionKickers,
5482
+ checkKickerAboveHeading,
5189
5483
  checkMotion,
5190
5484
  checkGlow,
5191
5485
  scanCssTextForGlow,
@@ -5199,6 +5493,7 @@ export {
5199
5493
  cssLengthToPx,
5200
5494
  scanCssTextForPulsingDot,
5201
5495
  scanHtmlForShapeAssembledIllustration,
5496
+ buildHtmlPatternCorpora,
5202
5497
  checkHtmlPatterns,
5203
5498
  readOwnBackgroundColor,
5204
5499
  resolveBackground,
@@ -5216,9 +5511,9 @@ export {
5216
5511
  parseAnyColor,
5217
5512
  parseColorResolved,
5218
5513
  cleanInlineText,
5219
- isRepeatedKickerCandidate,
5220
- collectRepeatedSectionKickerCandidates,
5221
- checkRepeatedSectionKickersDOM,
5514
+ isKickerCandidate,
5515
+ collectKickerCandidates,
5516
+ checkKickerAboveHeadingDOM,
5222
5517
  parseNumberedLabelText,
5223
5518
  isNumberedSectionLabelCandidate,
5224
5519
  collectNumberedSectionLabelCandidates,
@@ -5235,6 +5530,9 @@ export {
5235
5530
  checkElementMotionDOM,
5236
5531
  checkElementGlowDOM,
5237
5532
  checkElementAIPaletteDOM,
5533
+ checkElementRadialSpotlightDOM,
5534
+ checkElementRadialSpotlight,
5535
+ checkRadialSpotlight,
5238
5536
  resolveFontSizePx,
5239
5537
  resolveLengthPx,
5240
5538
  checkQuality,
@@ -5247,7 +5545,7 @@ export {
5247
5545
  checkElementIconTile,
5248
5546
  checkElementItalicSerif,
5249
5547
  checkElementHeroEyebrow,
5250
- checkRepeatedSectionKickersFromDoc,
5548
+ checkKickerAboveHeadingFromDoc,
5251
5549
  checkElementMotion,
5252
5550
  checkElementGlow,
5253
5551
  checkTypography,