# Recreate this section as a single HTML file: Slipway Clay Co-op Memberships

## What it is

A warm, tactile **pricing and comparison section** for *Slipway Clay Co-op*, a fictional community pottery studio. It has three plans: **Taster** (€28/mo), **Regular** (€64/mo, "Most chosen") and **Resident** (€139/mo). On a cream, clay-dust ground, a soft-serif headline ("Find your place *at the wheel.*") sits next to an illustrated **potter's wheel with a living pot on it**. Below them is a real `<table>` that compares 14 features in four groups, with info tooltips on every row. **Signature:** choosing or hovering a plan slides a warm "slip" highlight card behind that column on a spring, and the pot on the wheel **re-throws itself** into that plan's vessel: a terracotta mug for Taster, a wide sage bowl for Regular, a tall cobalt vase for Resident. It does this with a springy, wobbling profile morph, a glaze colour blend, a burst of wheel spin and a new speech bubble. A Monthly/Yearly control rolls every price like an **odometer**. A **"Help me choose"** three-question quiz moves the highlight to the recommended plan, retags it "Recommended for you" and explains why. When you scroll the long table, a **sticky compare bar** appears with column-aligned names, live prices and Join buttons. On phones, the table becomes **swipeable snap cards** with a sliding segmented picker. Every Join button opens a validated sign-up dialog.

**Round-3 upgrade:** the pot is **live WebGL**. It is a three.js lathe whose profile is rewritten every frame, with a custom glaze shader (glossy clearcoat, colour pooling low down, iron speckle, glaze crawling to bare clay at the rim, an unglazed foot) on a spinning wheel head with wet slip, a soft contact shadow and studio light. The camera dollies to frame each shape. An idle **cover loop** walks the highlight and the pot through the plans every 4 s until the visitor picks one. The inline SVG pot stays in the page as the fallback when there is no WebGL or the CDN fails.

## Page shell & libraries

- One `index.html` with inline CSS and JS. No frameworks. One library, three.js **r170**, loaded through an import map, with both entries pinned:
  `{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}`. Only `RoomEnvironment` is used from the addons. The 3D code is a separate `<script type="module">` after the main classic script; it talks to the page through `window.__potIndex` and `window.__pot3d.show(i)`.
- Google Fonts:
  `https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400..600,50&family=Instrument+Sans:wght@400;500;600&display=swap` (with preconnects to fonts.googleapis.com and fonts.gstatic.com).
- Structure: a skip link, then `main > section#pricing > .wrap`, containing `.intro` (copy + controls | `.stage`), `section#quiz` (hidden by default), and `.compare` (`.table-wrap` with `.hl` + `table#compare-table`, `.cards-wrap`, `.foot`). After `main` come `div#sticky` (the fixed compare bar) and `dialog#join`.
- The JS generates the table body, phone cards and sticky bar from two data arrays (`PLANS`, `GROUPS`), so all three always agree.

## Tokens

- **Colour:** cream `#f4ede2` (ground), slip `#fdf9f2` (highlight card, quiz, dialog), bisque `#e9dccb` (control tracks), ink `#2a211c`, muted `#6a5b50` (≥5:1 on cream), clay `#a4472a` (accent text, solid buttons, group labels; hover `#8e3b22`), line `rgba(42,33,28,.14)`, line-2 `rgba(42,33,28,.28)`, check green `#5f7d4f` (lit: `#3f5a32`), badge `#e3ead9` / `#3f5233`.
- **Glaze ramps** (4 stops: dark edge, highlight, body, dark edge): Taster `#7d3a22 #f0a37c #c46a43 #6a3019`, Regular `#5e6f52 #c3d3b4 #8aa27a #4f5e45`, Resident `#22355a #9fb7dd #3d5a8a #1b2a47`.
- **Background:** two soft radial washes on the section, terracotta at 12% (top right) and sage at 14% (left).
- **Type:** Fraunces 400–600 with SOFT 50 for display (headline `clamp(2.4rem, 1rem + 2.9vw, 3.9rem)`, line-height .98, tracking −.025em, italic clay emphasis; plan names 1.6rem; prices `clamp(2.2rem, 1.6rem + 1.4vw, 3.1rem)`, tracking −.03em). Instrument Sans 400/500/600 for text (16px body, eyebrows and group labels .78rem uppercase with .1em tracking).
- **Radii:** 10 / 16 / 24 / 999px. **Gutter:** `clamp(16px, 3vw, 40px)`. **Max width:** 1280px.

## Layout & structure

1. **Intro** (2-column grid, 1.25fr / .9fr, gap `clamp(24px, 4vw, 64px)`). Left: an eyebrow with a three-glaze conic dot, the h2, a lead paragraph, then the controls row:
   - The **billing control** is a `fieldset` of two real radios (Monthly / Yearly + "2 months free"), drawn as a bisque pill with an ink thumb that slides 100%.
   - The **Help me choose** ghost pill has `aria-expanded` and `aria-controls="quiz"`.

   Right: `.stage`, a rounded card (aspect 1 / .64; the hero is tightened so the whole plan header, down to the Join buttons, ends at about 710px at 1440×900: section top padding `clamp(28px,3.4vw,52px)`, h2 margins 14px, controls margin 24px, table margin `clamp(24px,2.6vw,40px)`, thead padding 30/22/22px) holding the WebGL canvas, the fallback inline SVG (viewBox 400×368) and the speech bubble `p#bubble` (slip card, radius 18/18/18/4, plan name in a clay micro-label above a Fraunces line).
2. **The wheel SVG:** a floor shadow, a trapezoid wheel body and stem, the splash tray and wheel head as stacked ellipses (`#b9a38c → #cdb9a3 → #a98e76 → #8d7666 → #9d8573`), and two dashed "spin" ellipses (rx 86 / 56, dasharray 18 30 / 10 22, cream at 55% / 35%). On top sits `g#pot`, made of:
   - a contact shadow, and the body `path` filled with a horizontal 4-stop gradient;
   - an inner-rim ellipse (ink at 55%), a rim highlight stroke and a gleam stroke along the left shoulder;
   - two ink eyes (rx 4, ry 5.2), two blush cheeks `#e88f7a` at 55%, and a mouth (an "o" for Taster, a smile for Regular, a wider grin for Resident).
3. **Quiz** (`section#quiz[hidden]`): a slip card with two columns (260px photo `assets/hands.webp` | body). It shows three-dash progress, one `fieldset` per question with three radio cards in a row, and Back / Next buttons. "Next" becomes "See my plan" on the last step. The result block shows "We'd put you on *Plan*." with a reason, plus "Show me in the table" and "Start again".
4. **Table:** `<table>` with a sr-only caption and a `colgroup` (features 31%, plans 23% each).
   - The first header cell is a `td.corner` ("Every plan comes with the basics." plus a hint).
   - Each plan `th[scope=col]` has an id, then, in order: the badge row (an invisible placeholder in columns without one, so the names stay aligned), the plan name as a `button.pick[aria-pressed]` with a ring dot, a two-line tagline, the price (€ superscript + odometer + "/ month" + sr-only full price), the billing note and a full-width Join pill (solid only in the lit column).
   - Each feature group is its own `tbody`. Its first row is `th[colspan=4][scope=rowgroup]` (a clay uppercase label). Rows are `th[scope=row]` (label + 20px round "i" tooltip button) and `td[data-col][headers]`. A cell holds text, a check SVG + sr "Included", or a dash + sr "Not included".
5. **Highlight** `.hl` sits absolutely behind the table (z 0, table z 1). It is a slip card with radius 24, an inset 1.5px clay ring at 25% and a soft drop shadow. It runs from 10px below the plan header's top to the table's bottom. A pill tag at its top centre says "Your pick" (clay), or "Recommended for you" (ink) after the quiz.
6. **Sticky bar** `#sticky`: fixed at the top, cream at 92% with a 10px backdrop blur and a hairline bottom border. Its grid columns copy the live `th` widths. It holds a label cell ("Compare plans / Monthly billing") and, for each plan, name + mini odometer price + small Join. The lit plan's cell gets the slip fill and ring.
7. **Phone cards** `.cards-wrap`: a segmented picker (3 buttons, `aria-pressed`, sliding ink thumb), then a horizontal scroll-snap row of `article.card`s at 86% width so the next card peeks in. A card holds a "Your pick" flag, the name + badge, tagline, price, note, Join, then every group as `h4` + `ul` of label / value rows with the same tooltips.
8. **Footer line:** the VAT/discount note, plus "Book a €15 drop-in session", which opens the dialog in drop-in mode.
9. **Dialog** `dialog#join`: a 150px photo header (`assets/studio.webp`) with a round close button. It contains a heading ("Join as a *Plan*" / "Book a drop-in session"), a summary with the live price and billing, name, email, an induction slot `select`, a required safety checkbox and "Reserve my place". On success it swaps to "See you at the wheel, {first name}." with a summary and "Back to plans".

### The live 3D pot (`.stage`, aspect 1 / .64 on desktop, 1 / .8 on phones)
- **Renderer:** WebGL with alpha (the CSS stage gradient shows through), DPR ≤ 2, ACES Filmic tone mapping (exposure 1), sRGB output and PCFSoft shadows. The canvas `.gl` fades in (.6 s) and the SVG fades out once the first frame renders (`.stage.is-3d`).
- **Light:**
  - environment: `PMREMGenerator.fromScene(new RoomEnvironment(), .04)` at intensity .42;
  - key: DirectionalLight `#ffe9d2` 2.4 at (−3.2, 5.5, 4.2), casting shadows with a 1024 map, bias −.0004 and normalBias .02;
  - rim: `#cfe0ff` 1.3 at (3.5, 3.2, −4);
  - fill: HemisphereLight `#fff6ea` / `#8a6e58` at .35.
- **Set:**
  - a ShadowMaterial ground at opacity .16;
  - a wood body cylinder (r 1.25 → 1.42, h .9, `#6b5444`);
  - a splash tray lathe `[[0,.9],[1.7,.9],[1.86,.94],[1.92,1.2],[1.86,1.23],[1.78,1.02],[0,1.0]]` in `#a38b74` at roughness .88;
  - a wheel head cylinder (r 1.2, h .1, top at y 1.12). Its cap uses a 512² canvas wet-slip texture: base `#8b7463`, a radial darkening and 170 random concentric arc streaks (light `rgba(236,214,190,.05–.21)` or dark), plus 26 slip blobs. The material is MeshPhysical with roughness .42 and clearcoat .55;
  - a radial blob contact shadow under the pot, plus a thin wet-slip torus at its foot. Both scale with the foot radius.
- **Pot geometry:** a custom indexed lathe with 112 segments and 72 rows (foot centre, foot edge, 34 outer samples, the lip, 34 inner samples offset by a wall of .055, and the inner floor). Radii are Catmull-Rom sampled from the 9 profile radii; svg px × .01 = world units. Positions and analytic profile normals are rewritten only while morphing.
- **Glaze shader** (MeshPhysicalMaterial with `onBeforeCompile`, object-space position as a varying):
  - colour runs from deep to glaze with `smoothstep(.02,.6,y/H + noise)`;
  - value noise at ×9 and ×23 frequencies;
  - crawl: `smoothstep(.82,.97, y/H + noise×.22)` blends to a pale clay;
  - the foot below roughly 7% is bare clay `#b8876a`;
  - iron speckle: `step(.972, hash(floor(p×140)))`;
  - roughness is .82 on bare clay and .16–.28 on glaze, and clearcoat is multiplied by the glaze mask.

  Glaze / deep pairs: Taster `#c4683f/#6e2c16`, Regular `#8fa77d/#3e4f35`, Resident `#4067a3/#16264a`.
- **Face:**
  - eyes: glossy black spheres (r .066, scaled 1 / 1.3 / .5);
  - cheeks: flattened pink spheres at 55% opacity;
  - mouth: an "o" torus for Taster, or a TubeGeometry along a Catmull-Rom curve that hugs the real surface for the smile (Regular) and grin (Resident).

  Everything sits at 50% of the pot's height, placed at the surface radius for its own height.
- **Profiles** (px, from foot to rim): Taster H 96 `[30,36,40,42,43,43,43,42,42]`, Regular H 88 `[30,46,60,70,77,82,85,87,88]`, Resident H 182 `[34,54,64,62,48,30,24,27,36]`.

## Behaviour & interaction


- **Spring** (semi-implicit Euler, sub-stepped at 240 Hz, dt capped at 1/30 s): `v += (−k(x−target) − c·v)·h`.
  - Highlight x and width: k 240, c 19, so the slide overshoots slightly.
  - Pot morph: k 150, c 11. This is underdamped on purpose, so the pot overshoots and wobbles.
- **Lit vs selected.** `select(i)` sets aria-pressed, the card/tab state, the highlight tag text and the scroll position (phones), then calls `light(i)`. `light(i)` lights the cells (`td.on`: ink, weight 500), makes that column's Join solid, marks the sticky cell and springs the highlight to the column's measured rect. After 90ms it calls `showPot(i)`.
  - A fine-pointer mouse hovering any `[data-col]` cell previews it with `light`. Leaving the table returns to the selection.
  - Clicking a cell or the plan-name button selects. Focusing a Join previews that column.
- **Pot morph.** Each plan has a profile of height H and nine radii from foot to rim: Taster H 96 `[30,36,40,42,43,43,43,42,42]`, Regular H 74 `[30,44,58,68,76,82,86,88,90]`, Resident H 182 `[34,54,64,62,48,30,24,27,36]`. The base line is y 276 and the centre x 200.
  - On a change, the current blend freezes as `from`, the spring jumps to 0 and animates to 1. Radii and height lerp with t and may overshoot (squash and stretch). The glaze stops blend with t clamped to 0–1, and the pot rotates by `clamp(velocity × 1.4, ±6)°` about its foot.
  - The outline is drawn with quadratic midpoint smoothing up the left side and down the right. The rim ellipse has ry = .21·r. The face sits at 42% of the height, with eyes ±min(.36·r, 17).
  - The speech bubble scales to .85 and fades for 200ms, swaps its text, then springs back (`cubic-bezier(.3,1.5,.5,1)`).
