Clone any website into a pixel-accurate Next.js app with AI — Playwright-measured extraction (no eyeballing), spec-gated parallel builder agents, and scored pixel-diff QA at phone/tablet/desktop. Works with Claude Code, Cursor, Copilot + 9 more.
JavaScript aiai-agentsclaudeclaude-codecursornextjspixel-perfectplaywrightscreenshot-to-codetailwindcssweb-cloningwebsite-cloner
feat: probe script, stricter responsive lint, and the Forty example
Mahanaicoach2c01e8dbf48e
diff --git a/.claude/skills/clone-website/SKILL.md b/.claude/skills/clone-website/SKILL.mdindex 0e424d7..9dc7389 100644--- a/.claude/skills/clone-website/SKILL.md+++ b/.claude/skills/clone-website/SKILL.md@@ -30,7 +30,7 @@ User-provided instructions override these defaults.## Tooling-Nine scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:+Ten scripts do the mechanical work — **use them instead of hand-measuring via browser MCP**:| Script | Purpose ||---|---|@@ -39,7 +39,8 @@ Nine scripts do the mechanical work — **use them instead of hand-measuring via| `node scripts/extract/assets.mjs <url>` | Enumerate + download all images/videos/SVGs/favicons/fonts → `public/`, `assets.json` || `node scripts/extract/section.mjs <url> --selector "css" [--name x] [--state scroll:600\|click:sel\|hover:sel] [--viewport pc\|ipad\|phone]` | Full computed-style DOM walk of one section; `--state` captures a second state and diffs them || `node scripts/extract/screenshot.mjs <url> [--selector css] [--name x]` | Screenshots at phone/iPad/PC → `docs/design-references/<host>/` |-| `node scripts/extract/responsive.mjs <url> [--selector css]` | Measures every section's real layout (actual column counts, hidden elements, font sizes) at all 3 viewports → `responsive.json` |+| `node scripts/extract/responsive.mjs <url> [--selector css]` | Auto-detects sections and measures each one's real layout (actual column counts, hidden elements, font sizes) at all 3 viewports → `responsive.json` |+| `node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]` | Exact computed values for specific selectors at all 3 viewports, as a markdown table with a **varies** column — paste straight into a spec's Responsive section || `node scripts/diff.mjs --original <url> --clone <url> [--selector css] [--viewport pc] [--threshold 95]` | Scored pixel diff, original vs clone || `node scripts/lint-spec.mjs <spec.md\|dir>` | Mechanical spec-completeness gate — must pass before ANY builder dispatch || `node scripts/manifest.mjs <cmd>` | Pipeline state: init / add-page / add-section / set / status / next |@@ -54,10 +55,12 @@ Browser MCP (Chrome MCP, Playwright MCP — if available) is for **judgment work4. **Foundation first.** Tokens, fonts, types, icons, and shared chrome (header/footer) before any page section.5. **Extract how it looks AND how it behaves.** Every interactive element needs before/after states with exact values — `section.mjs --state` produces the diff mechanically.6. **Identify the interaction model before building.** Scroll-driven vs click-driven confusion is the most expensive mistake in cloning — a wrong call means a rewrite, not a CSS fix. Scroll first without clicking and watch; only then click. Record the model in the spec frontmatter.-7. **Responsive is measured, never guessed.** The Responsive section of every spec is filled from `responsive.json` — real column counts at 390/768/1440.-8. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.-9. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run build` after every merge.-10. **The manifest is updated at every stage transition.** That's what makes the run resumable.+7. **Responsive is measured, never guessed — at all three widths.** Fill every spec's Responsive section from `responsive.json` + `probe.mjs`, with real numbers for phone AND iPad AND pc. Never write "iPad: same as desktop": most production sites step their root font-size at breakpoints, so *every* padding, margin, and font size changes even when the layout looks identical. A spec that only nails desktop produces a clone that scores ~98% at 1440px and ~91% at 390px. `lint-spec.mjs` rejects vague responsive sections.++8. **The extraction JSON is ground truth; the spec is a summary of it.** If a builder finds the spec disagreeing with `sections/<name>.json` or `responsive.json`, the JSON wins — say so explicitly in every builder prompt and have the builder report the discrepancy so you can correct the spec.+9. **Spec files are the contract.** No spec → no builder. lint-spec must pass → then dispatch.+10. **The build must always compile.** Builders verify `npx tsc --noEmit`; you verify `npm run build` after every merge.+11. **The manifest is updated at every stage transition.** That's what makes the run resumable.## Phase 0 — Crawl & Scope@@ -101,7 +104,8 @@ Work through `manifest.mjs next` until no sections remain. For each section:### 3a. Extract```bashnode scripts/extract/screenshot.mjs <page-url> --selector "<sel>" --name <name> # all 3 viewports-node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name> # computed styles + text+node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name> # computed styles + text (incl. ::before/::after)+node scripts/extract/probe.mjs <page-url> --selector "<sel>" --selector "<sel> h2" # per-viewport table for the Responsive section# per discovered behavior — one call per state:node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-hover --state hover:".card"node scripts/extract/section.mjs <page-url> --selector "<sel>" --name <name>-scrolled --state scroll:600@@ -162,6 +166,7 @@ Every builder receives IN ITS PROMPT (never "go read the file"):- Shared imports available: `cn()`, `icons.tsx` components, shadcn `ui/` primitives, types from `src/types/`- The target file path, and the data file to create in `src/data/` if the section has content collections- The rule: verify `npx tsc --noEmit` passes before finishing+- **The ground-truth rule:** "`docs/research/<host>/sections/<name>.json` and `responsive.json` are ground truth. If this spec contradicts them, follow the JSON and report the discrepancy." Builders reliably catch spec errors this way — treat their reports as corrections to make to the spec file.Complex section (3+ distinct sub-components) → one builder per sub-component + one for the wrapper, sub-components first. **Don't wait** — while builders run, extract the next section.@@ -185,6 +190,8 @@ node scripts/manifest.mjs set --route <r> --section <name> --score pc=<match>- Below 95% → open the diff image in `docs/research/qa/`, find the discrepancy, check the spec (wrong extraction → re-extract and fix; right spec, wrong build → fix component), re-diff- A large height mismatch reported by diff.mjs = missing content or wrong spacing — fix before pixel-tweaking- Max 3 fix iterations per section, then record the gap honestly and move on+- **Text-heavy sections at phone width often plateau at 90–95%** when the target's font isn't available on Google Fonts (e.g. Source Sans Pro → Source Sans 3). Different metrics = different wrap points = unavoidable pixel drift. Confirm the layout matches, note the substitution, and accept it.+- **A score that's high at pc but low at ipad/phone is always a responsive-spec problem**, not a styling bug. Re-run `probe.mjs` on the section and fill in the values the spec was missing.- Finally, test behaviors manually: scroll, click every tab, hover — screenshots can't verify motion; you mustWhole-page diffs (`--selector` omitted) at all 3 viewports close out each page.@@ -200,6 +207,9 @@ Whole-page diffs (`--selector` omitted) at all 3 viewports close out each page.- **Don't reference docs from builder prompts** — spec contents go inline.- **Don't skip the manifest updates.** An untracked run can't resume.- **Don't hardcode content in components.** Content → `src/data/`, components take props.+- **Don't write "same as desktop" in a Responsive section.** Root font-size steps at breakpoints on most real sites, so every number changes. Run `probe.mjs` and write the real values for all three widths — lint-spec now rejects vague responsive sections.+- **Don't forget `::before` / `::after`.** They carry hero overlays, heading underline bars, and icon glyphs. `section.mjs` captures them under a `pseudo` key — if a spec has none and the screenshot shows decorations, extraction was incomplete.+- **Don't trust the spec over the extraction JSON.** Specs are hand-written summaries and drift; `sections/*.json` is machine-measured.- **Don't declare done without QA scores.** "Looks right" is not a number.## Completion Reportdiff --git a/README.md b/README.mdindex fbf75c8..5bfbb31 100644--- a/README.md+++ b/README.md@@ -37,6 +37,10 @@ Point it at a URL. `/clone-website` crawls the site, measures everything with sc| Single-page only | `scripts/extract/crawl.mjs` — sitemap + nav discovery, shared header/footer extracted once || Clone is a dead-end copy | Content in `src/data/*.ts` + `/restyle` skill = rebrand without breaking layout |+## Example++[`examples/forty/`](examples/forty/) is a real end-to-end run against the HTML5 UP "Forty" demo — side-by-side screenshots, the four spec files that drove the build, the per-viewport score table (95–99% at desktop), and the eight tooling bugs that run exposed and fixed.+## Pipeline```@@ -59,6 +63,7 @@ node scripts/extract/assets.mjs <url> # download all images/vidnode scripts/extract/section.mjs <url> --selector "x" # computed styles (+ --state for hover/scroll/click diffs)node scripts/extract/screenshot.mjs <url> # phone/iPad/PC screenshotsnode scripts/extract/responsive.mjs <url> # real layout changes across viewports+node scripts/extract/probe.mjs <url> --selector "x" # per-viewport value table for specsnode scripts/diff.mjs --original <url> --clone <url> # scored pixel diffnode scripts/lint-spec.mjs docs/research/components # spec completeness gatenode scripts/manifest.mjs status # pipeline state / resume pointdiff --git a/examples/forty/README.md b/examples/forty/README.mdnew file mode 100644index 0000000..e3fa087--- /dev/null+++ b/examples/forty/README.md@@ -0,0 +1,54 @@+# Example: cloning HTML5 UP "Forty"++A real end-to-end run of `/clone-website` against **https://html5up.net/uploads/demos/forty/** — used to validate the pipeline and shipped here as a reference for what good output looks like.++> Forty is by [HTML5 UP](https://html5up.net), released under [CC BY 3.0](https://html5up.net/license). It's used here as a legally clean cloning target. Demo images from [Unsplash](https://unsplash.com).++| Original | Clone |+|---|---|+|  |  |++## Result++One page, 5 components, 4 measured sections × 3 viewports:++| Section | PC (1440) | iPad (768) | Phone (390) |+|---|---|---|---|+| banner | **98.2%** | **97.1%** | 93.4% |+| tiles | **95.2%** | **98.5%** | **96.1%** |+| cta | **99.0%** | **95.1%** | 91.3% |+| contact | **96.0%** | 93.5% | 92.8% |++Sections were built by four builder agents running in parallel, each getting only its spec inline.++## The specs++[`specs/`](specs/) holds the four spec files that drove the build — real output of Phase 3, all passing `lint-spec.mjs`. Use them as a format reference when writing your own.++## What this run taught the template++Every one of these became a fix in the tooling:++| Finding | Fix |+|---|---|+| Site served at apex domain, all links pointed at `www.` — crawler found 1 page instead of 251 | `crawl.mjs` compares hostnames modulo `www.` and follows sitemap-index files |+| `body > #wrapper > #main > section` nesting hid every real section | `responsive.mjs` walks down through non-semantic wrappers |+| A 44px phone header fell under the height floor and vanished | floor lowered to 40px |+| A 6-tile collection was split into 6 "sections" | repeated same-tag children stay ONE section → one component + data array |+| The hero's dark overlay, every heading underline, and the button arrows are `::before`/`::after` — the walker was blind to all of them | `section.mjs` now extracts pseudo-element styles |+| The Next.js dev badge rendered into QA screenshots and cost real score points | `devIndicators: false` in `next.config.ts` |+| Specs said "iPad: same as desktop" → builders guessed → 98% at PC but 91% at phone | `probe.mjs` added; `lint-spec.mjs` now rejects vague responsive sections |+| Builders found the hand-written specs wrong in ~10 places by checking the extraction JSON | builder prompts now carry an explicit "JSON is ground truth" rule |++## Honest limits++- **Phone scores plateau around 91–93% on text-heavy sections.** The target uses Source Sans Pro; Google Fonts serves Source Sans 3. Slightly different metrics → different wrap points → unavoidable pixel drift. The layout is correct; the pixels can't be.+- Scores are per-section pixel diffs, not a claim of perfection. Read the diff images in `docs/research/qa/` before trusting any number.++## Reproducing++```bash+npm install && npx playwright install chromium+claude --chrome+/clone-website https://html5up.net/uploads/demos/forty/+```diff --git a/examples/forty/clone-pc.png b/examples/forty/clone-pc.pngnew file mode 100644index 0000000..bfedeaeBinary files /dev/null and b/examples/forty/clone-pc.png differdiff --git a/examples/forty/original-pc.png b/examples/forty/original-pc.pngnew file mode 100644index 0000000..3f70a02Binary files /dev/null and b/examples/forty/original-pc.png differdiff --git a/examples/forty/specs/banner.spec.md b/examples/forty/specs/banner.spec.mdnew file mode 100644index 0000000..7d6f0d1--- /dev/null+++ b/examples/forty/specs/banner.spec.md@@ -0,0 +1,74 @@+---+component: Banner+target: src/components/Banner.tsx+page: /+screenshot: docs/design-references/html5up.net/home-pc.png+interaction_model: static+states: default, button-hover+assets: public/images/banner.jpg+responsive: phone, ipad, pc+---++# Banner Specification++## DOM Structure+`section#banner.major` (bg image, full-bleed) > `div.inner` (max-width container) > `header.major` > `h1`, then `div.content` > `p` + `ul.actions` > `li` > `a.button`++## Computed Styles++### section#banner+- height: 675px (desktop), display: flex, alignItems: center, position: relative+- backgroundImage: url(/images/banner.jpg), backgroundSize: cover, backgroundPosition: center+- **`::after` overlay (CRITICAL — without it the hero is far too bright):**+ content: "", position: absolute, inset: 0, backgroundColor: rgb(36, 41, 67), opacity: 0.85, zIndex: 1++### div.inner+- maxWidth: 1213.33px, width: 100%, margin: 0 auto, position: relative, zIndex: 2+- padding: 0 with the container centered; content is left-aligned++### h1+- fontSize: 60.6667px, fontWeight: 600, lineHeight: 100.1px, letterSpacing: 0.466667px, color: rgb(255, 255, 255)+- **`::after` underline:** content: "", display: block, width: 100%, height: 2px, backgroundColor: rgb(255,255,255), margin: 19.7167px 0px 30.3333px++### div.content+- display: flex, alignItems: center, gap between text and button++### p+- fontSize: 13.0667px, fontWeight: 600, letterSpacing: 3.26667px, textTransform: uppercase, lineHeight: 1.65, maxWidth: ~473px+- Use the `.label-caps` utility already in globals.css++### a.button (Get Started)+- display: inline-block, padding: 0 22.4px, height: 52.2656px, lineHeight: 52.2656px+- border: 2px solid rgba(255,255,255,0.2), color: rgb(255,255,255), backgroundColor: transparent+- fontSize: 14.9333px, fontWeight: 600, letterSpacing: 4.66667px, textTransform: uppercase+- paddingRight: 58px to leave room for the arrow+- **`::before` arrow icon:** an inline SVG right-arrow (36x24) positioned absolute right: 22.4px, white strokes, transition: opacity 0.2s ease-in-out+- **hover:** border/text color → rgb(155, 241, 255), arrow swaps to the cyan variant++## States & Behaviors+### Button hover+- **Trigger:** hover on `a.button`+- **State A:** color rgb(255,255,255), borderColor rgba(255,255,255,0.2)+- **State B:** color rgb(155,241,255), borderColor rgb(155,241,255)+- **Transition:** color/border 0.2s ease-in-out+- **Implementation:** Tailwind `hover:` classes + a CSS transition++## Per-State Content+N/A — single static state.++## Assets+- Background: `public/images/banner.jpg`+- Arrow icon: inline SVG in the component (stroke: currentColor so hover recolors it)++## Text Content+- h1: "Hi, my name is Forty"+- p: "A responsive site template designed by HTML5 UP and released under the Creative Commons."+- button: "Get Started"++## Responsive Behavior+Measured values (responsive.json + per-viewport probe) — the target scales with root font-size,+so every number changes even where the layout looks identical:+- **PC (1440px):** h1 60.6667px, label 13.0667px, section height 675px, padding-top 112px, inner max-width 1213.33px, flex-direction row+- **iPad (768px):** h1 52px, label 11.2px, section height 768px, padding-top 96px, inner width 672px, still row+- **Phone (390px):** h1 32px, label 11.2px, section height 444px, padding-top 128px, inner width 342px (24px gutters), still row (does NOT stack)+- **Breakpoints:** values step at 1280px and 736pxdiff --git a/examples/forty/specs/chrome.spec.md b/examples/forty/specs/chrome.spec.mdnew file mode 100644index 0000000..8c8a9cb--- /dev/null+++ b/examples/forty/specs/chrome.spec.md@@ -0,0 +1,85 @@+---+component: SiteHeader + SiteFooter+target: src/components/SiteHeader.tsx+page: /+screenshot: docs/design-references/html5up.net/home-pc.png+interaction_model: click-driven+states: default, menu-open+assets: none (icons are inline SVG)+responsive: phone, ipad, pc+---++# SiteHeader + SiteFooter Specification++Shared chrome — used by every page. Two components, one spec (they're small and both are site-wide).++## DOM Structure+`header#header` > `a.logo` (strong "Forty" + span "by HTML5 UP") + `nav` > `a` ("Menu").+`nav#menu` is a full-screen overlay panel, hidden until the Menu button is clicked.+`footer#footer` > `div.inner` > `ul.icons` (5 social links) + `p.copyright`.++## Computed Styles++### header#header+- height: 61px desktop / 44px phone, position: absolute (top of page, over the banner), zIndex: 10+- width: 100%, display: flex, alignItems: center, justifyContent: space-between+- paddingLeft/Right: 37.3333px desktop, 32px phone+- backgroundColor: transparent++### a.logo+- fontSize: 14.9333px, fontWeight: 600, letterSpacing: 4.66667px, textTransform: uppercase, color: rgb(255,255,255)+- `strong` (the word "Forty"): backgroundColor: rgb(255,255,255), color: rgb(36,41,67), padding: 0px 1.86667px 0px 5.6px, marginRight: 4.85333px++### nav a ("Menu")+- fontSize: 14.9333px, fontWeight: 600, letterSpacing: 4.66667px, textTransform: uppercase, color: rgb(255,255,255)+- Followed by a hamburger icon: 3 stacked 2px white bars, ~24px wide, gap ~5px, marginLeft ~13px++### nav#menu (overlay panel)+- position: fixed, top: 0, right: 0, height: 100vh, width: 350px (100% on phone), zIndex: 50+- backgroundColor: rgba(36, 41, 67, 0.9) with a backdrop blur feel; padding: 48px 37.3333px+- Menu links: fontSize: 18.6667px, borderBottom: 1px solid rgba(244,244,255,0.2), padding: 12px 0+- A "Close" X button top-right of the panel++### footer#footer+- padding: 74.6667px 0 37.3333px, backgroundColor: transparent+- `div.inner`: maxWidth: 1213.33px, margin: 0 auto+- borderTop: 1px solid rgba(244,244,255,0.2) above the footer content++### ul.icons li a (social)+- Circular: width/height 40px, borderRadius: 9999px, border: 1px solid rgba(244,244,255,0.2)+- display: inline-flex, alignItems/justifyContent: center, icon fontSize/size ~16px, color: rgb(255,255,255)+- gap between icons: ~13px+- **hover:** borderColor and icon color → rgb(155, 241, 255)++### p.copyright+- fontSize: 14.9333px, letterSpacing: 0.466667px, color: rgba(255,255,255,0.5), marginTop: 32px++## States & Behaviors+### Menu open/close+- **Trigger:** click on the "Menu" button opens `nav#menu`; click the X or the backdrop closes it+- **State A (closed):** panel translated off-screen right (transform: translateX(100%)), not focusable+- **State B (open):** transform: translateX(0), page content behind gets a slight dim+- **Transition:** transform 0.5s ease+- **Implementation:** `"use client"` component with a `useState` boolean; Escape key also closes++### Social icon hover+- **<a>:** color rgb(255,255,255) → rgb(155,241,255), borderColor likewise, transition 0.2s ease-in-out++## Per-State Content+Menu links (all states identical): Home /, Landing /landing, Generic /generic, Elements /elements++## Assets+Inline SVG icons only — hamburger, X, and 5 social glyphs (Twitter, Facebook, Instagram, GitHub, LinkedIn).+Add them to `src/components/icons.tsx`. Content comes from `src/data/home.ts` (`nav`, `footer`).++## Text Content+- Logo: "Forty" + "by HTML5 UP"+- Menu button: "Menu"+- Copyright: "© Untitled. Design: HTML5 UP. Demo Images: Unsplash."++## Responsive Behavior+Measured — root font-size steps (14pt above 1280px, 12pt below), so heights and gutters all change:+- **PC (1440px):** header 61px tall, logo padding-left 22.4px, hamburger inset 30px, footer padding-top 74.6667px, inner gutter 113px, menu panel 350px wide+- **iPad (768px):** header 52px tall, logo padding-left 19.2px, hamburger inset 26px, footer padding-top 64px, inner gutter 48px, panel 350px wide+- **Phone (390px):** header 44px tall, logo padding-left 12.8px, hamburger inset 14px, footer padding-top 48px, inner gutter 24px, panel 100% wide; "by HTML5 UP" and the "Menu" label are hidden+- **Breakpoints:** 1280px (font step) and 736px (panel full-width, labels hidden)diff --git a/examples/forty/specs/cta-contact.spec.md b/examples/forty/specs/cta-contact.spec.mdnew file mode 100644index 0000000..67b8a80--- /dev/null+++ b/examples/forty/specs/cta-contact.spec.md@@ -0,0 +1,89 @@+---+component: CtaSection + ContactSection+target: src/components/CtaSection.tsx+page: /+screenshot: docs/design-references/html5up.net/home-pc.png+interaction_model: static+states: default, input-focus, button-hover+assets: none (inline SVG icons)+responsive: phone, ipad, pc+---++# CtaSection + ContactSection Specification++Two adjacent sections, both plain-background content blocks on the dark page.++## DOM Structure+`section#two` > `div.inner` > `h2` + `p` + `ul.actions` > `a.button`.+`section#contact` > `div.inner` (2-column split) > left: contact `form`; right: `section.split` with 3 icon+text blocks.++## Computed Styles++### section#two > div.inner+- maxWidth: 1213.33px, margin: 0 auto, padding: 74.6667px 0px 37.3333px++### h2 ("Massa libero")+- fontSize: 32.6667px, fontWeight: 600, letterSpacing: 0.466667px, color: rgb(255,255,255)+- **`::after` underline:** content: "", display: block, width: 100%, height: 2px, backgroundColor: rgb(255,255,255), margin: 10.6167px 0px 16.3333px+ (the `.heading-rule` utility in globals.css does exactly this)++### section#two p+- fontSize: 18.6667px, fontWeight: 300, lineHeight: 1.65, color: rgb(255,255,255), marginBottom: 32px++### a.button (Get Started)+- Same as the banner button: padding 0 22.4px, height 52.2656px, border 2px solid rgba(255,255,255,0.2)+- fontSize: 14.9333px, fontWeight: 600, letterSpacing: 4.66667px, uppercase, inline arrow SVG on the right+- **hover:** border + text → rgb(155, 241, 255)++### section#contact > div.inner+- maxWidth: 1213.33px, margin: 0 auto, display: flex, gap: 0+- borderTop: 1px solid rgba(244,244,255,0.2)+- Left column (form) ~58%, right column (details) ~42% with a 1px left border rgba(244,244,255,0.2) and paddingLeft ~48px++### Form fields+- Name + Email side by side (each ~50% with a ~24px gap), Message full-width textarea (height ~150px)+- input/textarea: backgroundColor: rgba(212,212,255,0.035), border: 1px solid rgba(244,244,255,0.2), borderRadius: 0+- color: rgb(255,255,255), padding: 0 16px, height: 48px, fontSize: 16px+- **focus:** borderColor → rgb(155, 241, 255)+- Field labels above inputs: `.label-caps` (13.0667px, 600, letterSpacing 3.26667px, uppercase)++### Form buttons+- "Send Message": backgroundColor rgb(255,255,255), color rgb(36,41,67), height 48px, padding 0 22.4px+- "Clear": transparent with 2px solid rgba(255,255,255,0.2) border, white text+- Both: fontSize 14.9333px, fontWeight 600, letterSpacing 4.66667px, uppercase; gap ~13px++### Contact detail blocks (right column)+- 3 blocks (Email, Phone, Address), each: circular icon (40px, 1px border rgba(244,244,255,0.2), inline SVG ~16px) + `h3` (fontSize 18.6667px, fontWeight 600) + value text+- Separated by borderTop: 1px solid rgba(244,244,255,0.2), padding ~32px 0+- Links: color rgb(255,255,255), borderBottom: 1px dotted; hover → rgb(155,241,255)++## States & Behaviors+### Input focus+- **Trigger:** focus on input/textarea+- **State A:** borderColor rgba(244,244,255,0.2)+- **State B:** borderColor rgb(155,241,255)+- **Transition:** border-color 0.2s ease-in-out+- **Implementation:** Tailwind `focus:` classes++### Button hover+- Same as the banner button: colors → rgb(155,241,255), transition 0.2s ease-in-out++## Per-State Content+N/A — static content; form is non-submitting (mock, `onSubmit` prevented).++## Assets+Inline SVG icons: envelope, phone, home. Add to `src/components/icons.tsx`.+Content from `src/data/home.ts` (`cta`, `contact`).++## Text Content+- h2: "Massa libero"+- p: "Nullam et orci eu lorem consequat tincidunt vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus pharetra. Pellentesque condimentum sem. In efficitur ligula tate urna. Maecenas laoreet massa vel lacinia pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus amet pharetra et feugiat tempus."+- Form labels: "Name", "Email", "Message"; buttons "Send Message", "Clear"+- Email: [email protected] · Phone: (000) 000-0000 x12387+- Address: "1234 Somewhere Road #5432 / Nashville, TN 00000 / United States of America"++## Responsive Behavior+- **PC (1440px):** contact is 2 columns (form left, details right with left border)+- **iPad (768px):** still 2 columns, narrower gap+- **Phone (390px):** 1 column — form on top, details below (left border becomes a top border); Name/Email stack+- **Breakpoint:** single column at ~980px; form fields stack at ~736pxdiff --git a/examples/forty/specs/tiles.spec.md b/examples/forty/specs/tiles.spec.mdnew file mode 100644index 0000000..43c4f6e--- /dev/null+++ b/examples/forty/specs/tiles.spec.md@@ -0,0 +1,71 @@+---+component: Tiles+target: src/components/Tiles.tsx+page: /+screenshot: docs/design-references/html5up.net/home-pc.png+interaction_model: hover-driven+states: default, hover+assets: public/images/pic01.jpg … pic06.jpg+responsive: phone, ipad, pc+---++# Tiles Specification++## DOM Structure+`section#one.tiles` (display: flex, flexWrap: wrap, width: 100%) > 6 × `article`.+Each article: bg image + two overlay pseudo-elements + `header.major` (h3 + p) + a full-size absolute link.++## Computed Styles++### section#one+- display: flex, flexDirection: row, flexWrap: wrap, width: 100%++### article (each tile)+- position: relative, display: flex, alignItems: center, justifyContent: center+- height: 429.328px (desktop), backgroundImage per tile, backgroundSize: cover, backgroundPosition: center+- **Widths alternate**: 576px and 864px at 1440px viewport → flex-basis 40% and 60%+ Order: narrow(576), wide(864), wide(864), narrow(576), narrow(576), wide(864)+- **`::before` color overlay:** content: "", position: absolute, inset: 0, backgroundColor: per-tile color, opacity: 0.85, zIndex: 2, transition: opacity 0.5s+- **`::after` dark overlay:** content: "", position: absolute, inset: 0, backgroundColor: rgba(36, 41, 67, 0.25), zIndex: 1++### header.major (inside each tile)+- position: relative, zIndex: 3, textAlign: left++### h3+- fontSize: 32.6667px, fontWeight: 600, letterSpacing: 0.466667px, color: rgb(255,255,255)+- **`::after` underline:** content: "", display: block, width: 100%, height: 2px, backgroundColor: rgb(255,255,255), margin: 10.6167px 0px 16.3333px++### p+- fontSize: 13.0667px, fontWeight: 600, letterSpacing: 3.26667px, textTransform: uppercase (use `.label-caps`)++### a.link.primary+- position: absolute, inset: 0, width: 100%, height: 100%, zIndex: 4, text hidden (accessible label only)++## States & Behaviors+### Tile hover+- **Trigger:** hover anywhere on the article+- **State A:** h3/link color rgb(255, 255, 255)+- **State B:** h3/link color rgb(155, 241, 255); the `::before` color overlay fades (opacity 0.85 → ~0.35) revealing more of the photo+- **Transition:** color 0.2s ease-in-out, overlay opacity 0.5s ease+- **Implementation:** group-hover on the article wrapper++## Per-State Content+N/A — content is identical across states; only styling changes.++## Assets+Content comes from `src/data/home.ts` → `tiles` array (title, subtitle, image, color, href, span).+Images: public/images/pic01.jpg … pic06.jpg. Colors: #6fc3df, #8d82c4, #ec8d81, #e7b788, #8ea9e8, #87c5a4.++## Text Content+1. Aliquam / "Ipsum dolor sit amet"+2. Tempus / "feugiat amet tempus"+3. Magna / "Lorem etiam nullam"+4. Ipsum / "Nisl sed aliquam"+5. Consequat / "Ipsum dolor sit amet"+6. Etiam / "Feugiat amet tempus"++## Responsive Behavior+- **PC (1440px):** 2 tiles per row, alternating 40%/60% widths, height 429px+- **iPad (768px):** still 2 per row, equal 50/50 widths, height ~330px+- **Phone (390px):** 1 tile per row (100% width), heading 24px, height ~330px+- **Breakpoint:** 50/50 at ~980px; single column at ~736pxdiff --git a/scripts/diff.mjs b/scripts/diff.mjsindex 04cff8e..ee7178b 100644--- a/scripts/diff.mjs+++ b/scripts/diff.mjs@@ -3,7 +3,10 @@//// File mode: node scripts/diff.mjs --a original.png --b clone.png [--out diff.png]// Live mode: node scripts/diff.mjs --original <url> --clone <url> [--selector css]-// [--viewport pc|ipad|phone] [--name hero]+// [--clone-selector css] [--viewport pc|ipad|phone] [--name hero]+//+// --selector applies to both sides; --clone-selector overrides it for the clone+// when your component's markup uses different hooks than the target's.//// Prints a match % (higher = closer). Exit code 1 if --threshold given and not met.// Live-mode artifacts land in docs/research/qa/.@@ -41,7 +44,7 @@ if (args.original && args.clone) {const dir = "docs/research/qa";mkdirSync(dir, { recursive: true });fileA = await shoot(args.original, `${dir}/${name}-${vp}-original.png`, VIEWPORTS[vp], args.selector);- fileB = await shoot(args.clone, `${dir}/${name}-${vp}-clone.png`, VIEWPORTS[vp], args.selector);+ fileB = await shoot(args.clone, `${dir}/${name}-${vp}-clone.png`, VIEWPORTS[vp], args["clone-selector"] || args.selector);outPath = outPath || `${dir}/${name}-${vp}-diff.png`;}if (!fileA || !fileB) {diff --git a/scripts/extract/probe.mjs b/scripts/extract/probe.mjsnew file mode 100644index 0000000..f9a68f3--- /dev/null+++ b/scripts/extract/probe.mjs@@ -0,0 +1,83 @@+#!/usr/bin/env node+// Probe exact computed values for specific selectors at all three viewports.+// This is what you paste into a spec's "Responsive Behavior" section — it exists+// because writing "iPad: same as desktop" makes builders guess, and guesses cost+// QA points on any site whose spacing scales with root font-size.+//+// Usage:+// node scripts/extract/probe.mjs <url> --selector "section#two" [--selector "h2" ...]+// node scripts/extract/probe.mjs <url> --selector "#two" --props fontSize,paddingTop,marginBottom+//+// Output: a markdown table per selector (stdout) + docs/research/<host>/probe-<name>.json+import { VIEWPORTS, launchPage, gotoAndSettle, autoScroll, hostOf, slugify, writeJson } from "../lib.mjs";++// --selector can repeat, so parse args manually rather than with parseArgs()+const argv = process.argv.slice(2);+const url = argv.find((a) => !a.startsWith("--") && argv[argv.indexOf(a) - 1]?.startsWith("--") !== true);+const selectors = [];+let props = null;+let name = null;+for (let i = 0; i < argv.length; i++) {+ if (argv[i] === "--selector") selectors.push(argv[++i]);+ else if (argv[i] === "--props") props = argv[++i].split(",");+ else if (argv[i] === "--name") name = argv[++i];+}+if (!url || !selectors.length) {+ console.error('Usage: node scripts/extract/probe.mjs <url> --selector "css" [--selector "css2"] [--props a,b,c]');+ process.exit(1);+}++const DEFAULT_PROPS = [+ "fontSize", "fontWeight", "lineHeight", "letterSpacing",+ "paddingTop", "paddingRight", "paddingBottom", "paddingLeft",+ "marginTop", "marginBottom", "width", "maxWidth",+ "display", "flexDirection", "gap", "gridTemplateColumns",+];+const USE = props || DEFAULT_PROPS;++const PROBE = `(function (selectors, props) {+ const out = {};+ for (const sel of selectors) {+ const el = document.querySelector(sel);+ if (!el) { out[sel] = { error: "not found" }; continue; }+ const cs = getComputedStyle(el);+ const r = el.getBoundingClientRect();+ const v = { _height: Math.round(r.height) + "px", _width: Math.round(r.width) + "px" };+ for (const p of props) v[p] = cs[p];+ out[sel] = v;+ }+ return out;+})`;++const results = {};+for (const [vpName, vp] of Object.entries(VIEWPORTS)) {+ const { browser, page } = await launchPage(vp);+ await gotoAndSettle(page, url);+ await autoScroll(page);+ results[vpName] = await page.evaluate(`(${PROBE})(${JSON.stringify(selectors)}, ${JSON.stringify(USE)})`);+ await browser.close();+ console.error(` ✓ probed @ ${vpName} (${vp.width}px)`);+}++// Markdown tables — only rows that actually differ across viewports are interesting,+// but print everything so the spec author can copy what matters.+for (const sel of selectors) {+ console.log(`\n### \`${sel}\`\n`);+ console.log("| property | phone (390) | ipad (768) | pc (1440) | varies |");+ console.log("| --- | --- | --- | --- | --- |");+ const keys = Object.keys(results.pc[sel] || {});+ for (const k of keys) {+ const p = results.phone[sel]?.[k] ?? "—";+ const t = results.ipad[sel]?.[k] ?? "—";+ const d = results.pc[sel]?.[k] ?? "—";+ const varies = new Set([p, t, d]).size > 1 ? "**yes**" : "";+ console.log(`| ${k} | ${p} | ${t} | ${d} | ${varies} |`);+ }+}++writeJson(`docs/research/${hostOf(url)}/probe-${name || slugify(selectors[0])}.json`, {+ url,+ selectors,+ generatedAt: new Date().toISOString(),+ results,+});diff --git a/scripts/lint-spec.mjs b/scripts/lint-spec.mjsindex a79304d..31035f6 100644--- a/scripts/lint-spec.mjs+++ b/scripts/lint-spec.mjs@@ -104,6 +104,36 @@ for (const file of files) {if (!/getComputedStyle|px|rem|rgb|oklch/.test(body)) {errors.push("No concrete CSS values found in body — computed styles must be extracted, not described");}++ // The Responsive section must carry MEASURED NUMBERS for all three viewports,+ // not prose. Real-site testing showed that specs saying "iPad: same layout"+ // make builders guess intermediate values, and every guess costs QA points on+ // sites whose spacing scales with root font-size.+ const rIdx = body.indexOf("## Responsive Behavior");+ if (rIdx !== -1) {+ const rEnd = body.indexOf("\n## ", rIdx + 1);+ const rBody = body.slice(rIdx, rEnd === -1 ? undefined : rEnd);+ const perViewport = { phone: /phone|390/i, ipad: /ipad|tablet|768/i, pc: /pc|desktop|1440/i };+ for (const [vp, re] of Object.entries(perViewport)) {+ const line = rBody.split("\n").find((l) => re.test(l));+ if (!line) {+ errors.push(`Responsive Behavior has no line for "${vp}" — all three viewports must be documented`);+ continue;+ }+ // Strip the viewport width itself, then demand at least two real measurements+ const measurements = line.replace(/\b(390|768|1440)\b/g, "").match(/\d+(\.\d+)?\s*(px|rem|%|col)/gi) || [];+ if (measurements.length < 2) {+ errors.push(+ `Responsive Behavior "${vp}" needs at least 2 measured values with units (e.g. "h2 28px, padding 48px, 2 cols") — got ${measurements.length}. Copy real numbers from responsive.json instead of describing the layout.`+ );+ }+ if (/\b(same|unchanged|identical|as above|no change)\b/i.test(line) && measurements.length < 3) {+ errors.push(+ `Responsive Behavior "${vp}" says "same/unchanged" — spell out the actual values. Sites that scale with root font-size change every number between breakpoints even when the layout looks identical.`+ );+ }+ }+ }}if (errors.length) {