# Ember — a fire restaurant whose name burns as live coals, and a tasting menu wiped by ink
> Paste this whole prompt as one message into a new, empty project.
## 1. Role and goal
You are a senior creative developer and art director. Build the one-page site of [BRAND], a 26-seat restaurant that cooks everything over a wood fire, in one pass. It hangs on one real-time WebGL scene that never leaves the screen:
- On the first screen the name is the fire: a fragment shader draws the giant serif word as a bed of cracked, glowing coals, sparks are born inside the letters, and the pointer is a breath (where it passes the coals turn white-hot, the sparks flare and scatter, a small thermometer climbs).
- Scrolling burns the word away from the bottom up. The tasting menu is one pinned screen of five courses, each an abstract plate seen from above (a thrown, glazed dish with a few glazed forms, real 3D under studio light, turning, draggable); between courses an ink-bleed with a thin burning edge spreads from the plate and reveals the next plate on the next table.
- A cream sheet slides over everything (the woods on a horizontal track, the room) and lifts on the fire behind a reservation panel; the word re-ignites in the footer.
It must read as a real restaurant's site, with a working (local) reservation panel. Follow the numbers exactly: they are the design.
## 2. Stack and constraints
- Next.js (App Router) with TypeScript and Tailwind CSS v4 (`@import "tailwindcss"`, tokens in `@theme`); `three` with `@react-three/fiber` and `@react-three/drei` (only `Environment` and `Lightformer`); `@react-three/postprocessing` with `postprocessing` (bloom, FXAA, tone mapping); `gsap` with ScrollTrigger; `lenis`. In a Vite project use the same libraries with React 19.
- Fonts: Fraunces (variable with its optical-size axis, roman and italic), Inter (variable), DM Mono 400, through `next/font/google` (`Fraunces({ axes: ["opsz"], style: ["normal", "italic"] })`), or self-hosted from `@fontsource-variable/fraunces` (the `opsz` files), `@fontsource-variable/inter` and `@fontsource/dm-mono` in Vite, Latin subset only.
- The scene is one client component imported with `dynamic(() => import(...), { ssr: false })`: one `<Canvas>` for the whole page.
- No external assets: every visual is generated in code. No image, video, 3D model, HDRI, texture or icon file. Forbidden because they download files: drei `Environment` with `preset` or `files`, `useGLTF`, `useTexture` with a URL, drei `<Text>` without a local font, any `<link>` or `@import` to a font or script host.
- One page. Every link is an in-page anchor scrolled by lenis (prevent the default, leave the hash alone); footer social links are placeholders that do nothing. No `target="_blank"`, no `alert`, no `mailto:`. The reservation form sends nothing. Pinning is allowed; never block or hijack the scroll.
- No UI kit, no icon font, no carousel package, no lorem ipsum. A handful of files: `content`, `state`, `hooks`, `fitText`, `scene/` (`Scene`, `shaders`, `mask`, `dishes`), `sections/` (`Hero`, `Menu`, `Sheet`, `Reserve`, `Chrome`).
## 3. Design tokens
```css
--char: #0E0C0A; /* page background; text on the accent */
--soot: #16120F; /* the reservation panel */
--cream: #F1E7D6; /* main text on dark */
--bone: #A99C89; /* secondary text and labels on dark */
--paper: #ECE2CF; /* background of the cream sheet */
--ink: #1A1512; /* text on paper; background of the wood cards */
--smoke: #6E6253; /* labels on paper */
--accent: #FF5A1F; /* ember: buttons, live dot, units, selected states, one ring per wood card, and the fire itself in the scene */
--line: rgba(241, 231, 214, 0.16); /* hairlines on dark */
--line-ink: rgba(26, 21, 18, 0.18); /* hairlines on paper */
/* text tints used once each: #CFC3B0 course paragraph, #D8CCB9 wood-card and footer text, #3D342C lead paragraph on paper */
/* scene only, the table behind each course, in order: #131B1F, #27211B, #141E19, #2A120E, #2A1A0E */
```
`--accent` is a custom property on `:root` and a prop of the scene: every ember colour, in CSS and shaders, reads it.
Type. Display: Fraunces. Body: Inter 400, 1rem / 1.6. Labels: DM Mono 400, 0.6875rem / 1.4, uppercase, tracking 0.12em.
Role | Size | Setting
--- | --- | ---
The word (hero, footer) | fitted to its container's width, at most 52% of the viewport height | Fraunces 800, line-height 0.86, tracking -0.04em
Section title (`h2`) | `clamp(2.4rem, 1.2rem + 4.6vw, 5.5rem)` | Fraunces 400, line-height 0.98, tracking -0.035em; second line 300 italic, tracking -0.02em
Course title | `clamp(2.3rem, 1.2rem + 4vw, 5rem)` | as `h2`
Wood name, end of track, list-menu titles | `clamp(2.5rem, 1.6rem + 3vw, 4.25rem)` | Fraunces 400, line-height 0.95, tracking -0.04em
Manifesto statement | `clamp(1.9rem, 1.05rem + 3.5vw, 4.4rem)` | Fraunces 400, line-height 1.1, tracking -0.03em
Hero headline | `clamp(1.55rem, 1.1rem + 1.7vw, 2.6rem)` | Fraunces 400, line-height 1.08, tracking -0.025em; second line 300 italic
Stat numbers | `clamp(2.6rem, 1.6rem + 3.4vw, 4.6rem)` | Fraunces 300, line-height 1, tracking -0.04em; unit at 0.42em in the accent
Lead paragraph | `clamp(1.03rem, 0.97rem + 0.32vw, 1.22rem)` | Inter 400, line-height 1.55, max-width 34em
Course meta value; zone note; quote | 1.25rem; 1.125rem; `clamp(1.35rem, 1.1rem + 0.9vw, 1.9rem)` | Fraunces 400; 300 italic; 300 italic
Navigation brand; links; buttons | 1.375rem; 0.875rem; 0.9375rem | Fraunces 600, tracking -0.03em; Inter 400; Inter 500, tracking -0.01em
Space: page padding `--pad: clamp(20px, 4vw, 56px)`; grid gutter `--gap: clamp(14px, 1.7vw, 24px)`. Radii: buttons and chips 999px, wood cards 10px, the panel 18px, stepper buttons 50%. Focus ring: 2px solid accent, offset 4px. One shadow, on the panel: `0 40px 120px rgba(0,0,0,0.55)`.
Easing vocabulary: arrivals and hovers `expo.out` (CSS `cubic-bezier(0.16, 1, 0.3, 1)`), exits `power2.in`, the ink threshold a quadratic ease-in-out, anything scrubbed `none`. Arrivals last 0.9 to 1.1 s with staggers of 0.07 to 0.1 s; hovers 0.5 to 0.7 s.
## 4. Layout
- A 12-column grid (`repeat(12, minmax(0, 1fr))`, gutter `--gap`) inside the page padding, no max-width. Asymmetric on purpose: labels in columns 1 to 2, titles from column 3, supporting text in columns 8 or 9 to 12, the plate right of centre.
- Stacking: canvas `position: fixed; inset: 0; z-index: 0; pointer-events: none`; `main` and footer `position: relative; z-index: 1`, transparent wherever the fire must show; the cream sheet `z-index: 2`, opaque; navigation `position: fixed; z-index: 20`. `body` is `--char`; the root wrapper has `overflow-x: clip`.
- Order and heights at 1440 by 900 (about 9.3 screens, never more than 10): hero 100vh; the hearth 0.95 screen; tasting menu 100vh, pinned for a further 250% of the viewport height; the cream sheet 1.9 screens (the fire, then the room); reservations 1.15 screens; footer 0.8 screen.
- Anchor ids: `top`, `menu`, `fire`, `room`, `reserve`.
## 5. Sections
### 5.1 The scene
One canvas, three layers drawn in this order, plus post-processing. The reference code holds every formula; this text says what each part is and gives its numbers.
**Renderer.** `<Canvas dpr={[1, 1.75]} shadows frameloop="never" gl={{ antialias: false, alpha: false }}>`, perspective camera `fov 30` at `[0, 0, 10]`, `gl.shadowMap.autoUpdate = false`. `EffectComposer` with `multisampling={0}` and three effects merged in one pass: `FXAA`, `Bloom` (`mipmapBlur`, intensity 0.7, luminance threshold 0.9, smoothing 0.35, radius 0.7), `ToneMapping` (ACES filmic). The shaders output linear HDR colour. A `requestAnimationFrame` loop calls fiber's `advance(performance.now() / 1000)` only while the canvas is visible (not covered by the cream sheet, tab not hidden).
**Layer 1, the backdrop.** One full-screen triangle (positions `[-1,-1,0, 3,-1,0, -1,3,0]`, clip space written directly, no depth test or write, `renderOrder -1`, not frustum-culled) whose fragment shader shows the fire or a table and cuts between them with the ink.
- *The fire.* Near-black base, linear `(0.0105, 0.0085, 0.0075)`. Smoke is value noise: one warp octave feeding a 3-octave fbm (octaves rotated, scaled about 2.03), drifting up at 0.045 screen heights per second, lit from a hearth below the screen (`exp(-3.1 y)`); the light sways sideways (period 18 s) and flickers (`uFlick`, 0.68 to 1).
- *The word as coals.* `uMask` is a canvas texture of the word (red: letters; green: blurred by 7% of the font size; blue: blurred by 30%), placed by `uRect` exactly over the transparent DOM heading. Inside the letters, cellular (Worley) noise on a noise-warped grid, cell size 8.5% of the font size (`uCell`), makes lumps and cracks. Heat = `uHeat` (0.52 at rest) + slow noise (±0.47) + the pointer trail (× 0.6, capped) + a gust crossing the screen every 7 s (+0.22), ±0.3 per lump once lit. Glow falls off from the cracks into each lump, wider with heat; above 0.95 a lump lights up whole. `ramp()` maps heat to colour: black, deep red (accent × `(0.6, 0.2, 0.16)`), accent, then the hot colour (accent mixed 65% toward linear `(1, 0.8, 0.42)`), at intensity `0.35 + 1.5 h` so hot coals exceed 1 and bloom. The crust is charcoal with ash flecks, bevelled from the green channel, lit warm from below (20% of it until the fire reaches it) and faintly cool from above. Around the letters and in their counters the blue channel darkens the smoke up to 80% (soot); a faint halo glows only beyond the bevel.
- *Ignition (intro).* `uIgnite` runs 0 to 1 between 0.35 s and 1.7 s: a noisy, white-hot front crosses the word from left to right and leaves the coals alight. `uCold` fades the cold letters in over the first 0.5 s. `uHeat` carries an extra 0.4 that decays (time constant 3 s) once the front has passed.
- *Burn-away (scroll).* `uBurn = smoothstep(0, 0.8 × viewport height, scrollY)`: the letters are eaten from the bottom up along a ragged white-hot front; `uHeat` gains `1.1 × burn × (1 - burn)`.
- *The table.* A dark stained board in the colour of the course: two stretched value noises for the grain, a pool of light around the plate, a faint accent glow from the left, and the plate's contact shadow (a soft disc, 75% dark, from 0.9 to 1.24 plate radii, offset 0.02 right and 0.03 down).
**The ink-bleed.** One scalar field over the screen (`inkField`), shared by the backdrop and every plate material: radial distance from `uOrigin` (the plate centre) × 0.7 + 3-octave fbm × 0.3; or, with `uVert = 1`, height × 0.86 + fbm × 0.14. Everything with `field < T` shows the *next* image. `inkEdge` paints the front: the old image is soaked to near-black within 0.11 ahead of it, a thin line burns exactly on it, a short warm afterglow trails behind. Plate materials get the same GLSL through `onBeforeCompile` (`inkPatch`): fragments outside `(uOut, uIn)` are discarded and the same edge is added to the outgoing light. Plate and table are cut by the same line, with no render target.
**Layer 2, the plates.** Five dishes (`DISHES` in the reference code is their exact data), built one per frame once the intro clock passes 2.7 s or the page is scrolled 15% of a screen, then pre-compiled with `gl.compileAsync`. Only the current dish, and during a wipe the next, are visible. Outer group: position, scale, pointer tilt. Inner group: rotation `[π/2 - 0.2, 0, 0]` (seen from above, leaning 11° away). Each dish turns about its own axis.
- *Dish.* `LatheGeometry` (96 segments) of the profile smoothed by a `SplineCurve` (44 divisions, last point forced onto the axis). Push it out of round (radius × `1 + 0.006 sin(3a + 1) + 0.003 sin(7a)`, height + `0.006 r sin(2a + 0.5)`), recompute the normals, average them along the lathe seam, and replace the UVs by a plan view (`0.5 + x / 2R`, `0.5 + z / 2R`, R = 1.02 × the largest radius).
- *Glaze.* One canvas texture per dish (1024px, 512 on phones), painted in plan: a radial gradient from `pool` (centre) to `base` (50% to 90%) to `rim` (96.5% outward); 70 throwing rings (arcs 1 to 6 rad long, 1 to 6px wide, alternately white at 2 to 7% and black at 3 to 10%); 1,500 speckles in `speck` (radius 0.4 to 3.6px, alpha 0.15 to 0.8). It is the `map` (sRGB, anisotropy 4) of a white `MeshPhysicalMaterial` with the dish's roughness, clearcoat 1, clearcoatRoughness 0.12.
- *Forms.* Eight shared unit geometries: `ball` (sphere 40×24), `slab` (`RoundedBoxGeometry` 1×1×1, 4 segments, radius 0.16), `ring` (torus radius 1, tube 0.06, laid flat), `log` (capsule radius 0.5, length 2, laid along x), `cup` (lower half-sphere), `dome` (upper half-sphere), `shard` (3-sided cylinder), `crumb` (icosahedron). A part is a holder group (position `p`, rotation `r`) with one mesh (scale `s`) and optional `kids` in the holder's frame. Its `MeshPhysicalMaterial`: `color`, roughness `rough` (default 0.4), clearcoat `coat` (default 0, clearcoatRoughness 0.12), iridescence `irid` (IOR 1.6), emissive in its own colour at intensity `glow`, double-sided if `double`; `accent` parts take the accent colour. Each `scatter` is one `InstancedMesh` of `n` instances at random angles around `at`, at a radius between the two `spread` values, sized between the two `size` values, flattened to `flat` of their height (then only turned about y) or randomly rotated. Every material goes through `inkPatch`; every mesh casts and receives shadows.
**Light.** No HDRI. `<Environment resolution={256} frames={1}>` on a `#0b0a09` background with four `Lightformer`s aimed at the origin: a soft box overhead (rect 10×5 at `[0, 9, 4]`, `#fff3e2`, intensity 1.6); a warm strip on the fire side (rect 2.4×8 at `[-9, 0, 2]`, `#ff8a45`, 1.6); a cool strip opposite (rect 2×8 at `[9, 2, 3]`, `#cfe1ff`, 0.6); a ring for the sparkle on round forms (scale 2.2 at `[2, -3, 9]`, white, 2). One `directionalLight` (`#fff8ef`, 1.5) from `[-3.2, 4.5, 6.5]` relative to the plate, with a 1024px shadow map (orthographic ±2.4, near 1, far 20, bias -0.0004, normalBias 0.03) refreshed only while a plate is visible; during a wipe only one dish casts shadows (the old one until `T` reaches 0.3, then the new one). One `pointLight` in the accent colour (1.6 × the flicker, distance 9, decay 2) follows the pointer 2.2 units above the table.
**Layer 3, the sparks.** One `THREE.Points` of 2,600 points (1,300 on phones), additive, no depth test, `renderOrder 10`, placed in screen space by the vertex shader (the camera is ignored). 72% are born at random pixels inside the letters (sampled from the mask's red channel), 28% along a line 3% below the screen. Each lives 2.6 to 6.5 s in a loop, rises 0.3 to 1.15 screen heights (× a depth factor 0.55 to 1.6) on a wobbling path, is drawn as a streak along its travel (stretch 1 to 6 with speed), cools from the hot colour to the accent to dark red, and twinkles. 1.5% are large soft discs (26 to 72px, 9% intensity), embers out of focus. In the intro every letter spark takes off when the ignition front passes its letter. `uEmit` scales the letter sparks (up to 3.2 while the word burns, 0 once it is gone); `uAmount` thins all sparks to 7% over the tables.
**Pointer.** Viewport fractions, smoothed by `1 - exp(-10 dt)`. It leaves eight heat points in a uniform array: slot 0 rests under the pointer (strength 0.5 while it has moved within the last 2.5 s), slots 1 to 7 are stamped every 0.07 screen heights of travel at strength 1 and cool by `exp(-1.5 dt)`. They heat the coals (Gaussian, variance 0.02), warm the smoke, push the sparks aside (0.03) and brighten them (up to × 3.1). The thermometer reads `620 + min(180, 52 × Σ strength)`. Over the menu the plate group tilts with the pointer (x ±0.07 rad, y ±0.1 rad) and the point light follows it; a horizontal drag on the plate adds spin (0.02 rad/s per pixel, clamped to ±6, decaying by `exp(-2.2 dt)`) to the base 0.14 rad/s.
**Scroll.** Read every frame from the DOM (rectangles of the hero word, the footer word and the pinned menu section) and from `S.menu`, 0 to 4, written by the menu's ScrollTrigger.
Where | What the scene does
--- | ---
Hero, scrollY 0 to 0.8 screen | The word scrolls up with its heading and burns away (`uBurn` 0 to 1); letter sparks up to 3.2 times brighter, then none
Menu section top between 1.2 and 0 screens below the top of the viewport | The first table and plate rise over the fire: vertical ink, `T = (1 - top) × 0.86 + 0.14`, so the bleeding front follows the section's top edge; the plate sits in the section and scrolls in with it; sparks thin to 7%
Menu pinned: course `c`, fraction `f` of its quarter | `f` under 0.5: course `c` alone. `f` from 0.5 to 0.95: radial ink from the plate, `T = -0.08 + 1.16 × easeInOut((f - 0.5) / 0.45)`, table and dish `c` to `c + 1` (`uOut = T` on the old dish, `uIn = T` on the new), noise seed `7.3 c + 1.7`; from `T = 1.07` only the new course is drawn. All dishes also turn by `0.7 × S.menu`
After the pin | Course 5 scrolls away with its section under the cream sheet; rendering stops while the sheet covers the viewport
Sheet lifting, reservations, footer | Fire again, all sparks. Once the footer word is within 1.1 screens the mask is placed on it and `uBurn = 1 - smoothstep(0.1, 0.8, (viewport height - top) / height)`: the word re-forms as it enters. Confirming a reservation sets `S.flare = 1` (heat +0.6, flicker +0.5, sparks +1), decaying by `exp(-1.3 dt)`
Plate placement: on screens wider than 0.9 aspect, centre 15% of the width right of the middle and 2% below it, scale `min(0.95, viewportWidth / 8.2)` (the plate is about 60% of the viewport height across); otherwise centred, 16% above the middle, scale `0.86 × viewportWidth / 3.4`.
#### Reference code
Use this code as written; adapt only imports and file layout to the project. It holds the shaders, the word mask, the dish data with the ink patch, and the scene's frame function (pointer and scroll mapping) with its lights. Write the rest from 5.1: `dishGeometry`, `glazeTexture`, `buildDish(dish, index, ink, own, accents, textureSize)` (returns a `THREE.Group`), the `<Canvas>` with its composer and frame loop, and this set-up, which the frame function relies on:
- `S`: a plain shared object `{ px: 0.68, py: 0.4, seen: -1e9, menu: 0, spin: 0, flare: 0, still: false, temp: 620, t0 }` (pointer as viewport fractions and the `performance.now()` of its last move, written by a `pointermove` listener; `t0`: section 6). `TABLES`: the five table colours. `clamp`, `smooth` (smoothstep): helpers.
- `ink`: one object of shared uniforms `{ uRes: Vector2, uOrigin: Vector2, uSeed: 0, uVert: 0, uAccent: Color(accent), uHot: Color(accent).lerp(HOT, 0.65) }`, spread into the backdrop's uniforms and handed to every dish material; `uAccent` and `uHot` are also the sparks' uniforms (the same objects). An effect updates both colours, the accent materials and the point light when the accent changes.
- `backdrop`: a `ShaderMaterial` (`BACKDROP_VERT`, `BACKDROP_FRAG`, no depth test or write) with, besides `ink`: `uTime 0, uT -9, uFromFire 1, uCold 0, uIgnite 0, uBurn 0, uHeat 0.52, uWord 1, uCell 0.03, uFlick 1, uPlateR 0.3, uPlate Vector2, uTexel Vector2, uColA Color, uColB Color, uRect Vector4, uMask (the mask texture), uTrail (the array of 8 Vector3)`.
- `sparks`: `{ geometry, material }`. Attributes: `position` (zeros; three needs it for the draw count), `aSpawn` (vec4: random x, random y, 0 for the first 72% and 1 for the rest, a random seed), `aRand` (vec4 of randoms). Material: `ShaderMaterial` (`SPARK_VERT`, `SPARK_FRAG`, transparent, additive, no depth test or write) with `uTime, uAspect, uPx, uEmit 1, uAmount 1, uIgnite0 = IGNITE0, uIgniteDur = IGNITE_DUR, uRect` (the backdrop's own uniform object), `uAccent`, `uHot`, `uTrail` (the same array).
- `mask = createMask()`. An effect calls `drawMask(mask, heroWord, wordCount)` on mount, 120 ms after the fonts load (`document.fonts.ready` and `loadingdone`), 120 ms after a resize and when the brand changes; it then copies `mask.spawn` into the first `wordCount` entries of `aSpawn` and sets `uTexel` to one texel of the canvas.
- `trail`: 8 `Vector3`. `tables`: `TABLES` as `Color`s. `screen`: the full-screen triangle. `dishes`: a ref to the built dishes `{ own: { uIn, uOut }, group, cast }`. `accents`: the materials flagged `accent`. `local`: a ref `{ x: S.px, y: S.py, rest: 0, head: 0, lx: 0, ly: 0, angle: 0, amount: 1, accent }`. Refs `tilt`, `table`, `key`, `fire` for the JSX. `gl` from `useThree`; `accent` and `phone` (viewport up to 720px) are props.
- The frame loop: on every animation frame, nothing if the canvas is covered or the tab hidden; in reduced motion, draw only while a counter is positive (14 at mount, reset to 8 by the mask and accent effects); otherwise `advance(performance.now() / 1000)`.
`scene/shaders.ts`
```ts
/** GLSL of the scene: value noise, the ink-bleed field, the backdrop (fire, coal lettering, tables) and the sparks. */
export const NOISE = /* glsl */ `
float hash21(vec2 p){ p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }
float vnoise(vec2 p){
vec2 i = floor(p), f = fract(p); f = f * f * (3.0 - 2.0 * f);
return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x), mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x), f.y);
}
float fbm3(vec2 p){ // three octaves, each turned so the lattice never lines up
mat2 r = mat2(0.8, -0.6, 0.6, 0.8);
float s = 0.5 * vnoise(p); p = r * p * 2.03 + 11.7;
s += 0.25 * vnoise(p); p = r * p * 2.01 + 23.1;
return (s + 0.125 * vnoise(p)) / 0.875;
}
`;
// The ink-bleed: one scalar field over the screen; everything with field < threshold shows the next image. Radial from uOrigin (the plate)
// for the course changes, vertical (uVert = 1) when the menu rises over the fire. The same chunk is injected in the plate materials.
export const INK = /* glsl */ `
uniform vec2 uRes; uniform vec2 uOrigin; uniform float uSeed; uniform float uVert; uniform vec3 uAccent; uniform vec3 uHot;
float inkField(vec2 frag){
vec2 uv = frag / uRes; float asp = uRes.x / uRes.y; vec2 p = vec2(uv.x * asp, uv.y);
vec2 w = p + 0.10 * vec2(vnoise(p * 3.1 + uSeed), vnoise(p * 3.1 + uSeed + 7.7));
float n = fbm3(w * 2.6 + uSeed);
float radial = length(p - uOrigin) / (0.55 * asp + 0.45);
return mix(radial * 0.7 + n * 0.3, uv.y * 0.86 + n * 0.14, uVert);
}
// d = field - threshold. d > 0: the old image, soaked with ink just ahead of the front. d < 0: the new one, still warm.
vec3 inkEdge(vec3 col, float d){
float soak = (1.0 - smoothstep(0.0, 0.11, d)) * step(0.0, d);
col = mix(col, vec3(0.010, 0.008, 0.007), soak * 0.94);
col += mix(uAccent, uHot, 0.6) * 1.7 * exp(-abs(d) * 210.0) + uAccent * 0.12 * exp(-max(-d, 0.0) * 22.0) * step(d, 0.0);
return col;
}
`;
export const BACKDROP_VERT = /* glsl */ `void main(){ gl_Position = vec4(position.xy, 1.0, 1.0); }`;
export const BACKDROP_FRAG = /* glsl */ `
precision highp float;
uniform float uTime, uT, uFromFire, uCold, uIgnite, uBurn, uHeat, uWord, uCell, uFlick, uPlateR;
uniform vec2 uPlate, uTexel;
uniform vec3 uColA, uColB;
uniform vec4 uRect; // the word: x, y (from the top), width, height, in fractions of the screen
uniform sampler2D uMask; // r: the letters, g: letters blurred a little (bevel), b: blurred a lot (halo)
uniform vec3 uTrail[8]; // pointer heat: x * aspect, y (up), strength
${NOISE}
${INK}
vec3 ramp(float h){ // black body, bent toward the accent colour; returns HDR
vec3 c = mix(vec3(0.0), uAccent * vec3(0.6, 0.2, 0.16), smoothstep(0.0, 0.3, h));
c = mix(c, uAccent, smoothstep(0.2, 0.6, h));
c = mix(c, uHot, smoothstep(0.55, 1.0, h));
return c * (0.35 + 1.5 * h);
}
float trailHeat(vec2 p){
float h = 0.0;
for (int i = 0; i < 8; i++){ vec2 d = p - uTrail[i].xy; h += uTrail[i].z * exp(-dot(d, d) / 0.02); }
return h;
}
vec3 fireLayer(vec2 uv, vec2 p, float asp){
float t = uTime;
// smoke drifting up, lit from a hearth just below the screen; the light sways from side to side
vec2 q = vec2(p.x * 1.15, p.y * 0.8 - t * 0.045);
float warp = vnoise(q * 1.3 + vec2(0.0, t * 0.03));
float smoke = fbm3(q * 2.2 + warp * 1.5);
float lift = exp(-uv.y * 3.1);
float sway = 0.5 + 0.5 * sin(t * 0.35 + p.x * 1.4);
float th = trailHeat(p);
vec3 col = vec3(0.0105, 0.0085, 0.0075);
col += uAccent * vec3(1.0, 0.55, 0.4) * lift * (0.035 + 0.15 * smoke * smoke) * (0.55 + 0.65 * sway) * uFlick;
col += vec3(0.034, 0.025, 0.02) * smoke * smoke * (0.2 + 1.6 * lift);
col += uAccent * vec3(1.0, 0.6, 0.45) * 0.022 * th;
// the word, as a bed of coals
vec2 mu = (vec2(uv.x, 1.0 - uv.y) - uRect.xy) / uRect.zw;
if (uWord > 0.001 && mu.x > 0.0 && mu.x < 1.0 && mu.y > 0.0 && mu.y < 1.0){
vec2 tu = vec2(mu.x, 1.0 - mu.y);
vec4 m = texture2D(uMask, tu);
float nz = vnoise(p * 7.0);
float front = uIgnite * 1.3 - 0.15 - mu.x - (nz - 0.5) * 0.1; // the fire runs through the letters, left to right
float ign = smoothstep(0.0, 0.05, front);
float ignEdge = exp(-abs(front) * 26.0) * step(uIgnite, 0.999);
float bf = (1.0 - mu.y) * 0.5 + fbm3(p * 4.5 + 3.0) * 0.5; // on scroll they burn away from the bottom up
float B = uBurn * 1.25 - 0.12;
float alive = smoothstep(B, B + 0.04, bf);
float burnEdge = exp(-abs(bf - B) * 22.0) * step(0.002, uBurn);
col *= 1.0 - 0.8 * smoothstep(0.12, 0.5, m.b) * (1.0 - smoothstep(0.4, 0.6, m.r)) * uWord * uCold * (1.0 - uBurn); // soot around and between the letters
col += ramp(0.5) * m.b * m.b * 0.2 * ign * (1.0 - uBurn) * uWord * (0.6 + 0.8 * uHeat) * (1.0 - smoothstep(0.15, 0.5, m.g)); // halo, kept off the counters
float inside = smoothstep(0.4, 0.6, m.r) * alive * uWord;
if (inside > 0.001){
float gust = 0.22 * exp(-pow((uv.x - (fract(t / 7.0) * 1.8 - 0.4)) / 0.16, 2.0));
float heat = (uHeat + 0.95 * (vnoise(p * 2.1 + vec2(0.0, -t * 0.12)) - 0.5) + min(th, 1.2) * 0.6 + gust) * ign + ignEdge * 1.2 + burnEdge * 1.5;
// cracked crust: cellular noise on a warped grid, each lump keeps its own heat
vec2 c = vec2(mu.x * uRect.z * asp, mu.y * uRect.w) / uCell;
c += 0.5 * vec2(vnoise(c * 0.8 + 3.0), vnoise(c * 0.8 + 9.0));
vec2 ci = floor(c), cf = fract(c); float f1 = 9.0, f2 = 9.0, id = 0.0;
for (int j = -1; j <= 1; j++) for (int i = -1; i <= 1; i++){
vec2 g = vec2(float(i), float(j)); float h = hash21(ci + g);
vec2 o = g + vec2(h, fract(h * 37.7)) - cf; float d = dot(o, o);
if (d < f1){ f2 = f1; f1 = d; id = h; } else if (d < f2){ f2 = d; }
}
float crack = sqrt(f2) - sqrt(f1);
float fine = vnoise(c * 6.0);
float ch = heat + (id - 0.5) * 0.6 * (0.2 + 0.8 * ign); // cold coals are all alike; once lit each lump keeps its own heat
float glow = exp(-crack / (0.03 + max(ch, 0.0) * 0.24)) * (0.72 + 0.56 * fine); // heat spreads from the cracks into the lump
glow = max(glow, smoothstep(0.95, 1.7, ch) * 0.7); // and a very hot lump lights up whole
// the crust itself: charcoal, bevelled with the soft channel, lit warm from below and faintly from above
float gx = texture2D(uMask, tu + vec2(uTexel.x * 3.0, 0.0)).g - texture2D(uMask, tu - vec2(uTexel.x * 3.0, 0.0)).g;
float gy = texture2D(uMask, tu + vec2(0.0, uTexel.y * 3.0)).g - texture2D(uMask, tu - vec2(0.0, uTexel.y * 3.0)).g;
vec3 nrm = normalize(vec3(-gx * 4.0 + (id - 0.5) * 0.6, -gy * 4.0 + (fract(id * 7.3) - 0.5) * 0.6, 0.4));
float warm = max(dot(nrm, normalize(vec3(-0.25, -0.75, 0.55))), 0.0);
float cool = max(dot(nrm, normalize(vec3(0.35, 0.7, 0.6))), 0.0);
float ash = smoothstep(0.62, 0.95, vnoise(c * 3.0 + 40.0)) * id;
vec3 crust = (vec3(0.02, 0.017, 0.015) * (0.5 + fine) + vec3(0.06, 0.056, 0.052) * ash) * (0.35 + 0.65 * smoothstep(0.0, 0.2, crack));
crust += vec3(0.045, 0.043, 0.042) * cool * cool + uAccent * vec3(1.0, 0.5, 0.35) * warm * 0.28 * (0.3 + uHeat) * (0.2 + 0.8 * ign); // unlit coals are charcoal
vec3 letter = crust * uCold * (1.0 - clamp(glow * 1.3, 0.0, 1.0)) + ramp(glow * clamp(0.2 + ch * 0.72, 0.0, 1.08)) * (0.3 + 0.7 * ign);
col = mix(col, letter, inside);
}
}
return col;
}
vec3 tableLayer(vec3 base, vec2 uv, vec2 p, float asp){
// a dark stained board: long grain, a pool of light on the plate, the fire far on the left, the plate's own shadow
float grain = vnoise(vec2(p.x * 1.4, p.y * 42.0)) * 0.6 + vnoise(vec2(p.x * 5.0, p.y * 150.0)) * 0.4;
vec3 c = base * (0.8 + 0.9 * grain);
vec2 dp = (uv - uPlate) * vec2(asp, 1.0);
float d = length(dp);
c *= 0.5 + 1.0 * exp(-d * d * 1.7);
c += uAccent * vec3(1.0, 0.6, 0.45) * 0.018 * exp(-uv.x * 3.4) * uFlick;
c += uAccent * 0.012 * trailHeat(p);
float sd = length(dp - vec2(0.02, -0.03));
c *= 1.0 - 0.75 * smoothstep(uPlateR * 1.24, uPlateR * 0.9, sd);
return c;
}
void main(){
vec2 uv = gl_FragCoord.xy / uRes; float asp = uRes.x / uRes.y; vec2 p = vec2(uv.x * asp, uv.y);
float d = (uT > -1.0 && uT < 2.0) ? inkField(gl_FragCoord.xy) - uT : 5.0;
vec3 col;
if (d > 0.0) col = uFromFire > 0.5 ? fireLayer(uv, p, asp) : tableLayer(uColA, uv, p, asp);
else col = tableLayer(uColB, uv, p, asp);
col = inkEdge(col, d);
col += (hash21(gl_FragCoord.xy + fract(uTime) * 61.0) - 0.5) * 0.006; // dither against banding
gl_FragColor = vec4(max(col, 0.0), 1.0);
}
`;
export const SPARK_VERT = /* glsl */ `
attribute vec4 aSpawn; // xy: where it starts (inside the word, or along the floor), z: 0 word / 1 floor, w: seed
attribute vec4 aRand;
uniform float uTime, uAspect, uPx, uEmit, uAmount, uIgnite0, uIgniteDur;
uniform vec4 uRect;
uniform vec3 uAccent, uHot;
uniform vec3 uTrail[8];
varying vec3 vCol; varying vec2 vDir; varying float vStretch; varying float vSoft;
vec2 path(float a, vec2 start, float rise, float depth){
vec2 q = start;
q.y -= rise * (0.75 * a + 0.25 * a * a);
float w = sin(a * 7.0 + aRand.y * 31.0) * 0.022 + sin(a * 17.0 + aRand.x * 19.0 + uTime * 0.7) * 0.008;
q.x += (w * (0.25 + a) + (aRand.w - 0.5) * 0.16 * a + 0.04 * a * sin(uTime * 0.23 + start.y * 3.0)) * depth / uAspect;
return q;
}
void main(){
float kind = aSpawn.z;
float life = mix(2.6, 6.5, aRand.x);
float a = fract(uTime / life + aRand.y * 9.0);
vec2 start = kind < 0.5 ? uRect.xy + aSpawn.xy * uRect.zw : vec2(aSpawn.x, 1.03);
// every spark of the word takes off when the ignition front passes its letter, then settles into its own cycle
float lit = kind < 0.5 ? uIgnite0 + aSpawn.x * uIgniteDur : uIgnite0 + 0.2 + aRand.z * 1.4;
float env = 1.0;
if (uTime - a * life < lit){ env = uTime < lit ? 0.0 : smoothstep(1.0, 0.8, a); a = clamp((uTime - lit) / life, 0.0, 1.0); }
float depth = mix(0.55, 1.6, aRand.z * aRand.z);
float rise = mix(0.3, 1.15, aRand.w) * depth;
vec2 pos = path(a, start, rise, depth);
vec2 prev = path(max(a - 0.012, 0.0), start, rise, depth);
float blow = 0.0; // the pointer blows them aside and makes them flare
vec2 pp = vec2(pos.x * uAspect, 1.0 - pos.y);
for (int i = 0; i < 8; i++){
vec2 d = pp - uTrail[i].xy; float f = uTrail[i].z * exp(-dot(d, d) / 0.022);
vec2 push = normalize(d + 1e-4) * f * 0.03; pos += vec2(push.x / uAspect, -push.y); blow += f;
}
vec2 vel = (pos - prev) * vec2(uAspect, 1.0);
vDir = normalize(vel + vec2(0.0, -1e-5));
vStretch = clamp(1.0 + 240.0 * length(vel), 1.0, 6.0);
float young = 1.0 - a;
float seed2 = fract(aSpawn.w * 91.7);
vSoft = step(0.985, seed2); // a few large, soft, out-of-focus embers close to the lens
float size = mix(1.6, 5.6, aRand.z * aRand.z) * (0.35 + 0.65 * young) * (1.0 + 0.6 * min(blow, 1.5));
if (vSoft > 0.5){ size = mix(26.0, 72.0, aRand.w); vStretch = 1.0; }
gl_PointSize = size * vStretch * uPx;
float fade = smoothstep(0.0, 0.03, a) * pow(young, 1.4) * env;
float on = step(fract(aSpawn.w * 13.37), uAmount) * (kind < 0.5 ? uEmit : 1.0);
vec3 c = mix(uHot * 1.5, uAccent, smoothstep(0.0, 0.4, a));
c = mix(c, uAccent * vec3(0.9, 0.3, 0.25), smoothstep(0.35, 1.0, a));
float twinkle = 0.75 + 0.25 * sin(uTime * (9.0 + aRand.y * 14.0) + aSpawn.w * 50.0);
vCol = c * fade * on * twinkle * (vSoft > 0.5 ? 0.09 : 2.3 * (1.0 + 1.4 * min(blow, 1.5)));
gl_Position = vec4(pos.x * 2.0 - 1.0, 1.0 - pos.y * 2.0, 0.0, 1.0);
}
`;
export const SPARK_FRAG = /* glsl */ `
precision highp float;
varying vec3 vCol; varying vec2 vDir; varying float vStretch; varying float vSoft;
void main(){
vec2 pc = gl_PointCoord * 2.0 - 1.0;
float d = length(vec2(dot(pc, vDir), dot(pc, vec2(-vDir.y, vDir.x)) * vStretch)); // a streak along the direction of travel
float i = vSoft > 0.5 ? smoothstep(1.0, 0.25, d) : exp(-d * d * 5.0);
gl_FragColor = vec4(vCol * i, 1.0);
}
`;
```
`scene/mask.ts`
```ts
import * as THREE from "three";
/**
* The word, drawn on a 2D canvas exactly where the (transparent) DOM heading sits, and used by the shader as a mask.
* Red: the letters. Green: the letters blurred a little (their bevel). Blue: blurred a lot (their halo).
* Also returns points inside the letters, where the sparks are born.
*/
export type WordMask = { texture: THREE.CanvasTexture; w: number; fs: number; pad: number; spawn: Float32Array };
const PAD = 0.34; // margin around the word, in font sizes, so the halo has room
export function createMask(): WordMask {
const texture = new THREE.CanvasTexture(document.createElement("canvas"));
texture.minFilter = texture.magFilter = THREE.LinearFilter;
texture.generateMipmaps = false;
return { texture, w: 0, fs: 0, pad: 0, spawn: new Float32Array(0) };
}
export function drawMask(mask: WordMask, el: HTMLElement, count: number) {
const r = el.getBoundingClientRect(), cs = getComputedStyle(el), fs = parseFloat(cs.fontSize);
if (!r.width || !fs) return false;
const pad = fs * PAD, k = Math.min(2048 / (r.width + pad * 2), 2);
const inner = r.width - (parseFloat(cs.paddingRight) || 0); // the span is padded on the right by its negative tracking
const canvas = mask.texture.image as HTMLCanvasElement;
mask.texture.dispose(); // the size changes: let three allocate a new texture
canvas.width = Math.ceil((r.width + pad * 2) * k);
canvas.height = Math.ceil((r.height + pad * 2) * k);
const g = canvas.getContext("2d", { willReadFrequently: true })!, text = el.textContent || "";
g.fillStyle = "#000";
g.fillRect(0, 0, canvas.width, canvas.height);
// same face, weight, tracking and size as the DOM word; the size is then corrected so both have exactly the same width
const setFont = (px: number) => {
g.font = `${cs.fontStyle} ${cs.fontWeight} ${px}px ${cs.fontFamily}`;
if ("letterSpacing" in g) (g as unknown as { letterSpacing: string }).letterSpacing = `${((parseFloat(cs.letterSpacing) || 0) * px) / fs}px`;
};
setFont(fs * k);
const px = (fs * k * inner * k) / Math.max(1, g.measureText(text).width);
setFont(px);
const m = g.measureText(text), x = pad * k;
const y = pad * k + (r.height * k) / 2 + (m.fontBoundingBoxAscent - m.fontBoundingBoxDescent) / 2; // the baseline, by CSS half-leading
g.textBaseline = "alphabetic";
g.fillStyle = "#f00";
g.fillText(text, x, y);
// blurred copies: the shadow of a text drawn off-canvas. It works in every browser, unlike ctx.filter.
g.globalCompositeOperation = "lighter";
const far = canvas.width * 2;
g.shadowOffsetX = far;
for (const [color, blur, times] of [["#0f0", px * 0.07, 1], ["#00f", px * 0.3, 2]] as const) {
g.shadowColor = color;
g.shadowBlur = blur;
for (let i = 0; i < times; i++) g.fillText(text, x - far, y);
}
g.shadowColor = "transparent";
g.globalCompositeOperation = "source-over";
// spawn points: random pixels of the red channel, as fractions of the canvas
const data = g.getImageData(0, 0, canvas.width, canvas.height).data, spawn = new Float32Array(count * 2);
let seed = 7;
const rnd = () => ((seed = (seed * 16807) % 2147483647) - 1) / 2147483646;
for (let i = 0, guard = 0; i < count && guard < count * 60; guard++) {
const sx = Math.floor(rnd() * canvas.width), sy = Math.floor(rnd() * canvas.height);
if (data[(sy * canvas.width + sx) * 4] > 128) { spawn[i * 2] = sx / canvas.width; spawn[i * 2 + 1] = sy / canvas.height; i++; }
}
Object.assign(mask, { spawn, w: r.width, fs, pad });
mask.texture.needsUpdate = true;
return true;
}
```
`scene/dishes.ts (the ink patch; DISHES, dishGeometry, glazeTexture and buildDish follow the table of 5.1)`
```ts
/** The five courses as abstract plates: a thrown dish (lathe) with a painted glaze, and a few glazed forms on it. */
type Look = { color: string; rough?: number; coat?: number; irid?: number; glow?: number; accent?: boolean; double?: boolean };
type Part = Look & { g: Shape; p: number[]; s: number[]; r?: number[]; kids?: Part[] };
type Scatter = Look & { g: Shape; n: number; at: number[]; spread: number[]; size: number[]; flat?: number };
type Dish = { profile: number[][]; glaze: { base: string; pool: string; speck: string; rim: string }; rough: number; parts: Part[]; scatter: Scatter[] };
type Shape = "ball" | "slab" | "ring" | "log" | "cup" | "dome" | "shard" | "crumb";
export type Uniforms = Record<string, THREE.IUniform>;
// dish profiles, from the outer foot over the lip to the centre (radius, height); the well is at height 0
const RIM = [[0.95, -0.1], [1.45, -0.03], [1.68, 0.07], [1.7, 0.11], [1.65, 0.125], [1.28, 0.105], [1.14, 0.04], [1.0, 0], [0, 0]];
const COUPE = [[0.9, -0.14], [1.38, -0.02], [1.6, 0.13], [1.63, 0.19], [1.57, 0.2], [1.2, 0.07], [0.7, 0.01], [0, 0]];
const BOWL = [[0.85, -0.22], [1.3, -0.08], [1.56, 0.2], [1.6, 0.3], [1.53, 0.31], [1.36, 0.12], [1.05, 0.02], [0.5, 0], [0, 0]];
export const DISHES: Dish[] = [
{ // 01 oyster: night-blue bowl, a pearl shell, cream flesh, ember roe, green oil
profile: BOWL, rough: 0.3, glaze: { base: "#1c2a31", pool: "#0c1216", speck: "#8fb0bd", rim: "#4a3524" },
parts: [
{ g: "cup", p: [-0.08, 0.2, 0.06], r: [0, 0.5, 0], s: [0.86, 0.2, 0.62], color: "#a39c90", rough: 0.28, coat: 1, irid: 1, double: true },
{ g: "ball", p: [-0.1, 0.13, 0.06], r: [0, 0.5, 0], s: [0.5, 0.12, 0.34], color: "#dbd0b9", rough: 0.22, coat: 1 },
{ g: "ball", p: [0.12, 0.21, -0.03], s: [0.17, 0.09, 0.15], color: "#f2dd9a", rough: 0.3, coat: 1 },
],
scatter: [
{ g: "ball", n: 9, at: [-0.3, 0.25, 0.14], spread: [0, 0.15], size: [0.04, 0.055], color: "#ff5a1f", rough: 0.15, coat: 1, glow: 0.6, accent: true },
{ g: "ball", n: 8, at: [0.2, 0.012, -0.1], spread: [0.72, 0.98], size: [0.045, 0.1], flat: 0.2, color: "#71862c", rough: 0.1, coat: 1 },
],
},
{ // 02 leek: speckled cream plate, a charred log split to its green heart, a yolk, hazelnut
profile: RIM, rough: 0.42, glaze: { base: "#e6dbc6", pool: "#d8cbb2", speck: "#4d3b28", rim: "#9a7650" },
parts: [
{ g: "log", p: [-0.12, 0.17, 0.08], r: [0, 0.42, 0], s: [0.6, 0.34, 0.34], color: "#171310", rough: 0.92,
kids: [{ g: "log", p: [0.03, 0.1, 0], s: [0.48, 0.2, 0.22], color: "#cdd9a2", rough: 0.35, coat: 0.8 }] },
{ g: "ball", p: [0.6, 0.17, -0.52], s: [0.25, 0.17, 0.25], color: "#f0a21a", rough: 0.1, coat: 1 },
{ g: "ring", p: [0.08, 0.012, 0.02], s: [0.9, 0.3, 0.9], color: "#2a2420", rough: 0.6 },
],
scatter: [
{ g: "crumb", n: 22, at: [-0.3, 0.03, 0.6], spread: [0, 0.34], size: [0.03, 0.065], color: "#a87b4a", rough: 0.7 },
{ g: "ball", n: 5, at: [0.6, 0.012, 0.36], spread: [0, 0.24], size: [0.04, 0.07], flat: 0.25, color: "#6f8f2a", rough: 0.1, coat: 1 },
],
},
{ // 03 turbot: celadon coupe, a white slab with grill marks, its sauce, a charred lemon
profile: COUPE, rough: 0.3, glaze: { base: "#a3b9a9", pool: "#84a090", speck: "#33483d", rim: "#6b5540" },
parts: [
{ g: "slab", p: [-0.2, 0.15, 0.02], r: [0, 0.32, 0], s: [1.1, 0.26, 0.64], color: "#f3ecdc", rough: 0.38, coat: 0.5,
kids: [-0.36, -0.12, 0.12, 0.36].map((x): Part => ({ g: "slab", p: [x, 0.132, 0], r: [0, 0.55, 0], s: [0.034, 0.016, 0.62], color: "#3a2415", rough: 0.85 })) },
{ g: "ball", p: [0.6, 0.02, 0.56], s: [0.5, 0.03, 0.4], color: "#f1d778", rough: 0.08, coat: 1 },
{ g: "dome", p: [0.7, 0.01, -0.62], s: [0.27, 0.24, 0.27], color: "#e9c63c", rough: 0.45, coat: 0.6,
kids: [{ g: "ball", p: [0, 0.235, 0], s: [0.14, 0.012, 0.14], color: "#3a2415", rough: 0.9 }] },
],
scatter: [{ g: "ball", n: 8, at: [0.6, 0.045, 0.56], spread: [0, 0.34], size: [0.03, 0.07], flat: 0.25, color: "#6a8c26", rough: 0.1, coat: 1 }],
},
{ // 04 beef: rust tenmoku plate, three slices with a rare face, burnt onion cups, jus, one live coal
profile: RIM, rough: 0.28, glaze: { base: "#4d1f12", pool: "#200d09", speck: "#d9743a", rim: "#96491f" },
parts: [
...[[-0.5, -0.05, 0.2], [-0.08, 0, 0.08], [0.34, 0.05, -0.04]].map(([x, z, ry]): Part => ({ g: "slab", p: [x, 0.11, z], r: [0, ry, 0], s: [0.36, 0.18, 0.7], color: "#2b1610", rough: 0.75,
kids: [{ g: "slab", p: [0, 0.085, 0], s: [0.27, 0.03, 0.6], color: "#a3383a", rough: 0.38, coat: 0.6 }] })),
{ g: "cup", p: [0.66, 0.19, -0.5], s: [0.2, 0.16, 0.2], color: "#6a3d4f", rough: 0.3, coat: 1, double: true },
{ g: "cup", p: [0.3, 0.15, -0.74], s: [0.15, 0.12, 0.15], color: "#6a3d4f", rough: 0.3, coat: 1, double: true },
{ g: "ball", p: [-0.2, 0.015, 0.68], s: [0.42, 0.02, 0.2], color: "#3a150b", rough: 0.05, coat: 1 },
{ g: "ball", p: [0.74, 0.07, 0.42], s: [0.08, 0.07, 0.08], color: "#ff5a1f", rough: 0.6, glow: 3, accent: true },
],
scatter: [{ g: "crumb", n: 14, at: [0.5, 0.02, 0.3], spread: [0, 0.3], size: [0.015, 0.03], color: "#1a1512", rough: 0.9 }],
},
{ // 05 burnt milk: warm white bowl with an ember rim, a quenelle on a caramel pool, sugar shards
profile: BOWL, rough: 0.45, glaze: { base: "#f0e7d7", pool: "#e3d6bf", speck: "#b48a58", rim: "#c9552a" },
parts: [
{ g: "ball", p: [0.05, 0.02, 0.05], s: [0.8, 0.03, 0.72], color: "#b65c14", rough: 0.06, coat: 1 },
{ g: "ball", p: [-0.08, 0.2, 0], r: [0, 0.6, 0], s: [0.5, 0.26, 0.3], color: "#f7f0e3", rough: 0.5, coat: 0.25 },
{ g: "shard", p: [0.32, 0.3, -0.2], r: [1.1, 0.4, 0.3], s: [0.34, 0.03, 0.34], color: "#e39a2c", rough: 0.15, coat: 1, glow: 0.25 },
{ g: "shard", p: [0.44, 0.22, 0.24], r: [0.8, -0.5, 0.2], s: [0.24, 0.025, 0.24], color: "#e39a2c", rough: 0.15, coat: 1, glow: 0.25 },
{ g: "shard", p: [0.05, 0.33, -0.36], r: [1.3, 1.2, 0], s: [0.2, 0.025, 0.2], color: "#e39a2c", rough: 0.15, coat: 1, glow: 0.25 },
],
scatter: [{ g: "crumb", n: 26, at: [-0.48, 0.05, 0.5], spread: [0, 0.36], size: [0.015, 0.04], color: "#2a211b", rough: 0.9 }],
},
];
/** Cuts a material with the ink-bleed: outside (uOut, uIn) the fragment is discarded, near the edges it soaks and glows. */
export function inkPatch(material: THREE.Material, shared: Uniforms, own: Uniforms) {
material.onBeforeCompile = (shader) => {
Object.assign(shader.uniforms, shared, own);
shader.fragmentShader = shader.fragmentShader
.replace("#include <common>", `#include <common>\n${NOISE}\n${INK}\nuniform float uIn; uniform float uOut;`)
.replace("#include <clipping_planes_fragment>", "#include <clipping_planes_fragment>\nfloat inkN = inkField(gl_FragCoord.xy); if (inkN > uIn || inkN < uOut) discard;")
.replace("#include <opaque_fragment>", "outgoingLight = inkEdge(inkEdge(outgoingLight, inkN - uOut), inkN - uIn);\n#include <opaque_fragment>");
};
material.customProgramCacheKey = () => "ink";
}
```
`scene/Scene.tsx`
```tsx
const IGNITE0 = 0.35, IGNITE_DUR = 1.35; // the fire crosses the word between 0.35 s and 1.7 s of the intro clock
const HOT = new THREE.Color(1, 0.8, 0.42); // the accent is mixed 65 % toward this for the hottest colour
const easeInOut = (t: number) => (t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2);
// Inside the scene component, after the set-up listed above (ink, backdrop, sparks, mask, trail, tables, dishes, local, refs).
useFrame((state, delta) => {
const L = local.current, dt = Math.min(delta, 0.05), { size, viewport, clock, camera, scene } = state;
const u = backdrop.uniforms, su = sparks.material.uniforms;
const t = S.still ? 5.2 : Math.max(0, clock.elapsedTime - S.t0); // clock.elapsedTime is performance.now() / 1000: the frame loop passes it to advance()
const box = gl.domElement.getBoundingClientRect(), vw = size.width, vh = size.height, asp = vw / vh;
gl.getDrawingBufferSize(ink.uRes.value);
// the dishes are built once the intro is over (or as soon as the page is scrolled), one per frame; their shaders compile off the main thread where possible
const built = dishes.current;
if (!S.still && built.length < DISHES.length && (t > 2.7 || window.scrollY > vh * 0.15) && table.current) {
const own: Uniforms = { uIn: { value: -9 }, uOut: { value: -9 } };
const group = buildDish(DISHES[built.length], built.length, ink, own, accents, phone ? 512 : 1024);
accents.forEach((m) => { m.color.set(L.accent); if (m.emissiveIntensity) m.emissive.set(L.accent); });
table.current.add(group);
built.push({ own, group, cast: true });
if (built.length === DISHES.length) { built.forEach((d) => (d.group.visible = true)); gl.compileAsync(table.current, camera, scene); }
}
// pointer, smoothed, and the trail of heat it leaves (slot 0 rests under the pointer, 1..7 are stamps that cool down)
const k = 1 - Math.exp(-dt * 10), live = performance.now() - S.seen < 2500;
L.x += (S.px - L.x) * k; L.y += (S.py - L.y) * k;
const hx = L.x * asp, hy = 1 - L.y;
let warmth = 0;
for (const p of trail) { p.z *= Math.exp(-dt * 1.5); warmth += p.z; }
L.rest += ((live ? 0.5 : 0) - L.rest) * (1 - Math.exp(-dt * 4));
trail[0].set(hx, hy, L.rest);
if (live && Math.hypot(hx - L.lx, hy - L.ly) > 0.07) { L.head = 1 + (L.head % 7); trail[L.head].set(hx, hy, 1); L.lx = hx; L.ly = hy; }
S.temp = 620 + Math.round(Math.min(180, warmth * 52));
S.flare *= Math.exp(-dt * 1.3);
// the word: the hero heading at the top of the page, the same word again in the footer
const hero = document.querySelector<HTMLElement>('[data-word="hero"]'), foot = S.still ? null : document.querySelector<HTMLElement>('[data-word="foot"]');
const fr = foot?.getBoundingClientRect(), atFoot = !!fr && fr.top < vh * 1.1, r = atFoot ? fr : hero?.getBoundingClientRect();
if (r && mask.w) {
const s = r.width / mask.w, pad = mask.pad * s;
u.uRect.value.set((r.left - box.left - pad) / vw, (r.top - box.top - pad) / vh, (r.width + pad * 2) / vw, (r.height + pad * 2) / vh);
u.uCell.value = Math.max(0.011, (mask.fs * s * 0.085) / vh);
}
const burn = S.still ? 0 : atFoot ? 1 - smooth(0.1, 0.8, (vh - fr!.top) / fr!.height) : smooth(0, 1, window.scrollY / (vh * 0.8));
const flick = 0.84 + 0.16 * Math.sin(t * 9.1) * Math.sin(t * 5.3 + 1) + 0.5 * S.flare;
u.uTime.value = su.uTime.value = t;
u.uBurn.value = burn;
u.uCold.value = atFoot ? 1 : smooth(0, 0.5, t);
u.uIgnite.value = atFoot ? 1 : clamp((t - IGNITE0) / IGNITE_DUR);
u.uHeat.value = 0.52 + (atFoot ? 0 : 0.4 * Math.exp(-Math.max(t - IGNITE0 - IGNITE_DUR, 0) / 3)) + 1.1 * burn * (1 - burn) + 0.6 * S.flare;
u.uFlick.value = flick;
su.uEmit.value = (1 - smooth(0.5, 0.95, burn)) * (1 + 2.2 * smooth(0.02, 0.35, burn)) + S.flare;
su.uAspect.value = asp;
su.uPx.value = ink.uRes.value.y / 900;
// the menu: where the pinned section is decides what the ink shows
const menu = S.still ? null : document.querySelector<HTMLElement>("[data-menu]"), mr = menu?.getBoundingClientRect();
const top = mr ? mr.top / vh : 9, inMenu = !!mr && top < 1.2 && mr.bottom / vh > -0.3;
const p = clamp(S.menu, 0, 4), c = Math.min(Math.floor(p), 3), f = p - c;
let T = -9, fromFire = 1, vert = 0, showA = -1, showB = -1, a = 0, b = 0, amount = 1;
if (inMenu && top > 0) { // the table rises over the fire with the section: a vertical bleed whose front follows the section's top edge
vert = 1; showA = 0; T = (1 - top) * 0.86 + 0.14; amount = 1 - 0.93 * smooth(0, 1, 1 - top);
} else if (inMenu) { // pinned: course c, and from the second half of each step the next one bleeds out from the plate
fromFire = 0; amount = 0.07; a = showA = c;
if (f > 0.5) { T = -0.08 + 1.16 * easeInOut(clamp((f - 0.5) / 0.45)); b = showB = c + 1; }
if (T >= 1.07) { a = showA = c + 1; showB = -1; T = -9; }
}
L.amount += (amount - L.amount) * (1 - Math.exp(-dt * 6));
su.uAmount.value = L.amount;
u.uT.value = T; u.uFromFire.value = fromFire; ink.uVert.value = vert; ink.uSeed.value = vert ? 3.1 : c * 7.3 + 1.7;
u.uColA.value.copy(tables[a]); u.uColB.value.copy(tables[b]);
// the plate: right of centre on a wide screen, top half on a phone; it scrolls in and out with its section
const wide = asp > 0.9, scale = wide ? Math.min(0.95, viewport.width / 8.2) : (viewport.width * 0.86) / 3.4;
const cx = wide ? viewport.width * 0.15 : 0, cy = (wide ? -0.02 : 0.16) * viewport.height - (inMenu ? top : 0) * viewport.height;
u.uPlate.value.set(cx / viewport.width + 0.5, cy / viewport.height + 0.5);
u.uPlateR.value = (1.7 * scale) / viewport.height;
ink.uOrigin.value.set(u.uPlate.value.x * asp, u.uPlate.value.y);
S.spin *= Math.exp(-dt * 2.2);
L.angle += dt * (0.14 + S.spin);
if (tilt.current) {
tilt.current.position.set(cx, cy, 0);
tilt.current.scale.setScalar(scale);
tilt.current.rotation.set((L.y - 0.5) * 0.14, (L.x - 0.5) * 0.2, 0);
}
built.forEach((dish, i) => {
dish.group.visible = i === showA || i === showB;
dish.group.rotation.y = L.angle + S.menu * 0.7 + i * 1.3;
dish.own.uIn.value = vert || i === showB ? T : 9;
dish.own.uOut.value = i === showA && showB >= 0 ? T : -9;
// during a wipe only one dish throws shadows: the old one until the front has left the plate, then the new one
const cast = showB < 0 || (i === showB) === T > 0.3;
if (cast !== dish.cast) { dish.cast = cast; dish.group.traverse((o) => void (o.castShadow = cast)); }
});
gl.shadowMap.needsUpdate = showA >= 0; // the shadow map is only drawn while a plate is on screen
if (key.current) { key.current.position.set(cx - 3.2, cy + 4.5, 6.5); key.current.target.position.set(cx, cy, 0); key.current.target.updateMatrixWorld(); }
if (fire.current) { fire.current.position.set((L.x - 0.5) * viewport.width, (0.5 - L.y) * viewport.height, 2.2); fire.current.intensity = 1.6 * flick; }
});
return (
<>
<mesh geometry={screen} material={backdrop} frustumCulled={false} renderOrder={-1} />
<group ref={tilt}>
<group ref={table} rotation={[Math.PI / 2 - 0.2, 0, 0]} />
</group>
<points geometry={sparks.geometry} material={sparks.material} frustumCulled={false} renderOrder={10} />
<directionalLight ref={key} color="#fff8ef" intensity={1.5} castShadow shadow-mapSize={[1024, 1024]} shadow-bias={-0.0004} shadow-normalBias={0.03}>
<orthographicCamera attach="shadow-camera" args={[-2.4, 2.4, 2.4, -2.4, 1, 20]} />
</directionalLight>
<pointLight ref={fire} color={accent} intensity={1.6} distance={9} decay={2} />
<Environment resolution={256} frames={1}>
<color attach="background" args={["#0b0a09"]} />
<Lightformer form="rect" intensity={1.6} color="#fff3e2" position={[0, 9, 4]} scale={[10, 5, 1]} target={[0, 0, 0]} />
<Lightformer form="rect" intensity={1.6} color="#ff8a45" position={[-9, 0, 2]} scale={[2.4, 8, 1]} target={[0, 0, 0]} />
<Lightformer form="rect" intensity={0.6} color="#cfe1ff" position={[9, 2, 3]} scale={[2, 8, 1]} target={[0, 0, 0]} />
<Lightformer form="ring" intensity={2} color="#ffffff" position={[2, -3, 9]} scale={2.2} target={[0, 0, 0]} />
</Environment>
</>
);
```
### 5.2 Navigation
Fixed, 76px tall (64px on phones), three columns `1fr auto 1fr` inside the page padding, no background. Left: the brand (ellipsis beyond 46vw). Centre: [NAV_1], [NAV_2], [NAV_3] to `#menu`, `#fire`, `#room`, each with a hairline that draws from the left on hover and leaves to the right. Right: a small accent pill "Reserve →" (padding `11px 16px 11px 18px`, 0.8125rem) to `#reserve`. Text is cream; while the cream sheet is under the navigation (its top above 36px, its bottom below 36px) it is ink, switched instantly. Scrolling down past half a screen, brand and links slide up and fade (`yPercent -220`, opacity 0, 0.6 s, `power3.out`); scrolling up brings them back; the pill always stays.
### 5.3 Hero
`min-height: 100svh`, a three-row grid (`auto 1fr auto`), padding `108px var(--pad) 34px`, transparent; children `min-width: 0`.
- Row 1, bone labels spread across the width (wrapping on narrow screens): [PLACE_LINE]; [LIT_LINE]; a live dot (6px, accent, glowing) and "Hearth 620 °C", the number in cream. It is a thermometer: it counts from 018 in the intro, then follows the scene (`S.temp`, eased 12% per frame), three digits.
- Row 2, the word: an `h1` holding one `inline-block`, `nowrap` span with the brand, vertically centred, left-aligned, `padding-right: 0.04em` to offset the tracking. `useFitText(ref, [brand], { max: () => innerHeight * 0.52 })` solves its font size in a layout effect so the span fills the `h1` exactly: set 100px, measure, scale by `parent.clientWidth / measured`, three passes (the optical-size axis changes the proportions with the size), clamped between 12px and the max; it refits on a `ResizeObserver` of the parent, on resize and when the fonts load. With WebGL the span is `color: transparent` and unselectable: the scene draws the word in its place from the same rectangle, font, weight and tracking. Names of 3 to 24 characters must work.
- Row 3, on the grid, bottom-aligned: the headline in columns 1 to 6 (two masked lines, the second italic); in columns 8 to 12 the sub-line as a lead paragraph in bone, then [CTA] (to `#reserve`) and the text link [CTA_2] (to `#menu`), 28px apart.
Buttons: accent pill, padding `15px 22px 15px 24px`, ink text; on hover a cream fill rises from below and the arrow moves 5px (0.6 s). Text links carry a 1px underline that retracts to the right on hover.
### 5.4 The hearth (manifesto)
Transparent, on the fire (smoke, glow and sparks; the word has burnt away). Padding top `clamp(96px, 15vh, 160px)`, bottom `clamp(96px, 16vh, 170px)`; on the grid, row gap `clamp(48px, 9vh, 96px)`. Label "01 — [LABEL_1]" in columns 1 to 2, bone. The statement in columns 3 to 11, every word in its own inline element (6.3). Four stats in columns 3 to 12, equal cells with a top hairline and 16px of padding: the number, its unit in the accent, a bone label. The numbers count up from 0 in 1.6 s (`power2.out`) when they enter.
### 5.5 Tasting menu
`id="menu"`, exactly `100svh`, transparent (the scene supplies table and plate), pinned (6.4). Inside, a grid with padding `104px var(--pad) 34px` and rows `auto 1fr auto`, ignoring the pointer except on its buttons.
- Top row, bone labels: "02 — [LABEL_2]" left, [MENU_DETAIL] right.
- Middle, columns 1 to 5, vertically centred: the five courses stacked in one grid cell. Each: a label "Course 0n / 05" (accent, "/ 05" in bone); 22px below, the title in two masked lines (second italic); 26px below, the paragraph (#CFC3B0, lead size, max 30em); 30px below, a meta row under a hairline with three cells, Wood, Heat, Time (label over a 1.25rem Fraunces value).
- Middle, columns 11 to 12, right-aligned: the course index, five mono buttons "0n NAME"; the current one at opacity 1 followed by a 26px accent line, the others at 0.42; on hover the text shifts 6px left. A click scrolls to that course (pin start + n/4 of the pin length).
- Bottom row, bone labels on the grid: a progress hairline in columns 1 to 3 whose accent fill scales 0 to 1 over the pin; [MENU_NOTE] in columns 4 to 8; [MENU_HINT] right-aligned.
- A transparent drag layer over the plate (56% wide, 6% from the right, 12% from top and bottom; `cursor: grab`, `touch-action: pan-y`, pointer capture) turns it.
Without WebGL or with reduced motion the section is a plain list: the five courses one under another, each a row of two columns (a CSS plate `clamp(96px, 16vw, 190px)` wide, then the copy) with a top hairline and 44px of padding. The CSS plate is a circle, `radial-gradient(circle, pool 0 36%, base 37% 88%, rim 89% 100%)` in that course's glaze colours with a highlight and a small accent dot, ringed by a `clamp(8px, 1.6vw, 18px)` band in the table colour.
### 5.6 The cream sheet: the fire
An opaque `div` in `--paper` with ink text, holding two sections; it slides over the menu and its edges are curved caps (6.5).
`id="fire"`, padding-top `clamp(90px, 15vh, 170px)`. Header on the grid, bottom-aligned: label "03 — [LABEL_3]" in columns 1 to 2 (smoke), the title in columns 3 to 8, a lead paragraph (#3D342C) in columns 9 to 12.
Below, a full-bleed track (`overflow: hidden`, padding `clamp(40px, 7vh, 72px)` above, `clamp(60px, 10vh, 110px)` below) that moves sideways with the scroll (6.5): a flex row with `--gap` and the page padding at both ends, holding four wood cards and then [TRACK_END] as two lines of display type (the second italic, accent) with `clamp(20px, 5vw, 90px)` of margin.
Wood card: `clamp(272px, 26vw, 390px)` wide, at least `clamp(430px, 60vh, 560px)` tall, `--ink`, cream text, radius 10px, padding `22px 24px 24px`, a column with space between. Top: labels "N° n / 4" and the temperature. Behind the text, an inline SVG of the log's end grain, 150% of the card's width, 18% from the left and 34% above the top: 30 nested closed paths of 72 points (radius grows 5 to 14 per ring; each ring deformed by three sines of the angle with 2, 3 and 7 lobes, amplitudes 4 to 9%, up to 7%, 1.2 to 2.6%, seeded per card), cream strokes 0.6 wide at opacity 0.2, every fifth at 0.42, one ring (number 6, 11, 16, 21) 1.3 wide in the accent, and two straight drying cracks from the pith at 0.5. Bottom: the name, the Latin name in 300 italic bone, a sentence (0.9375rem, #D8CCB9), and three hairline rows (label left, value right): Burns at, Lasts, We cook. Hover: the card lifts 8px (0.7 s), the rings turn 14° and grow 5% (1.4 s).
### 5.7 The room
`id="room"`, on the sheet, padding-top `clamp(40px, 8vh, 90px)`, bottom `clamp(110px, 18vh, 200px)`. Columns 1 to 7: label "04 — [LABEL_4]", the title, the lead paragraph, then under a hairline the quote in 300 italic with its source as a label. Columns 9 to 12: five hairline rows (a label 7.5em wide, the value at 0.9375rem): Find us, Dinner, Sunday, Monday, Telephone.
### 5.8 Reservations
`id="reserve"`, transparent, `min-height: 100vh`, padding `clamp(120px, 22vh, 220px) var(--pad) clamp(40px, 8vh, 90px)`, content centred vertically. One panel: `--soot`, 1px `--line` border, radius 18px, padding `clamp(22px, 3.4vw, 52px)`, on the 12-column grid.
- Columns 1 to 7: label "05 — [LABEL_5]" in the accent; the title; the lead paragraph in bone; then the form, each field a row with a top hairline, a label 9.5em wide and its control:
- Guests: a stepper, two 38px round outlined buttons (− and +) around the number in 1.6rem Fraunces, 1 to 8, starting at 2.
- Evening: six chips for the next six evenings the restaurant is open (Tuesday to Saturday), computed from today: weekday in mono, then the day number; the second selected at start.
- Seating: four chips, 18:00, 18:30, 20:45, 21:15; the third selected at start.
- Name for the table: an underlined text input in 1.25rem Fraunces with a placeholder; an accent error line appears under it if the form is sent with fewer than 2 characters.
- Chips: outlined pills, padding `9px 14px`, 0.875rem; hover lifts them 2px; the selected one is filled with the accent, ink text. They are `role="radio"` buttons in a `radiogroup`.
- Columns 9 to 12: a label row ("Where" left, the chosen zone right); the plan of the room, which is the "where" control; the zone's note in 300 italic; under a hairline the summary in mono, always current; then the submit button [RESERVE_CTA] (attached to the form by its id).
- The plan: an inline SVG, viewBox `0 0 360 292`. Walls (rounded rectangle, hairline); the hearth at the top (a 240×26 rectangle outlined and tinted 22% in the accent, labelled in mono); the water at the bottom (dashed line, label). Three zones, each a focusable group with `role="radio"` (Enter and Space select): the counter (a line and 12 stools in front of the hearth), the oak tables (five small tables with two seats each, staggered along the right wall), the window table (one round table with four seats, bottom left). Zones are stroked cream at 50%, full cream on hover; the selected zone is stroked in the accent with its seats filled and a 7% accent wash.
- Sending with a valid name replaces the form by a confirmation: the title becomes [DONE_TITLE], then a lead paragraph, a reference in the accent (the brand's first three letters in capitals, a dash, four digits derived from the choices) followed by the summary, and a text button to go back. The fire flares at that moment (5.1).
### 5.9 Footer
Transparent, on the fire, padding `clamp(30px, 6vh, 70px) var(--pad) 26px`. First the word again, fitted like the hero's, transparent and `aria-hidden`: the scene re-ignites it here. Then, under a hairline, a grid row: [FOOT_LINE] in 1.375rem Fraunces (columns 1 to 5) and three lists of two columns each from column 7 (mono heading, three lines at 0.875rem; the third list holds text links). Last, a row of bone labels: "© 2026 [BRAND]" and a link back to the top.
## 6. Motion
One clock for the intro: `S.t0 = performance.now() / 1000 + 0.2`, set when the script boots; intro time = `performance.now() / 1000 - S.t0`, never below 0. The scene's time is that value; the page's intro is a paused GSAP timeline whose `time()` is set to it on every tick. Lenis (`lerp 0.11`) runs on the GSAP ticker with `lagSmoothing(0)` and calls `ScrollTrigger.update` on scroll; anchors scroll in 1.4 s with a quartic ease-out. Whatever changes with time or scroll is driven by script (GSAP or the scene); CSS transitions are for hover only.
**6.1 Intro (complete 2.4 s after the clock starts).** Scene: the ignition of 5.1 (front from 0.35 to 1.7 s). Page, all `expo.out`: thermometer 018 to 620 from 0.2 s, 1.9 s, `power2.out`; hero labels rise from under their masks (`yPercent 112` to 0), 0.9 s, stagger 0.07, from 0.75 s; navigation drops in (`yPercent -100`, opacity 0), 0.95 s, from 0.9 s; headline lines rise, 1.0 s, stagger 0.1, from 1.05 s; sub-line and buttons fade up 26px, 0.9 s, stagger 0.08, from 1.3 s.
**6.2 Hero to hearth (scroll 0 to 0.8 screen).** The burn-away of 5.1, tied to `scrollY`.
**6.3 Statement.** Each word's opacity goes 0.13 to 1, `ease: none`, stagger 0.06, scrubbed from "statement top at 80% of the viewport" to "statement bottom at 45%".
**6.4 Tasting menu (pinned).** ScrollTrigger on the section: `start: "top top"`, `end: "+=250%"`, `pin: true`, `scrub: true`; `onUpdate` writes `S.menu = progress × 4`. It scrubs one timeline of duration 4 (one unit per course). For each change i to i + 1: at `i + 0.5` the lines of course i leave upward (`yPercent -112`, 0.2, stagger 0.02, `power2.in`) and its paragraph and meta fade up 14px (0.16, `power1.in`); at `i + 0.72` the lines of the next course rise (`yPercent 112` to 0, 0.25, stagger 0.03, `power3.out`); at `i + 0.76` its paragraph and meta fade in from 18px below (0.22, `power2.out`). The progress line scales over the 4 units. The active index entry is `floor(progress × 4 + 0.28)`; its change is tweened (opacity 0.5 s `power2.out`, line `scaleX` 0.6 s `expo.out`). Arrival: header, copy, index and footer of the section go from opacity 0, 56px low, to place, `ease: none`, stagger 0.04, scrubbed from "top at 60%" to "top at top", in step with the vertical ink.
**6.5 The cream sheet.** Two caps, `--paper` blocks 13vh tall, as wide as the sheet, just outside its top and bottom edges, with elliptical corners (`50% 50% 0 0 / 100% 100% 0 0` and its mirror). The top cap's `scaleY` goes 1 to 0 (origin bottom) while the sheet's top travels from the bottom of the viewport to 12% from the top; the bottom cap's goes 0 to 1 (origin top) while the sheet's bottom travels from the bottom of the viewport to 35%: the sheet arrives as a dome that flattens and leaves with a belly. The wood track's `x` goes from 0 to `-(track width - viewport width)`, `ease: none`, scrubbed from "track top at 80%" to "track centre at 45%" (`invalidateOnRefresh`).
**6.6 Reveals.** Every block marked for reveal plays once when its top passes 82% of the viewport: its masked lines rise (`yPercent 112`, 1.1 s, stagger 0.09, `expo.out`; a mask is an `overflow: hidden` block around the line, with 0.12em of bottom padding for the descenders), its other marked children fade up 22px (0.9 s, stagger 0.07) 0.15 s later. This covers section headers, the stats, the room and the panel.
**Reduced motion** (`prefers-reduced-motion: reduce`): no lenis, pin, scrub, reveal or intro, and `transition: none` on everything (a near-zero duration would still delay the styles the fitting hook measures); every text is in place. The canvas is `position: absolute` over the first screen only and shows one composed still (scene time frozen at 5.2 s: the word alight, sparks in the air, no pointer reaction), drawn for a few frames, then stopped. The menu is the plain list; the wood track scrolls sideways natively; the footer word uses the CSS gradient of section 8.
## 7. Responsive behaviour
- 900px and below: hero headline and side block take the full width, one under the other; [LIT_LINE] disappears; manifesto label, statement and stats take the full width, stats in two columns; the sheet's headers stack; the room is one column; the panel is one column (form, then plan); the footer line takes the full width and the three lists four columns each.
- 720px and below: navigation links are hidden (brand and Reserve pill remain); hero padding `92px var(--pad) 28px`. Menu: the plate is drawn in the top half (narrow placement of 5.1), the copy takes the full width at the bottom of the screen with a 0.9375rem paragraph, the index, hint, note and [MENU_DETAIL] are hidden, the progress line spans the width, the drag layer covers 10% to 54% of the height. Form fields stack label over control. Sparks 1,300, glaze textures 512px, footer lists six columns each.
- The word always fits on one line (a 24-character name is simply smaller). No horizontal scrolling from 360 to 1440px.
## 8. Accessibility and performance
- Semantics: one `h1` (the word), an `h2` per section, `h3` for courses and woods, `dl` for stats, meta and rows, `nav` landmarks, a real `form` with labelled controls, `aria-live` on the guest count, `role="alert"` on the name error, `aria-current` on the active course; decorative SVG `aria-hidden`; visible focus everywhere. Contrast: cream on char 15:1, bone on char 7:1, ink on paper 14:1.
- Budgets: one canvas; `dpr` at most 1.75; about 50 draw calls with a plate and its shadow pass on screen (about 20 on the hero), under 150,000 triangles; at most 5 noise octaves per layer of the full-screen shader; post-processing is bloom plus one merged pass; no render target of our own; no `backdrop-filter`, no large `filter: blur()`. DOM animation is transform and opacity only.
- No WebGL (no `webgl2` context): no canvas, and the first screen is designed in CSS. The word keeps its fitted size, filled with an ember gradient clipped to the letters (two warm radial gradients over a vertical gradient from #3A1508 through the accent to #FFB347); the hero has two radial glows rising from below the screen and a dozen small fixed spark dots; the word rises 30% and fades in during the intro. The menu is the plain list, the reservations section gets a soft accent glow from below, the footer word the same gradient.
## 9. Copy deck
Brand: `[BRAND] :: Ember`. Page title: `[BRAND] — a restaurant that cooks over fire`. Navigation: `[NAV_1] :: Menu`, `[NAV_2] :: The fire`, `[NAV_3] :: The room`, `Reserve`.
Hero: `[PLACE_LINE] :: Wood-fired kitchen · Leith, Edinburgh`, `[LIT_LINE] :: Fire lit daily at 16:00`, `Hearth 620 °C`, headline `Everything on the plate` / `has met the fire.`, sub-line `Twenty-six seats around one open hearth. Oak, apple, vine and birch; no gas, no oven, nothing plugged in.`, `[CTA] :: Reserve a table`, `[CTA_2] :: Tonight’s menu`.
The hearth: `[LABEL_1] :: The hearth`, statement `We do not own an oven. There is a hearth three metres wide, four kinds of wood, and a cook who has not looked at a dial in six years. Everything else is timing.`, stats `3 m` of open hearth · `620 °C` at the coals · `26` seats in the room · `0` gas lines, ovens, timers.
Tasting menu: `[LABEL_2] :: Tasting menu`, `[MENU_DETAIL] :: Five courses · £95 per guest`, `[MENU_NOTE] :: Wine from the cellar, five glasses · £65`, `[MENU_HINT] :: Drag the plate to turn it`, meta labels `Wood`, `Heat`, `Time`.
- 01 `Oyster`, title `Oyster,` / `apple-wood butter`, `A Loch Fyne oyster warmed in its shell until the lip just lets go. The butter spends a night in the chimney first.`, `Apple`, `240 °C`, `90 sec`
- 02 `Leek`, title `Leek, buried` / `in the embers`, `A whole leek goes under the coals until the outside is charcoal. We split it at the pass: the heart, a smoked yolk, hazelnut.`, `Oak embers`, `480 °C`, `22 min`
- 03 `Turbot`, title `Turbot` / `on the bone`, `Turned once over vine cuttings in a hinged grill. The sauce is nothing but its own juices, whisked with oil until they hold.`, `Vine`, `320 °C`, `9 min`
- 04 `Beef`, title `Rib of beef,` / `fifty days`, `Galloway rib, aged fifty days, laid straight on the coals and rested for as long as it cooked. Burnt onion, and what ran out of it.`, `Oak`, `620 °C`, `14 + 14 min`
- 05 `Burnt milk`, title `Burnt milk,` / `smoked caramel`, `Milk scorched in an iron pan, then churned. Caramel taken a shade too far on purpose, and a shard of sugar set by the last of the fire.`, `Birch, dying`, `180 °C`, `To finish`
The fire: `[LABEL_3] :: The fire`, title `The wood is` / `the seasoning.`, `We buy it by the cord from two estates in Perthshire and dry it for two summers in the old net loft. Each one does a different job.`, rows `Burns at`, `Lasts`, `We cook`, `[TRACK_END] :: Nothing else / goes on the fire.`
- `Oak`, `Quercus robur`, `620 °C`, `3 hours`, `Beef, bread, onions`, `Long, even heat and a low, sweet smoke. The bed everything else is built on.`
- `Apple`, `Malus domestica`, `480 °C`, `90 minutes`, `Oysters, butter, pork`, `Pale smoke that tastes of the orchard. Gentle enough for shellfish.`
- `Vine`, `Vitis vinifera`, `700 °C`, `6 minutes`, `Turbot, leeks, langoustine`, `Last winter’s prunings. They flare hard and are gone: a grill, not a fire.`
- `Birch`, `Betula pendula`, `540 °C`, `50 minutes`, `Milk, fruit, the last course`, `A bright, clean flame and almost no smoke. We finish the night on it.`
The room: `[LABEL_4] :: The room`, title `Twenty-six seats.` / `One fire.`, `[ROOM_TEXT] :: A herring smokehouse from 1887, left mostly as we found it: tarred beams, a brick chimney you can stand inside, and a counter of twelve stools facing the hearth. The rest is five oak tables and one round one at the window, on the Water of Leith.`, `[QUOTE] :: “You will smell of smoke for a day and not mind at all.”`, `[QUOTE_SOURCE] :: Marina Okafor, Table Notes`
- `Find us`, `[ADDRESS] :: The Old Smokehouse, 4 Cooper’s Wynd, Leith, Edinburgh EH6` — `Telephone`, `[PHONE] :: 0131 496 0127, from noon`
- `Dinner`, `Tuesday to Saturday. Seatings at 18:00 and 20:45` — `Sunday`, `One long lunch at 13:00. Whole animals, shared tables` — `Monday`, `Closed. The chimney is swept and the wood is stacked`
Reservations: `[LABEL_5] :: Reservations`, title `Hold a seat` / `by the fire.`, `Tables open thirty days ahead, at noon. No card needed; we keep yours for fifteen minutes past the hour.`, fields `Guests`, `Evening`, `Seating` (`18:00`, `18:30`, `20:45`, `21:15`) · `Name for the table` (placeholder `Your name`, error `A name for the table, please.`) · `Where`, `[RESERVE_CTA] :: Request this table`, stepper labels `One guest fewer`, `One guest more`, summary pattern `2 guests · Tue 1 Dec · 20:45 · Hearth counter` (`1 guest` in the singular).
- Zones: `Hearth counter` — `12 stools facing the fire. Warm.`, `Oak tables` — `Five tables for two, along the wall.`, `Window table` — `One round table for four, on the water.`, plan labels `Hearth`, `[WATER] :: Water of Leith`
- Confirmation: `[DONE_TITLE] :: Your seat / is held.`, `We will ring within the hour to confirm. Come hungry, and wear something you do not mind smelling of smoke.`, reference pattern `EMB-2045`, `Change the details`
Footer: `[FOOT_LINE] :: [BRAND]. Cooked over wood since 2019.`, `Visit` — `The Old Smokehouse`, `4 Cooper’s Wynd, Leith`, `Edinburgh EH6`, `Hours` — `Tue to Sat, from 18:00`, `Sunday lunch, 13:00`, `Closed Monday`, `Elsewhere` — `Instagram`, `Journal`, `Gift cards`, `© 2026 [BRAND]`, `Back to the top ↑`
## 10. Acceptance checklist
- [ ] The first screen shows the brand as cracked, glowing coals with sparks rising from the letters; underneath it is real, transparent DOM text that fits names of 3 to 24 characters on one line.
- [ ] Intro: the fire runs through the word from left to right with a burst of sparks, labels and headline rise from masks, the thermometer counts to 620; all in place before 3.0 s.
- [ ] Moving the pointer across the word heats the coals along its path, blows the sparks aside and raises the thermometer above 620.
- [ ] Scrolling burns the word away from the bottom up; the statement lights up word by word.
- [ ] The menu pins for 250% of the viewport; each of the four changes is an ink-bleed from the plate whose thin burning edge cuts plate and table along the same line while the copy changes with masked lines; the index jumps on click; dragging turns the plate.
- [ ] Each plate matches the comment above its entry in `DISHES` and its glaze is recognisable (night blue, speckled cream, celadon, rust, warm white with an ember rim); none is blown out or a dark blob.
- [ ] The cream sheet arrives as a dome and leaves with a belly; the wood track reaches its last words when the cards are centred; navigation text is ink over the sheet.
- [ ] Behind the reservation panel the fire is back; guests, evening, seating and the zone picked on the plan update the summary; sending shows the confirmation and the fire flares; nothing is sent.
- [ ] The footer word re-ignites as it enters.
- [ ] One canvas, `dpr` at most 1.75, about 50 draw calls on a plate, dishes built after the intro, nothing rendered while the sheet covers the screen or the tab is hidden; smooth on an ordinary laptop.
- [ ] `prefers-reduced-motion`: a still first screen, no pin or scrub, the menu as a list, everything readable.
- [ ] Without WebGL: the CSS ember word and glow on the first screen, the menu as a list, no blank area.
- [ ] No request leaves the page's origin; no horizontal scroll from 360 to 1440px; the build passes without TypeScript errors.