- **3D motion** (the same sub-stepped spring integrator):
  - morph: k 150, c 11 (it overshoots, so the pot squashes and stretches);
  - hop: k 320, c 15, with an impulse of v = 3.4 on each change. It lifts the pot, and the negative overshoot squashes it (scale y +, x/z −);
  - pot roll: `clamp(morph.v × .018, ±.12)` rad;
  - cursor yaw ±.35 rad and tilt ±.06 (k 60, c 12);
  - camera dolly: k 40, c 10, distance `3.1 + max(H, 1.5·rmax) × 1.45` (3.8 + … on narrow stages), aimed at the pot's mid-height + .1;
  - wheel head spins at `.6 + 9·boost` rad/s, where boost decays ×.3 per second;
  - blink: eyes scaleY → .08 over .18 s, every 2.4–5 s.

  The rAF runs only while the stage intersects and the tab is visible. With reduced motion it renders once per change.
- **Cover loop.** A 250 ms ticker accumulates real elapsed time. Every 4000 ms it steps through `[0,1,2,1]`: on desktop with `light(i)` (highlight + cells + pot), on phones with only the pot and bubble.
  - It is paused while the pointer is over the table, stage, sticky bar or cards, while focus is inside the table, while the quiz or dialog is open, on a hidden tab, when off-screen (phones: stage out of view or cards in view) and under reduced motion.
  - It stops for good once the visitor picks a plan (`S.touched`) or the quiz recommends one.
  - A chip in the stage corner reads "Touring plans / Paused / Your plan".
  - Before any choice, the highlight tag reads "Gentle start / Sweet spot / All in". After a choice it reads "Your pick", and after the quiz "Recommended for you".
- **SVG fallback wheel spin.** A rAF loop moves the dash offsets at `30 + 520·boost` px/s. Boost is set to 1 on each morph and decays ×0.25 per second. The loop runs only while `.stage` intersects, the tab is visible and reduced motion is off.
- **Blink:** every 2.4–5s (random), the eyes scaleY to .1 for 180ms. It only runs when the stage is visible.
- **Odometer.** Each price is three slots. Each slot holds a strip of the digits 0–9 and shows a digit with `translateY(−d·10%)`, transitioning over .9s on `cubic-bezier(.22,1.25,.36,1)`. The delay is staggered 70ms per slot, right to left. Leading blank slots collapse to width 0 (.45s), so €139 → €116 and €64 → €53 roll cleanly.
  - Yearly prices per month are 23 / 53 / 116. The notes cross-fade (180ms) to "€{y×12} billed yearly, **save €{(m−y)×12}**".
  - The sr-only text updates to "€53 per month, billed yearly at €636".
- **Quiz scoring.** Each answer is worth 0–2. The score is `a0·1.3 + a1 + a2·1.2`.
  - Resident if a2 = 2 and a0 ≥ 1. Otherwise Taster if the score ≤ 1.4, Resident if ≥ 4.6, and Regular in between.
  - The explanation is built from the answers ("Coming most days, selling your work: …"), with the live price.
  - Next without an answer shows "Pick one answer to continue." (`role=alert`). The result takes focus.
  - The result sets `S.rec`, selects the plan, retags the highlight and card flag "Recommended for you" and updates the bubble label. "Start again" clears it.
- **Tooltips:** they show on hover, on focus (via `focusin`) or when tapped (toggles `aria-expanded`). Esc or an outside click closes them. They are clamped inside the viewport with 12px margins, and their arrow tracks the button.
- **Sticky bar:** shown when the thead's bottom is < 0 and the table's bottom is > 160px (checked on rAF-throttled scroll). It slides in over .35s on `cubic-bezier(.2,.9,.3,1)`, and its columns re-measure on resize.
- **Phone cards:** after scrolling settles (90ms debounce), the nearest card becomes selected. Picker buttons smooth-scroll to their card. ← / → on the focused scroller move the selection.
- **Join dialog:** `showModal()`, which focuses the name field.
  - Validation: name ≥ 2 characters, email pattern, checkbox. It sets `aria-invalid`, writes a message per field and focuses the first error.
  - The success view takes focus. Closing (button, backdrop click or Esc) returns focus to the opener.

## Responsive

- **≥1101px:** the layout as described.
- **≤1100px:** cell padding 14px, the feature column 28%, plan names 1.4rem.
- **≤900px:**
  - The intro becomes 1fr / .8fr and the quiz options stack.
  - Taglines get min-height 4.3em, prices 2.1rem and Join buttons a smaller size.
  - The sticky bar drops its buttons.
- **≤759px (390 reference):** one column with the stage first (aspect 1 / .72). The billing control and Help button go full width, and the quiz stacks (photo 140px tall). The table and sticky bar get `display:none` and the cards show.
- Checked at 390 / 768 / 1440 with no horizontal overflow. The card scroller bleeds to the screen edge with negative margins inside a clipped body.

## Accessibility & reduced motion

- Real table semantics: caption, `scope` col / row / rowgroup, and `headers` on cells. Checks and dashes have sr text.
- Real radios for billing and the quiz, `aria-pressed` pick buttons, a live region for the quiz step and the bubble, and `role=tooltip` with `aria-describedby`.
- A native `<dialog>` with labelled fields, a skip link, and a 2.5px ink focus ring everywhere. Text contrast is AA on cream and slip.
- `prefers-reduced-motion`: springs jump to their target, the odometer and every transition take 0.01ms, and the wheel spin and blink are off. Morphs still change shape instantly, so the meaning stays.

## Fallbacks

- If WebGL is unavailable, the three.js import fails (CDN blocked) or the context is lost, the inline SVG pot stays. It runs the same morph, glaze blend, wheel spin and blink in 2D, and every other feature is unaffected.
- The `:has()` billing thumb falls back to text colour alone in older browsers.
- `ResizeObserver` and `document.fonts` are optional (feature-checked).
- The photos are decorative backgrounds on warm tan placeholders (`#c9b49c`), so a missing image never breaks the layout.

## Assets

- `assets/hands.webp` (900w, ~80 KB): an overhead, film-look shot of muddy hands pulling up a terracotta cylinder on a slip-splashed wheel tray, with a sponge and wire tool at the edge. Used in the quiz.
- `assets/studio.webp` (~57 KB): a rough wooden shelf of drying handmade cups and bowls in window light, cropped off-centre and tilted 0.8°. Used in the join dialog header.
- **Grade both identically:** saturation 78%, a warm `#c89a72` soft-light wash, levels 4%–97% with gamma .96, and a 12% overlay of Gaussian grain. Add the CSS grain overlay (an SVG feTurbulence data URI, 16% opacity, overlay blend) on `.grain` and `.stage`.

## Make it yours

This prompt rebuilds one exact design. If everyone ships it unchanged, the sites will look alike.
Before you paste it, change these lines so the result is yours. Each change is one edit to the
prompt; the structure and the interactions stay intact.

1. **Brand and offer.** Swap "Slipway Clay Co-op" and the three plans (Taster / Regular /
   Resident) for your own business, tier names, prices and feature rows. Keep 3 plans and
   10–16 rows so the table and the sticky compare bar still balance.
2. **The object on the wheel.** The pot that reshapes per plan is the signature. Replace it with
   one object from your own world that grows with the plan: a plant in a bigger pot, a stack
   of books, a coffee cup to a pot to an urn, a tent to a cabin. Keep the three-state morph,
   the colour blend and the speech bubble.
3. **Palette.** Replace the cream, clay and ink tokens and the three glaze ramps with your brand
   colours. Keep the muted text at ≥ 4.5:1 contrast on the ground colour.
4. **Type pairing.** Swap Fraunces + Instrument Sans for another serif or display face with a
   plain sans for body text. Pick one you have not seen on the last three sites you visited.
5. **The quiz.** Rewrite the three "Help me choose" questions as the questions your customers
   actually ask before buying, and map their answers to your plans.
6. **Photos.** Replace `assets/hands.webp` and `assets/studio.webp` with your own photos, or
   generate new ones in the same light and crop.
7. **Copy.** Rewrite every headline and note in your own voice. Say what your product does
   specifically ("a key to the studio", not "unlock your potential").

Tell your AI: *"Build exactly as specified, but with these changes: …"*, then list your edits.

---

## Reference implementation (use verbatim)

The complete working `index.html`. Every number in the spec above is in this file; if the two ever seem to differ, the code wins. Images and models referenced as `assets/...` can be downloaded from https://copytheprompt.design/demos/pottery-studio-pricing-table/assets/ or replaced with your own (see Make it yours).

````html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Slipway Clay Co-op · Memberships</title>
<meta name="description" content="Compare Slipway Clay Co-op studio memberships: Taster, Regular and Resident.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400..600,50&family=Instrument+Sans:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
  --cream:#f4ede2; --slip:#fdf9f2; --bisque:#e9dccb; --ink:#2a211c; --muted:#6a5b50;
  --clay:#a4472a; --clay-hi:#c46a43; --sage:#8aa27a; --cobalt:#3d5a8a;
  --line:rgba(42,33,28,.14); --line-2:rgba(42,33,28,.28);
  --r-sm:10px; --r-md:16px; --r-lg:24px; --r-pill:999px;
  --f-disp:'Fraunces',Georgia,serif; --f-text:'Instrument Sans',system-ui,sans-serif;
  --h2:clamp(2.4rem,1rem + 2.9vw,3.9rem); --price:clamp(2.2rem,1.6rem + 1.4vw,3.1rem);
  --gut:clamp(16px,3vw,40px);
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--cream);color:var(--ink);font:400 16px/1.5 var(--f-text);-webkit-font-smoothing:antialiased;overflow-x:clip}
h1,h2,h3,p{margin:0}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:2.5px solid var(--ink);outline-offset:3px;border-radius:6px}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;margin:-1px}
.skip{position:absolute;left:12px;top:-60px;background:var(--ink);color:var(--slip);padding:10px 16px;border-radius:var(--r-pill);z-index:50;text-decoration:none}
.skip:focus{top:12px}

#pricing{position:relative;padding:clamp(28px,3.4vw,52px) 0 clamp(56px,8vw,120px);
  background:radial-gradient(1200px 500px at 85% -10%,rgba(196,106,67,.12),transparent 60%),
             radial-gradient(900px 500px at -10% 30%,rgba(138,162,122,.14),transparent 60%),var(--cream)}
.wrap{max-width:1280px;margin:0 auto;padding:0 var(--gut)}

