3D engine that AI agents drive
Restyle the site, showcase and docs with the Afterimage theme; add scene loading chip and free navigation to the showcase
Nguyen Xuan An2b72da89c012
diff --git a/changes/site-afterimage.md b/changes/site-afterimage.mdnew file mode 100644index 00000000..4e8861f9--- /dev/null+++ b/changes/site-afterimage.md@@ -0,0 +1 @@+- Restyle the site, showcase and docs with the CodePawl Afterimage theme (always dark, glass header, scene-coloured glow, grain, pointer light), show a loading chip with real download progress when a showcase scene opens, and add pan, pinch, keyboard movement and Reset view to the showcase.diff --git a/docs.html b/docs.htmlindex 2c4952eb..bcc530cd 100644--- a/docs.html+++ b/docs.html@@ -1,5 +1,5 @@<!doctype html>-<html lang="en">+<html lang="en" data-theme="afterimage"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="description" content="67js documentation: scenes, materials, cameras, animation, GLB assets, CPU/GPU media export and AI agent workflows."/><title>Documentation · 67js</title><link rel="icon" href="/favicon.svg"/></head><body class="site documentation"><a class="skip-link" href="#content">Skip to content</a>diff --git a/index.html b/index.htmlindex 105ddf5c..549efd24 100644--- a/index.html+++ b/index.html@@ -1,9 +1,9 @@<!doctype html>-<html lang="en">+<html lang="en" data-theme="afterimage"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta name="theme-color" content="#191d22" />+ <meta name="theme-color" content="#09070f" /><meta name="description" content="67js is a WebGL2 3D engine for agents and people: PBR, shadows, fog, animation, GLB, PNG and MP4 export, and an MCP server. Install with npm i @codepawlhq/67js." /><meta property="og:type" content="website" /><meta property="og:site_name" content="67js" />@@ -29,33 +29,33 @@</header><main id="content"><section class="hero" aria-label="67js introduction and live preview">- <header class="introduction">- <div>- <h1>A 3D engine<br />agents can drive</h1>- <p>WebGL2 rendering, deterministic animation and an MCP server in one package.</p>- <div class="hero-actions">- <a href="/docs.html#getting-started" data-icon="book">Get started</a>- <a href="https://www.npmjs.com/package/@codepawlhq/67js"><span class="package-logo package-logo-npm brand-npm" aria-hidden="true"></span>npm</a>- </div>- <section id="downloads" class="home-install" aria-label="Install 67js">- <div class="package-install">- <div class="package-managers" role="group" aria-label="Package manager">- <button data-package-manager="npm" aria-pressed="true"><span class="package-logo package-logo-npm" aria-hidden="true"></span><span>npm</span></button>- <button data-package-manager="pnpm" aria-pressed="false"><span class="package-logo package-logo-pnpm" aria-hidden="true"></span><span>pnpm</span></button>- <button data-package-manager="yarn" aria-pressed="false"><span class="package-logo package-logo-yarn" aria-hidden="true"></span><span>Yarn</span></button>- <button data-package-manager="bun" aria-pressed="false"><span class="package-logo package-logo-bun" aria-hidden="true"></span><span>Bun</span></button>- </div>- <div class="command-row"><code data-install-command>Loading the release command…</code><button data-copy-install disabled>Copy command</button></div>- <div class="release-feedback" hidden><p data-release-status role="status">Loading release information</p><button data-release-retry hidden>Retry</button></div>- </div>- </section>+ <div class="hero-frame" data-glow="#ff6a2b">+ <a class="hero-shot" href="./showcase.html?scene=airport" aria-label="Open the airport ramp as a live 3D scene">+ <img src="./previews/showcase-airport.webp" alt="An airport ramp with a 787 at its stand and the turnaround crew, rendered by 67js" width="1280" height="720" fetchpriority="high" />+ </a>+ <p class="hero-caption">Now showing: Airport ramp</p>+ </div>+ <div class="hero-copy">+ <h1>A 3D engine<br />agents can drive</h1>+ <p class="lede">WebGL2 rendering, deterministic animation and an MCP server in one package.</p>+ <div class="hero-actions">+ <a href="/docs.html#getting-started" data-icon="book">Get started</a>+ <a href="https://www.npmjs.com/package/@codepawlhq/67js"><span class="package-logo package-logo-npm brand-npm" aria-hidden="true"></span>npm</a></div>- </header>+ </div>+ </section>- <a class="hero-shot" href="./showcase.html?scene=airport" aria-label="Open the airport ramp as a live 3D scene">- <img src="./previews/showcase-airport.webp" alt="An airport ramp with a 787 at its stand and the turnaround crew, rendered by 67js" width="1280" height="720" fetchpriority="high" />- <span class="hero-shot-label">Open the live scene</span>- </a>+ <section id="downloads" class="home-install" aria-label="Install 67js">+ <div class="package-install">+ <div class="package-managers" role="group" aria-label="Package manager">+ <button data-package-manager="npm" aria-pressed="true"><span class="package-logo package-logo-npm" aria-hidden="true"></span><span>npm</span></button>+ <button data-package-manager="pnpm" aria-pressed="false"><span class="package-logo package-logo-pnpm" aria-hidden="true"></span><span>pnpm</span></button>+ <button data-package-manager="yarn" aria-pressed="false"><span class="package-logo package-logo-yarn" aria-hidden="true"></span><span>Yarn</span></button>+ <button data-package-manager="bun" aria-pressed="false"><span class="package-logo package-logo-bun" aria-hidden="true"></span><span>Bun</span></button>+ </div>+ <div class="command-row"><code data-install-command>Loading the release command…</code><button data-copy-install disabled>Copy command</button></div>+ <div class="release-feedback" hidden><p data-release-status role="status">Loading release information</p><button data-release-retry hidden>Retry</button></div>+ </div></section><section id="code" class="code-section" aria-labelledby="code-title">@@ -87,9 +87,9 @@ renderer.render({ eye: [58, 31, 84], target: [-8, 3, -18] });</code></pre><li>PBR materials</li><li>Shadows</li><li>HDR and bloom</li><li>MSAA</li><li>Volumetric fog</li><li>Skinning and morphs</li><li>Physics</li><li>Spume liquid</li><li>Glass and leaf cutouts</li><li>HDRI lighting</li><li>Textured terrain</li><li>Trees and grass</li><li>Vehicles</li><li>Humanoid retargeting</li><li>GLB import and export</li><li>PNG and MP4 export</li></ul><div class="gallery">- <a class="example" href="./showcase.html?scene=airport"><img src="./previews/showcase-airport.webp" alt="Airport ramp, rendered by 67js" width="1280" height="720" loading="lazy" /><div class="example-caption"><h3>Airport ramp</h3></div><p>A widebody at the stand with its service trucks</p></a>- <a class="example" href="./showcase.html?scene=datacenter"><img src="./previews/showcase-datacenter.webp" alt="AI data center, rendered by 67js" width="1280" height="720" loading="lazy" /><div class="example-caption"><h3>AI data center</h3></div><p>Rows of racks, power and cooling, cut open</p></a>- <a class="example" href="./showcase.html?scene=port"><img src="./previews/showcase-port.webp" alt="Container port, rendered by 67js" width="1280" height="720" loading="lazy" /><div class="example-caption"><h3>Container port</h3></div><p>A ship at berth under the quay cranes</p></a>+ <a class="example is-lead" href="./showcase.html?scene=airport" data-glow="#ff6a2b"><span class="work-media"><img src="./previews/showcase-airport.webp" alt="Airport ramp, rendered by 67js" width="1280" height="720" loading="lazy" /></span><span class="work-title"><span class="work-index" aria-hidden="true">01</span><span class="work-name">Airport ramp</span><span class="work-date">A widebody at the stand with its service trucks</span></span></a>+ <a class="example" href="./showcase.html?scene=datacenter" data-glow="#3b82f6"><span class="work-media"><img src="./previews/showcase-datacenter.webp" alt="AI data center, rendered by 67js" width="1280" height="720" loading="lazy" /></span><span class="work-title"><span class="work-index" aria-hidden="true">02</span><span class="work-name">AI data center</span><span class="work-date">Rows of racks, power and cooling, cut open</span></span></a>+ <a class="example" href="./showcase.html?scene=port" data-glow="#f59e0b"><span class="work-media"><img src="./previews/showcase-port.webp" alt="Container port, rendered by 67js" width="1280" height="720" loading="lazy" /></span><span class="work-title"><span class="work-index" aria-hidden="true">03</span><span class="work-name">Container port</span><span class="work-date">A ship at berth under the quay cranes</span></span></a></div></section>@@ -124,5 +124,6 @@ renderer.render({ eye: [58, 31, 84], target: [-8, 3, -18] });</code></pre><nav class="footer-links" aria-label="Project links"><a href="https://github.com/anxuanng/67.js">GitHub</a><a href="https://www.npmjs.com/package/@codepawlhq/67js">npm</a><a data-release-commit href="https://github.com/anxuanng/67.js">Release commit</a><a href="/changelog.md">Changelog</a><a href="/license.txt">MIT license</a><a href="/logo.svg" download>Logo SVG</a></nav></footer><script type="module" src="/src/home.js"></script>+ <script type="module" src="/src/home-effects.js"></script></body></html>diff --git a/scripts/smoke-site.mjs b/scripts/smoke-site.mjsindex 6d6c9548..77ba08e9 100644--- a/scripts/smoke-site.mjs+++ b/scripts/smoke-site.mjs@@ -75,6 +75,16 @@ try {await showcase.waitForFunction(() => window.__showcase?.renderer, null, { timeout:60000 });assert.equal(await showcase.evaluate(() => window.__showcase.renderer.context.getError()), 0);assert.equal(await showcase.locator('#showcase-tabs button').count(), 3);+ await showcase.locator('#showcase-reset').waitFor();+ await showcase.evaluate(() => { window.__firstRenderer = window.__showcase.renderer; });+ await showcase.locator('#showcase-tabs button[data-scene="airport"]').click();+ const chip = showcase.locator('#showcase-status');+ assert.equal(await chip.isVisible(), true, 'Loading chip is missing after a tab switch');+ assert.match(await chip.textContent(), /Loading Airport ramp/);+ assert.equal(await showcase.locator('#showcase-tabs button[data-scene="airport"]').isDisabled(), true, 'Tab can be clicked again while loading');+ await showcase.waitForFunction(() => window.__showcase.renderer !== window.__firstRenderer, null, { timeout:60000 });+ await chip.waitFor({ state:'hidden', timeout:10000 });+ assert.equal(await showcase.locator('#showcase-tabs button[data-scene="airport"]').getAttribute('aria-pressed'), 'true');await showcase.close();report.interactions.push('Hero links to the live airport scene, and the showcase opens the data center scene');}@@ -160,7 +170,7 @@ try {}await page.emulateMedia({colorScheme:'light'});await page.goto(origin);- assert.equal(await page.evaluate(() => getComputedStyle(document.body).getPropertyValue('--window').trim()),'#fff');+ assert.equal(await page.evaluate(() => getComputedStyle(document.body).getPropertyValue('--window').trim()),'#09070f', 'Site is dark in light mode too');await page.screenshot({path:'artifacts/site-home-light.png',fullPage:true});await page.goto(`${origin}/object.html`);await page.waitForFunction(() => window.__studio?.renderer);diff --git a/showcase.html b/showcase.htmlindex fa05e9a4..17097d9e 100644--- a/showcase.html+++ b/showcase.html@@ -1,5 +1,5 @@<!doctype html>-<html lang="en">+<html lang="en" data-theme="afterimage"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />@@ -24,11 +24,11 @@<h1 id="showcase-title">Showcase</h1><p id="showcase-blurb"></p></div>- <div id="showcase-tabs" class="showcase-tabs" role="group" aria-label="Scene"></div>+ <div class="showcase-controls"><div id="showcase-tabs" class="showcase-tabs" role="group" aria-label="Scene"></div><button id="showcase-reset" type="button">Reset view</button></div></div><div class="showcase-frame">- <canvas id="showcase-viewport" tabindex="0" aria-label="Live 3D scene. Drag to orbit, scroll to zoom."></canvas>- <p id="showcase-status" role="status">◷ Loading the scene…</p>+ <canvas id="showcase-viewport" tabindex="0" aria-label="Live 3D scene. Drag to orbit, right-drag or shift-drag to pan, scroll to zoom, WASD or arrow keys to move, Q and E to turn."></canvas>+ <p id="showcase-status" role="status"></p></div><details class="showcase-credits"><summary>Models and licences</summary>diff --git a/src/dither-field.js b/src/dither-field.jsnew file mode 100644index 00000000..a0889886--- /dev/null+++ b/src/dither-field.js@@ -0,0 +1,181 @@+// A soft glow behind the hero drawn as ordered-dither pixels (ported from codepawl.com's DitherField). The field is a sum of+// blurred blobs; every cell of a coarse grid is inked or left blank by comparing the field with an 8x8 Bayer matrix.+// Decorative: it steps at ten frames a second, pauses off screen, draws one still frame for reduced motion, and is cut out+// from under the header and the hero words.+const CELL = 4;+const FRAME_MS = 100;+const CLEAR_SELECTORS = ['.navigation', '.hero-copy'];+const CLEAR_MARGIN = 24;+const CLEAR_FEATHER = 72;+const PRESET_OPACITY = 0.24;++const BAYER = [+ 0, 32, 8, 40, 2, 34, 10, 42,+ 48, 16, 56, 24, 50, 18, 58, 26,+ 12, 44, 4, 36, 14, 46, 6, 38,+ 60, 28, 52, 20, 62, 30, 54, 22,+ 3, 35, 11, 43, 1, 33, 9, 41,+ 51, 19, 59, 27, 49, 17, 57, 25,+ 15, 47, 7, 39, 13, 45, 5, 37,+ 63, 31, 55, 23, 61, 29, 53, 21,+].map(value => (value + 0.5) / 64);++function blobsAround(anchor) {+ return [+ { offsetX: 0, offsetY: 0, radius: Math.max(anchor.width, anchor.height) * 0.62, strength: 0.46, orbit: 22, speed: 0.35, phase: 0, pulse: 0.2, pulseSpeed: 0.9 },+ { offsetX: anchor.width * 0.4, offsetY: anchor.height * 0.4, radius: anchor.height * 0.5, strength: 0.28, orbit: 50, speed: 0.22, phase: 2.1, pulse: 0.3, pulseSpeed: 0.6 },+ { offsetX: -anchor.width * 0.4, offsetY: -anchor.height * 0.34, radius: anchor.height * 0.42, strength: 0.22, orbit: 45, speed: 0.28, phase: 4.2, pulse: 0.3, pulseSpeed: 0.75 },+ ];+}++// The ink colour as ImageData stores a pixel (little-endian ABGR).+function inkFromTheme() {+ const style = getComputedStyle(document.documentElement);+ const hex = style.getPropertyValue('--dither-ink').trim().slice(1);+ const strength = Number.parseFloat(style.getPropertyValue('--dither-strength')) || 1;+ const alpha = Math.round(Math.min(1, PRESET_OPACITY * strength) * 255);+ const red = parseInt(hex.slice(0, 2), 16);+ const green = parseInt(hex.slice(2, 4), 16);+ const blue = parseInt(hex.slice(4, 6), 16);+ return ((alpha << 24) | (blue << 16) | (green << 8) | red) >>> 0;+}++export function startDitherField({ anchor, cover }) {+ const anchorElement = document.querySelector(anchor);+ const wrapper = document.createElement('div');+ const canvas = document.createElement('canvas');+ const context = canvas.getContext('2d');+ if (!anchorElement || !context) return;+ wrapper.className = 'dither';+ wrapper.setAttribute('aria-hidden', 'true');+ wrapper.append(canvas);+ document.body.prepend(wrapper);++ const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');+ const ink = inkFromTheme();+ let columns = 0;+ let rows = 0;+ let image = null;+ let pixels = null;+ let field = null;+ let clearance = null;+ let anchorBox = new DOMRect();+ let startedAt = performance.now();+ let frame = 0;+ let lastStep = 0;+ let visible = true;++ function applyClearance(wrapperBox) {+ clearance = new Float32Array(columns * rows).fill(1);+ for (const selector of CLEAR_SELECTORS) {+ for (const element of document.querySelectorAll(selector)) {+ const box = element.getBoundingClientRect();+ if (box.width === 0 || box.height === 0) continue;+ const left = box.left - wrapperBox.left - CLEAR_MARGIN;+ const right = box.right - wrapperBox.left + CLEAR_MARGIN;+ const top = box.top - wrapperBox.top - CLEAR_MARGIN;+ const bottom = box.bottom - wrapperBox.top + CLEAR_MARGIN;+ const firstRow = Math.max(0, Math.floor((top - CLEAR_FEATHER) / CELL));+ const lastRow = Math.min(rows - 1, Math.ceil((bottom + CLEAR_FEATHER) / CELL));+ const firstColumn = Math.max(0, Math.floor((left - CLEAR_FEATHER) / CELL));+ const lastColumn = Math.min(columns - 1, Math.ceil((right + CLEAR_FEATHER) / CELL));+ for (let row = firstRow; row <= lastRow; row += 1) {+ const y = row * CELL + CELL / 2;+ const distanceY = Math.max(top - y, 0, y - bottom);+ for (let column = firstColumn; column <= lastColumn; column += 1) {+ const x = column * CELL + CELL / 2;+ const distanceX = Math.max(left - x, 0, x - right);+ const index = row * columns + column;+ clearance[index] = Math.min(clearance[index], Math.min(1, Math.hypot(distanceX, distanceY) / CLEAR_FEATHER));+ }+ }+ }+ }+ }++ function measure() {+ const wrapperBox = wrapper.getBoundingClientRect();+ const coverElement = document.querySelector(cover);+ const coverBottom = coverElement ? coverElement.getBoundingClientRect().bottom - wrapperBox.top : 640;+ const height = Math.max(480, Math.round(coverBottom + 140));+ wrapper.style.height = `${height}px`;+ columns = Math.ceil(wrapperBox.width / CELL);+ rows = Math.ceil(height / CELL);+ canvas.width = columns;+ canvas.height = rows;+ canvas.style.width = `${columns * CELL}px`;+ canvas.style.height = `${rows * CELL}px`;+ image = context.createImageData(columns, rows);+ pixels = new Uint32Array(image.data.buffer);+ field = new Float32Array(columns * rows);+ applyClearance(wrapperBox);+ const box = anchorElement.getBoundingClientRect();+ anchorBox = new DOMRect(box.left - wrapperBox.left, box.top - wrapperBox.top, box.width, box.height);+ }++ function addBlob(blob, seconds, centreX, centreY) {+ const x = (centreX + blob.offsetX + Math.cos(seconds * blob.speed + blob.phase) * blob.orbit) / CELL;+ const y = (centreY + blob.offsetY + Math.sin(seconds * blob.speed * 0.8 + blob.phase) * blob.orbit) / CELL;+ const radius = blob.radius * (1 + blob.pulse * Math.sin(seconds * blob.pulseSpeed + blob.phase));+ const sigma = radius / CELL / 2;+ const reach = Math.ceil(sigma * 3);+ const twoSigmaSquared = 2 * sigma * sigma;+ const top = Math.max(0, Math.floor(y - reach));+ const bottom = Math.min(rows - 1, Math.ceil(y + reach));+ const left = Math.max(0, Math.floor(x - reach));+ const right = Math.min(columns - 1, Math.ceil(x + reach));+ for (let row = top; row <= bottom; row += 1) {+ const distanceY = row - y;+ for (let column = left; column <= right; column += 1) {+ const distanceX = column - x;+ field[row * columns + column] += blob.strength * Math.exp(-(distanceX * distanceX + distanceY * distanceY) / twoSigmaSquared);+ }+ }+ }++ function draw(now) {+ if (!image) return;+ const seconds = (now - startedAt) / 1000;+ field.fill(0);+ for (const blob of blobsAround(anchorBox)) {+ addBlob(blob, seconds, anchorBox.x + anchorBox.width / 2, anchorBox.y + anchorBox.height / 2);+ }+ pixels.fill(0);+ for (let row = 0; row < rows; row += 1) {+ const bayerRow = (row & 7) * 8;+ for (let column = 0; column < columns; column += 1) {+ const index = row * columns + column;+ if (field[index] * clearance[index] > BAYER[bayerRow + (column & 7)]) pixels[index] = ink;+ }+ }+ context.putImageData(image, 0, 0);+ }++ function loop(now) {+ frame = requestAnimationFrame(loop);+ if (!visible || document.hidden || now - lastStep < FRAME_MS) return;+ lastStep = now;+ draw(now);+ }++ function start() {+ cancelAnimationFrame(frame);+ if (reducedMotion.matches) {+ startedAt = performance.now() - 60000;+ draw(performance.now());+ return;+ }+ frame = requestAnimationFrame(loop);+ }++ function refresh() {+ measure();+ draw(performance.now());+ }++ measure();+ start();+ new ResizeObserver(refresh).observe(document.documentElement);+ new IntersectionObserver(([entry]) => { visible = entry.isIntersecting; }).observe(wrapper);+ reducedMotion.addEventListener('change', start);+}diff --git a/src/documentation.css b/src/documentation.cssindex 8ede2d5b..fcc7438a 100644--- a/src/documentation.css+++ b/src/documentation.css@@ -53,9 +53,6 @@.doc-pagination span { color:var(--muted); font-size:12px; }.doc-pagination strong { font-size:14px; font-weight:500; }.docs-sidebar, .doc-actions, .doc-pagination, .navigation { user-select:none; }-@media (prefers-color-scheme:light) {- .documentation { --syntax-string:#246a43; --syntax-keyword:#77439b; --syntax-number:#93601e; --syntax-comment:#666; --syntax-name:#245e91; }-}@media (max-width:1200px) and (min-width:1051px) { .documentation .docs-page { gap:30px; grid-template-columns:220px minmax(0,1fr); padding:30px; } }@media (max-width:1050px) {.documentation .docs-page { display:block; padding:28px 30px 50px; }diff --git a/src/home-effects.js b/src/home-effects.jsnew file mode 100644index 00000000..35b1350d--- /dev/null+++ b/src/home-effects.js@@ -0,0 +1,4 @@+import './pointer-light.js';+import { startDitherField } from './dither-field.js';++startDitherField({ anchor: '.hero-frame', cover: '.hero' });diff --git a/src/pointer-light.js b/src/pointer-light.jsnew file mode 100644index 00000000..447cdefe--- /dev/null+++ b/src/pointer-light.js@@ -0,0 +1,28 @@+// A soft light under the pointer. The position goes into two custom properties on <html>, at most once per frame.+// Touch screens and reduced motion get none.+const finePointer = window.matchMedia('(hover: hover) and (pointer: fine)');+const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');++if (finePointer.matches && !reducedMotion.matches) {+ const root = document.documentElement;+ const light = document.createElement('div');+ light.className = 'pointer-light';+ light.setAttribute('aria-hidden', 'true');+ document.body.append(light);++ let pendingFrame = 0;+ let latestX = 0;+ let latestY = 0;++ const paint = () => {+ pendingFrame = 0;+ root.style.setProperty('--pointer-x', `${latestX}px`);+ root.style.setProperty('--pointer-y', `${latestY}px`);+ };++ window.addEventListener('pointermove', event => {+ latestX = event.clientX;+ latestY = event.clientY;+ if (!pendingFrame) pendingFrame = requestAnimationFrame(paint);+ }, { passive: true });+}diff --git a/src/showcase.css b/src/showcase.cssindex 35c99823..e6d8dc3a 100644--- a/src/showcase.css+++ b/src/showcase.css@@ -3,16 +3,59 @@.showcase-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }.showcase-head > div:first-child { display: grid; gap: 10px; }.showcase-head p { color: var(--muted); font-size: 17px; }+.showcase-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }.showcase-tabs { display: flex; flex-wrap: wrap; gap: 4px; }-.site .showcase-tabs button { min-height: 36px; padding: 6px 14px; background: transparent; color: var(--muted); font-size: 14px; }-.site .showcase-tabs button:hover { background: var(--bg); color: var(--text); }+.site .showcase-controls button { min-height: 36px; padding: 6px 14px; background: transparent; color: var(--muted); font-size: 14px; }+.site .showcase-controls button:hover:not(:disabled) { background: #ffffff12; color: var(--text); }.site .showcase-tabs button[aria-pressed=true] { background: var(--surface); color: var(--text); }-.showcase-frame { position: relative; overflow: hidden; border-radius: var(--panel-radius); background: var(--surface); }-#showcase-viewport { display: block; width: 100%; height: clamp(360px, 62vh, 760px); touch-action: none; cursor: grab; }+.site .showcase-tabs button:disabled { opacity: 1; cursor: default; }+.site .showcase-tabs button[aria-pressed=false]:disabled { opacity: .5; }+.showcase-frame {+ position: relative;+ overflow: hidden;+ border-radius: 24px;+ background: var(--surface);+ box-shadow: 0 0 0 1px #ffffff1f, 0 40px 140px -40px color-mix(in srgb, var(--glow) 70%, transparent);+}+#showcase-viewport { display: block; width: 100%; height: clamp(360px, 62vh, 760px); touch-action: none; cursor: grab; transition: opacity .25s; }#showcase-viewport:active { cursor: grabbing; }-#showcase-status { position: absolute; inset: auto 16px 16px 16px; margin: 0; color: var(--muted); font-size: 14px; pointer-events: none; }-#showcase-status[data-failed=true] { color: var(--error); }+.showcase-frame[data-loading=true] #showcase-viewport { opacity: .45; }++/* The loading and error chip: glass, centred over the canvas. */+#showcase-status {+ position: absolute;+ left: 50%;+ top: 50%;+ display: flex;+ align-items: center;+ gap: 10px;+ max-width: calc(100% - 32px);+ margin: 0;+ padding: 10px 16px;+ transform: translate(-50%, -50%);+ border-radius: 999px;+ background: #0d0a16b8;+ color: #fff;+ font-size: 14px;+ font-weight: 500;+ font-variant-numeric: tabular-nums;+ box-shadow: inset 0 0 0 1px #ffffff26;+ pointer-events: none;+ -webkit-backdrop-filter: blur(14px) saturate(1.4);+ backdrop-filter: blur(14px) saturate(1.4);+}+#showcase-status[data-kind=error] { border-radius: 16px; color: var(--error); }+#showcase-status .status-icon { flex: none; }+#showcase-status .spinner { animation: showcase-spin .9s linear infinite; }+@keyframes showcase-spin { to { transform: rotate(360deg); } }+@media (prefers-reduced-motion: reduce) {+ #showcase-status .spinner { animation: none; }+ #showcase-viewport { transition: none; }+}.showcase-credits { color: var(--muted); font-size: 14px; }.showcase-credits summary { cursor: pointer; width: max-content; }.showcase-credits ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 4px; }.showcase-credits a { color: var(--text); text-decoration: underline; }+@media (max-width: 600px) {+ .showcase-frame { border-radius: 20px; }+}diff --git a/src/showcase.js b/src/showcase.jsindex e6b0de77..fb396ebf 100644--- a/src/showcase.js+++ b/src/showcase.js@@ -1,6 +1,7 @@import './site.css';import './brand.js';import './showcase.css';+import './pointer-light.js';import { Renderer67 } from './renderer.js';import { loadGltf } from './gltf.js';import { loadHdri } from './hdri.js';@@ -8,26 +9,79 @@ import { createCascadedShadows } from './cascaded-shadows.js';import { applyWaterReflection, attachWaterReflection } from './water-reflection.js';// Each scene lives in public/showcase/<id>/scene.json: its GLB, sky, camera, renderer and frame options, and credits.+// Optional fields: "bounds" ({ min, max } the camera target stays inside), "minDistance" and "maxDistance".const SCENE_LABELS = { airport: 'Airport ramp', datacenter: 'AI data center', port: 'Container port' };+const SCENE_GLOWS = { airport: '#ff6a2b', datacenter: '#3b82f6', port: '#f59e0b' };const SCENE_IDS = Object.keys(SCENE_LABELS);+const MIN_PITCH = 0.05;+const MAX_PITCH = 1.45;+const DEFAULT_MAX_DISTANCE_FACTOR = 3;+const DEFAULT_MIN_DISTANCE_FACTOR = 0.05;+const BOUNDS_MARGIN = 0.25;+const MAX_SAMPLED_VERTICES_PER_PART = 4000;+const KEY_MOVE_PER_SECOND = 0.6;+const KEY_TURN_PER_SECOND = 1.6;++const SPINNER_ICON = '<svg class="status-icon spinner" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-opacity=".25" stroke-width="3"/><path d="M21 12a9 9 0 0 0-9-9" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg>';+const ERROR_ICON = '<svg class="status-icon" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><path d="M12 3 2.5 20h19L12 3Z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M12 10v4.5M12 17.2v.1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';const canvas = document.querySelector('#showcase-viewport');+const frame = document.querySelector('.showcase-frame');const status = document.querySelector('#showcase-status');const tabs = document.querySelector('#showcase-tabs');+const resetButton = document.querySelector('#showcase-reset');const title = document.querySelector('#showcase-title');const blurb = document.querySelector('#showcase-blurb');const creditList = document.querySelector('#showcase-credits');const orbit = { yaw: 0, pitch: 0, distance: 1, target: [0, 0, 0] };+const limits = { minDistance: 0.1, maxDistance: 10, boundsMin: [-1, -1, -1], boundsMax: [1, 1, 1] };+const homeView = { yaw: 0, pitch: 0, distance: 1, target: [0, 0, 0] };+const pointers = new Map();+const pressedKeys = new Set();let renderer = null;let scene = null;+let currentId = null;+let loadingId = null;let loadingRequest = 0;let scheduledFrame = 0;-let pointer = null;+let dragMode = 'orbit';+let keyFrame = 0;+let keyTimestamp = 0;++function setLoadingState(id) {+ loadingId = id;+ frame.dataset.loading = id ? 'true' : 'false';+ for (const button of tabs.querySelectorAll('button')) {+ button.disabled = Boolean(id) && (button.dataset.scene === id || button.dataset.scene === currentId);+ }+}-function showStatus(message, failed = false) {+function showStatus(kind, message) {status.hidden = false;- status.dataset.failed = failed ? 'true' : 'false';- status.textContent = `${failed ? '⚠' : '◷'} ${message}`;+ status.dataset.kind = kind;+ status.innerHTML = kind === 'error' ? ERROR_ICON : SPINNER_ICON;+ const text = document.createElement('span');+ text.className = 'status-text';+ text.textContent = message;+ status.append(text);+}++function showProgress(id, fraction) {+ const percent = fraction === null ? '' : ` ${Math.round(fraction * 100)}%`;+ showStatus('loading', `Loading ${SCENE_LABELS[id]}…${percent}`);+}++function dot(a, b) {+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];+}++function cross(a, b) {+ return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];+}++function normalize(vector) {+ const length = Math.hypot(...vector) || 1;+ return vector.map(value => value / length);}function orbitFromCamera(eye, target) {@@ -48,9 +102,52 @@ function eyeFromOrbit() {];}+function clampOrbit() {+ orbit.pitch = Math.max(MIN_PITCH, Math.min(MAX_PITCH, orbit.pitch));+ orbit.distance = Math.max(limits.minDistance, Math.min(limits.maxDistance, orbit.distance));+ orbit.target = orbit.target.map((value, axis) => Math.max(limits.boundsMin[axis], Math.min(limits.boundsMax[axis], value)));+}++// The part bounds, sampled so a scene with millions of vertices still opens quickly, plus a margin.+function boundsOfParts(parts) {+ const minimum = [Infinity, Infinity, Infinity];+ const maximum = [-Infinity, -Infinity, -Infinity];+ for (const part of parts) {+ const positions = part.geometry?.positions;+ const matrix = part.matrix;+ if (!positions || !matrix) continue;+ const vertexCount = positions.length / 3;+ const stride = Math.max(1, Math.floor(vertexCount / MAX_SAMPLED_VERTICES_PER_PART));+ for (let vertex = 0; vertex < vertexCount; vertex += stride) {+ const x = positions[vertex * 3];+ const y = positions[vertex * 3 + 1];+ const z = positions[vertex * 3 + 2];+ for (let axis = 0; axis < 3; axis++) {+ const value = matrix[axis] * x + matrix[4 + axis] * y + matrix[8 + axis] * z + matrix[12 + axis];+ minimum[axis] = Math.min(minimum[axis], value);+ maximum[axis] = Math.max(maximum[axis], value);+ }+ }+ }+ return minimum.every(Number.isFinite) ? { min: minimum, max: maximum } : null;+}++function applyLimits(description, parts) {+ const bounds = description.bounds ?? boundsOfParts(parts) ?? {+ min: orbit.target.map(value => value - orbit.distance),+ max: orbit.target.map(value => value + orbit.distance),+ };+ const margin = bounds.max.map((value, axis) => (value - bounds.min[axis]) * BOUNDS_MARGIN);+ limits.boundsMin = bounds.min.map((value, axis) => Math.min(value - margin[axis], orbit.target[axis]));+ limits.boundsMax = bounds.max.map((value, axis) => Math.max(value + margin[axis], orbit.target[axis]));+ limits.minDistance = description.minDistance ?? orbit.distance * DEFAULT_MIN_DISTANCE_FACTOR;+ limits.maxDistance = description.maxDistance ?? orbit.distance * DEFAULT_MAX_DISTANCE_FACTOR;+}+function draw() {scheduledFrame = 0;if (!renderer || !scene) return;+ clampOrbit();renderer.render({ ...scene.frame, eye: eyeFromOrbit(), target: orbit.target });}@@ -58,6 +155,43 @@ function requestDraw() {if (!scheduledFrame) scheduledFrame = requestAnimationFrame(draw);}+// Screen-space pan: the target slides along the camera's right and up directions.+function panByPixels(deltaX, deltaY) {+ const forward = normalize(orbit.target.map((value, axis) => value - eyeFromOrbit()[axis]));+ const right = normalize(cross(forward, [0, 1, 0]));+ const up = cross(right, forward);+ const scale = orbit.distance * 0.0016;+ orbit.target = orbit.target.map((value, axis) => value - right[axis] * deltaX * scale + up[axis] * deltaY * scale);+ requestDraw();+}++function moveOnGround(forwardAmount, rightAmount) {+ const forward = [-Math.sin(orbit.yaw), 0, -Math.cos(orbit.yaw)];+ const right = [Math.cos(orbit.yaw), 0, -Math.sin(orbit.yaw)];+ orbit.target = orbit.target.map((value, axis) => value + forward[axis] * forwardAmount + right[axis] * rightAmount);+}++function keyboardStep(timestamp) {+ keyFrame = 0;+ if (!pressedKeys.size) return;+ const seconds = Math.min(0.1, (timestamp - keyTimestamp) / 1000);+ keyTimestamp = timestamp;+ const step = orbit.distance * KEY_MOVE_PER_SECOND * seconds;+ const axis = (positive, negative) => Number(pressedKeys.has(positive)) - Number(pressedKeys.has(negative));+ moveOnGround(step * (axis('w', 's') + axis('arrowup', 'arrowdown')), step * (axis('d', 'a') + axis('arrowright', 'arrowleft')));+ orbit.yaw += KEY_TURN_PER_SECOND * seconds * axis('q', 'e');+ requestDraw();+ keyFrame = requestAnimationFrame(keyboardStep);+}++function resetView() {+ orbit.yaw = homeView.yaw;+ orbit.pitch = homeView.pitch;+ orbit.distance = homeView.distance;+ orbit.target = [...homeView.target];+ requestDraw();+}+function renderTabs() {for (const id of SCENE_IDS) {const button = document.createElement('button');@@ -75,6 +209,25 @@ async function readDescription(id) {return response.json();}+// Streams the GLB so the loading chip can show real progress; Content-Length may be missing or compressed.+async function downloadWithProgress(url, onProgress) {+ const response = await fetch(url);+ if (!response.ok) throw new Error(`model is not available (${response.status})`);+ const total = Number(response.headers.get('content-length')) || 0;+ if (!response.body?.getReader) return response.blob();+ const reader = response.body.getReader();+ const chunks = [];+ let received = 0;+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ chunks.push(value);+ received += value.length;+ onProgress(total ? Math.min(0.99, received / total) : null);+ }+ return new Blob(chunks, { type: 'model/gltf-binary' });+}+function showCredits(credits = []) {creditList.replaceChildren(...credits.map(credit => {const item = document.createElement('li');@@ -86,20 +239,25 @@ function showCredits(credits = []) {}));}+function markPressedTab(id) {+ for (const button of tabs.querySelectorAll('button')) button.setAttribute('aria-pressed', String(button.dataset.scene === id));+}++// The old scene stays on screen and interactive until the new one is ready.async function selectScene(id) {const request = ++loadingRequest;- history.replaceState(null, '', `?scene=${id}`);- for (const button of tabs.querySelectorAll('button')) button.setAttribute('aria-pressed', String(button.dataset.scene === id));- showStatus('Loading the scene…');+ document.documentElement.style.setProperty('--glow', SCENE_GLOWS[id]);+ setLoadingState(id);+ markPressedTab(id);+ showProgress(id, null);try {const description = await readDescription(id);- title.textContent = description.title;- blurb.textContent = description.blurb;- showCredits(description.credits);- const [asset, map] = await Promise.all([- loadGltf(description.glb, description.gltfOptions ?? {}),+ const glbUrl = new URL(description.glb, location.href);+ const [model, map] = await Promise.all([+ downloadWithProgress(glbUrl.href, fraction => { if (request === loadingRequest) showProgress(id, fraction); }),loadHdri(description.hdri, description.hdriOptions ?? {}),]);+ const asset = await loadGltf(model, { baseUrl: new URL('.', glbUrl).href, ...(description.gltfOptions ?? {}) });if (request !== loadingRequest) return;renderer?.dispose();const rendererOptions = description.renderer ?? {};@@ -116,32 +274,87 @@ async function selectScene(id) {attachWaterReflection(renderer, reflection.surface);scene = { frame: { exposure: description.exposure ?? 1, ...(description.frame ?? {}) } };orbitFromCamera(description.eye, description.target);- window.__showcase = { renderer, scene, orbit, draw };+ applyLimits(description, asset.parts);+ Object.assign(homeView, { yaw: orbit.yaw, pitch: orbit.pitch, distance: orbit.distance, target: [...orbit.target] });+ currentId = id;+ history.replaceState(null, '', `?scene=${id}`);+ title.textContent = description.title;+ blurb.textContent = description.blurb;+ showCredits(description.credits);+ window.__showcase = { renderer, scene, orbit, draw, limits };status.hidden = true;+ setLoadingState(null);requestDraw();} catch (error) {- if (request === loadingRequest) showStatus(`Could not open this scene: ${error.message}`, true);+ if (request !== loadingRequest) return;+ markPressedTab(currentId);+ setLoadingState(null);+ showStatus('error', `Could not open ${SCENE_LABELS[id]}: ${error.message}`);}}+function pairMetrics() {+ const [first, second] = [...pointers.values()];+ return {+ distance: Math.hypot(first.x - second.x, first.y - second.y) || 1,+ x: (first.x + second.x) / 2,+ y: (first.y + second.y) / 2,+ };+}++canvas.addEventListener('contextmenu', event => event.preventDefault());canvas.addEventListener('pointerdown', event => {- pointer = { x: event.clientX, y: event.clientY };+ pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });+ dragMode = event.button === 2 || event.button === 1 || event.shiftKey ? 'pan' : 'orbit';canvas.setPointerCapture(event.pointerId);});canvas.addEventListener('pointermove', event => {- if (!pointer) return;- orbit.yaw -= (event.clientX - pointer.x) * 0.005;- orbit.pitch = Math.max(0.05, Math.min(1.45, orbit.pitch + (event.clientY - pointer.y) * 0.004));- pointer = { x: event.clientX, y: event.clientY };+ const previous = pointers.get(event.pointerId);+ if (!previous) return;+ if (pointers.size === 2) {+ const before = pairMetrics();+ pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });+ const after = pairMetrics();+ orbit.distance *= before.distance / after.distance;+ panByPixels(after.x - before.x, after.y - before.y);+ return;+ }+ const deltaX = event.clientX - previous.x;+ const deltaY = event.clientY - previous.y;+ pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });+ if (dragMode === 'pan') {+ panByPixels(deltaX, deltaY);+ return;+ }+ orbit.yaw -= deltaX * 0.005;+ orbit.pitch += deltaY * 0.004;requestDraw();});-canvas.addEventListener('pointerup', () => { pointer = null; });-canvas.addEventListener('pointercancel', () => { pointer = null; });+const endPointer = event => { pointers.delete(event.pointerId); };+canvas.addEventListener('pointerup', endPointer);+canvas.addEventListener('pointercancel', endPointer);canvas.addEventListener('wheel', event => {event.preventDefault();orbit.distance *= Math.exp(event.deltaY * 0.001);requestDraw();}, { passive: false });++canvas.addEventListener('keydown', event => {+ if (event.ctrlKey || event.metaKey || event.altKey) return;+ const key = event.key.toLowerCase();+ if (!'wasdqe'.includes(key) && !key.startsWith('arrow')) return;+ event.preventDefault();+ if (pressedKeys.has(key)) return;+ pressedKeys.add(key);+ if (!keyFrame) {+ keyTimestamp = performance.now();+ keyFrame = requestAnimationFrame(keyboardStep);+ }+});+canvas.addEventListener('keyup', event => { pressedKeys.delete(event.key.toLowerCase()); });+canvas.addEventListener('blur', () => pressedKeys.clear());++resetButton.addEventListener('click', resetView);window.addEventListener('resize', () => {renderer?.resize();requestDraw();diff --git a/src/site.css b/src/site.cssindex 9afbc66b..c900704c 100644--- a/src/site.css+++ b/src/site.css@@ -1,31 +1,43 @@-/* The home page and the docs use the CodePawl site theme (codepawl.com): system type, a white page,- content in light grey cards with no borders, one black primary button, and a faint dot grid- behind the top of the page. Dark mode follows the system. The demo pages keep their own app UI. */+/* The home page, the showcase and the docs use the CodePawl "Afterimage" theme (codepawl.com): a dark violet field lit by one+ blurred colour (--glow), dither and film grain over it, frosted glass chrome and pill buttons. Always dark.+ Tokens and rules follow codepawl-web/src/styles.css; the demo pages keep their own app UI. */++@property --glow {+ syntax: '<color>';+ inherits: true;+ initial-value: #ff6a2b;+}++:root[data-theme="afterimage"] {+ color-scheme: dark;+ --window: #09070f;+ --bg: #15121f;+ --surface: #201c2d;+ --text: #f1edff;+ --muted: #aea7c4;+ --border: #ffffff1f;+ --primary: #f1edff;+ --primary-text: #0d0a16;+ --focus: #ffb38a;+ --error: #ffb4ab;+ --invert-border: #ffffff26;+ --dither-ink: #ff9a62;+ --dither-strength: 2.2;+ transition: --glow .9s ease-out;+}+@media (prefers-reduced-motion: reduce) {+ :root[data-theme="afterimage"] { transition: none; }+}body.site {--font: ui-sans-serif, -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;- --window: #fff;- --bg: #f7f7f8;- --surface: #f1f1f1;- --text: #1f1f1f;- --muted: #555;- --border: #e5e5e5;- --primary: #171717;- --primary-text: #fff;- --focus: #576b99;- --error: #b3261e;--radius: 9px;--panel-radius: 16px;--control-height: 40px;- --page: min(1120px, calc(100% - 40px));- --grid-dot: #17171726;- --aura-one: #1717171f;- --aura-two: #17171714;- --shot-shadow: 0 2px 4px #0000000f, 0 18px 48px #00000014;+ --page: min(1060px, calc(100% - 40px));--dither: none;--navigation-height: 0px;- color-scheme: light;position: relative;isolation: isolate;overflow-x: clip;@@ -41,34 +53,14 @@ body.site {line-height: 1.5;}-@media (prefers-color-scheme: dark) {- body.site {- color-scheme: dark;- --window: #0b0b0b;- --bg: #212121;- --surface: #2f2f2f;- --text: #ececec;- --muted: #b4b4b4;- --border: #404040;- --primary: #ececec;- --primary-text: #171717;- --focus: #a6c1ff;- --error: #ffb4ab;- --grid-dot: #ffffff22;- --aura-one: #ffffff1c;- --aura-two: #ffffff11;- --shot-shadow: 0 2px 4px #00000066, 0 18px 48px #00000080;- }-}-body.site *, body.site *::before, body.site *::after { box-sizing: border-box; }body.site [hidden] { display: none !important; }body.site a { color: inherit; text-decoration: none; text-underline-offset: 3px; }body.site h1, body.site h2, body.site h3, body.site p { margin: 0; }body.site h1, body.site h2, body.site h3 { text-wrap: balance; }body.site p { text-wrap: pretty; }-body.site h1 { font-size: clamp(36px, 5.2vw, 56px); font-weight: 600; letter-spacing: -1.6px; line-height: 1.06; }-body.site h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; letter-spacing: -.5px; line-height: 1.2; }+body.site h1 { font-size: clamp(40px, 6.2vw, 74px); font-weight: 600; letter-spacing: -2.2px; line-height: 1.02; }+body.site h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 600; letter-spacing: -.8px; line-height: 1.2; }body.site h3 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }body.site code, body.site pre { font-family: var(--mono); }body.site :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }@@ -76,62 +68,199 @@ body.site ::selection { background: color-mix(in srgb, var(--focus) 24%, transpabody.site .icon { width: 18px; height: 18px; margin: 0; }.site .skip-link { position: absolute; left: -9999px; }-.site .skip-link:focus { left: 16px; top: 16px; z-index: 10; padding: 10px 14px; background: var(--bg); border-radius: var(--radius); }+.site .skip-link:focus { left: 16px; top: 16px; z-index: 40; padding: 10px 14px; background: var(--bg); border-radius: var(--radius); }-/* Buttons: one plain style, one black primary. */-.site button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 6px 12px; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .12s, opacity .12s; }-.site button:hover:not(:disabled) { background: var(--border); }-.site button:disabled { opacity: .5; cursor: default; }-.site .hero-actions a, .site .site-nav-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-height); padding: 8px 18px; border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 15px; font-weight: 500; transition: background-color .12s, opacity .12s; }-.site .hero-actions a:hover { background: var(--surface); }-.site .hero-actions a:first-child { background: var(--primary); color: var(--primary-text); }-.site .hero-actions a:first-child:hover { opacity: .85; }--/* The lab backdrop: two soft grey pools and a fine dot grid behind the top of the page. */-body.site::before, body.site::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: min(1000px, 120vh); pointer-events: none; }-body.site::before {+/* One fixed layer of light behind everything, in the colour of the work on screen. */+body.site::after {+ content: '';+ position: fixed;z-index: -2;- background: radial-gradient(38% 42% at 78% 18%, var(--aura-one), transparent 70%), radial-gradient(34% 36% at 12% 8%, var(--aura-two), transparent 70%);- mask-image: linear-gradient(to bottom, #000 40%, transparent);+ inset: 0;+ pointer-events: none;+ background:+ radial-gradient(closest-side at 68% 26%, color-mix(in srgb, var(--glow) 62%, transparent), transparent),+ radial-gradient(closest-side at 24% 66%, #8b5cf633, transparent),+ radial-gradient(closest-side at 82% 88%, #2563eb26, transparent);}-body.site::after {+/* Film grain over the page, and a soft light under the pointer. Both ignore the pointer. */+body.site::before {+ content: '';+ position: fixed;+ inset: 0;+ z-index: 30;+ pointer-events: none;+ opacity: .06;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");+ background-size: 180px 180px;+}+/* Long text and code: a dimmer glow and no grain, so reading stays easy. */+.documentation.site::before { display: none; }+.documentation.site::after { opacity: .55; }++.pointer-light {+ position: fixed;+ top: 0;+ left: 0;+ z-index: -1;+ width: 640px;+ height: 640px;+ margin: -320px 0 0 -320px;+ pointer-events: none;+ transform: translate3d(var(--pointer-x, 60vw), var(--pointer-y, 30vh), 0);+ background: radial-gradient(closest-side, #ffffff1a, transparent);+}++/* The dithered grain behind the hero (src/dither-field.js). */+.dither {+ position: absolute;+ top: 0;+ left: 0;+ right: 0;z-index: -1;- background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.4px);- background-size: 22px 22px;- mask-image: radial-gradient(70% 60% at 60% 20%, #000 30%, transparent 75%);+ overflow: hidden;+ pointer-events: none;+ -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);+ mask-image: linear-gradient(to bottom, #000 55%, transparent);+}+.dither canvas { display: block; image-rendering: pixelated; }++/* Buttons: pill shaped, a hairline ring, one light primary. */+.site button {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 7px;+ min-height: 34px;+ padding: 6px 14px;+ border: 0;+ border-radius: 999px;+ background: var(--surface);+ color: var(--text);+ font: inherit;+ font-size: 13px;+ font-weight: 500;+ cursor: pointer;+ transition: background-color .12s, opacity .12s;}-.documentation.site::before, .documentation.site::after { display: none; }+.site button:hover:not(:disabled) { background: #ffffff1f; }+.site button:disabled { opacity: .5; cursor: default; }+.site .hero-actions a {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 8px;+ min-height: var(--control-height);+ padding: 8px 18px;+ border: 1px solid var(--border);+ border-radius: 999px;+ background: var(--bg);+ color: var(--text);+ font-size: 15px;+ font-weight: 500;+ pointer-events: auto;+ transition: background-color .12s, opacity .12s;+}+.site .hero-actions a:hover { background: var(--surface); }+.site .hero-actions a:first-child { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }+.site .hero-actions a:first-child:hover { opacity: .85; }+.site .hero-actions .package-logo { width: 18px; height: 18px; }+.site .brand-npm { color: #cb3837; }+.site .hero-actions a:first-child .icon { width: 17px; height: 17px; }-/* Header: brand on the left, links on the right, on the page background. */-.site .navigation { width: var(--page); margin-inline: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding-block: 20px; }+/* Header: a frosted glass pill that floats over the light. */+.site .navigation {+ position: sticky;+ top: 12px;+ z-index: 10;+ width: var(--page);+ margin: 12px auto 0;+ display: flex;+ align-items: center;+ flex-wrap: wrap;+ gap: 12px 20px;+ padding: 10px 12px 10px 16px;+ border-radius: 999px;+ background: #15121f99;+ box-shadow: inset 0 0 0 1px #ffffff1f;+ -webkit-backdrop-filter: blur(18px) saturate(1.5);+ backdrop-filter: blur(18px) saturate(1.5);+}.site .brand { display: inline-flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; letter-spacing: -.3px; color: var(--text); }.site .brand .brand-mark { width: 26px; height: 26px; margin: 0; }-.site .version { padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); font-family: var(--mono); font-size: 12px; }+.site .version { padding: 2px 8px; border-radius: 999px; background: #ffffff12; color: var(--muted); font-family: var(--mono); font-size: 12px; }.site .navigation nav { display: flex; align-items: center; gap: 20px; margin-left: auto; }.site .navigation nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; color: var(--muted); font-size: 15px; }.site .navigation nav a:hover, .site .navigation nav a[aria-current] { color: var(--text); }.site .navigation .icon { width: 16px; height: 16px; }-.site .site-nav-cta { min-height: 34px; padding: 4px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: 14px; font-weight: 600; }+.site .site-nav-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 4px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: 14px; font-weight: 600; }.site .site-nav-cta:hover { opacity: .88; }.site .site-nav-cta .package-logo { width: 16px; height: 16px; }-body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-block: 28px 88px; display: grid; gap: 96px; }+body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-block: 20px 80px; display: grid; gap: 76px; }+body.site > main > section { scroll-margin-top: 96px; }-/* Hero: the proposition on the left, the live model on the right. */-.site .hero { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: center; gap: 48px; }-.site .introduction { display: grid; gap: 22px; min-width: 0; }-.site .introduction > div { display: grid; gap: 22px; }-.site .introduction p { max-width: 34rem; color: var(--muted); font-size: clamp(17px, 1.9vw, 20px); }+/* Hero: the featured scene in a frame, the words on its lower left over a dark scrim. */+.site .hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 12px; }+.site .hero-frame, .site .hero .hero-copy { grid-area: 1 / 1; }+.site .hero-frame {+ position: relative;+ aspect-ratio: 16 / 9;+ min-height: 100%;+ overflow: hidden;+ border-radius: 24px;+ background: var(--surface);+ box-shadow: 0 0 0 1px #ffffff1f, 0 40px 140px -40px color-mix(in srgb, var(--glow) 70%, transparent);+}+.site .hero-shot { position: absolute; inset: 0; display: block; }+.site .hero-shot img { display: block; width: 100%; height: 100%; object-fit: cover; }+.site .hero-frame::after {+ content: '';+ position: absolute;+ inset: 0;+ pointer-events: none;+ background:+ linear-gradient(to top, #09070ff2 0%, #09070fe0 34%, #09070f8c 58%, transparent 84%),+ linear-gradient(to right, #09070fb3, transparent 70%);+}+.site .hero-caption {+ position: absolute;+ z-index: 1;+ top: 16px;+ right: 16px;+ max-width: calc(100% - 32px);+ margin: 0;+ padding: 8px 14px;+ border-radius: 999px;+ background: #0d0a16a6;+ color: #fff;+ font-size: 13px;+ line-height: 1.4;+ box-shadow: inset 0 0 0 1px #ffffff26;+ user-select: none;+ pointer-events: none;+ -webkit-backdrop-filter: blur(14px) saturate(1.4);+ backdrop-filter: blur(14px) saturate(1.4);+}+.site .hero .hero-copy {+ position: relative;+ z-index: 1;+ align-self: end;+ justify-self: start;+ display: grid;+ gap: 20px;+ max-width: 44rem;+ padding: clamp(22px, 4vw, 48px);+ pointer-events: none;+}+.site .hero h1 { font-size: clamp(34px, 5.2vw, 62px); text-shadow: 0 2px 24px #09070f99; }+.site .hero .lede { max-width: 36rem; color: var(--text); font-size: clamp(17px, 1.9vw, 20px); }.site .hero-actions { display: flex; flex-wrap: wrap; gap: 10px 12px; }-.site .hero-actions .package-logo { width: 18px; height: 18px; }-.site .brand-npm { color: #cb3837; }-.site .hero-actions a:first-child .icon { width: 17px; height: 17px; }-.site .home-install { scroll-margin-top: 24px; margin-top: 6px; }-.site .package-install { display: grid; gap: 12px; padding: 14px; border-radius: var(--panel-radius); background: var(--bg); }+.site .home-install { margin-top: 0; }+.site .package-install { display: grid; gap: 12px; padding: 14px; border-radius: var(--panel-radius); background: #ffffff12; box-shadow: inset 0 0 0 1px var(--invert-border); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }.site .package-managers { display: flex; flex-wrap: wrap; gap: 4px; }.site .package-managers button { min-height: 34px; padding: 6px 12px; background: transparent; color: var(--muted); }-.site .package-managers button:hover { background: var(--surface); color: var(--text); }+.site .package-managers button:hover:not(:disabled) { background: #ffffff12; color: var(--text); }.site .package-managers button[aria-pressed=true] { background: var(--surface); color: var(--text); }.site .command-row { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--radius); background: var(--window); }.site .command-row code { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }@@ -147,43 +276,59 @@ body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-blo.site .package-logo-bun { mask-image: url('/logos/bun.svg'); }.site .package-logo-github { mask-image: url('/logos/github.svg'); }-.site .feature-showcase { position: relative; min-width: 0; margin: 0; }-.site .live-showcase canvas { display: block; width: 100%; height: clamp(320px, 36vw, 500px); touch-action: pan-y; cursor: grab; }-.site .live-showcase canvas:active { cursor: grabbing; }-.site .live-showcase canvas:focus-visible { outline-offset: -4px; }-.site #home-preview-status { position: absolute; top: 16px; left: 16px; right: 16px; color: var(--muted); font-size: 13px; pointer-events: none; }-.site .preview-assembly { width: min(100%, 420px); margin: 8px auto 0; padding: 12px 16px; border-radius: var(--panel-radius); background: var(--bg); }-.site .preview-assembly-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 500; }-.site .preview-assembly-label output { color: var(--muted); font-size: 12px; font-weight: 400; }-.site .preview-assembly input { display: block; width: 100%; min-height: 32px; margin: 2px 0 0; accent-color: var(--primary); cursor: ew-resize; }--/* Sections below the hero. */.site .code-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 40px; }.site .code-copy { display: grid; gap: 20px; min-width: 0; }.site .code-section .code-block, .site .agents .code-block { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 16px 16px 16px 20px; border-radius: var(--panel-radius); background: var(--bg); }.site .code-section .code-block pre, .site .agents .code-block pre { margin: 0; overflow-x: auto; font-size: 13px; line-height: 1.7; }.site .code-section .code-block code, .site .agents .code-block code { display: block; user-select: text; }-.site .code-result { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--panel-radius); background: var(--surface); box-shadow: var(--shot-shadow); }+.site .code-result { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px #ffffff1f; }.site .examples { display: grid; gap: 20px; }.site .capability-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }-.site .capability-list li { padding: 4px 11px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 13px; }-.site .gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 16px; }-.site .example { display: grid; gap: 4px; min-width: 0; }-.site .example img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: 8px; border-radius: var(--panel-radius); background: var(--surface); transition: opacity .12s; }-.site .example:hover img { opacity: .92; }-.site .example:hover h3 { text-decoration: underline; text-underline-offset: 3px; }-.site .example-caption { display: flex; align-items: center; gap: 8px; }-.site .example h3 { font-size: 15px; font-weight: 500; }-.site .example p { color: var(--muted); font-size: 14px; }--.site .agents { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 40px; padding: clamp(22px, 4vw, 40px); border-radius: var(--panel-radius); background: var(--bg); }+.site .capability-list li { padding: 4px 11px; border-radius: 999px; background: #ffffff12; color: var(--muted); font-size: 13px; }++/* The wall: the first scene is twice the size of the rest, each with a glass label. */+.site .gallery { display: grid; grid-auto-flow: dense; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }+.site .example { position: relative; display: block; grid-column: span 2; min-width: 0; border-radius: 20px; }+.site .example.is-lead { grid-row: span 2; }+.site .example .work-media { display: block; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 20px; background: var(--surface); }+.site .example.is-lead .work-media { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }+.site .example.is-lead { min-height: 100%; }+.site .example img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s cubic-bezier(.2, 0, 0, 1); }+.site .example:hover img { transform: scale(1.02); }+.site .example:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 22px; }+.site .work-title {+ position: absolute;+ left: 12px;+ right: 12px;+ bottom: 12px;+ display: grid;+ grid-template-columns: auto minmax(0, 1fr);+ align-items: baseline;+ gap: 2px 10px;+ padding: 10px 14px;+ border-radius: 12px;+ background: #0d0a16b8;+ color: #fff;+ font-size: 14px;+ font-weight: 500;+ line-height: 1.35;+ box-shadow: inset 0 0 0 1px #ffffff26;+ -webkit-backdrop-filter: blur(14px) saturate(1.4);+ backdrop-filter: blur(14px) saturate(1.4);+}+.site .work-index { grid-row: 1 / 3; align-self: start; color: #d9d3ee; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .4px; user-select: none; }+.site .work-name { grid-column: 2; margin: 0; font-size: inherit; letter-spacing: 0; }+.site .work-date { grid-column: 2; color: #d9d3ee; font-size: 12px; font-weight: 400; }+.site .example.is-lead .work-title { font-size: 17px; padding: 14px 18px; }++.site .agents { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 40px; padding: clamp(22px, 4vw, 40px); border-radius: 24px; background: #ffffff12; box-shadow: inset 0 0 0 1px var(--invert-border); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }.site .agents-intro { display: grid; gap: 14px; min-width: 0; }.site .agents-intro p { color: var(--muted); }.site .agents .code-block { margin-top: 6px; background: var(--window); align-items: center; }.site .agents .code-block pre { white-space: pre-wrap; overflow-wrap: anywhere; }.site .agent-cards { display: grid; gap: 8px; }-.site .agent-cards a { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); background: var(--window); transition: background-color .12s; }+.site .agent-cards a { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--panel-radius); background: var(--bg); transition: background-color .12s; }.site .agent-cards a:hover { background: var(--surface); }.site .agent-cards .icon { grid-row: span 2; width: 22px; height: 22px; }.site .agent-cards h3 { font-size: 15px; }@@ -191,13 +336,17 @@ body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-blo.site .documentation-links { display: grid; gap: 20px; }.site .doc-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }-.site .doc-links a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 14px 18px; border-radius: var(--radius); background: var(--bg); font-size: 15px; font-weight: 500; transition: background-color .12s; }+.site .doc-links a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 14px 18px; border-radius: var(--panel-radius); background: var(--bg); font-size: 15px; font-weight: 500; transition: background-color .12s; }.site .doc-links a:hover { background: var(--surface); }-/* Footer: one quiet row on the page background. */+.site .section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }+.site .section-heading a { color: var(--muted); font-size: 15px; }+.site .section-heading a:hover { color: var(--text); text-decoration: underline; }+.site .site-footer { width: var(--page); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px; padding-block: 24px 32px; color: var(--muted); font-size: 14px; }.site .site-footer .brand { font-size: 14px; font-weight: 600; }.site .site-footer .brand .brand-mark { width: 18px; height: 18px; }+.site .site-footer p { display: flex; align-items: center; gap: 5px; }.site .site-footer p a:not(.brand) { color: var(--text); }.site .footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }.site .footer-links a { display: inline-flex; align-items: center; min-height: 26px; color: var(--muted); }@@ -205,7 +354,7 @@ body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-blo/* Docs: the reading page keeps its own layout (documentation.css) on these tokens. */.documentation.site { --page: min(1320px, calc(100% - 40px)); }-.documentation.site > main { width: 100%; padding-top: 12px; }+.documentation.site > main { width: var(--page); padding-top: 12px; }.site .table-scroll { overflow-x: auto; }.site table { width: 100%; border-collapse: collapse; }.site td, .site th { text-align: left; vertical-align: top; }@@ -213,39 +362,40 @@ body.site > main { flex: 1; width: var(--page); margin-inline: auto; padding-blo.site .docs-search input { width: 100%; border: 0; color: var(--text); font: inherit; }@media (max-width: 1100px) {- .site .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }.site .doc-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }}@media (max-width: 960px) {- .site .hero, .site .code-section, .site .agents { grid-template-columns: 1fr; gap: 28px; }+ .site .code-section, .site .agents { grid-template-columns: 1fr; gap: 28px; }+}+@media (max-width: 820px) {+ .site .hero { gap: 20px; }+ .site .hero-frame { min-height: 0; }+ .site .hero-frame::after { background: linear-gradient(to top, #09070f66, transparent 40%); }+ .site .hero .hero-copy { grid-area: 2 / 1; padding: 0; max-width: none; }+ .site .hero h1 { text-shadow: none; }+ .site .hero .lede { color: var(--muted); }+ .site .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }+ .site .example { grid-column: span 1; }+ .site .example.is-lead { grid-column: span 2; grid-row: span 1; min-height: 0; aspect-ratio: 4 / 3; }}@media (max-width: 760px) {- body.site > main { gap: 64px; padding-top: 12px; }- .site .gallery, .site .doc-links { grid-template-columns: 1fr; }+ body.site > main { gap: 64px; }+ .site .doc-links { grid-template-columns: 1fr; }.site .version { display: none; }.site .command-row { flex-wrap: wrap; }.site .command-row code { flex-basis: 100%; }.site .code-section .code-block pre { font-size: 12px; }.site .site-footer { flex-direction: column; align-items: flex-start; }}--/* The logo file is drawn in a light stroke for dark backgrounds; light mode inverts it. */-.site .brand .brand-mark { filter: invert(1); }-@media (prefers-color-scheme: dark) {- .site .brand .brand-mark { filter: none; }-}-/* Inside the agents card the rows step up from the card: white on grey in light mode, a lighter grey in dark mode. */-@media (prefers-color-scheme: dark) {- .site .agents .code-block, .site .agent-cards a, .site .command-row { background: var(--surface); }- .site .agent-cards a:hover { background: var(--border); }+/* On a phone the cards are too small to carry a chip: the label goes back under the piece. */+@media (max-width: 600px) {+ .site .navigation { border-radius: 20px; }+ .site .hero-frame { aspect-ratio: 4 / 3; border-radius: 20px; }+ .site .hero-caption { top: 10px; right: 10px; left: 10px; max-width: none; font-size: 12px; border-radius: 14px; }+ .site .gallery { grid-template-columns: 1fr; }+ .site .example, .site .example.is-lead { grid-column: auto; aspect-ratio: auto; }+ .site .example.is-lead .work-media { position: relative; height: auto; aspect-ratio: 4 / 3; }+ .site .work-title { position: static; margin-top: 10px; padding: 0; background: none; box-shadow: none; color: var(--text); -webkit-backdrop-filter: none; backdrop-filter: none; }+ .site .example.is-lead .work-title { font-size: 15px; padding: 0; }+ .site .work-index, .site .work-date { color: var(--muted); }}-.site .site-footer p { display: flex; align-items: center; gap: 5px; }-.site .section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }-.site .section-heading a { color: var(--muted); font-size: 15px; }-.site .section-heading a:hover { color: var(--text); text-decoration: underline; }-/* The hero shows a still of a showcase scene; it opens the live scene. */-.site .hero-shot { position: relative; display: block; min-width: 0; overflow: hidden; border-radius: var(--panel-radius); background: var(--surface); box-shadow: var(--shot-shadow); }-.site .hero-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .4s cubic-bezier(.2, 0, 0, 1); }-.site .hero-shot:hover img { transform: scale(1.02); }-.site .hero-shot-label { position: absolute; left: 14px; bottom: 14px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--window) 88%, transparent); color: var(--text); font-size: 14px; font-weight: 500; backdrop-filter: blur(8px); }-@media (prefers-reduced-motion: reduce) { .site .hero-shot:hover img { transform: none; } }