/* ---------- intro ---------- */
.intro{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr);gap:clamp(24px,4vw,64px);align-items:center}
.eyebrow{display:inline-flex;align-items:center;gap:10px;font-size:.82rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.eyebrow::before{content:"";width:22px;height:22px;border-radius:50%;background:conic-gradient(var(--clay-hi) 0 33%,var(--sage) 0 66%,var(--cobalt) 0);box-shadow:inset 0 0 0 5px var(--cream)}
h2{font:500 var(--h2)/.98 var(--f-disp);letter-spacing:-.025em;margin:14px 0 14px;font-variation-settings:"SOFT" 50}
h2 em{font-style:italic;color:var(--clay);font-weight:400}
.lead{font-size:clamp(1rem,.95rem + .25vw,1.15rem);color:var(--muted);max-width:34em}
.controls{display:flex;flex-wrap:wrap;gap:14px 18px;align-items:center;margin-top:24px}

/* billing segmented control (real radios) */
.billing{position:relative;display:inline-grid;grid-template-columns:1fr 1fr;border:0;margin:0;padding:5px;background:var(--bisque);border-radius:var(--r-pill);min-width:0}
.billing legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.billing input{position:absolute;opacity:0;pointer-events:none}
.billing label{position:relative;z-index:1;padding:10px 18px;border-radius:var(--r-pill);font-weight:600;font-size:.95rem;cursor:pointer;text-align:center;white-space:nowrap;transition:color .3s}
.billing label small{font-weight:600;font-size:.72rem;color:var(--clay);margin-left:6px;transition:color .3s}
.billing .thumb{position:absolute;top:5px;bottom:5px;left:5px;width:calc(50% - 5px);background:var(--ink);border-radius:var(--r-pill);transition:transform .45s cubic-bezier(.3,1.4,.5,1);box-shadow:0 6px 14px -6px rgba(42,33,28,.5)}
.billing input:checked+label{color:var(--slip)}
.billing input:checked+label small{color:#f4c3a6}
.billing:has(#bill-y:checked) .thumb{transform:translateX(100%)}
.billing:has(input:focus-visible){outline:2.5px solid var(--ink);outline-offset:3px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:var(--r-pill);padding:12px 20px;font-weight:600;font-size:.95rem;border:1.5px solid var(--ink);background:transparent;cursor:pointer;text-decoration:none;transition:background .25s,color .25s,transform .25s,border-color .25s;white-space:nowrap}
.btn svg{width:16px;height:16px;flex:none}
.btn:hover{transform:translateY(-1px)}
.btn.solid{background:var(--clay);border-color:var(--clay);color:#fff}
.btn.solid:hover{background:#8e3b22;border-color:#8e3b22}
.btn.ghost{border-color:var(--line-2)}
.btn.ghost:hover{border-color:var(--ink)}
.help[aria-expanded="true"]{background:var(--ink);color:var(--slip)}

/* ---------- mascot stage ---------- */
.stage{position:relative;aspect-ratio:1/0.64;isolation:isolate;border-radius:var(--r-lg);overflow:hidden;background:
  radial-gradient(70% 60% at 50% 38%,#f6ecdf 0,transparent 70%),linear-gradient(170deg,#e7d7c3,#dcc8b1);
  box-shadow:inset 0 0 0 1px rgba(42,33,28,.08)}
.stage svg{position:absolute;inset:0;width:100%;height:100%}
.stage .gl{position:absolute;inset:0;width:100%!important;height:100%!important;opacity:0;transition:opacity .6s ease;z-index:0}
.stage.is-3d .gl{opacity:1}
.stage.is-3d svg{opacity:0;transition:opacity .4s}
.stage .bubble{z-index:2}
.stage::after,.grain::after{content:"";position:absolute;inset:0;pointer-events:none;z-index:3;opacity:.16;mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E")}
.grain{position:relative;isolation:isolate}
.stage .hint{position:absolute;right:12px;bottom:12px;background:rgba(253,249,242,.82);padding:6px 10px;border-radius:999px;backdrop-filter:blur(4px);z-index:2;font-size:.74rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:rgba(42,33,28,.55);display:flex;gap:6px;align-items:center}
.stage .hint i{width:7px;height:7px;border-radius:50%;background:var(--clay);opacity:.7}
.stage .hint.paused i{background:var(--muted)}
.bubble{position:absolute;left:7%;top:8%;max-width:62%;background:var(--slip);padding:12px 16px;border-radius:18px 18px 18px 4px;font:500 1.02rem/1.3 var(--f-disp);box-shadow:0 10px 24px -16px rgba(42,33,28,.5);transition:transform .35s cubic-bezier(.3,1.5,.5,1),opacity .2s}
.bubble.swap{transform:scale(.85) translateY(6px);opacity:0}
.bubble b{display:block;font:600 .72rem/1 var(--f-text);letter-spacing:.08em;text-transform:uppercase;color:var(--clay);margin-bottom:6px}
.stage .eyes{transform-box:fill-box;transform-origin:center}
.stage .eyes.blink{animation:blink .18s ease-in-out}
@keyframes blink{50%{transform:scaleY(.1)}}

/* ---------- quiz ---------- */
.quiz{margin-top:clamp(28px,4vw,48px);display:grid;grid-template-columns:minmax(0,260px) minmax(0,1fr);background:var(--slip);border-radius:var(--r-lg);overflow:hidden;box-shadow:0 30px 60px -40px rgba(42,33,28,.45),inset 0 0 0 1px var(--line)}
.quiz[hidden]{display:none}
.quiz .photo{background:#c9b49c center/cover no-repeat;min-height:220px}
.quiz .body{padding:clamp(20px,3vw,36px)}
.qhead{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}
.qhead h3{font:500 1.5rem/1.1 var(--f-disp)}
.steps{display:flex;gap:6px}
.steps i{width:28px;height:6px;border-radius:3px;background:var(--bisque);transition:background .3s}
.steps i.done{background:var(--clay)}
.q{border:0;margin:0;padding:0;min-width:0}
.q legend{font-weight:600;font-size:1.08rem;margin-bottom:14px;padding:0}
.opts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.opt{position:relative}
.opt input{position:absolute;opacity:0}
.opt label{display:block;height:100%;padding:14px 16px;border-radius:var(--r-md);border:1.5px solid var(--line);cursor:pointer;transition:border-color .2s,background .2s,transform .2s}
.opt label strong{display:block;font-weight:600}
.opt label span{display:block;font-size:.88rem;color:var(--muted);margin-top:2px}
.opt label:hover{border-color:var(--line-2)}
.opt input:checked+label{border-color:var(--clay);background:#fbeee4}
.opt input:focus-visible+label{outline:2.5px solid var(--ink);outline-offset:2px}
.qnav{display:flex;gap:10px;margin-top:18px;align-items:center}
.qnav .err{color:var(--clay);font-size:.9rem;font-weight:500}
.result{display:none}
.result.on{display:block;animation:rise .5s cubic-bezier(.2,.9,.3,1)}
.result p{color:var(--muted);margin:10px 0 16px;max-width:46em}
.result h4{margin:0;font:500 1.9rem/1.1 var(--f-disp)}
.result h4 em{color:var(--clay)}
@keyframes rise{from{opacity:0;transform:translateY(10px)}}

/* ---------- table ---------- */
.compare{position:relative;margin-top:clamp(24px,2.6vw,40px)}
.hl{position:absolute;left:0;top:0;width:0;height:0;border-radius:var(--r-lg);background:var(--slip);box-shadow:0 30px 60px -36px rgba(120,60,30,.45),inset 0 0 0 1.5px rgba(164,71,42,.25);will-change:transform;pointer-events:none;z-index:0}
.hl .tag{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);background:var(--clay);color:#fff;font-size:.74rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;padding:6px 12px;border-radius:var(--r-pill);white-space:nowrap;transition:background .3s}
.hl.rec .tag{background:var(--ink)}
table{position:relative;z-index:1;width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}
col.c-feat{width:31%}
caption{text-align:left}
thead th{text-align:left;vertical-align:top;padding:30px 22px 22px;font-weight:400}
thead th.corner{padding-left:0;vertical-align:bottom}
.corner{color:var(--ink)}
.corner p{font:500 1.3rem/1.2 var(--f-disp);max-width:12em}
.corner small{display:block;color:var(--muted);font:400 .9rem/1.45 var(--f-text);margin-top:8px}
.pick{display:flex;align-items:center;gap:10px;background:none;border:0;padding:0;cursor:pointer;text-align:left}
.pick .dot{width:14px;height:14px;border-radius:50%;flex:none;box-shadow:inset 0 0 0 1.5px var(--ink);transition:box-shadow .25s}
.pick[aria-pressed="true"] .dot{box-shadow:inset 0 0 0 4.5px var(--ink)}
.pname{font:500 1.6rem/1.1 var(--f-disp);letter-spacing:-.01em}
.badge{display:inline-block;margin:0 0 10px;white-space:nowrap;font-size:.7rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase;padding:3px 8px;border-radius:var(--r-pill);background:#e3ead9;color:#3f5233;vertical-align:middle}
.badge.ph{visibility:hidden}
thead th .badge{display:table}
.ptag{color:var(--muted);font-size:.94rem;margin:6px 0 12px;min-height:2.9em}
.price{display:flex;align-items:baseline;gap:2px;font:500 var(--price)/1 var(--f-disp);letter-spacing:-.03em}
.price .cur{font-size:.55em;align-self:flex-start;margin-top:.12em;margin-right:2px}
.price .per{white-space:nowrap;font:500 .92rem var(--f-text);letter-spacing:0;color:var(--muted);margin-left:6px}
.note{display:block;font-size:.84rem;color:var(--muted);margin:8px 0 18px;min-height:1.3em;transition:opacity .25s}
.note.fade{opacity:0}
.note b{color:var(--clay);font-weight:600}
thead .btn{width:100%}

/* odometer */
.odo{display:inline-flex;height:1em;overflow:hidden;font-variant-numeric:tabular-nums lining-nums}
.slot{display:inline-block;width:.62em;height:1em;overflow:hidden;transition:width .45s cubic-bezier(.3,1.2,.5,1),opacity .3s}
.slot.blank{width:0;opacity:0}
.strip{display:flex;flex-direction:column;transition:transform .9s cubic-bezier(.22,1.25,.36,1)}
.strip span{height:1em;line-height:1;text-align:center}

tbody th,tbody td{padding:13px 22px;border-top:1px solid var(--line);font-weight:400;text-align:left;vertical-align:middle}
tbody th{padding-left:0}
tbody tr.grp th{border-top:0;padding:34px 0 10px;font:600 .78rem/1 var(--f-text);letter-spacing:.1em;text-transform:uppercase;color:var(--clay)}
tbody tr:not(.grp):hover th,tbody tr:not(.grp):hover td{background:linear-gradient(rgba(42,33,28,.035),rgba(42,33,28,.035))}
tbody tr:last-child td,tbody tr:last-child th{border-bottom:1px solid var(--line)}
td{color:var(--muted);transition:color .25s}
td.on{color:var(--ink);font-weight:500}
td .yes{width:24px;height:24px;color:#5f7d4f}
td.on .yes{color:#3f5a32}
td .no{display:inline-block;width:14px;height:1.5px;background:currentColor;opacity:.5;vertical-align:middle}
.feat{display:inline-flex;align-items:center;gap:8px;position:relative}
.tipbtn{width:20px;height:20px;border-radius:50%;border:1.3px solid var(--line-2);background:transparent;display:inline-grid;place-items:center;font:600 .72rem/1 var(--f-text);color:var(--muted);cursor:help;flex:none;padding:0}
.tipbtn:hover,.tipbtn[aria-expanded="true"]{background:var(--ink);color:var(--slip);border-color:var(--ink)}
.tip{position:absolute;left:0;bottom:calc(100% + 10px);width:max-content;max-width:min(270px,80vw);background:var(--ink);color:var(--slip);font-size:.86rem;line-height:1.4;padding:10px 12px;border-radius:12px;opacity:0;visibility:hidden;transform:translateY(4px);transition:opacity .18s,transform .18s,visibility 0s .18s;z-index:20;pointer-events:none;font-weight:400;text-transform:none;letter-spacing:0}
.tip::after{content:"";position:absolute;left:var(--ax,60px);top:100%;border:6px solid transparent;border-top-color:var(--ink)}
.feat.open .tip,.feat:has(.tipbtn:hover) .tip{opacity:1;visibility:visible;transform:none;transition:opacity .18s,transform .18s}
.foot{display:flex;flex-wrap:wrap;gap:10px 28px;justify-content:space-between;margin-top:28px;color:var(--muted);font-size:.9rem}
.foot a{color:var(--ink)}

/* ---------- sticky compare header ---------- */
.sticky{position:fixed;top:0;left:0;right:0;z-index:30;background:rgba(244,237,226,.92);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line);transform:translateY(-105%);visibility:hidden;transition:transform .35s cubic-bezier(.2,.9,.3,1),visibility 0s .35s}
.sticky.show{transform:none;visibility:visible;transition:transform .35s cubic-bezier(.2,.9,.3,1)}
.sticky .row{position:relative;display:grid;align-items:center;padding:10px 0}
.sticky .cell{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 14px;border-radius:14px;transition:background .3s}
.sticky .cell.on{background:var(--slip);box-shadow:inset 0 0 0 1.5px rgba(164,71,42,.25)}
.sticky .lbl{display:block;font:500 1.05rem var(--f-disp);padding-left:0}
.sticky .lbl small{display:block;font:500 .78rem var(--f-text);color:var(--muted)}
.sticky .nm{font:500 1.1rem/1.1 var(--f-disp)}
.sticky .pr{font:500 .9rem var(--f-text);color:var(--muted);display:flex;align-items:baseline;gap:1px}
.sticky .pr .odo{font:600 .98rem var(--f-text);color:var(--ink)}
.sticky .btn{padding:8px 14px;font-size:.85rem}

/* ---------- mobile cards ---------- */
.cards-wrap{display:none}
.ctabs{display:flex;gap:4px;padding:4px;background:var(--bisque);border-radius:var(--r-pill);margin:0 0 18px;position:relative}
.ctabs button{flex:1;position:relative;z-index:1;border:0;background:none;padding:10px 8px;border-radius:var(--r-pill);font-weight:600;font-size:.92rem;cursor:pointer;transition:color .3s}
.ctabs button[aria-pressed="true"]{color:var(--slip)}
.ctabs .thumb{position:absolute;top:4px;bottom:4px;left:4px;width:calc((100% - 8px - 8px)/3);background:var(--ink);border-radius:var(--r-pill);transition:transform .45s cubic-bezier(.3,1.3,.5,1)}
.cards{display:flex;gap:14px;overflow-x:auto;scroll-snap-type:x mandatory;margin:0 calc(-1 * var(--gut));padding:16px var(--gut) 24px;scroll-padding:0 var(--gut);scrollbar-width:none;overscroll-behavior-x:contain}
.cards::-webkit-scrollbar{display:none}
.card{flex:0 0 86%;scroll-snap-align:start;background:rgba(253,249,242,.55);border-radius:var(--r-lg);padding:24px 20px 20px;box-shadow:inset 0 0 0 1px var(--line);transition:background .3s,box-shadow .3s;position:relative}
.card.on{background:var(--slip);box-shadow:0 30px 50px -36px rgba(120,60,30,.5),inset 0 0 0 1.5px rgba(164,71,42,.3)}
.card .flag{position:absolute;top:-11px;left:20px;background:var(--clay);color:#fff;font-size:.7rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;padding:5px 10px;border-radius:var(--r-pill);opacity:0;transition:opacity .3s}
.card.on .flag{opacity:1}
.card.rec .flag{background:var(--ink)}
.card h3{font:500 1.7rem/1.1 var(--f-disp)}
.card h3 .badge{margin:0 0 0 6px;vertical-align:middle}
.card .btn{width:100%}
.card h4{margin:22px 0 4px;font:600 .74rem/1 var(--f-text);letter-spacing:.1em;text-transform:uppercase;color:var(--clay)}
.card ul{list-style:none;margin:0;padding:0}
.card li{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 0;border-top:1px solid var(--line);font-size:.94rem}
.card li .v{text-align:right;font-weight:500}
.card li .v.no{color:var(--muted);font-weight:400}
.card .tip{left:-4px}

/* ---------- dialog ---------- */
dialog{border:0;padding:0;border-radius:var(--r-lg);width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 32px);background:var(--slip);color:var(--ink);box-shadow:0 40px 80px -30px rgba(42,33,28,.6)}
dialog::backdrop{background:rgba(42,33,28,.45);backdrop-filter:blur(3px)}
dialog[open]{animation:pop .35s cubic-bezier(.2,1.2,.4,1)}
@keyframes pop{from{opacity:0;transform:translateY(16px) scale(.97)}}
.dhead{height:150px;background:#c9b49c center/cover no-repeat;position:relative}
.dclose{position:absolute;top:12px;right:12px;width:40px;height:40px;border-radius:50%;border:0;background:var(--slip);cursor:pointer;display:grid;place-items:center}
.dbody{padding:24px clamp(20px,4vw,32px) 28px}
.dbody h3{font:500 1.8rem/1.1 var(--f-disp)}
.dsum{color:var(--muted);margin:6px 0 20px}
.dsum b{color:var(--ink)}
.field{margin-bottom:14px}
.field label{display:block;font-weight:600;font-size:.9rem;margin-bottom:6px}
.field input[type=text],.field input[type=email],.field select{width:100%;padding:12px 14px;border-radius:12px;border:1.5px solid var(--line-2);background:#fff;font-size:1rem}
.field input:focus-visible,.field select:focus-visible{outline:2.5px solid var(--ink);outline-offset:1px}
.field [aria-invalid="true"]{border-color:var(--clay)}
.field .msg{display:block;color:var(--clay);font-size:.84rem;margin-top:5px;min-height:0}
.check{display:flex;gap:10px;align-items:flex-start;font-size:.92rem}
.check input{width:20px;height:20px;accent-color:var(--clay);margin:2px 0 0;flex:none}
.done-view{display:none;text-align:left}
.done-view.on{display:block}
.done-view p{color:var(--muted);margin:10px 0 20px}

/* ---------- responsive ---------- */
@media (max-width:1100px){
  thead th,tbody td{padding-left:14px;padding-right:14px}
  col.c-feat{width:28%}
  .pname{font-size:1.4rem}
}
@media (max-width:900px){
  .intro{grid-template-columns:minmax(0,1fr) minmax(0,.8fr)}
  .opts{grid-template-columns:1fr}
  .quiz{grid-template-columns:minmax(0,180px) minmax(0,1fr)}
  thead th{padding-top:30px}
  .ptag{font-size:.86rem;min-height:4.3em}
  thead .btn{padding:10px 8px;font-size:.86rem}
  tbody th,tbody td{font-size:.92rem}
  .sticky .btn{display:none}
  .bubble{font-size:.9rem;padding:10px 12px;max-width:56%;left:5%;top:6%}
  .price{font-size:2.1rem}
}
@media (max-width:759px){
  .intro{grid-template-columns:1fr}
  .stage{aspect-ratio:1/.8;order:-1;max-width:none}
  .bubble{font-size:.95rem}
  .controls .btn,.billing{width:100%}
  .quiz{grid-template-columns:1fr}
  .quiz .photo{min-height:140px}
  .table-wrap,.sticky{display:none!important}
  .cards-wrap{display:block}
  .compare{margin-top:36px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:.01ms!important;animation-duration:.01ms!important;transition-delay:0s!important}
}
</style>
</head>
<body>
<a class="skip" href="#compare-table">Skip to the plan comparison</a>
<main>
<section id="pricing" aria-labelledby="p-title">
  <div class="wrap">
    <div class="intro">
      <div>
        <span class="eyebrow">Slipway Clay Co-op · Memberships</span>
        <h2 id="p-title">Find your place <em>at the wheel.</em></h2>
        <p class="lead">A shared studio for hands that want to get muddy. Every plan includes the induction, the glaze library and our patient kiln team. Change or pause any month.</p>
        <div class="controls">
          <fieldset class="billing">
            <legend>Billing period</legend>
            <span class="thumb" aria-hidden="true"></span>
            <input type="radio" name="bill" id="bill-m" value="monthly" checked><label for="bill-m">Monthly</label>
            <input type="radio" name="bill" id="bill-y" value="yearly"><label for="bill-y">Yearly<small>2 months free</small></label>
          </fieldset>
          <button class="btn ghost help" type="button" aria-expanded="false" aria-controls="quiz">
            <svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="6.6" stroke="currentColor" stroke-width="1.5"/><path d="M6.2 6.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.4M8 11.6v.1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
            Help me choose
          </button>
        </div>
      </div>
      <div class="stage" id="stage">
        <p class="hint" id="tour-hint" aria-hidden="true"><i></i><span>Touring plans</span></p>
        <p class="bubble" id="bubble" aria-live="polite"><b id="bubble-k">Regular</b><span id="bubble-t">Bowls. Whole sets of bowls.</span></p>
        <svg viewBox="0 0 400 368" role="img" aria-labelledby="stage-label">
          <title id="stage-label">Illustration: a lump of clay on a potter's wheel that shapes itself into the selected plan's pot</title>
          <defs>
            <linearGradient id="glaze" x1="0" x2="1">
              <stop id="g0" offset="0" stop-color="#5e6f52"/>
              <stop id="g1" offset=".34" stop-color="#b6c8a6"/>
              <stop id="g2" offset=".62" stop-color="#8aa27a"/>
              <stop id="g3" offset="1" stop-color="#4f5e45"/>
            </linearGradient>
            <radialGradient id="floor" cx=".5" cy=".5" r=".5"><stop offset="0" stop-color="#7a5a44" stop-opacity=".28"/><stop offset="1" stop-color="#7a5a44" stop-opacity="0"/></radialGradient>
          </defs>
          <ellipse cx="200" cy="340" rx="170" ry="22" fill="url(#floor)"/>
          <!-- wheel body -->
          <path d="M120 300 L280 300 L262 338 L138 338 Z" fill="#6e5747"/>
          <path d="M120 300 L280 300 L276 310 L124 310 Z" fill="#5b4739"/>
          <rect x="190" y="282" width="20" height="22" fill="#4b3a2f"/>
          <!-- splash tray + wheel head -->
          <ellipse cx="200" cy="284" rx="150" ry="30" fill="#b9a38c"/>
          <ellipse cx="200" cy="280" rx="150" ry="28" fill="#cdb9a3"/>
          <ellipse cx="200" cy="281" rx="128" ry="21" fill="#a98e76"/>
          <ellipse cx="200" cy="278" rx="112" ry="18" fill="#8d7666"/>
          <ellipse cx="200" cy="276" rx="112" ry="17" fill="#9d8573"/>
          <ellipse id="spin" cx="200" cy="276" rx="86" ry="12.5" fill="none" stroke="#f2e4d4" stroke-opacity=".55" stroke-width="2.5" stroke-dasharray="18 30" stroke-linecap="round"/>
          <ellipse id="spin2" cx="200" cy="276" rx="56" ry="8" fill="none" stroke="#f2e4d4" stroke-opacity=".35" stroke-width="2" stroke-dasharray="10 22" stroke-linecap="round"/>
          <!-- the pot -->
          <g id="pot">
            <ellipse id="shadow" cx="200" cy="277" rx="60" ry="9" fill="#5b4739" opacity=".45"/>
            <path id="body" fill="url(#glaze)" stroke="#2a211c" stroke-opacity=".25" stroke-width="1.2"/>
            <ellipse id="rim-in" fill="#2a211c" fill-opacity=".55"/>
            <ellipse id="rim" fill="none" stroke="#fff" stroke-opacity=".45" stroke-width="2"/>
            <path id="gleam" fill="none" stroke="#fff" stroke-opacity=".5" stroke-width="4" stroke-linecap="round"/>
            <g class="eyes" id="eyes"><ellipse id="e1" rx="4" ry="5.2" fill="#2a211c"/><ellipse id="e2" rx="4" ry="5.2" fill="#2a211c"/></g>
            <ellipse id="c1" rx="6" ry="3.4" fill="#e88f7a" opacity=".55"/><ellipse id="c2" rx="6" ry="3.4" fill="#e88f7a" opacity=".55"/>
            <path id="mouth" fill="none" stroke="#2a211c" stroke-width="2.4" stroke-linecap="round"/>
          </g>
        </svg>
      </div>
    </div>

    <section class="quiz" id="quiz" hidden aria-labelledby="quiz-title">
      <div class="photo grain" style="background-image:url(assets/hands.webp)" role="img" aria-label="Clay-covered hands centring terracotta clay on a spinning wheel"></div>
      <div class="body">
        <div class="qhead"><h3 id="quiz-title">Three questions, one pot</h3><span class="steps" aria-hidden="true"><i></i><i></i><i></i></span></div>
        <form id="qform" novalidate>
          <p class="sr" id="qprog" aria-live="polite"></p>
          <fieldset class="q" data-step="0">
            <legend>How often do you picture yourself at the studio?</legend>
            <div class="opts">
              <div class="opt"><input type="radio" name="q0" id="q0a" value="0"><label for="q0a"><strong>Once a week</strong><span>An evening ritual</span></label></div>
              <div class="opt"><input type="radio" name="q0" id="q0b" value="1"><label for="q0b"><strong>Two or three times</strong><span>Whenever life allows</span></label></div>
              <div class="opt"><input type="radio" name="q0" id="q0c" value="2"><label for="q0c"><strong>Most days</strong><span>It's basically my job</span></label></div>
            </div>
          </fieldset>
          <fieldset class="q" data-step="1" hidden>
            <legend>How well do you and clay know each other?</legend>
            <div class="opts">
              <div class="opt"><input type="radio" name="q1" id="q1a" value="0"><label for="q1a"><strong>Never touched it</strong><span>Wheel? What wheel?</span></label></div>
              <div class="opt"><input type="radio" name="q1" id="q1b" value="1"><label for="q1b"><strong>I've done a course</strong><span>I can centre, mostly</span></label></div>
              <div class="opt"><input type="radio" name="q1" id="q1c" value="2"><label for="q1c"><strong>I sell my work</strong><span>Markets, commissions</span></label></div>
            </div>
          </fieldset>
          <fieldset class="q" data-step="2" hidden>
            <legend>What would help you most right now?</legend>
            <div class="opts">
              <div class="opt"><input type="radio" name="q2" id="q2a" value="0"><label for="q2a"><strong>Someone to guide me</strong><span>Tutors and a set time</span></label></div>
              <div class="opt"><input type="radio" name="q2" id="q2b" value="1"><label for="q2b"><strong>Wheel time &amp; firings</strong><span>Room to practise</span></label></div>
              <div class="opt"><input type="radio" name="q2" id="q2c" value="2"><label for="q2c"><strong>Space of my own</strong><span>Storage, kiln priority</span></label></div>
            </div>
          </fieldset>
          <div class="qnav">
            <button class="btn ghost" type="button" id="qback" hidden>Back</button>
            <button class="btn solid" type="submit" id="qnext">Next</button>
            <span class="err" id="qerr" role="alert"></span>
          </div>
        </form>
        <div class="result" id="qresult" tabindex="-1">
          <h4>We'd put you on <em id="qr-plan">Regular</em>.</h4>
          <p id="qr-why"></p>
          <div class="qnav">
            <button class="btn solid" type="button" id="qr-show">Show me in the table</button>
            <button class="btn ghost" type="button" id="qr-again">Start again</button>
          </div>
        </div>
      </div>
    </section>

    <div class="compare" id="compare">
      <div class="table-wrap" id="table-wrap">
        <div class="hl" id="hl" aria-hidden="true"><span class="tag" id="hl-tag">Your pick</span></div>
        <table id="compare-table" tabindex="-1">
          <caption class="sr">Compare Slipway studio memberships: Taster, Regular and Resident. Prices update with the billing period.</caption>
          <colgroup><col class="c-feat"><col><col><col></colgroup>
          <thead><tr id="thead-row"><td class="corner"><p>Every plan comes with the basics.</p><small>Hover a column to compare, or pick one to light it.</small></td></tr></thead>
        </table>
      </div>
      <div class="cards-wrap" id="cards-wrap">
        <div class="ctabs" id="ctabs" role="group" aria-label="Choose a plan"><span class="thumb" aria-hidden="true"></span></div>
        <div class="cards" id="cards" aria-label="Plans, swipe to compare" tabindex="0"></div>
      </div>
      <div class="foot">
        <span>Prices in euros, VAT included. Under-25s and over-65s get 20% off, just ask at the desk.</span>
        <span>Not sure yet? <a href="#join" id="drop-in">Book a €15 drop-in session</a></span>
      </div>
    </div>
  </div>
</section>
</main>

<div class="sticky" id="sticky" aria-label="Plan summary"><div class="wrap"><div class="row" id="sticky-row"></div></div></div>

<dialog id="join" aria-labelledby="join-title">
  <div class="dhead grain" style="background-image:url(assets/studio.webp)" role="img" aria-label="Shelves of drying handmade stoneware in the studio">
    <button class="dclose" type="button" id="dclose" aria-label="Close"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M2 2l10 10M12 2L2 12" stroke="#2a211c" stroke-width="1.8" stroke-linecap="round"/></svg></button>
  </div>
  <div class="dbody">
    <form id="jform" novalidate>
      <h3 id="join-title">Join as a <span id="j-plan">Regular</span></h3>
      <p class="dsum" id="j-sum"></p>
      <div class="field"><label for="j-name">Your name</label><input type="text" id="j-name" name="name" autocomplete="name" required aria-describedby="j-name-m"><span class="msg" id="j-name-m"></span></div>
      <div class="field"><label for="j-email">Email</label><input type="email" id="j-email" name="email" autocomplete="email" required aria-describedby="j-email-m"><span class="msg" id="j-email-m"></span></div>
      <div class="field"><label for="j-start">Start with an induction on</label>
        <select id="j-start" name="start"><option>Saturday, 10:00</option><option>Tuesday, 18:30</option><option>Thursday, 18:30</option></select></div>
      <div class="field"><label class="check"><input type="checkbox" id="j-ok" required aria-describedby="j-ok-m"> I'll wear closed shoes and tie my hair back at the wheel.</label><span class="msg" id="j-ok-m"></span></div>
      <button class="btn solid" type="submit" style="width:100%">Reserve my place</button>
    </form>
    <div class="done-view" id="jdone" tabindex="-1">
      <h3>See you at the wheel, <span id="jd-name"></span>.</h3>
      <p id="jd-text"></p>
      <button class="btn ghost" type="button" id="jd-close">Back to plans</button>
    </div>
  </div>
</dialog>

<script>
(() => {
'use strict';
const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches;
const MOBILE = matchMedia('(max-width: 759px)');
const $ = s => document.querySelector(s);
const $$ = s => [...document.querySelectorAll(s)];
const el = (tag, cls, html) => { const n = document.createElement(tag); if (cls) n.className = cls; if (html != null) n.innerHTML = html; return n; };

/* ---------------- data ---------------- */
const PLANS = [
  { id:'taster',   name:'Taster',   tag:'One guided evening a week, for curious hands.', m:28,  y:23,  glaze:['#7d3a22','#f0a37c','#c46a43','#6a3019'],
    say:'A mug a week. Very civilised.', mood:'o' },
  { id:'regular',  name:'Regular',  tag:'Open studio most days, for the properly hooked.', m:64, y:53, badge:'Most chosen', glaze:['#5e6f52','#c3d3b4','#8aa27a','#4f5e45'],
    say:'Bowls. Whole sets of bowls.', mood:'smile' },
  { id:'resident', name:'Resident', tag:'Your own shelf, kiln priority and a key to the place.', m:139, y:116, glaze:['#22355a','#9fb7dd','#3d5a8a','#1b2a47'],
    say:'Tall ambitions. Taller vases.', mood:'grin' },
];
const Y = true, N = false;
const GROUPS = [
  { name:'Studio time', rows:[
    ['Open studio hours', 'Unsupervised wheel and bench time whenever no class is running.', '3 h / week', '15 h / week', '24/7 key fob'],
    ['Guided evening session', 'A two-hour session with a tutor on hand. Eight people at most.', '1 / week', '1 / week', 'Any evening'],
    ['Wheel booking window', 'How far ahead you can reserve a specific wheel.', '2 days', '7 days', '21 days'],
    ['Bring a guest', 'Guests throw for free alongside you; their clay is charged at cost.', N, '1 / month', '4 / month'],
  ]},
  { name:'Clay & firing', rows:[
    ['Clay included', 'Buff stoneware or red earthenware, reclaimed or fresh from the bag.', '5 kg / mo', '12 kg / mo', '25 kg / mo'],
    ['Kiln shelf space', 'We fire to cone 6 twice a week. This is your space per firing.', '1 slot', '3 slots', '6 slots, first in'],
    ['House glaze library', 'Twenty-two tested glazes, mixed fresh every month.', Y, Y, Y],
    ['Glaze lab bench', 'Raw materials, scales and a bench to mix and test your own recipes.', N, Y, Y],
  ]},
  { name:'Learning', rows:[
    ['Induction & safety walk', 'A 90-minute first visit: wheels, kilns, dust and where the tea lives.', Y, Y, Y],
    ['Monthly technique clinic', 'Trimming, handles, lids, surface. A different topic each month.', N, Y, Y],
    ['One-to-one tutor time', 'Thirty minutes with one of our resident potters, on whatever you are stuck on.', N, '1 / quarter', '1 / month'],
  ]},
  { name:'Space & perks', rows:[
    ['Storage for work in progress', 'Where your pots wait between visits, wrapped and safe.', 'Shared shelf', 'Half shelf', 'Own shelf + locker'],
    ['Saturday market table', 'A free table at our monthly street market to sell your work.', N, N, Y],
    ['Studio shop discount', 'Tools, aprons, sponges and bagged clay from our shop.', '5%', '10%', '15%'],
  ]},
];
const ICON_YES = '<svg class="yes" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="12" cy="12" r="10" fill="currentColor" opacity=".16"/><path d="M7.5 12.4l3 3 6-6.6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
const ARROW = '<svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M2 8h11M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';
const cellHTML = v => v === true ? ICON_YES + '<span class="sr">Included</span>' : v === false ? '<span class="no" aria-hidden="true"></span><span class="sr">Not included</span>' : v;

const S = { sel:1, lit:1, yearly:false, rec:null, touched:false };
window.__potIndex = 1;

/* ---------------- spring ---------------- */
function spring(k, c, onUpdate, x0 = 0) {
  let x = x0, v = 0, target = x0, raf = 0, last = 0;
  const step = now => {
    const dt = Math.min((now - (last || now)) / 1000 || 1/60, 1/30); last = now;
    const n = Math.max(1, Math.ceil(dt * 240)), h = dt / n;
    for (let i = 0; i < n; i++) { v += (-k * (x - target) - c * v) * h; x += v * h; }
    if (Math.abs(v) < 1e-3 && Math.abs(x - target) < 1e-3) { x = target; v = 0; raf = 0; last = 0; onUpdate(x, 0); return; }
    onUpdate(x, v); raf = requestAnimationFrame(step);
  };
  return {
    to(t) { target = t; if (REDUCED) return this.jump(t); if (!raf) { last = 0; raf = requestAnimationFrame(step); } },
    jump(t) { cancelAnimationFrame(raf); raf = 0; x = target = t; v = 0; onUpdate(x, 0); },
    get value() { return x; }, get target() { return target; },
  };
}

/* ---------------- odometer ---------------- */
const odos = [];
function makeOdo(planIndex) {
  const w = el('span', 'odo'); w.setAttribute('aria-hidden', 'true');
  for (let i = 0; i < 3; i++) {
    const slot = el('span', 'slot'), strip = el('span', 'strip');
    for (let d = 0; d < 10; d++) strip.appendChild(el('span', '', String(d)));
    slot.appendChild(strip); w.appendChild(slot);
  }
  odos.push({ w, p: planIndex });
  return w;
}
function setOdo(w, val) {
  const s = String(val).padStart(3, ' ');
  [...w.children].forEach((slot, i) => {
    const ch = s[i];
    slot.classList.toggle('blank', ch === ' ');
    const d = ch === ' ' ? 0 : +ch;
    slot.style.transitionDelay = slot.firstChild.style.transitionDelay = (REDUCED ? 0 : (2 - i) * 70) + 'ms';
    slot.firstChild.style.transform = `translateY(${-d * 10}%)`;
  });
}
const priceOf = p => S.yearly ? p.y : p.m;
const noteOf = p => S.yearly ? `€${p.y * 12} billed yearly, <b>save €${(p.m - p.y) * 12}</b>` : 'Billed monthly, pause any month';
const srPrice = p => `€${priceOf(p)} per month${S.yearly ? `, billed yearly at €${p.y * 12}` : ''}`;

/* ---------------- build table ---------------- */
const headRow = $('#thead-row'), table = $('#compare-table');
const planTh = [], picks = [], notes = [], srs = [];
PLANS.forEach((p, i) => {
  const th = el('th'); th.scope = 'col'; th.dataset.col = i; th.id = 'col-' + p.id;
  th.innerHTML = `${p.badge ? `<span class="badge">${p.badge}</span>` : '<span class="badge ph" aria-hidden="true">&nbsp;</span>'}<button class="pick" type="button" aria-pressed="false"><span class="dot" aria-hidden="true"></span><span class="pname">${p.name}</span></button>
    <p class="ptag">${p.tag}</p>
    <div class="price"><span class="cur" aria-hidden="true">€</span><span class="odo-slot"></span><span class="per" aria-hidden="true">/ month</span><span class="sr"></span></div>
    <span class="note"></span>
    <button class="btn ${i === 1 ? 'solid' : ''} join" type="button" data-plan="${i}">Join ${p.name} ${ARROW}</button>`;
  th.querySelector('.odo-slot').replaceWith(makeOdo(i));
  headRow.appendChild(th); planTh.push(th);
  picks.push(th.querySelector('.pick')); notes.push(th.querySelector('.note')); srs.push(th.querySelector('.price .sr'));
});
let tipId = 0;
function featHTML(label, tip) {
  const id = 'tip-' + (++tipId);
  return `<span class="feat">${label}<button class="tipbtn" type="button" aria-label="About ${label}" aria-describedby="${id}" aria-expanded="false">i</button><span class="tip" role="tooltip" id="${id}">${tip}</span></span>`;
}
GROUPS.forEach(g => {
  const tb = el('tbody');
  tb.innerHTML = `<tr class="grp"><th colspan="4" scope="rowgroup">${g.name}</th></tr>` +
    g.rows.map(r => `<tr><th scope="row">${featHTML(r[0], r[1])}</th>${[2,3,4].map((c, i) => `<td data-col="${i}" headers="col-${PLANS[i].id}">${cellHTML(r[c])}</td>`).join('')}</tr>`).join('');
  table.appendChild(tb);
});
const tds = $$('#compare-table td[data-col]');

/* ---------------- build cards (phones) ---------------- */
const cards = $('#cards'), ctabs = $('#ctabs'), cardEls = [], tabBtns = [];
PLANS.forEach((p, i) => {
  const b = el('button', '', p.name); b.type = 'button'; b.setAttribute('aria-pressed', 'false'); b.dataset.i = i;
  ctabs.appendChild(b); tabBtns.push(b);
  const c = el('article', 'card'); c.setAttribute('aria-labelledby', 'card-' + p.id); c.dataset.i = i;
  c.innerHTML = `<span class="flag" aria-hidden="true">Your pick</span>
    <h3 id="card-${p.id}">${p.name} ${p.badge ? `<span class="badge">${p.badge}</span>` : ''}</h3>
    <p class="ptag" style="min-height:0">${p.tag}</p>
    <div class="price"><span class="cur" aria-hidden="true">€</span><span class="odo-slot"></span><span class="per" aria-hidden="true">/ month</span><span class="sr"></span></div>
    <span class="note"></span>
    <button class="btn solid join" type="button" data-plan="${i}">Join ${p.name} ${ARROW}</button>
    ${GROUPS.map(g => `<h4>${g.name}</h4><ul>${g.rows.map(r => {
      const v = r[2 + i];
      return `<li><span>${featHTML(r[0], r[1])}</span><span class="v ${v === false ? 'no' : ''}">${v === true ? 'Included' : v === false ? '<span aria-hidden="true">—</span><span class="sr">Not included</span>' : v}</span></li>`;
    }).join('')}</ul>`).join('')}`;
  c.querySelector('.odo-slot').replaceWith(makeOdo(i));
  notes.push(c.querySelector('.note')); srs.push(c.querySelector('.price .sr'));
  cards.appendChild(c); cardEls.push(c);
});

/* ---------------- build sticky bar ---------------- */
const stickyRow = $('#sticky-row'), sticky = $('#sticky'), stickyCells = [];
const lbl = el('div', 'cell lbl', `Compare plans<small id="sticky-bill">Monthly billing</small>`); stickyRow.appendChild(lbl);
PLANS.forEach((p, i) => {
  const c = el('div', 'cell');
  c.innerHTML = `<div><div class="nm">${p.name}</div><div class="pr"><span aria-hidden="true">€</span><span class="odo-slot"></span><span>&nbsp;/ mo</span></div></div><button class="btn solid join" type="button" data-plan="${i}">Join</button>`;
  c.querySelector('.odo-slot').replaceWith(makeOdo(i));
  c.addEventListener('click', e => { if (!e.target.closest('.join')) select(i); });
  stickyRow.appendChild(c); stickyCells.push(c);
});

/* ---------------- billing ---------------- */
function renderBilling() {
  odos.forEach(o => setOdo(o.w, priceOf(PLANS[o.p])));
  notes.forEach((n, k) => {
    const p = PLANS[k % 3];
    n.classList.add('fade');
    setTimeout(() => { n.innerHTML = noteOf(p); n.classList.remove('fade'); }, REDUCED ? 0 : 180);
  });
  srs.forEach((s, k) => s.textContent = srPrice(PLANS[k % 3]));
  $('#sticky-bill').textContent = S.yearly ? 'Yearly billing' : 'Monthly billing';
}
$$('input[name=bill]').forEach(r => r.addEventListener('change', () => { S.yearly = $('#bill-y').checked; renderBilling(); }));

/* ---------------- highlight column ---------------- */
const wrap = $('#table-wrap'), hl = $('#hl');
let geo = { x:0, w:0 };
const hlX = spring(240, 19, x => { geo.x = x; paintHL(); });
const hlW = spring(240, 19, w => { geo.w = w; paintHL(); });
function paintHL() { hl.style.transform = `translateX(${geo.x}px)`; hl.style.width = geo.w + 'px'; }
function colRect(i) {
  const wr = wrap.getBoundingClientRect(), r = planTh[i].getBoundingClientRect();
  return { x: r.left - wr.left, w: r.width };
}
function layoutHL(instant) {
  if (MOBILE.matches) return;
  const wr = wrap.getBoundingClientRect(), tr = table.getBoundingClientRect(), hr = planTh[0].getBoundingClientRect();
  hl.style.top = (hr.top - wr.top + 10) + 'px';
  hl.style.height = (tr.bottom - hr.top + 4) + 'px';
  const c = colRect(S.lit);
  if (instant) { hlX.jump(c.x); hlW.jump(c.w); } else { hlX.to(c.x); hlW.to(c.w); }
  // sticky columns mirror the table's column widths
  const ws = [...headRow.children].map(n => n.getBoundingClientRect().width);
  stickyRow.style.gridTemplateColumns = ws.map(w => w + 'px').join(' ');
}

/* ---------------- mascot: the pot on the wheel ---------------- */
// Profiles: height and 9 radii from foot to rim (px in the 400×368 viewBox)
const PROFILES = [
  { H: 96,  r:[30,36,40,42,43,43,43,42,42] },     // Taster: a mug
  { H: 74,  r:[30,44,58,68,76,82,86,88,90] },     // Regular: a wide bowl
  { H: 182, r:[34,54,64,62,48,30,24,27,36] },     // Resident: a tall vase
];
const BASE = 276, CX = 200;
let fromP = PROFILES[1], toP = PROFILES[1], fromG = PLANS[1].glaze, toG = PLANS[1].glaze, mood = PLANS[1].mood;
const mix = (a, b, t) => a + (b - a) * t;
const hex = h => [1,3,5].map(i => parseInt(h.slice(i, i + 2), 16));
const mixHex = (a, b, t) => { const A = hex(a), B = hex(b); return '#' + A.map((v, i) => Math.round(Math.max(0, Math.min(255, mix(v, B[i], t)))).toString(16).padStart(2, '0')).join(''); };
const potEl = { body:$('#body'), rimIn:$('#rim-in'), rim:$('#rim'), gleam:$('#gleam'), e1:$('#e1'), e2:$('#e2'), c1:$('#c1'), c2:$('#c2'), mouth:$('#mouth'), shadow:$('#shadow'), pot:$('#pot'), g:[0,1,2,3].map(i => $('#g' + i)) };
function smooth(pts) {
  let d = `M${pts[0][0].toFixed(1)} ${pts[0][1].toFixed(1)}`;
  for (let i = 1; i < pts.length - 1; i++) {
    const [x, y] = pts[i], [nx, ny] = pts[i + 1];
    d += ` Q${x.toFixed(1)} ${y.toFixed(1)} ${((x + nx) / 2).toFixed(1)} ${((y + ny) / 2).toFixed(1)}`;
  }
  const l = pts[pts.length - 1]; return d + ` L${l[0].toFixed(1)} ${l[1].toFixed(1)}`;
}
function drawPot(t, vel) {
  const H = mix(fromP.H, toP.H, t), r = fromP.r.map((v, i) => Math.max(6, mix(v, toP.r[i], t)));
  const n = r.length, ys = r.map((_, i) => BASE - H * i / (n - 1));
  const left = r.map((v, i) => [CX - v, ys[i]]), right = r.map((v, i) => [CX + v, ys[i]]).reverse();
  potEl.body.setAttribute('d', smooth(left) + ' ' + smooth(right).replace('M', 'L') + ' Z');
  const top = ys[n - 1], rt = r[n - 1];
  potEl.rimIn.setAttribute('cx', CX); potEl.rimIn.setAttribute('cy', top); potEl.rimIn.setAttribute('rx', rt - 2); potEl.rimIn.setAttribute('ry', rt * .2);
  potEl.rim.setAttribute('cx', CX); potEl.rim.setAttribute('cy', top); potEl.rim.setAttribute('rx', rt); potEl.rim.setAttribute('ry', rt * .21);
  potEl.shadow.setAttribute('rx', r[0] + 14);
  // gleam along the left shoulder
  const g = left.slice(2, n - 2).map(([x, y], i) => [x + r[i + 2] * .3, y]);
  potEl.gleam.setAttribute('d', smooth(g));
  // face sits at 42% height
  const f = .42 * (n - 1), fi = Math.floor(f), rf = mix(r[fi], r[fi + 1], f - fi), fy = BASE - H * .42;
  const dx = Math.min(rf * .36, 17);
  [[potEl.e1, -dx], [potEl.e2, dx]].forEach(([e, o]) => { e.setAttribute('cx', CX + o); e.setAttribute('cy', fy - 6); });
  [[potEl.c1, -dx - 7], [potEl.c2, dx + 7]].forEach(([e, o]) => { e.setAttribute('cx', CX + o); e.setAttribute('cy', fy + 5); });
  const mw = mood === 'o' ? 0 : mood === 'smile' ? 6 : 9;
  potEl.mouth.setAttribute('d', mood === 'o'
    ? `M${CX - 3} ${fy + 5} a3 3.4 0 1 0 6 0 a3 3.4 0 1 0 -6 0`
    : `M${CX - mw} ${fy + 3} Q${CX} ${fy + 3 + mw * .9} ${CX + mw} ${fy + 3}`);
  const ct = Math.max(0, Math.min(1, t));
  potEl.g.forEach((s, i) => s.setAttribute('stop-color', mixHex(fromG[i], toG[i], ct)));
  potEl.pot.style.transform = `rotate(${Math.max(-6, Math.min(6, vel * 1.4))}deg)`;
  potEl.pot.style.transformOrigin = `${CX}px ${BASE}px`;
}
const morph = spring(150, 11, (t, v) => drawPot(t, v), 1);
let spinBoost = 0, potTimer = 0, shown = 1;
function showPot(i) {
  if (i === shown) return; shown = i;
  // freeze the current blend as the new start
  const t = morph.value;
  fromP = { H: mix(fromP.H, toP.H, t), r: fromP.r.map((v, k) => mix(v, toP.r[k], t)) };
  fromG = fromG.map((c, k) => mixHex(c, toG[k], Math.max(0, Math.min(1, t))));
  toP = PROFILES[i]; toG = PLANS[i].glaze; mood = PLANS[i].mood;
  morph.jump(0); morph.to(1); spinBoost = 1;
  window.__potIndex = i; if (window.__pot3d) window.__pot3d.show(i);
  const b = $('#bubble');
  if (REDUCED) { setBubble(i); return; }
  b.classList.add('swap'); setTimeout(() => { setBubble(i); b.classList.remove('swap'); }, 200);
}
function setBubble(i) { $('#bubble-k').textContent = S.rec === i ? 'Recommended: ' + PLANS[i].name : PLANS[i].name; $('#bubble-t').textContent = PLANS[i].say; }

// wheel spin + blink: only while the stage is on screen and the tab is visible
let stageOn = true, spinRaf = 0, off = 0, lastT = 0;
function spinLoop(now) {
  const dt = Math.min(.05, (now - (lastT || now)) / 1000); lastT = now;
  spinBoost *= Math.pow(.25, dt);
  off -= dt * (30 + 520 * spinBoost);
  $('#spin').setAttribute('stroke-dashoffset', off.toFixed(1));
  $('#spin2').setAttribute('stroke-dashoffset', (off * .7).toFixed(1));
  spinRaf = requestAnimationFrame(spinLoop);
}
function runSpin() {
  const go = stageOn && !document.hidden && !REDUCED;
  if (go && !spinRaf) { lastT = 0; spinRaf = requestAnimationFrame(spinLoop); }
  if (!go && spinRaf) { cancelAnimationFrame(spinRaf); spinRaf = 0; }
}
new IntersectionObserver(es => { stageOn = es[0].isIntersecting; runSpin(); }).observe($('#stage'));
document.addEventListener('visibilitychange', runSpin);
(function blink() {
  setTimeout(() => {
    if (stageOn && !document.hidden && !REDUCED) { const e = $('#eyes'); e.classList.remove('blink'); void e.getBBox(); e.classList.add('blink'); }
    blink();
  }, 2400 + Math.random() * 2600);
})();

/* ---------------- selection ---------------- */
function tagFor(i) { return S.rec === i ? 'Recommended for you' : S.touched ? (i === S.sel ? 'Your pick' : PLANS[i].name) : ['Gentle start', 'Sweet spot', 'All in'][i]; }
function light(i, instant) {
  S.lit = i;
  $('#hl-tag').textContent = tagFor(i); hl.classList.toggle('rec', S.rec === i);
  tds.forEach(td => td.classList.toggle('on', +td.dataset.col === i));
  planTh.forEach((th, k) => th.querySelector('.join').classList.toggle('solid', k === i));
  stickyCells.forEach((c, k) => c.classList.toggle('on', k === i));
  layoutHL(instant);
  clearTimeout(potTimer); potTimer = setTimeout(() => showPot(i), instant ? 0 : 90);
}
function select(i, { scrollCard = true, instant = false } = {}) {
  S.sel = i;
  picks.forEach((b, k) => b.setAttribute('aria-pressed', String(k === i)));
  tabBtns.forEach((b, k) => b.setAttribute('aria-pressed', String(k === i)));
  ctabs.querySelector('.thumb').style.transform = `translateX(calc(${i * 100}% + ${i * 4}px))`;
  cardEls.forEach((c, k) => { c.classList.toggle('on', k === i); c.classList.toggle('rec', k === i && S.rec === i); });
  if (!instant) S.touched = true;
  cardEls.forEach((c, k) => c.querySelector('.flag').textContent = tagFor(k));
  light(i, instant);
  if (scrollCard && MOBILE.matches) {
    const c = cardEls[i];
    cards.scrollTo({ left: c.offsetLeft - cards.offsetLeft - parseFloat(getComputedStyle(cards).paddingLeft) + (c.offsetLeft ? 0 : 0) - 0, behavior: REDUCED || instant ? 'auto' : 'smooth' });
  }
}
// desktop: hover previews, click / keyboard picks
const FINE = matchMedia('(hover: hover) and (pointer: fine)');
table.addEventListener('pointerover', e => {
  if (!FINE.matches || e.pointerType !== 'mouse') return;
  const c = e.target.closest('[data-col]'); if (c && +c.dataset.col !== S.lit) light(+c.dataset.col);
});
table.addEventListener('pointerleave', () => { if (S.lit !== S.sel) light(S.sel); });
table.addEventListener('click', e => {
  if (e.target.closest('.tipbtn') || e.target.closest('.join')) return;
  const c = e.target.closest('[data-col]'); if (c) select(+c.dataset.col);
});
table.addEventListener('focusin', e => { const c = e.target.closest('[data-col]'); if (c && e.target.closest('.join')) light(+c.dataset.col); });
table.addEventListener('focusout', e => { if (!table.contains(e.relatedTarget) && S.lit !== S.sel) light(S.sel); });
tabBtns.forEach((b, i) => b.addEventListener('click', () => select(i)));
// phones: swiping picks the card that settles
let scT = 0;
cards.addEventListener('scroll', () => {
  clearTimeout(scT);
  scT = setTimeout(() => {
    const mid = cards.scrollLeft + cards.clientWidth * .3;
    let best = 0, bd = 1e9;
    cardEls.forEach((c, k) => { const d = Math.abs(c.offsetLeft - cards.offsetLeft - mid); if (d < bd) { bd = d; best = k; } });
    // offsetLeft measured relative to the scroller's offsetParent; use positions relative to the first card
    const base = cardEls[0].offsetLeft;
    bd = 1e9; cardEls.forEach((c, k) => { const d = Math.abs((c.offsetLeft - base) - cards.scrollLeft); if (d < bd) { bd = d; best = k; } });
    if (best !== S.sel) select(best, { scrollCard: false });
  }, 90);
}, { passive: true });
cards.addEventListener('keydown', e => {
  if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') { e.preventDefault(); select(Math.max(0, Math.min(2, S.sel + (e.key === 'ArrowRight' ? 1 : -1)))); }
});

/* ---------------- tooltips (hover, focus, tap; Esc closes) ---------------- */
function closeTips(except) { $$('.feat.open').forEach(f => { if (f !== except) { f.classList.remove('open'); f.querySelector('.tipbtn').setAttribute('aria-expanded', 'false'); } }); }
function placeTip(f) {
  const tip = f.querySelector('.tip'), btn = f.querySelector('.tipbtn');
  tip.style.left = '0px';
  const r = tip.getBoundingClientRect(), vw = document.documentElement.clientWidth;
  let shift = 0; if (r.right > vw - 12) shift = vw - 12 - r.right; if (r.left + shift < 12) shift = 12 - r.left;
  tip.style.left = shift + 'px';
  const b = btn.getBoundingClientRect(); tip.style.setProperty('--ax', (b.left + b.width / 2 - r.left - shift - 6) + 'px');
}
document.addEventListener('click', e => {
  const b = e.target.closest('.tipbtn');
  if (!b) { closeTips(); return; }
  const f = b.closest('.feat'), open = !f.classList.contains('open');
  closeTips(f); f.classList.toggle('open', open); b.setAttribute('aria-expanded', String(open)); if (open) placeTip(f);
});
document.addEventListener('focusin', e => {
  const b = e.target.closest && e.target.closest('.tipbtn');
  closeTips(b ? b.closest('.feat') : null);
  if (b) { const f = b.closest('.feat'); f.classList.add('open'); b.setAttribute('aria-expanded', 'true'); placeTip(f); }
});
document.addEventListener('mouseover', e => { const b = e.target.closest && e.target.closest('.tipbtn'); if (b) placeTip(b.closest('.feat')); });
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeTips(); });

/* ---------------- sticky compare header ---------------- */
function updateSticky() {
  if (MOBILE.matches) { sticky.classList.remove('show'); return; }
  const th = headRow.getBoundingClientRect(), tb = table.getBoundingClientRect(), wr = wrap.getBoundingClientRect();
  const show = th.bottom < 0 && tb.bottom > 160;
  sticky.classList.toggle('show', show);
  if (show) stickyRow.style.marginLeft = (wr.left - stickyRow.parentElement.getBoundingClientRect().left - parseFloat(getComputedStyle(stickyRow.parentElement).paddingLeft)) + 'px';
}
let ticking = false;
addEventListener('scroll', () => { if (!ticking) { ticking = true; requestAnimationFrame(() => { ticking = false; updateSticky(); }); } }, { passive: true });

/* ---------------- quiz ---------------- */
const helpBtn = $('.help'), quiz = $('#quiz'), qform = $('#qform'), steps = $$('.q'), dots = $$('.steps i');
let step = 0;
helpBtn.addEventListener('click', () => {
  const open = quiz.hidden; quiz.hidden = !open; helpBtn.setAttribute('aria-expanded', String(open));
  if (open) { showStep(step); (qresult.classList.contains('on') ? qresult : steps[step].querySelector('input')).focus({ preventScroll: true }); quiz.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'nearest' }); }
  requestAnimationFrame(() => layoutHL(true));
});
const qresult = $('#qresult');
function showStep(n) {
  step = n; steps.forEach((s, k) => s.hidden = k !== n);
  dots.forEach((d, k) => d.classList.toggle('done', k <= n));
  $('#qback').hidden = n === 0; $('#qnext').textContent = n === 2 ? 'See my plan' : 'Next';
  $('#qprog').textContent = `Question ${n + 1} of 3`; $('#qerr').textContent = '';
}
$('#qback').addEventListener('click', () => { showStep(step - 1); steps[step].querySelector('input:checked, input').focus(); });
steps.forEach(s => s.addEventListener('change', () => { $('#qerr').textContent = ''; }));
qform.addEventListener('submit', e => {
  e.preventDefault();
  if (!qform.querySelector(`input[name=q${step}]:checked`)) { $('#qerr').textContent = 'Pick one answer to continue.'; return; }
  if (step < 2) { showStep(step + 1); steps[step].querySelector('input').focus(); return; }
  const a = [0,1,2].map(k => +qform.querySelector(`input[name=q${k}]:checked`).value);
  const score = a[0] * 1.3 + a[1] + a[2] * 1.2;
  const plan = a[2] === 2 && a[0] >= 1 ? 2 : score <= 1.4 ? 0 : score >= 4.6 ? 2 : 1;
  const why = {
    0: ['once a week suits the guided evening perfectly', 'the induction and a tutor in the room take the fear out of the first pots', 'Taster gives you a tutor every session'],
    1: ['a few visits a week is exactly what the 15 open hours are for', 'you already know your way around a wheel', 'Regular adds the glaze lab, monthly clinics and three kiln slots'],
    2: ['daily throwing needs a key, not a timetable', 'selling work means you need kiln priority and a market table', 'Resident gives you your own shelf, a locker and first place in every firing'],
  }[plan];
  const p0 = ['Coming once a week', 'Two or three visits', 'Coming most days'][a[0]];
  const p1 = ['starting from scratch', 'with a course behind you', 'selling your work'][a[1]];
  $('#qr-plan').textContent = PLANS[plan].name;
  $('#qr-why').textContent = `${p0}, ${p1}: ${why[0]}. ${why[2]}, at €${priceOf(PLANS[plan])} a month${S.yearly ? ' on yearly billing' : ''}.`;
  qform.hidden = true; qresult.classList.add('on'); qresult.focus({ preventScroll: true });
  S.rec = plan; select(plan); setBubble(plan);
});
$('#qr-again').addEventListener('click', () => {
  qform.reset(); qform.hidden = false; qresult.classList.remove('on'); S.rec = null; select(S.sel); setBubble(S.sel); showStep(0); steps[0].querySelector('input').focus();
});
$('#qr-show').addEventListener('click', () => {
  const target = MOBILE.matches ? $('#cards-wrap') : $('#compare-table');
  target.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'start' });
  setTimeout(() => (MOBILE.matches ? cardEls[S.sel].querySelector('.join') : planTh[S.sel].querySelector('.join')).focus({ preventScroll: true }), REDUCED ? 0 : 500);
});

/* ---------------- join dialog ---------------- */
const dlg = $('#join'), jform = $('#jform'), jdone = $('#jdone');
let joinPlan = 1, dropIn = false, opener = null;
function openJoin(i, drop) {
  joinPlan = i; dropIn = !!drop; opener = document.activeElement;
  const p = PLANS[i];
  $('#j-plan').parentElement.innerHTML = drop ? 'Book a <span id="j-plan">drop-in session</span>' : `Join as a <span id="j-plan">${p.name}</span>`;
  $('#j-sum').innerHTML = drop ? 'Two hours at the wheel with a tutor, clay and one firing included. <b>€15</b>, paid on the day.'
    : `<b>€${priceOf(p)} / month</b>, ${S.yearly ? `billed yearly at €${p.y * 12}` : 'billed monthly'}. Nothing is charged until after your induction.`;
  jform.hidden = false; jdone.classList.remove('on');
  ['j-name', 'j-email', 'j-ok'].forEach(id => { $('#' + id).removeAttribute('aria-invalid'); $('#' + id + '-m').textContent = ''; });
  dlg.showModal(); $('#j-name').focus();
}
document.addEventListener('click', e => { const j = e.target.closest('.join'); if (j) { select(+j.dataset.plan, { scrollCard: false }); openJoin(+j.dataset.plan); } });
$('#drop-in').addEventListener('click', e => { e.preventDefault(); openJoin(0, true); });
function closeJoin() { dlg.close(); }
dlg.addEventListener('close', () => { if (opener && opener.focus) opener.focus({ preventScroll: true }); });
$('#dclose').addEventListener('click', closeJoin); $('#jd-close').addEventListener('click', closeJoin);
dlg.addEventListener('click', e => { if (e.target === dlg) closeJoin(); });
function check(id, ok, msg) { const f = $('#' + id); f.setAttribute('aria-invalid', String(!ok)); $('#' + id + '-m').textContent = ok ? '' : msg; return ok; }
jform.addEventListener('submit', e => {
  e.preventDefault();
  const name = $('#j-name').value.trim(), email = $('#j-email').value.trim();
  const ok = [
    check('j-name', name.length >= 2, 'Tell us what to call you.'),
    check('j-email', /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email), 'That email looks incomplete.'),
    check('j-ok', $('#j-ok').checked, 'Please tick this, it matters around spinning wheels.'),
  ];
  if (ok.includes(false)) { $('#' + ['j-name', 'j-email', 'j-ok'][ok.indexOf(false)]).focus(); return; }
  $('#jd-name').textContent = name.split(' ')[0];
  $('#jd-text').textContent = `${dropIn ? 'Your drop-in' : 'Your ' + PLANS[joinPlan].name + ' membership'} starts with the ${$('#j-start').value} induction. We have held a place for you and will write to ${email} with what to bring (an old T-shirt is plenty).`;
  jform.hidden = true; jdone.classList.add('on'); jdone.focus();
});

/* ---------------- cover loop: walk the plans while idle ---------------- */
// Every 4 s (only while on-screen, tab visible, no hover / focus inside, no quiz or dialog open,
// motion allowed, and the visitor has not picked a plan yet) the light and the pot walk 0 → 1 → 2 → 1.
const TOUR = [0, 1, 2, 1], TOUR_MS = 4000, hint = $('#tour-hint');
let lastTick = 0, tourI = 1, tourAcc = 0, hovering = false, tableOn = false, cardsOn = false;
const io2 = new IntersectionObserver(es => es.forEach(e => {
  if (e.target === wrap) tableOn = e.isIntersecting; else cardsOn = e.isIntersecting;
}), { threshold: .15 });
io2.observe(wrap); io2.observe($('#cards-wrap'));
['table-wrap', 'stage', 'sticky', 'cards-wrap'].forEach(id => {
  const n = document.getElementById(id);
  n.addEventListener('pointerenter', e => { if (e.pointerType === 'mouse') hovering = true; });
  n.addEventListener('pointerleave', () => { hovering = false; });
});
function tourBlocked() {
  return REDUCED || S.touched || S.rec !== null || document.hidden || hovering || dlg.open || !quiz.hidden ||
    wrap.contains(document.activeElement) ||
    (MOBILE.matches ? (!stageOn || cardsOn) : !(stageOn || tableOn));
}
function tourStop() { if (S.lit !== S.sel) light(S.sel); else showPot(S.sel); }
let wasBlocked = false;
setInterval(() => {
  const blocked = tourBlocked();
  hint.classList.toggle('paused', blocked);
  hint.querySelector('span').textContent = S.touched || S.rec !== null || REDUCED ? 'Your plan' : blocked ? 'Paused' : 'Touring plans';
  if (blocked) { if (!wasBlocked && (S.touched || MOBILE.matches)) tourStop(); wasBlocked = true; tourAcc = 0; lastTick = 0; return; }
  wasBlocked = false;
  const now = performance.now(); tourAcc += Math.min(1000, now - (lastTick || now)); lastTick = now;
  if (tourAcc < TOUR_MS) return;
  tourAcc = 0; tourI = (tourI + 1) % TOUR.length;
  const i = TOUR[tourI];
  if (MOBILE.matches) showPot(i); else light(i);
}, 250);

/* ---------------- init ---------------- */
renderBilling();
select(1, { instant: true });
drawPot(1, 0);
addEventListener('resize', () => { layoutHL(true); updateSticky(); });
if ('ResizeObserver' in window) new ResizeObserver(() => layoutHL(true)).observe(table);
MOBILE.addEventListener('change', () => { select(S.sel, { instant: true }); updateSticky(); });
document.fonts && document.fonts.ready.then(() => layoutHL(true));
})();
</script>
<script type="importmap">{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}</script>
<script type="module">
/* ---------- live 3D pot: a lathe that re-throws itself per plan (falls back to the inline SVG) ---------- */
import * as THREE from 'three';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';

const stage = document.getElementById('stage');
const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches;
let renderer = null;
try {
  const probe = document.createElement('canvas');
  if (probe.getContext('webgl2') || probe.getContext('webgl')) renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true, powerPreference: 'high-performance' });
} catch (e) { renderer = null; }
if (renderer) build();

function build() {
  const S = 0.01;                                    // svg px → world units
  const PROFILES = [
    { H: 96,  r: [30, 36, 40, 42, 43, 43, 43, 42, 42] },   // Taster: mug
    { H: 88,  r: [30, 46, 60, 70, 77, 82, 85, 87, 88] },   // Regular: bowl
    { H: 182, r: [34, 54, 64, 62, 48, 30, 24, 27, 36] },   // Resident: vase
  ];
  const GLAZE = [['#c4683f', '#6e2c16'], ['#8fa77d', '#3e4f35'], ['#4067a3', '#16264a']];
  const MOODS = ['o', 'smile', 'grin'];

  const canvas = renderer.domElement; canvas.className = 'gl'; canvas.setAttribute('aria-hidden', 'true');
  stage.prepend(canvas);
  renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
  renderer.toneMapping = THREE.ACESFilmicToneMapping; renderer.toneMappingExposure = 1.0;
  renderer.outputColorSpace = THREE.SRGBColorSpace;
  renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFSoftShadowMap;

  const scene = new THREE.Scene();
  const pmrem = new THREE.PMREMGenerator(renderer);
  scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;
  scene.environmentIntensity = 0.42;

  const camera = new THREE.PerspectiveCamera(28, 1.6, 0.1, 60);
  const TARGET = new THREE.Vector3(-0.72, 2.06, 0);

  // light: warm key with soft shadow, cool rim, gentle fill
  const key = new THREE.DirectionalLight('#ffe9d2', 2.4); key.position.set(-3.2, 5.5, 4.2);
  key.castShadow = true; key.shadow.mapSize.set(1024, 1024); key.shadow.radius = 6; key.shadow.bias = -0.0004; key.shadow.normalBias = 0.02;
  Object.assign(key.shadow.camera, { left: -2.6, right: 2.6, top: 2.6, bottom: -2.6, near: 1, far: 16 });
  scene.add(key);
  const rim = new THREE.DirectionalLight('#cfe0ff', 1.3); rim.position.set(3.5, 3.2, -4); scene.add(rim);
  scene.add(new THREE.HemisphereLight('#fff6ea', '#8a6e58', 0.35));

  // ---- procedural textures ----
  function canvasTex(size, draw) {
    const c = document.createElement('canvas'); c.width = c.height = size; draw(c.getContext('2d'), size);
    const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = 4; return t;
  }
  let seed = 7; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647;
  // wheel head: wet slip in concentric throwing rings
  const slipTex = canvasTex(512, (g, n) => {
    const c = n / 2; g.fillStyle = '#8b7463'; g.fillRect(0, 0, n, n);
    const grd = g.createRadialGradient(c, c, 0, c, c, c); grd.addColorStop(0, 'rgba(70,52,40,.35)'); grd.addColorStop(.55, 'rgba(0,0,0,0)'); grd.addColorStop(1, 'rgba(40,30,22,.35)');
    g.fillStyle = grd; g.fillRect(0, 0, n, n);
    for (let i = 0; i < 170; i++) {
      const r = 18 + rnd() * (c - 22), a0 = rnd() * Math.PI * 2, len = .4 + rnd() * 4.5;
      g.strokeStyle = rnd() < .62 ? `rgba(236,214,190,${.05 + rnd() * .16})` : `rgba(58,40,28,${.06 + rnd() * .14})`;
      g.lineWidth = .6 + rnd() * 3.2; g.beginPath(); g.arc(c, c, r, a0, a0 + len); g.stroke();
    }
    for (let i = 0; i < 26; i++) {                    // slip blobs
      const r = 40 + rnd() * (c - 60), a = rnd() * 6.28;
      g.fillStyle = `rgba(214,188,160,${.06 + rnd() * .1})`;
      g.beginPath(); g.ellipse(c + Math.cos(a) * r, c + Math.sin(a) * r, 3 + rnd() * 12, 2 + rnd() * 5, a + 1.57, 0, 6.28); g.fill();
    }
    g.strokeStyle = 'rgba(30,22,16,.5)'; g.lineWidth = 6; g.beginPath(); g.arc(c, c, c - 4, 0, 6.28); g.stroke();
  });
  const blobTex = canvasTex(256, (g, n) => {
    const grd = g.createRadialGradient(n / 2, n / 2, 0, n / 2, n / 2, n / 2);
    grd.addColorStop(0, 'rgba(30,18,10,.75)'); grd.addColorStop(.45, 'rgba(30,18,10,.35)'); grd.addColorStop(1, 'rgba(30,18,10,0)');
    g.fillStyle = grd; g.fillRect(0, 0, n, n);
  });

  // ---- wheel, tray, contact shadow ----
  const ground = new THREE.Mesh(new THREE.PlaneGeometry(30, 30), new THREE.ShadowMaterial({ opacity: 0.16 }));
  ground.rotation.x = -Math.PI / 2; ground.receiveShadow = true; scene.add(ground);
  const wood = new THREE.MeshStandardMaterial({ color: '#6b5444', roughness: .78 });
  const body = new THREE.Mesh(new THREE.CylinderGeometry(1.25, 1.42, 0.9, 64), wood); body.position.y = .45; body.castShadow = body.receiveShadow = true; scene.add(body);
  const trayPts = [[0, .9], [1.7, .9], [1.86, .94], [1.92, 1.2], [1.86, 1.23], [1.78, 1.02], [0, 1.0]].map(([x, y]) => new THREE.Vector2(x, y));
  const tray = new THREE.Mesh(new THREE.LatheGeometry(trayPts, 96), new THREE.MeshStandardMaterial({ color: '#a38b74', roughness: .88 }));
  tray.castShadow = tray.receiveShadow = true; scene.add(tray);
  const headMat = new THREE.MeshPhysicalMaterial({ map: slipTex, roughness: .42, clearcoat: .55, clearcoatRoughness: .25 });
  const sideMat = new THREE.MeshStandardMaterial({ color: '#5b4637', roughness: .5, metalness: .2 });
  const head = new THREE.Mesh(new THREE.CylinderGeometry(1.2, 1.2, 0.1, 96), [sideMat, headMat, sideMat]);
  head.position.y = 1.07; head.receiveShadow = true; head.castShadow = true; scene.add(head);
  const HEAD_TOP = 1.12;
  const blob = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), new THREE.MeshBasicMaterial({ map: blobTex, transparent: true, depthWrite: false }));
  blob.rotation.x = -Math.PI / 2; blob.position.y = HEAD_TOP + .002; scene.add(blob);

  // ---- the pot: a lathe whose profile we rewrite every frame of a morph ----
  const SEG = 112, K = 34, ROWS = 2 * K + 4, TH = .055;
  const geo = new THREE.BufferGeometry();
  const pos = new Float32Array((SEG + 1) * ROWS * 3), nor = new Float32Array(pos.length), uv = new Float32Array((SEG + 1) * ROWS * 2), idx = [];
  for (let i = 0; i <= SEG; i++) for (let j = 0; j < ROWS; j++) { const k = (i * ROWS + j) * 2; uv[k] = i / SEG; uv[k + 1] = j / (ROWS - 1); }
  for (let i = 0; i < SEG; i++) for (let j = 0; j < ROWS - 1; j++) { const a = i * ROWS + j, b = a + ROWS, c = b + 1, d = a + 1; idx.push(a, b, d, c, d, b); }
  geo.setIndex(idx);
  geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
  geo.setAttribute('normal', new THREE.BufferAttribute(nor, 3));
  geo.setAttribute('uv', new THREE.BufferAttribute(uv, 2));
  const sinT = [], cosT = [];
  for (let i = 0; i <= SEG; i++) { const p = i / SEG * Math.PI * 2; sinT.push(Math.sin(p)); cosT.push(Math.cos(p)); }

  const cr = (p0, p1, p2, p3, t) => .5 * ((2 * p1) + (-p0 + p2) * t + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t + (-p0 + 3 * p1 - 3 * p2 + p3) * t * t * t);
  const sampleR = (r, t) => { const f = t * (r.length - 1), i = Math.min(r.length - 2, Math.floor(f)), u = f - i; return cr(r[Math.max(0, i - 1)], r[i], r[i + 1], r[Math.min(r.length - 1, i + 2)], u); };
  const px = new Float32Array(ROWS), py = new Float32Array(ROWS), nx = new Float32Array(ROWS), ny = new Float32Array(ROWS);
  let cur = { H: PROFILES[1].H * S, r: PROFILES[1].r.map(v => v * S) };
  function writeProfile(H, r) {
    let j = 0;
    const set = (x, y) => { px[j] = Math.max(0, x); py[j] = y; j++; };
    set(0, 0); set(r[0] * .9, 0);
    for (let k = 0; k < K; k++) { const t = k / (K - 1); set(sampleR(r, t), Math.max(.012, t * H)); }
    const rt = sampleR(r, 1); set(rt - TH * .5, H + TH * .32);
    for (let k = K - 1; k >= 0; k--) { const t = k / (K - 1); set(Math.max(.015, sampleR(r, t) - TH), Math.max(TH * 1.4, t * H - TH * .15)); }
    set(0, TH * 1.4);
    for (let q = 0; q < ROWS; q++) {                 // analytic profile normals
      const a = Math.max(0, q - 1), b = Math.min(ROWS - 1, q + 1);
      let tx = px[b] - px[a], ty = py[b] - py[a]; const l = Math.hypot(tx, ty) || 1; nx[q] = ty / l; ny[q] = -tx / l;
    }
    for (let i = 0; i <= SEG; i++) for (let q = 0; q < ROWS; q++) {
      const k = (i * ROWS + q) * 3, s = sinT[i], c = cosT[i];
      pos[k] = px[q] * s; pos[k + 1] = py[q]; pos[k + 2] = px[q] * c;
      nor[k] = nx[q] * s; nor[k + 1] = ny[q]; nor[k + 2] = nx[q] * c;
    }
    geo.attributes.position.needsUpdate = true; geo.attributes.normal.needsUpdate = true;
    geo.computeBoundingSphere();
  }

  // glaze: glossy, pooled darker low down, iron speckle, breaking/crawling to bare clay at the rim, unglazed foot
  const U = { uGlaze: { value: new THREE.Color() }, uDeep: { value: new THREE.Color() }, uClay: { value: new THREE.Color('#b8876a') }, uH: { value: 1 } };
  const glaze = new THREE.MeshPhysicalMaterial({ roughness: .25, clearcoat: 1, clearcoatRoughness: .08, sheen: .3, sheenColor: new THREE.Color('#ffffff') });
  glaze.onBeforeCompile = sh => {
    Object.assign(sh.uniforms, U);
    sh.vertexShader = sh.vertexShader.replace('#include <common>', '#include <common>\nvarying vec3 vObj;')
      .replace('#include <begin_vertex>', '#include <begin_vertex>\nvObj = position;');
    sh.fragmentShader = sh.fragmentShader.replace('#include <common>', `#include <common>
      varying vec3 vObj; uniform vec3 uGlaze, uDeep, uClay; uniform float uH; float gMask; float gN;
      float h31(vec3 p){ p = fract(p * .3183099 + .1); p *= 17.0; return fract(p.x * p.y * p.z * (p.x + p.y + p.z)); }
      float vn(vec3 x){ vec3 i = floor(x), f = fract(x); f = f * f * (3. - 2. * f);
        return mix(mix(mix(h31(i), h31(i + vec3(1,0,0)), f.x), mix(h31(i + vec3(0,1,0)), h31(i + vec3(1,1,0)), f.x), f.y),
                   mix(mix(h31(i + vec3(0,0,1)), h31(i + vec3(1,0,1)), f.x), mix(h31(i + vec3(0,1,1)), h31(i + vec3(1,1,1)), f.x), f.y), f.z); }`)
      .replace('#include <color_fragment>', `#include <color_fragment>
      float yn = clamp(vObj.y / uH, 0., 1.1);
      gN = vn(vObj * 9.0) * .6 + vn(vObj * 23.0) * .4;
      vec3 g = mix(uDeep, uGlaze, smoothstep(.02, .6, yn + (gN - .5) * .18));
      g *= .92 + gN * .16;
      float crawl = smoothstep(.82, .97, yn + (vn(vObj * 34.0) - .5) * .22);
      g = mix(g, mix(uClay, vec3(.95, .9, .82), .45), crawl * .9);
      float foot = 1. - smoothstep(.05, .1, yn + (gN - .5) * .04);
      g = mix(g, uClay * .92, foot);
      float sp = step(.972, h31(floor(vObj * 140.0))) * (1. - foot);
      g = mix(g, vec3(.16, .1, .07), sp * .7);
      diffuseColor.rgb = g;
      gMask = (1. - foot) * (1. - crawl * .75);`)
      .replace('#include <roughnessmap_fragment>', `#include <roughnessmap_fragment>
      roughnessFactor = mix(.82, .16 + gN * .12, gMask);`)
      .replace('#include <lights_physical_fragment>', `#include <lights_physical_fragment>
      material.clearcoat *= gMask;`);
  };

  const pot = new THREE.Group(); scene.add(pot);
  const potMesh = new THREE.Mesh(geo, glaze); potMesh.castShadow = true; potMesh.receiveShadow = true; pot.add(potMesh);
  // wet slip ring where the pot meets the wheel
  const ring = new THREE.Mesh(new THREE.TorusGeometry(1, .022, 10, 96), new THREE.MeshPhysicalMaterial({ color: '#7a5a46', roughness: .3, clearcoat: .8 }));
  ring.rotation.x = Math.PI / 2; ring.position.y = .012; pot.add(ring);

  // face: sculpted glossy eyes, soft cheeks, a carved mouth
  const face = new THREE.Group(); pot.add(face);
  const eyeMat = new THREE.MeshPhysicalMaterial({ color: '#1a120d', roughness: .12, clearcoat: 1, clearcoatRoughness: .04 });
  const eyeGeo = new THREE.SphereGeometry(.066, 24, 16);
  const eyes = [0, 1].map(() => { const m = new THREE.Mesh(eyeGeo, eyeMat); m.scale.set(1, 1.3, .5); face.add(m); return m; });
  const cheekMat = new THREE.MeshStandardMaterial({ color: '#ee8d78', roughness: .7, transparent: true, opacity: .55, depthWrite: false });
  const cheeks = [0, 1].map(() => { const m = new THREE.Mesh(new THREE.SphereGeometry(.06, 20, 12), cheekMat); m.scale.set(1.35, .7, .18); face.add(m); return m; });
  const mouthMat = new THREE.MeshPhysicalMaterial({ color: '#2a1810', roughness: .3, clearcoat: .6 });
  const mouths = {
    o: new THREE.Mesh(new THREE.TorusGeometry(.036, .014, 10, 28), mouthMat),
    arc: new THREE.Mesh(new THREE.BufferGeometry(), mouthMat),
  };
  Object.values(mouths).forEach(m => face.add(m));

  // ---- springs (same integrator as the page) ----
  function spring(k, c, x0 = 0) { return { x: x0, v: 0, t: x0, k, c, step(dt) { const n = Math.max(1, Math.ceil(dt * 240)), h = dt / n; for (let i = 0; i < n; i++) { this.v += (-this.k * (this.x - this.t) - this.c * this.v) * h; this.x += this.v * h; } }, get rest() { return Math.abs(this.v) < 1e-3 && Math.abs(this.x - this.t) < 1e-3; } }; }
  const morph = spring(150, 11, 1), hop = spring(320, 15, 0), yaw = spring(60, 12, 0), tilt = spring(60, 12, 0);
  let from = cur, to = cur, fromG = GLAZE[1].map(c => new THREE.Color(c)), toG = fromG.map(c => c.clone());
  let mood = 'smile', spin = 0.6, spinBoost = 0, blinkT = 0, nextBlink = 2.5, dirty = true;
  const lerpProfile = t => ({ H: from.H + (to.H - from.H) * t, r: from.r.map((v, i) => Math.max(.06, v + (to.r[i] - v) * t)) });

  function show(i, instant) {
    from = lerpProfile(morph.x); cur = from;
    fromG = fromG.map((c, k) => c.clone().lerp(toG[k], Math.min(1, Math.max(0, morph.x))));
    to = { H: PROFILES[i].H * S, r: PROFILES[i].r.map(v => v * S) };
    toG = GLAZE[i].map(c => new THREE.Color(c)); mood = MOODS[i];
    if (REDUCED || instant) { morph.x = morph.t = 1; morph.v = 0; } else { morph.x = 0; morph.t = 1; morph.v = 0; hop.v = 3.4; spinBoost = 1; }
    dirty = true; kick();
  }

  function applyPot() {
    const t = morph.x, P = lerpProfile(t);
    writeProfile(P.H, P.r);
    U.uH.value = P.H; frameFor(P.H, Math.max(...P.r));
    const ct = Math.min(1, Math.max(0, t));
    U.uGlaze.value.copy(fromG[0]).lerp(toG[0], ct); U.uDeep.value.copy(fromG[1]).lerp(toG[1], ct);
    ring.scale.set(P.r[0] * .95, P.r[0] * .95, 1);
    blob.scale.set(P.r[0] * 3.4 + .25, P.r[0] * 3.4 + .25, 1);
    // face at 42% height, eyes spread with the girth
    const fy = P.H * .5, rf = sampleR(P.r, .5), dx = Math.min(rf * .4, .19), th = dx / rf;
    const place = (m, ang, y, out) => { const rr = sampleR(P.r, Math.min(1, Math.max(0, y / P.H))) + out; m.position.set(Math.sin(ang) * rr, y, Math.cos(ang) * rr); m.rotation.y = ang; };
    const blink = blinkT > 0 ? Math.max(.08, Math.abs(1 - blinkT / .09)) : 1;
    eyes.forEach((e, k) => { place(e, k ? th : -th, fy + .06, -.008); e.scale.y = 1.3 * Math.min(1, blink); });
    const ch = th + .12 / rf;
    cheeks.forEach((c, k) => place(c, k ? ch : -ch, fy - .03, .0));
    mouths.o.visible = mood === 'o'; mouths.arc.visible = mood !== 'o';
    if (mood === 'o') { place(mouths.o, 0, fy - .05, -.004); mouths.o.rotation.y = 0; }
    else {   // a smile carved along the actual surface: a tube on a curve that hugs the pot
      const w = mood === 'grin' ? .1 : .075, my = fy - .035, rm = sampleR(P.r, Math.min(1, my / P.H)), a = w / rm, pts = [];
      for (let k = 0; k <= 10; k++) { const f = -1 + k / 5, ph = f * a, y = my - w * .5 * (1 - f * f), rr = sampleR(P.r, Math.min(1, Math.max(0, y / P.H))) + .002; pts.push(new THREE.Vector3(Math.sin(ph) * rr, y, Math.cos(ph) * rr)); }
      mouths.arc.geometry.dispose(); mouths.arc.geometry = new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts), 24, mood === 'grin' ? .017 : .015, 8, false);
    }
  }

  // ---- size / cursor / loop ----
  // the camera dollies to frame whatever the pot is becoming (spring, slight overshoot)
  let narrow = false;
  const camD = spring(40, 10, 4.2), camY = spring(40, 10, 1.55);
  function frameFor(H, r0) { const size = Math.max(H, r0 * 1.5); camD.t = (narrow ? 3.8 : 3.1) + size * 1.45; camY.t = HEAD_TOP + H * .5 + .1; }
  function placeCamera() {
    const x = narrow ? 0 : -.38 - camD.x * .06;
    camera.position.set(x - .25, camY.x + camD.x * .2, camD.x);
    camera.lookAt(x, camY.x, 0);
  }
  function resize() {
    const w = stage.clientWidth, h = stage.clientHeight; if (!w || !h) return;
    renderer.setSize(w, h, false); camera.aspect = w / h;
    // keep the wheel framed on narrow stages: pull back and centre
    narrow = camera.aspect < 1.45;
    placeCamera(); camera.updateProjectionMatrix(); dirty = true; kick();
  }
  new ResizeObserver(resize).observe(stage);
  stage.addEventListener('pointermove', e => {
    if (REDUCED) return;
    const r = stage.getBoundingClientRect();
    yaw.t = ((e.clientX - r.left) / r.width - .5) * .7; tilt.t = ((e.clientY - r.top) / r.height - .5) * .12; kick();
  });
  stage.addEventListener('pointerleave', () => { yaw.t = 0; tilt.t = 0; kick(); });

  let visible = true, raf = 0, last = 0, first = true;
  new IntersectionObserver(es => { visible = es[0].isIntersecting; kick(); }).observe(stage);
  document.addEventListener('visibilitychange', kick);
  function kick() { if (!raf && visible && !document.hidden) { last = 0; raf = requestAnimationFrame(frame); } }
  function frame(now) {
    raf = 0;
    const dt = Math.min(1 / 30, (now - (last || now)) / 1000 || 1 / 60); last = now;
    const moving = !morph.rest;
    morph.step(dt); hop.step(dt); yaw.step(dt); tilt.step(dt); camD.step(dt); camY.step(dt); placeCamera();
    if (moving || dirty || blinkT > 0) applyPot();
    if (!REDUCED) {
      spinBoost *= Math.pow(.3, dt);
      head.rotation.y -= dt * (spin + 9 * spinBoost);
      nextBlink -= dt; if (nextBlink < 0) { blinkT = .18; nextBlink = 2.4 + Math.random() * 2.6; }
      if (blinkT > 0) blinkT = Math.max(0, blinkT - dt);
    }
    pot.position.y = HEAD_TOP + Math.max(0, hop.x) * 1 + Math.min(0, hop.x) * .3;
    pot.scale.set(1 + Math.min(0, hop.x) * -.6, 1 + Math.min(0, hop.x) * .9, 1 + Math.min(0, hop.x) * -.6);   // squash on landing
    pot.rotation.y = yaw.x; pot.rotation.z = Math.max(-.12, Math.min(.12, morph.v * .018)); pot.rotation.x = tilt.x;
    renderer.render(scene, camera); dirty = false;
    if (first) { first = false; stage.classList.add('is-3d'); }
    if (REDUCED) { camD.x = camD.t; camY.x = camY.t; placeCamera(); }
    const alive = !REDUCED || !morph.rest || !hop.rest || !yaw.rest;
    if (alive && visible && !document.hidden) raf = requestAnimationFrame(frame);
  }
  canvas.addEventListener('webglcontextlost', e => { e.preventDefault(); stage.classList.remove('is-3d'); cancelAnimationFrame(raf); raf = 0; visible = false; });

  show(window.__potIndex ?? 1, true);
  resize(); applyPot(); camD.x = camD.t; camY.x = camY.t; placeCamera();
  window.__pot3d = { show: i => show(i) };
}
</script>
</body>
</html>

````
