# Recreate this site as a single HTML file: Aldermark Type 38 — Field Watch

## What it is

A one-page product site for **Aldermark Type 38**, a fictional 38 mm automatic field watch. The page is a technical drawing: instrument-grey paper with a fine graph grid, a drawing frame with corner marks, hairline rules, a title block for a footer, and one signal colour (safety orange `#ff4f14`). The product is a **procedural three.js watch**, built from code with no model file. It has a lathe-turned case with drilled lugs, a polished 120-click bezel with an engraved 60-minute scale and an orange pip, a knurled screw-down crown between guards, a domed sapphire crystal with an iridescent anti-reflective sheen, a printed dial drawn on a canvas, sword hands with lume, a movement (plate, gold train wheels, jewels, a balance wheel that oscillates and a rotor that spins), an engraved caseback and a curved canvas strap with stitching. **The hands show the visitor's real local time**, and the seconds hand ticks in eight beats per second like a 28,800 vph movement. **Signature:** one fixed WebGL canvas, one watch, and it **travels between four screens on scroll**:
- it sits in the hero inside live dimension lines (Ø 38.0, 46.5 L-L, 20.0 lug);
- it **explodes along its own axis** into seven labelled parts in a pinned section, with leader lines drawn from each part to its callout;
- it turns side-on next to the specification table;
- it lands in a **working configurator** (case finish, dial, strap and caseback engraving) with live price, a drag/turn/flip stage and a real bag.

**It opens on film.** The first screen is a pinned, **scroll-scrubbed 8-second macro reel** (all-intra H.264, `currentTime = progress × duration`). It is one continuous dolly across the rain-flecked dial, over the crown and back to the watch on a wrist in a misty forest. Live engineering annotations (viewfinder brackets, a focus ring, leader-line callouts, timecode, frame counter and focus distance) are drawn over the frames as they pass. The live 3D runs through a **cinematic post chain** (bloom on lume and speculars, ACES, film grain, vignette, ≤ 0.0016 chromatic aberration). In the exploded view the camera **flies through the stack into the movement**, where the balance wheel beats at 4 Hz under its hairspring.

It turns toward the cursor on a spring, and its straps **trail the turn on a second, underdamped spring**. A **plotter preloader** draws the watch outline and lifts once fonts, page load and the first WebGL frame are all ready. A **drafting cursor** (a denser grid under the pointer, an orange crosshair and a live X/Y readout in millimetres) keeps the paper alive. Without WebGL, an SVG technical drawing with live hands takes over every slot.

## Page shell & libraries

- One `index.html`, inline CSS and two inline scripts: a classic script for all UI (it works with no WebGL), and a `type="module"` script for three.js.
- Import map, exact versions:
  ```html
  <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>
  ```
  Addons: `environments/RoomEnvironment.js`, `geometries/RoundedBoxGeometry.js`, and `postprocessing/EffectComposer.js`, `RenderPass.js`, `UnrealBloomPass.js`, `OutputPass.js`, `ShaderPass.js`. The post-processing imports sit in their own try/catch, so their failure only drops to a plain render. No other JS libraries, and no smooth-scroll library: native scrolling.
- Google Fonts: `Barlow Condensed 500/600/700` (display, uppercase), `Barlow 400/500/600` (body), `IBM Plex Mono 400/500` (labels, figures, readouts). Preconnect to both font hosts.
- Order in `body`: skip link → `.curtain` (preloader) → `.loupe`, `.xh.h`, `.xh.v`, `.xtag` (drafting cursor) → `.frame` (drawing border) → `header.hdr` → `canvas#gl` → `main#main` (film, hero, assembly, specs, configure, field, service) → `footer` (title block) → `dialog#bag` → `.toast`.
- The UI script exposes `window.AM = { cfg, view, on(fn), emit(), price(cfg), code(cfg), enableFallback(why), reduced }`. The module subscribes to configuration changes through `AM.on`.

## Tokens

- **Paper** `#d6d7d1` (ground, header at 88% with an 8px backdrop blur), paper-2 `#cbccc5`, paper-3 `#e3e4df` (inputs, selected options, price box).
- **Ink** `#1b1e22`, ink-2 `#464b52` (body copy, 6:1 on paper), ink-3 `#6a6f75` (index codes only, used at 11px uppercase mono).
- **Rules:** `rgba(27,30,34,.28)`, soft `.12`. Grid: `.055` lines every 80px over `.028` lines every 16px.
- **Signal** `#ff4f14`. It is used for marks, the primary button (ink text on orange, 4.9:1), the seconds hand, the bezel pip, the dot before every eyebrow and the crosshair. It is **never** used for small text on paper. Error text `#8f2208`.
- **Type:** h1 `clamp(48px,6.7vw,112px)`/.88, uppercase Barlow Condensed 600. h2 `clamp(40px,5.2vw,84px)`/.9. Lede `clamp(16px,1.25vw,19px)`/1.55. Mono labels 11–13px uppercase with .04–.06em tracking. All figures use tabular numerals.
- **Radii:** 2px (buttons and inputs). Everything else is square: it is a drawing.
- **Spacing:** gutter `clamp(16px,3.2vw,48px)`; frame inset `clamp(8px,1vw,14px)`; section padding 12–16vh top and bottom.
- **Motion:** `--ease: cubic-bezier(.2,.7,0,1)`. Reveals are 18px rise + fade over .8–.9s.

## Layout & structure

1. **Frame** (fixed, `inset: var(--frame)`): a 1px rule border, 7px zone ticks every 12.5% along the top and bottom, and four 14px corner marks in 2px ink. It is `pointer-events: none`.
2. **Header** (fixed, 56px, bottom rule). Left: the `ALDERMARK` wordmark (Barlow Condensed 700, .14em tracking) plus a two-line mono "INSTRUMENTS / EST. DWG. 2026". Centre: the **sheet indicator** ("SHEET 02 / 05", a 72px orange progress bar of total scroll, and the sheet title), updated from `[data-sheet]` sections. Right: anchor links and the Bag button with an orange count pill that bumps (scale 1.45) on add.
3. **Field film** `section#film` (`height: 340vh`, dark `#0e1011`, z-index 3 so it covers the fixed canvas). Inside it, a sticky 100svh pin stacks these layers:
   - the poster `<img>` (`fetchpriority="high"`, the first frame) under a muted `playsinline` `<video>` that fades in on `loadeddata`;
   - a shade (dark radial top-left for the copy, an edge vignette, top and bottom gradients);
   - an SVG HUD with `viewBox 0 0 1600 900` and `preserveAspectRatio="xMidYMid slice"`, so its coordinates are the source frame's. It holds four corner brackets, a dashed focus ring (r 46 → 106 with progress) with a crosshair, and five callouts. Each callout is an orange ring on the feature, a leader that strokes in by `pathLength` dash offset, a Barlow Condensed label and a mono sub-line. The callouts are: numerals at (612,300) for p .02–.20, signal seconds (295,737) .17–.34, crown (1190,372) .32–.52, case Ø 38.0 (457,470) .56–.75, strap 20 mm (812,650) .78–.99.

   Copy, top-left: "FIELD FILM · REEL 01 · 1:1 SCROLL" and an h2 "TYPE 38" at `clamp(54px,9vw,150px)` with a lede; it lifts away after 8%. A pulsing "Scroll" cue sits bottom-centre. The bottom bar shows timecode `00:00:SS:FF` at 24 fps, frame `087 / 193`, focus `0.12 + p²·0.9 m`, lens, and an orange progress track. "Now, the drawing." appears top-right after 90%.
4. **Hero** (2 columns, min-height 100svh). Left:
   - an eyebrow (orange square, "DWG. AM-38-001", a boxed "REV. C", "SCALE 2:1");
   - the h1 "A field watch *drawn* to be read in any weather.", where "drawn" has an orange highlighter band (a gradient from 62% to 88%);
   - the lede, then two buttons: "Configure yours — from $1,150" (primary) and "See the assembly" (ghost);
   - a 3-column readout `dl`: **your local time** (ticking each second), beat 28,800 vph, case Ø 38.0.

   Right: `.hero-stage`, with the square watch slot and an SVG dimension overlay (`viewBox 0 0 260 260`, where the case is 200 units wide, so the lines meet the real model). It shows a Ø 38.0 dimension below, 46.5 L-L on the right, 20.0 lug width above, and dashed centre lines. Labels have a paper-coloured `paint-order: stroke` halo. Lines draw in over 1.6s after the preloader lifts. A caption reads "FIG. 1 — FRONT ELEVATION" plus the visitor's IANA time zone.
5. **Assembly** (`height: 320vh`; sticky 100svh inner grid of 3 columns, .9fr / 1.2fr / .9fr):
   - copy: "Seven parts. One axis.", a lede, and a "Separation 0.0 → 24.0 mm" readout with a bar;
   - the watch slot (`height: min(78svh,720px)`);
   - an `ol` of seven callouts (number box, name, one-line spec): Sapphire crystal, Compass bezel, Hands, Dial, Case & crown, Movement, Caseback.

   An absolutely positioned SVG draws an elbowed leader from each part's projected anchor to its number box. Callouts are 18% opacity until their part has separated, then go full opacity and their number box inverts.
6. **Specs** (2 columns). Left: the sticky watch slot, `min(34vw,460px)` square, centred vertically. Right:
   - an eyebrow and "Tolerances, not adjectives.";
   - a `dl` of 10 rows with a grid of 44px index code (A1…D2) / name / value. The value is a mono figure over an explanatory line;
   - three boxed key figures: 200 m, 72 h, 5 yr.
7. **Configure**: heading row, then 2 columns:
   - the **stage**: a sticky box with a hairline border and two ink corner marks, holding the slot (drag to turn, `touch-action: pan-y`) and a bar with the live config code (`AM38-ST-GR-CV`) plus Rotate left, Rotate right and Flip (`aria-pressed`) icon buttons;
   - a **form** of four fieldsets: case (Bead-blasted 316L incl. / Black DLC +$180 / Grade 5 titanium +$260), dial (Graphite / Chalk / Olive), strap (Canvas webbing incl. / FKM rubber +$40 / Steel bracelet +$220), engraving (text, max 18, +$45). Each option is a real radio drawn as a card with a swatch, name and price. The legend repeats the current choice. Below: a price box with line items, a big total (`aria-live`), "Add to bag" and the service line.
8. **Field record**: 12-column grid of four figures with mono captions ("FIG. 2 — TRAILHEAD, 06:10 · RAIN, 4 °C · CANVAS"…). The images have a 1px ink border, a slow 1.04 → 1 hover zoom, an SVG `feTurbulence` grain overlay at 16% (overlay blend) and `saturate(.86)` for one grade across the set.
9. **Service**: a `details` accordion (N1–N5) with a plus that turns into a minus.
10. **Footer as a title block**: a 4-cell bordered grid (brand + newsletter form, then three link columns) over a 6-cell strip (Drawn, Checked, Scale 2:1, Units mm, Sheet 05/05, ©).
11. **Bag** `dialog` (right drawer, 440px): line items with an SVG thumbnail coloured from the configuration, a quantity stepper (1–5), Remove, subtotal, free shipping and Checkout. Checkout reserves a build slot reference and says plainly that no payment is taken.

## Behaviour & interaction

- **Travel.** Each section has a `[data-slot]` element. On layout, compute a scroll *hold range* `[a, b]` per slot:
  - a normal slot: `a = b = slotCentreDocY − innerHeight/2`;
  - a sticky slot (or one inside a sticky stage): from the parent's top − sticky top to the parent's bottom − sticky height − sticky top;
  - assembly: the section's sticky range;
  - hero: `a = −∞`;
  - a final `exit` stop starting at `fieldTop − 0.55·innerHeight`, with opacity 0.

  Each frame, find the hold or the gap the scroll is in. In a gap, `t = smoothstep((scrollY − A.b)/(B.a − A.b))`. The watch's screen centre lerps between the two slots' **live** `getBoundingClientRect` centres, and its pixels-per-unit lerps between `slotSize / fit`. Rotation, explode and opacity lerp between poses:
  - hero: rx .06, ry −.14, rz .04, fit 2.6;
  - assembly: rx −1.2, ry .38, fit 5.4, explode 1;
  - specs: rx .22, ry −.95, rz −.12, fit 2.75;
  - configure: rx .08, ry .22, fit 3.5;
  - exit: as configure, opacity 0.

  Screen → world: camera fov 26°, z 14; `k = 2·14·tan(13°)/innerHeight`.
- **Explode** (assembly only): `e = easeOutCubic(clamp((progress − .06)/.5))`. Offsets along the watch axis: crystal 2.35, bezel 1.75, hands 1.2, dial .78, case 0, movement −.85, caseback −1.7, all recentred by −.325·e. The crown slides out .55. The straps and the contact shadow fade out by e = .29. Callout i turns on at `e > .08 + .1·i`, and its leader strokes in via dash offset. The separation readout is `e × 24.0 mm`.
- **Fly-through** (assembly, second phase): `fly = smoothstep(clamp((progress − .6)/.34))`.
  - Watch scale × `(1 + 2.3·fly)`. The pose rotation × `(1 − .72·fly)` on x and `(1 − .6·fly)` on y, so the axis turns toward the lens.
  - The recentre point moves from the stack middle to the movement. Parts above the movement add `+9·fly` along the axis (they pass the camera and hide at fly .42); case and caseback add `−6·fly` (the caseback hides at .6).
  - All callouts except 06 fade by fly .25. A paper note "06 · CALIBRE AM-28 / Balance 4 Hz · 25 jewels · blued screws · 72 h" rises in via a `--fly` custom property.
  - The movement adds 3 balance spokes, a 7-turn hairspring line, 7 blued screws and a second bridge. It renders every frame while fly > 0.
- **Cinematic post** (desktop/fine pointer, not reduced motion): `EffectComposer` on a HalfFloat RGBA target → `RenderPass` → `UnrealBloomPass(strength .42 (−.18·fly), radius .55, threshold .9)` → `OutputPass` (ACES + sRGB; exposure `1.05 − .4·fly` so the face-on plate never blows out) → a grade `ShaderPass` (grain ±.03 × alpha, vignette `.18 + .5·fly`, chromatic aberration .0016 radial).
  - The canvas must stay transparent over the paper, so the bloom blend material uses `CustomBlending` with colour One/One and alpha Zero/One. The bloom adds light but never alpha; a premultiplied glow then reads as additive light on the page.
  - The lume material's emissive is `#8c8558` × .55, so it blooms.
- **Film scrub.** One rAF loop, running only while the section intersects.
  - `p = clamp(−rect.top / (rect.height − innerHeight))`, `target = p × duration`.
  - One seek in flight: a seek is skipped if `seeking` is set or if the frame is within half a frame of the target. `seeked` clears the flag and re-seeks if the target moved.
  - HUD values and callout opacities are computed from `p` in the same frame.
  - Desktop loads `film-1600.mp4`, ≤700px loads `film-720.mp4` (a portrait centre crop), and the HUD `viewBox` becomes `547 0 506 900` so the callouts stay on the same pixels.
- **Turntable.** Pointer position normalised to −1…1. A spring (k 38, damping ratio .62) maps it to yaw ±.32 and pitch ±.16 rad. Fine pointers only, never under reduced motion.
- **Straps trail the turn.** A second spring (k 26, damping ratio .32, underdamped) chases the head's actual yaw and pitch. The difference, clamped to ±.38, rotates each strap about its lug-bar pivot: `rotation.z = −Δyaw·.75`, `rotation.x = ±Δpitch·.55`. The straps overshoot and settle after every turn, scroll pose change and drag.
- **Hands:** `sec = s + floor(ms/125)/8` (s alone under reduced motion). The minute and hour hands are continuous. The rotor spins at `.6 + |spring velocity|·4` rad/s and the balance wheel oscillates at 4 Hz, amplitude 1.4 rad.
- **Render on demand.** Render only when scroll, the springs, the drag, the configuration or the 1/8 s beat changes. Stop the loop on `visibilitychange`, and skip rendering while opacity is 0. DPR is capped at 1.75.
- **Configurator.**
  - Radios update `AM.cfg` → price lines, total, config code, legend labels and the stage `aria-label`, then the 3D materials: case colour/roughness/metalness per finish (steel `#c4c7ca` r .42, DLC `#2b2d31` r .48, titanium `#9d9a93` r .56), polished bezel and crown, and tick fill (light on DLC). The dial canvas is redrawn in the new colours. Hands are white steel on dark dials and black on chalk. The strap texture is redrawn (canvas weave with stitching / rubber grooves / bracelet links that copy the case colour).
  - Engraving is upper-cased live and validated against `[A-Z0-9 -/&.°·]`. It redraws the caseback canvas, auto-sizes the text and adds +$45.
  - Drag adds 0.012 rad per px. The arrow buttons turn ±30°. Flip adds π. A spring (k 30, c 9) eases yaw, and flip eases with `1 − e^(−7dt)`.
- **Bag.** Same configuration + engraving merges quantities (max 5). It is stored in `localStorage` (try/catch). On add: the button reads "Added — add another" for 2.2s, a toast appears, and an orange dot flies to the bag on a 750ms 3-keyframe arc.
- **Plotter preloader.** Gates: `document.fonts.ready`, `load` and the `am-ready` event (first WebGL frame, or the fallback starting). FLOOR 700ms, PATIENCE 8000ms. The readout chases its target at .08/frame, creeps toward `min(.97, target + .12)`, and draws the four SVG paths in sequence by `pathLength` dash offset. It exits with `translateY(−101%)` over .9s `cubic-bezier(.7,0,.2,1)` and adds `.ready` to `html`, which starts the hero dimension lines.
- **Drafting cursor.** One rAF writer, idle when settled. `--mx/--my` lerp at .22 toward the pointer; they move a radial mask (190px, 4 stops) on an 8px ink grid at 13%. `--lx/--ly` place a 1px orange crosshair at 22% opacity and a tag "X 112.4 · Y 2210.7 mm" (document position × 25.4/96).
- **Sheet indicator**, IntersectionObserver reveals (`rootMargin 0 0 -8% 0`), a validated newsletter form (a full email with a TLD; the message and focus return on error).

## Responsive

- **1440:** as above.
- **≤1100:** nav links hide (the Bag stays). Assembly becomes 2 columns, with the copy spanning the top row.
- **≤900:** the sheet indicator hides. Hero, specs, configurator and service stack. The hero stage moves **above** the headline (`order: -1`, width `min(100%,380px)`, `margin-top: clamp(44px,14vw,80px)`), so the phone thumbnail opens on the watch. The spec slot stops being sticky. Figures go full width. The title block becomes 2 columns.
- **≤700 (390):** the film loads the 720×1280 portrait cut; callouts lose the sub-line and use a shorter leader; the bar shows timecode and frame only. Assembly is 1 column (heading / slot / 2-column callout grid with names only). Leader lines hide, and orange-free **numbered pins** sit on the parts instead. Option cards stay 3-up at 13px. Spec rows become 2 columns. The title block is 1 column with a 2-column strip.
- Every width is checked for `scrollWidth ≤ innerWidth`. Hover-only effects are gated on `(hover:hover) and (pointer:fine)`.

## Accessibility & reduced motion

- Skip link, one `header`/`main`/`footer`, and sections `aria-labelledby` their h1/h2. The callouts are a real `ol`, the specs are a `dl` and the FAQ uses `details`.
- The canvas is `aria-hidden`. The configurator slot is `role="img"` with an `aria-label` describing the live configuration. Every control is a native button, radio or input. The bag is a modal `dialog` (focus handling and Esc are native). Price, engraving hint, newsletter hint and toast are `aria-live`.
- Focus: 2px orange outline, 3px offset. Text contrast is ≥ 4.5:1 everywhere, and orange is never used for small text.
- **`prefers-reduced-motion: reduce`:**
  - no turntable or strap springs, no drafting cursor;
  - travel snaps between slots at t = .5 instead of gliding;
  - seconds tick once per second, the balance and rotor stop;
  - reveals are instant and the preloader fades instead of sliding;
  - the film never loads its video: the poster frame shows with the title copy;
  - no fly-through and no post chain (plain render).

## Fallbacks

- If WebGL is unavailable, three.js fails to import or init throws (or nothing has loaded by 9s), `html.no-gl` is set. Every slot then shows an **SVG technical drawing** (case, lugs, crown, bezel scale, numerals, orange pip, hands driven by the clock at 125ms). Dial, case and strap fills follow the configurator. The assembly shows an SVG side elevation whose seven ellipses separate with scroll. The UI (configurator, bag, forms, sheet indicator) never depends on three.js.
- `am-ready` is also fired by the fallback, so the preloader can never hang.
- If the video fails to load or decode, the `error` handler leaves the poster frame in place, and the HUD still runs with scroll.

## Assets (relative paths)

| file | what it shows |
|---|---|
| `assets/film-1600.mp4` (1600×900, 8 s, 24 fps, all-intra `-g 1`, CRF 28, faststart, no audio, 4.0 MB) | the opening reel: one continuous macro dolly across the dial, over the crown, pulling back to the watch on a wrist in misty forest (Seedance 2.5 from a generated macro still) |
| `assets/film-720.mp4` (720×1280, all-intra, CRF 29, 2.1 MB) | the same reel, centre-cropped to portrait for phones |
| `assets/film-poster.webp` (1600×900) | the reel's first frame, the LCP image |
| `assets/field-rain.webp` (1400×939) | a wrist on wet granite in mountain rain; the watch on olive canvas, pines in mist |
| `assets/field-ridge.webp` (1000×1241) | a shell-jacket sleeve checking the watch on black rubber, dawn fog over a coastal ridge |
| `assets/studio-plate.webp` (1400×875) | **Blender Cycles render** of the same watch built from the same profiles, on a slate block, shallow depth of field |
| `assets/field-map.webp` (1300×872) | flat lay on a topographic map: watch on canvas, brass compass, pencil, notebook |

All images are under 250 KB, and the two video cuts are encoded for instant seeking:
`ffmpeg -i in.mp4 -an -vf scale=1600:-2 -c:v libx264 -g 1 -keyint_min 1 -crf 28 -preset slow -pix_fmt yuv420p -movflags +faststart film-1600.mp4`. The watch itself has **no asset**: it is built from the lathe profiles and canvas textures in the code.

## 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 product.** Swap "Aldermark Type 38" for your own instrument and price. Keep one hero object, seven named parts for the exploded view and 8–12 spec rows, so the assembly column and the table still balance.
2. **The travelling object.** The procedural watch is the signature. Rebuild it as another round, layered object you can turn on a lathe: a camera lens (glass elements explode along the optical axis), a pepper mill, a bike hub, a coffee grinder burr set, a compass. Keep the lathe profiles, the exploded offsets along one axis, the leader-line callouts and the live element (the hands): a lens could show live focus distance, a compass the visitor's heading.
3. **The drawing language.** Re-theme the paper: blueprint (`#1d3557` ground, white linework, signal `#ffd166`), vellum (warm `#ece6d6`, sepia ink), or a dark CAD screen (`#14171a`, green grid). Keep body text ≥ 4.5:1 on the ground and the signal colour for marks only.
4. **Type pairing.** Swap Barlow Condensed / Barlow / IBM Plex Mono for another condensed grotesk + text face + mono, for example Saira Condensed + Inter Tight + JetBrains Mono, or Oswald + Source Sans 3 + Space Mono. Keep the uppercase condensed display.
5. **Configurator options.** Replace finish, dial and strap with your product's three real choices and their prices. Keep three options per group, the live code string and the engraving field (or another text personalisation that redraws a texture).
6. **Imagery.** Regenerate the field photos as your product in use, all with one lens, one light and one grade (overcast, muted, 35 mm documentary). Render one studio plate of the real object in Blender/Cycles from your own profiles rather than using AI for the hero object.
7. **The opening reel.** Shoot or generate one continuous 8–10 s macro move over your own product: no cuts, the start frame being your best macro still. Re-place the five HUD callouts on its real features with their source-frame coordinates and progress windows, and keep the timecode/frame/focus bar.
8. **Copy voice.** Rewrite every heading as a drawing note: short, factual and measurable ("Tolerances, not adjectives."). Replace the FAQ with the five questions your customers actually ask before buying.

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/watch-product-page-3d-configurator/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>Aldermark Type 38 — Field Watch</title>
<meta name="description" content="Aldermark Type 38: a 38 mm automatic field watch, drawn, exploded and configured live in the browser.">
<meta name="theme-color" content="#d6d7d1">
<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=Barlow+Condensed:wght@500;600;700&family=Barlow:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
<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>
<style>
:root{
  --paper:#d6d7d1; --paper-2:#cbccc5; --paper-3:#e3e4df;
  --ink:#1b1e22; --ink-2:#464b52; --ink-3:#6a6f75;
  --rule:rgba(27,30,34,.28); --rule-soft:rgba(27,30,34,.12); --grid:rgba(27,30,34,.055);
  --signal:#ff4f14; --signal-ink:#1b1e22;
  --f-display:"Barlow Condensed","Arial Narrow",sans-serif;
  --f-body:"Barlow",system-ui,sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  --gutter:clamp(16px,3.2vw,48px);
  --frame:clamp(8px,1vw,14px);
  --ease:cubic-bezier(.2,.7,0,1);
  --r:2px;
}
*,*::before,*::after{box-sizing:border-box}
html{background:var(--paper);color:var(--ink);-webkit-text-size-adjust:100%;scroll-padding-top:80px}
body{margin:0;font:400 16px/1.5 var(--f-body);background:var(--paper);overflow-x:clip;
  background-image:
    linear-gradient(var(--grid) 1px,transparent 1px),
    linear-gradient(90deg,var(--grid) 1px,transparent 1px),
    linear-gradient(rgba(27,30,34,.028) 1px,transparent 1px),
    linear-gradient(90deg,rgba(27,30,34,.028) 1px,transparent 1px);
  background-size:80px 80px,80px 80px,16px 16px,16px 16px;
  background-position:-1px -1px;}
img{max-width:100%;display:block}
a{color:inherit}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--signal);outline-offset:3px}
.sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.skip{position:fixed;left:16px;top:-60px;z-index:200;background:var(--ink);color:var(--paper);padding:10px 14px;text-decoration:none;font:500 14px var(--f-mono)}
.skip:focus{top:16px}
.mono{font-family:var(--f-mono);font-size:12px;letter-spacing:.04em;text-transform:uppercase}

/* drawing frame overlay */
.frame{position:fixed;inset:var(--frame);border:1px solid var(--rule);pointer-events:none;z-index:40}
.frame::before,.frame::after{content:"";position:absolute;left:0;right:0;height:7px;
  background:repeating-linear-gradient(90deg,var(--rule) 0 1px,transparent 1px 12.5%)}
.frame::before{top:0}.frame::after{bottom:0}
.frame i{position:absolute;width:14px;height:14px;border-color:var(--ink);border-style:solid}
.frame i:nth-child(1){left:-1px;top:-1px;border-width:2px 0 0 2px}
.frame i:nth-child(2){right:-1px;top:-1px;border-width:2px 2px 0 0}
.frame i:nth-child(3){left:-1px;bottom:-1px;border-width:0 0 2px 2px}
.frame i:nth-child(4){right:-1px;bottom:-1px;border-width:0 2px 2px 0}

/* header (title strip) */
.hdr{position:fixed;z-index:50;top:var(--frame);left:var(--frame);right:var(--frame);height:56px;
  display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:16px;padding:0 calc(var(--gutter) - var(--frame));
  background:color-mix(in srgb,var(--paper) 88%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  border-bottom:1px solid var(--rule)}
.logo{display:flex;align-items:center;gap:10px;text-decoration:none}
.logo b{font:700 22px/1 var(--f-display);letter-spacing:.14em}
.logo small{font:500 10px/1.1 var(--f-mono);letter-spacing:.08em;color:var(--ink-2);border-left:1px solid var(--rule);padding-left:10px}
.sheet{justify-self:center;display:flex;gap:10px;align-items:center;color:var(--ink-2)}
.sheet .n{color:var(--ink);font-weight:500}
.sheet .bar{width:72px;height:3px;background:var(--rule-soft);position:relative;overflow:hidden}
.sheet .bar span{position:absolute;inset:0;background:var(--signal);transform-origin:0 50%;transform:scaleX(var(--p,0))}
.nav{display:flex;align-items:center;gap:4px}
.nav a{text-decoration:none;padding:10px 10px;font:500 13px var(--f-mono);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-2)}
.nav a:hover{color:var(--ink)}
.bagbtn{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 14px;border:1px solid var(--ink);background:transparent;cursor:pointer;font:500 13px var(--f-mono);text-transform:uppercase;letter-spacing:.04em;border-radius:var(--r)}
.bagbtn:hover{background:var(--ink);color:var(--paper)}
.bagbtn .count{min-width:20px;height:20px;display:inline-grid;place-items:center;background:var(--signal);color:var(--signal-ink);font-size:11px;border-radius:10px;padding:0 5px}
.bagbtn.bump .count{animation:bump .5s var(--ease)}
@keyframes bump{40%{transform:scale(1.45)}}

main{position:relative;z-index:2}
section{position:relative}
.wrap{padding:0 calc(var(--gutter) + var(--frame))}
.eyebrow{display:flex;gap:14px;flex-wrap:wrap;align-items:center;color:var(--ink-2)}
.eyebrow .tag{border:1px solid var(--rule);padding:3px 7px}
.eyebrow .dot{width:8px;height:8px;background:var(--signal);display:inline-block}
h1,h2,h3{font-family:var(--f-display);font-weight:600;text-transform:uppercase;margin:0;letter-spacing:-.005em}
h2{font-size:clamp(40px,5.2vw,84px);line-height:.9}
.lede{font-size:clamp(16px,1.25vw,19px);line-height:1.55;color:var(--ink-2);max-width:46ch}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:48px;padding:0 22px;border-radius:var(--r);
  font:600 15px var(--f-body);letter-spacing:.02em;text-decoration:none;cursor:pointer;border:1px solid var(--ink);transition:background .2s,color .2s,transform .2s var(--ease)}
.btn.primary{background:var(--signal);border-color:var(--signal);color:var(--signal-ink)}
.btn.primary:hover{background:var(--ink);border-color:var(--ink);color:var(--paper)}
.btn.ghost{background:transparent}
.btn.ghost:hover{background:var(--ink);color:var(--paper)}
.btn:active{transform:translateY(1px)}
.btn svg{width:16px;height:16px}

/* WebGL stage */
#gl{position:fixed;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;display:block}
.no-gl #gl{display:none}

/* slots */
.slot{position:relative;aspect-ratio:1/1;width:100%}
.slot .fb{display:none;position:absolute;inset:0}
.no-gl .slot .fb{display:block}
.fb svg{width:100%;height:100%;overflow:visible}

/* HERO */
.hero{min-height:100svh;padding-top:calc(56px + var(--frame) + 4vh);padding-bottom:6vh;display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:var(--gutter);align-items:center}
.hero h1{font-size:clamp(48px,6.7vw,112px);line-height:.88;margin:22px 0 24px}
.hero h1 em{font-style:normal;color:var(--ink);background:linear-gradient(transparent 62%,var(--signal) 62%,var(--signal) 88%,transparent 88%)}
.hero .ctas{display:flex;gap:12px;flex-wrap:wrap;margin:30px 0 36px}
.readout{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-top:1px solid var(--rule);max-width:560px}
.readout div{padding:12px 12px 0 0}
.readout dt{font:500 11px var(--f-mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3)}
.readout dd{margin:4px 0 0;font:500 clamp(18px,1.6vw,24px)/1.1 var(--f-mono);font-variant-numeric:tabular-nums}
.hero-stage{position:relative;justify-self:center;width:min(100%,520px);padding:40px 48px 84px}
.dims{position:absolute;inset:40px 48px 84px;pointer-events:none;overflow:visible}
.dims svg{width:100%;height:100%;overflow:visible}
.dims line,.dims path{stroke:var(--ink);stroke-width:.6;fill:none;vector-effect:non-scaling-stroke}
.dims .ext{stroke:var(--ink-3);stroke-dasharray:3 3}
.dims text{font:500 8px var(--f-mono);fill:var(--ink);letter-spacing:.04em;paint-order:stroke;stroke:var(--paper);stroke-width:4px;stroke-linejoin:round}
.dims .draw{stroke-dasharray:400;stroke-dashoffset:400}
.dims .fade{opacity:0}
.ready .dims .draw{animation:draw 1.6s .3s var(--ease) forwards}
.ready .dims .fade{animation:fade .6s 1.2s forwards}
@keyframes draw{to{stroke-dashoffset:0}}@keyframes fade{to{opacity:1}}
.dwgno{position:absolute;left:48px;right:48px;bottom:8px;display:flex;justify-content:space-between;color:var(--ink-2)}
.dwgno span{background:var(--paper);padding:2px 6px;border:1px solid var(--rule-soft)}

/* ASSEMBLY */
.assembly{height:320vh}
.asm-pin{position:sticky;top:0;height:100vh;height:100svh;overflow:hidden;display:grid;
  grid-template-columns:minmax(0,.9fr) minmax(0,1.2fr) minmax(0,.9fr);gap:var(--gutter);align-items:center;
  padding-top:calc(56px + var(--frame) + 24px);padding-bottom:calc(var(--frame) + 24px)}
.asm-copy h2{margin:16px 0 20px}
.asm-progress{margin-top:28px;display:grid;gap:8px;max-width:260px}
.asm-progress .track{height:2px;background:var(--rule-soft);position:relative}
.asm-progress .track span{position:absolute;inset:0;background:var(--ink);transform-origin:0 50%;transform:scaleX(var(--e,0))}
.asm-slot{height:min(78svh,720px);aspect-ratio:auto;width:100%}
.asm-labels{list-style:none;margin:0;padding:0;display:grid;gap:clamp(8px,1.6vh,18px);align-self:center}
.asm-labels li{display:grid;grid-template-columns:28px 1fr;gap:0 10px;opacity:.18;transform:translateX(12px);transition:opacity .4s,transform .5s var(--ease)}
.asm-labels li.on{opacity:1;transform:none}
.asm-labels .num{grid-row:span 2;width:24px;height:24px;border:1px solid var(--ink);display:grid;place-items:center;font:500 11px var(--f-mono);margin-top:2px;background:var(--paper)}
.asm-labels li.on .num{background:var(--ink);color:var(--paper)}
.asm-labels b{font:600 clamp(16px,1.35vw,21px)/1.1 var(--f-display);text-transform:uppercase;letter-spacing:.02em}
.asm-labels span{font-size:13.5px;line-height:1.4;color:var(--ink-2)}
.leaders{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.leaders path{fill:none;stroke:var(--ink);stroke-width:1}
.leaders circle{fill:var(--paper);stroke:var(--ink);stroke-width:1}
.leaders circle.hot{fill:var(--signal);stroke:var(--signal)}
.pins{position:absolute;inset:0;pointer-events:none}
.fly-note{position:absolute;left:50%;bottom:calc(var(--frame) + 22px);transform:translate(-50%,calc((1 - var(--fly,0)) * 16px));opacity:clamp(0,calc(var(--fly,0) * 2 - .6),1);margin:0;display:grid;gap:4px;text-align:center;background:var(--paper);border:1px solid var(--ink);padding:10px 16px;pointer-events:none;z-index:3}
.fly-note b{font-weight:500;color:var(--ink)}.fly-note span{color:var(--ink-2)}
.pins span{position:absolute;left:0;top:0;width:20px;height:20px;margin:-10px 0 0 -10px;border-radius:50%;background:var(--ink);color:var(--paper);
  font:500 10px/20px var(--f-mono);text-align:center;opacity:0;transition:opacity .3s}

/* SPECS */
.specs{padding-top:16vh;padding-bottom:12vh;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:var(--gutter)}
.spec-col{position:relative}
.spec-slot{position:sticky;top:calc(50vh - min(34vw,460px)/2 + 28px);width:min(34vw,460px);margin:0 auto}
.spec-head{display:flex;justify-content:space-between;align-items:end;gap:24px;margin-bottom:36px;flex-wrap:wrap}
.spec-head p{margin:0}
.spec-table{border-top:2px solid var(--ink);margin:0}
.spec-table .row{display:grid;grid-template-columns:44px minmax(0,.8fr) minmax(0,1.2fr);gap:16px;padding:16px 0;border-bottom:1px solid var(--rule);align-items:baseline}
.spec-table dt{font:600 19px/1.15 var(--f-display);text-transform:uppercase;letter-spacing:.02em}
.spec-table dd{margin:0;font:400 15px/1.45 var(--f-body);color:var(--ink-2)}
.spec-table dd strong{display:block;font:500 17px/1.3 var(--f-mono);color:var(--ink);font-variant-numeric:tabular-nums}
.spec-table .idx{font:500 11px var(--f-mono);color:var(--ink-3)}
.tol{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:36px}
.tol div{border:1px solid var(--rule);padding:14px}
.tol b{display:block;font:600 clamp(28px,2.6vw,40px)/1 var(--f-display)}
.tol span{font:500 11px var(--f-mono);text-transform:uppercase;letter-spacing:.05em;color:var(--ink-2)}

/* CONFIGURATOR */
.config{padding-top:14vh;padding-bottom:14vh;border-top:1px solid var(--rule)}
.config-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:var(--gutter);align-items:start;margin-top:40px}
.cfg-stage{position:sticky;top:calc(56px + var(--frame) + 20px);border:1px solid var(--rule);padding:20px}
.cfg-stage::before,.cfg-stage::after{content:"";position:absolute;width:10px;height:10px;border:solid var(--ink)}
.cfg-stage::before{left:-1px;top:-1px;border-width:2px 0 0 2px}.cfg-stage::after{right:-1px;bottom:-1px;border-width:0 2px 2px 0}
.cfg-stage .slot{max-width:560px;margin:0 auto;cursor:grab;touch-action:pan-y}
.cfg-stage .slot:active{cursor:grabbing}
.stage-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;border-top:1px solid var(--rule);padding-top:14px;margin-top:8px}
.stage-bar .tools{display:flex;gap:6px}
.icon-btn{width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--ink);background:transparent;border-radius:var(--r);cursor:pointer}
.icon-btn:hover,.icon-btn[aria-pressed=true]{background:var(--ink);color:var(--paper)}
.icon-btn svg{width:18px;height:18px}
.cfg-code{color:var(--ink-2)}
form.cfg fieldset{border:0;border-top:1px solid var(--ink);margin:0 0 26px;padding:14px 0 0}
form.cfg legend{display:flex;justify-content:space-between;width:100%;padding:0;font:600 20px/1 var(--f-display);text-transform:uppercase;letter-spacing:.03em}
form.cfg legend .mono{font-weight:400;color:var(--ink-2);text-transform:none}
.opts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:14px}
.opt{position:relative}
.opt input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.opt label{display:grid;gap:8px;padding:12px;border:1px solid var(--rule);min-height:100%;cursor:pointer;transition:border-color .2s,background .2s;border-radius:var(--r)}
.opt .sw{height:30px;border:1px solid rgba(0,0,0,.25);border-radius:1px}
.opt b{font:600 15px/1.15 var(--f-body)}
.opt small{font:500 12px var(--f-mono);color:var(--ink-2)}
.opt input:checked + label{border-color:var(--ink);background:var(--paper-3);box-shadow:inset 0 0 0 1px var(--ink)}
.opt input:checked + label small{color:var(--ink)}
.opt input:focus-visible + label{outline:2px solid var(--signal);outline-offset:2px}
.field{display:grid;gap:6px;margin-top:14px}
.field label{font:500 12px var(--f-mono);text-transform:uppercase;letter-spacing:.05em;color:var(--ink-2)}
.field input{height:48px;border:1px solid var(--ink);background:var(--paper-3);padding:0 14px;font:500 16px var(--f-mono);text-transform:uppercase;letter-spacing:.08em;border-radius:var(--r)}
.field input[aria-invalid=true]{border-color:#a3260a;box-shadow:inset 0 0 0 1px #a3260a}
.hint{font-size:13px;color:var(--ink-2)}
.hint.err{color:#8f2208;font-weight:600}
.price{border:1px solid var(--ink);padding:18px;display:grid;gap:10px;background:var(--paper-3)}
.price ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.price li{display:flex;justify-content:space-between;font:400 14px var(--f-mono);color:var(--ink-2)}
.price .total{display:flex;justify-content:space-between;align-items:baseline;border-top:1px solid var(--rule);padding-top:10px}
.price .total b{font:600 clamp(34px,3vw,46px)/1 var(--f-display);font-variant-numeric:tabular-nums}
.price .btn{width:100%;margin-top:6px}
.price .ship{font-size:13px;color:var(--ink-2);margin:0}

/* FIELD */
.fieldsec{padding-top:14vh;padding-bottom:10vh;border-top:1px solid var(--rule)}
.figs{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--gutter);margin-top:48px}
.figs figure{margin:0;position:relative}
.figs .f1{grid-column:1/8}.figs .f2{grid-column:8/13;align-self:end}
.figs .f3{grid-column:1/6}.figs .f4{grid-column:6/13;align-self:start;margin-top:12vh}
.figs .ph{overflow:hidden;border:1px solid var(--ink);background:var(--paper-2)}
.figs .ph{position:relative}
.figs .ph::after{content:"";position:absolute;inset:0;pointer-events:none;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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
.figs img{filter:saturate(.86) contrast(1.03)}
.figs img{width:100%;height:auto;transform:scale(1.04);transition:transform 1.2s var(--ease)}
.figs figure:hover img{transform:scale(1)}
.figs figcaption{display:flex;gap:14px;justify-content:space-between;padding-top:10px;font:500 12px/1.4 var(--f-mono);text-transform:uppercase;letter-spacing:.04em;color:var(--ink-2)}
.figs figcaption b{color:var(--ink);font-weight:500}

/* SERVICE */
.service{padding-top:12vh;padding-bottom:12vh;border-top:1px solid var(--rule);display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:var(--gutter)}
.faq details{border-bottom:1px solid var(--rule)}
.faq details:first-child{border-top:2px solid var(--ink)}
.faq summary{list-style:none;cursor:pointer;display:grid;grid-template-columns:44px 1fr 24px;gap:12px;align-items:center;padding:20px 0;font:600 clamp(18px,1.5vw,23px)/1.15 var(--f-display);text-transform:uppercase;letter-spacing:.02em}
.faq summary::-webkit-details-marker{display:none}
.faq summary .idx{font:500 11px var(--f-mono);color:var(--ink-3)}
.faq summary .pm{width:16px;height:16px;position:relative}
.faq summary .pm::before,.faq summary .pm::after{content:"";position:absolute;left:0;right:0;top:50%;height:2px;margin-top:-1px;background:var(--ink);transition:transform .3s var(--ease)}
.faq summary .pm::after{transform:rotate(90deg)}
.faq details[open] .pm::after{transform:rotate(0)}
.faq details p{margin:0 0 22px 56px;color:var(--ink-2);max-width:60ch}

/* FOOTER / TITLE BLOCK */
footer{position:relative;z-index:2;padding-top:8vh;padding-bottom:calc(var(--frame) + 28px)}
.tb{display:grid;grid-template-columns:minmax(0,1.4fr) repeat(3,minmax(0,1fr));border:2px solid var(--ink)}
.tb > div{border-right:1px solid var(--ink);padding:18px}
.tb > div:last-child{border-right:0}
.tb h3{font-size:26px;line-height:1;margin-bottom:10px}
.tb ul{list-style:none;padding:0;margin:0;display:grid;gap:4px}
.tb a{text-decoration:none;font-size:15px}
.tb a:hover{text-decoration:underline;text-underline-offset:3px}
.tb .k{font:500 11px var(--f-mono);text-transform:uppercase;letter-spacing:.05em;color:var(--ink-3);margin:0 0 8px}
.news{display:flex;gap:8px;margin-top:12px}
.news input{flex:1;min-width:0;height:48px;border:1px solid var(--ink);background:var(--paper-3);padding:0 12px;border-radius:var(--r)}
.news input[aria-invalid=true]{border-color:#a3260a;box-shadow:inset 0 0 0 1px #a3260a}
.tb-strip{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));border:2px solid var(--ink);border-top:0}
.tb-strip div{padding:8px 12px;border-right:1px solid var(--ink)}
.tb-strip div:last-child{border-right:0}
.tb-strip .k{font:500 10px var(--f-mono);text-transform:uppercase;color:var(--ink-3)}
.tb-strip .v{font:500 13px var(--f-mono)}

/* BAG dialog */
dialog.bag{margin:0 0 0 auto;height:100%;max-height:100%;width:min(440px,100%);border:0;border-left:2px solid var(--ink);padding:0;background:var(--paper);color:var(--ink)}
dialog.bag::backdrop{background:rgba(27,30,34,.45)}
dialog.bag[open]{animation:slide .45s var(--ease)}
@keyframes slide{from{transform:translateX(40px);opacity:0}}
.bag-inner{display:grid;grid-template-rows:auto 1fr auto;height:100%}
.bag-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid var(--ink)}
.bag-head h2{font-size:30px}
.bag-list{list-style:none;margin:0;padding:0 20px;overflow:auto}
.bag-list li{display:grid;grid-template-columns:64px 1fr auto;gap:14px;padding:18px 0;border-bottom:1px solid var(--rule)}
.bag-list .thumb{width:64px;height:64px;border:1px solid var(--rule)}
.bag-list b{font:600 18px/1.1 var(--f-display);text-transform:uppercase}
.bag-list p{margin:4px 0 8px;font-size:13px;color:var(--ink-2)}
.qty{display:inline-flex;border:1px solid var(--ink);border-radius:var(--r)}
.qty button{width:36px;height:36px;border:0;background:transparent;cursor:pointer;font:500 16px var(--f-mono)}
.qty button:hover{background:var(--ink);color:var(--paper)}
.qty output{width:34px;display:grid;place-items:center;font:500 14px var(--f-mono)}
.rm{background:none;border:0;padding:6px 0;margin-left:10px;cursor:pointer;font:500 12px var(--f-mono);text-transform:uppercase;text-decoration:underline;text-underline-offset:3px;color:var(--ink-2)}
.line-price{font:500 15px var(--f-mono);text-align:right}
.bag-empty{padding:40px 20px;color:var(--ink-2)}
.bag-foot{border-top:2px solid var(--ink);padding:18px 20px;display:grid;gap:10px}
.bag-foot .row{display:flex;justify-content:space-between;font:500 14px var(--f-mono)}
.bag-foot .row.big{font:600 28px var(--f-display)}
.bag-note{font-size:13px;color:var(--ink-2);margin:0}
.fly{position:fixed;z-index:300;width:14px;height:14px;background:var(--signal);border-radius:50%;pointer-events:none}
.toast{position:fixed;left:50%;bottom:calc(var(--frame) + 18px);z-index:120;transform:translate(-50%,20px);opacity:0;background:var(--ink);color:var(--paper);padding:12px 16px;font:500 13px var(--f-mono);transition:.35s var(--ease);pointer-events:none;max-width:calc(100% - 40px)}
.toast.on{opacity:1;transform:translate(-50%,0)}

/* plotter curtain (preloader) */
.curtain{position:fixed;inset:0;z-index:150;background:var(--paper);display:grid;place-items:center;transition:transform .9s cubic-bezier(.7,0,.2,1),opacity .5s}
.curtain::before{content:"";position:absolute;inset:0;background-image:linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px);background-size:16px 16px}
.curtain.out{transform:translateY(-101%)}
.curtain .plot{position:relative;width:min(300px,70vw);display:grid;gap:14px;justify-items:center;text-align:center}
.curtain svg{width:180px;height:180px;overflow:visible}
.curtain svg *{fill:none;stroke:var(--ink);stroke-width:1.2}
.curtain svg .pen{stroke:var(--signal);stroke-width:2.4}
.curtain .bar{width:100%;height:1px;background:var(--rule);position:relative}
.curtain .bar span{position:absolute;inset:0;background:var(--ink);transform-origin:0 50%;transform:scaleX(var(--p,0))}
.curtain .row{display:flex;justify-content:space-between;width:100%;color:var(--ink-2)}
/* drafting cursor: denser grid + crosshair follow the pointer */
.loupe{position:fixed;inset:0;z-index:0;pointer-events:none;opacity:0;transition:opacity .4s;
  background-image:linear-gradient(rgba(27,30,34,.13) 1px,transparent 1px),linear-gradient(90deg,rgba(27,30,34,.13) 1px,transparent 1px);background-size:8px 8px;
  -webkit-mask-image:radial-gradient(circle 190px at var(--mx,-999px) var(--my,-999px),#000 0,rgba(0,0,0,.55) 45%,rgba(0,0,0,.18) 72%,transparent 100%);
  mask-image:radial-gradient(circle 190px at var(--mx,-999px) var(--my,-999px),#000 0,rgba(0,0,0,.55) 45%,rgba(0,0,0,.18) 72%,transparent 100%)}
.xh{position:fixed;z-index:3;pointer-events:none;background:var(--signal);opacity:0;transition:opacity .4s}
.xh.h{left:0;right:0;height:1px;top:0;transform:translateY(var(--ly,-10px))}
.xh.v{top:0;bottom:0;width:1px;left:0;transform:translateX(var(--lx,-10px))}
.xtag{position:fixed;z-index:3;left:0;top:0;pointer-events:none;font:500 10px var(--f-mono);letter-spacing:.04em;color:var(--ink);background:var(--paper);border:1px solid var(--rule);padding:2px 5px;opacity:0;transform:translate(calc(var(--lx,-200px) + 12px),calc(var(--ly,-200px) + 12px));white-space:nowrap}
.drafting .loupe{opacity:1}.drafting .xh{opacity:.22}.drafting .xtag{opacity:1}
@media (hover:none),(pointer:coarse){.loupe,.xh,.xtag{display:none}}
/* FIELD FILM: scroll-scrubbed all-intra footage with a live drawing HUD */
.film{height:340vh;background:#0e1011;color:#e9e7df;position:relative;z-index:3}
.film-pin{position:sticky;top:0;height:100vh;height:100svh;overflow:hidden}
.film video,.film .poster{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
.film .poster{z-index:0}
.film video{z-index:1;opacity:0;transition:opacity .5s}
.film video.on{opacity:1}
.film-shade{position:absolute;inset:0;z-index:2;pointer-events:none;background:radial-gradient(70% 60% at 12% 18%,rgba(8,9,10,.62),transparent 70%),radial-gradient(120% 90% at 50% 45%,transparent 45%,rgba(8,9,10,.55) 100%),linear-gradient(180deg,rgba(8,9,10,.55),transparent 22%,transparent 70%,rgba(8,9,10,.7))}
.film-copy,.film-end,.film-bar,.film-cue{text-shadow:0 1px 14px rgba(0,0,0,.55)}
.film-hud{position:absolute;inset:0;width:100%;height:100%;z-index:3;pointer-events:none}
.film-hud .ink{fill:none;stroke:#f1eee4;stroke-width:1.2;vector-effect:non-scaling-stroke}
.film-hud .sig{fill:none;stroke:var(--signal);stroke-width:1.6;vector-effect:non-scaling-stroke}
.film-hud text{font:500 15px var(--f-mono);fill:#f1eee4;letter-spacing:.05em}
.film-hud text.big{font:600 26px var(--f-display);letter-spacing:.04em}
.film-hud text{paint-order:stroke;stroke:rgba(8,9,10,.45);stroke-width:3px}
.film-hud .ann{transition:opacity .35s}
.film-copy{position:absolute;z-index:4;left:calc(var(--gutter) + var(--frame));right:calc(var(--gutter) + var(--frame));top:calc(56px + var(--frame) + 4vh);display:grid;gap:12px;max-width:760px;transition:opacity .5s,transform .7s var(--ease)}
.film-copy .eyebrow{color:#cfccc2}
.film-copy h2{font-size:clamp(54px,9vw,150px);line-height:.84;color:#f4f1e8}
.film-copy p{margin:0;max-width:40ch;color:#d8d5cb;font-size:clamp(15px,1.2vw,18px)}
.film-copy.gone{opacity:0;transform:translateY(-24px)}
.film-bar{position:absolute;z-index:4;left:calc(var(--gutter) + var(--frame));right:calc(var(--gutter) + var(--frame));bottom:calc(var(--frame) + 22px);display:grid;grid-template-columns:repeat(4,auto) 1fr;gap:28px;align-items:end;color:#d8d5cb}
.film-bar dt{font:500 10px var(--f-mono);letter-spacing:.08em;text-transform:uppercase;color:#a9a69c}
.film-bar dd{margin:2px 0 0;font:500 15px var(--f-mono);font-variant-numeric:tabular-nums;color:#f4f1e8}
.film-bar .track{height:2px;background:rgba(255,255,255,.2);position:relative;align-self:center}
.film-bar .track span{position:absolute;inset:0;background:var(--signal);transform-origin:0 50%;transform:scaleX(var(--fp,0))}
.film-cue{position:absolute;z-index:4;left:50%;bottom:calc(var(--frame) + 74px);transform:translateX(-50%);font:500 11px var(--f-mono);letter-spacing:.14em;text-transform:uppercase;color:#d8d5cb;transition:opacity .4s}
.film-cue::after{content:"";display:block;width:1px;height:34px;margin:8px auto 0;background:linear-gradient(#f1eee4,transparent);animation:cue 1.8s var(--ease) infinite}
@keyframes cue{0%{transform:scaleY(0);transform-origin:top}50%{transform:scaleY(1);transform-origin:top}51%{transform-origin:bottom}100%{transform:scaleY(0);transform-origin:bottom}}
.film-end{position:absolute;z-index:4;right:calc(var(--gutter) + var(--frame));top:calc(56px + var(--frame) + 4vh);text-align:right;opacity:0;transition:opacity .5s,transform .7s var(--ease);transform:translateY(20px)}
.film-end.on{opacity:1;transform:none}
.film-end h2{font-size:clamp(34px,4.4vw,70px);line-height:.9;color:#f4f1e8}
.film-end p{margin:10px 0 0;color:#d8d5cb}
@media (max-width:700px){.film-bar{grid-template-columns:repeat(3,auto);gap:16px}.film-bar .hide-s,.film-bar .track{display:none}.film-hud text.big{font-size:30px}.film-end{left:calc(var(--gutter) + var(--frame));text-align:left;top:auto;bottom:calc(var(--frame) + 90px)}}
/* reveal */
.rv{opacity:0;transform:translateY(18px);transition:opacity .8s var(--ease),transform .9s var(--ease)}
.rv.in{opacity:1;transform:none}

/* RESPONSIVE */
@media (max-width:1100px){
  .nav a{display:none}
  .asm-pin{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .asm-copy{grid-column:1/-1;align-self:end}
  .asm-copy .lede{display:none}
  .asm-slot{height:min(58svh,560px)}
}
@media (max-width:900px){
  .sheet{display:none}
  .hdr{grid-template-columns:1fr auto}
  .hero{grid-template-columns:1fr;padding-top:calc(56px + var(--frame) + 28px);min-height:auto}
  .hero-stage{width:min(100%,380px);padding:30px 44px 70px;order:-1;margin-top:clamp(44px,14vw,80px);margin-bottom:8px}
  .dims{inset:30px 44px 76px}
  .dwgno{left:40px;right:40px}
  .specs{grid-template-columns:1fr;padding-top:10vh}
  .spec-slot{position:relative;top:auto;width:min(86vw,440px)}
  .config-grid{grid-template-columns:1fr}
  .cfg-stage{position:relative;top:auto}
  .figs .f1,.figs .f2,.figs .f3,.figs .f4{grid-column:1/-1;margin-top:0}
  .service{grid-template-columns:1fr}
  .tb{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tb > div{border-bottom:1px solid var(--ink)}
  .tb > div:nth-child(2n){border-right:0}
  .tb-strip{grid-template-columns:repeat(3,minmax(0,1fr))}
  .tb-strip div:nth-child(3n){border-right:0}
  .tb-strip div:nth-child(-n+3){border-bottom:1px solid var(--ink)}
}
@media (max-width:700px){
  .assembly{height:300vh}
  .asm-pin{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;align-items:stretch}
  .asm-copy h2{font-size:38px;margin:10px 0 0}
  .asm-copy .asm-progress{display:none}
  .asm-slot{height:auto;min-height:0}
  .asm-labels{grid-template-columns:1fr 1fr;gap:6px 12px}
  .asm-labels li{grid-template-columns:24px 1fr;transform:none}
  .asm-labels .num{width:20px;height:20px;font-size:10px}
  .asm-labels b{font-size:14px}
  .asm-labels span{display:none}
  .leaders path{display:none}
  .leaders circle{display:none}
  .pins span{opacity:var(--o,0)}
  .opts{grid-template-columns:1fr 1fr 1fr;gap:6px}
  .opt label{padding:9px}
  .opt b{font-size:13px}
  .tol{grid-template-columns:1fr 1fr 1fr;gap:6px}
  .tol div{padding:10px}
  .spec-table .row{grid-template-columns:30px minmax(0,1fr);gap:4px 10px}
  .spec-table dd{grid-column:2}
  .readout dd{font-size:17px}
  .tb{grid-template-columns:minmax(0,1fr)}
  .tb > div{border-right:0!important}
  .tb-strip{grid-template-columns:1fr 1fr}
  .tb-strip div{border-bottom:1px solid var(--ink)}
  .tb-strip div:nth-child(2n){border-right:0}
  .tb-strip div:nth-child(3n){border-right:1px solid var(--ink)}
  .tb-strip div:nth-child(6n){border-right:0}
  .tb-strip div:nth-last-child(-n+2){border-bottom:0}
  .logo small{display:none}
  .faq details p{margin-left:0}
  .faq summary{grid-template-columns:30px 1fr 20px}
}
@media (prefers-reduced-motion:reduce){
  .loupe,.xh,.xtag{display:none}
  .curtain.out{transform:none;opacity:0;pointer-events:none}
  *,*::before,*::after{animation-duration:.001ms!important;animation-delay:0s!important;transition-duration:.001ms!important}
  .rv{opacity:1;transform:none}
}
</style>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<div class="curtain" id="curtain" aria-hidden="true">
  <div class="plot">
    <svg viewBox="0 0 200 200"><circle class="c1" cx="100" cy="100" r="78" pathLength="1"/><circle class="c2" cx="100" cy="100" r="66" pathLength="1"/><path class="c3" d="M78 22V6M122 22V6M78 178v16M122 178v16M178 92h12v16h-12" pathLength="1"/><path class="pen" d="M100 100V52M100 100l26 15" pathLength="1"/></svg>
    <div class="row mono"><span>Plotting DWG. AM-38-001</span><span id="curtainPct">0%</span></div>
    <div class="bar"><span id="curtainBar"></span></div>
  </div>
</div>
<div class="loupe" aria-hidden="true"></div><div class="xh h" aria-hidden="true"></div><div class="xh v" aria-hidden="true"></div><div class="xtag" id="xtag" aria-hidden="true">X 000.0 · Y 000.0 mm</div>
<div class="frame" aria-hidden="true"><i></i><i></i><i></i><i></i></div>

<header class="hdr">
  <a class="logo" href="#top" aria-label="Aldermark Instruments, back to top"><b>ALDERMARK</b><small>INSTRUMENTS<br>EST. DWG. 2026</small></a>
  <div class="sheet mono" aria-hidden="true"><span>Sheet</span><span class="n" id="sheetN">01 / 05</span><span class="bar"><span id="sheetBar"></span></span><span id="sheetT">General arrangement</span></div>
  <nav class="nav" aria-label="Primary">
    <a href="#assembly">Assembly</a><a href="#specs">Specs</a><a href="#configure">Configure</a><a href="#field">Field</a>
    <button class="bagbtn" id="bagBtn" type="button" aria-haspopup="dialog" aria-controls="bag">Bag <span class="count" id="bagCount" aria-label="0 items">0</span></button>
  </nav>
</header>

<canvas id="gl" aria-hidden="true"></canvas>

<main id="main">
  <!-- 00 FIELD FILM -->
  <section class="film" id="film" data-sheet="00|Field film" aria-labelledby="filmT">
    <div class="film-pin">
      <img class="poster" src="assets/film-poster.webp" alt="Macro view across the graphite dial of the Type 38, rain droplets on the crystal." fetchpriority="high">
      <video id="filmV" muted playsinline preload="auto" aria-hidden="true" tabindex="-1"></video>
      <div class="film-shade" aria-hidden="true"></div>
      <svg class="film-hud" id="filmHud" viewBox="0 0 1600 900" preserveAspectRatio="xMidYMid slice" aria-hidden="true"></svg>
      <div class="film-copy" id="filmCopy">
        <p class="eyebrow mono"><span class="dot"></span><span>Field film · Reel 01 · 1:1 scroll</span></p>
        <h2 id="filmT">Type 38</h2>
        <p>Scroll to run the reel. The camera crosses the dial, rides over the crown and pulls back to the wrist; the drawing notes follow it.</p>
      </div>
      <div class="film-end" id="filmEnd" aria-hidden="true"><h2>Now, the drawing.</h2><p class="mono">Sheet 01 follows ↓</p></div>
      <div class="film-cue" id="filmCue" aria-hidden="true">Scroll</div>
      <dl class="film-bar" aria-hidden="true">
        <div><dt>Timecode</dt><dd id="fTc">00:00:00:00</dd></div>
        <div><dt>Frame</dt><dd id="fFr">000 / 192</dd></div>
        <div class="hide-s"><dt>Focus</dt><dd id="fFo">0.12 m</dd></div>
        <div class="hide-s"><dt>Lens</dt><dd>100 mm macro</dd></div>
        <div class="track"><span id="fTrack"></span></div>
      </dl>
    </div>
  </section>
  <!-- 01 HERO -->
  <section class="hero wrap" id="top" data-sheet="01|General arrangement" aria-labelledby="h1">
    <div>
      <p class="eyebrow mono rv"><span class="dot"></span><span>DWG. AM-38-001</span><span class="tag">Rev. C</span><span>Scale 2:1</span></p>
      <h1 id="h1" class="rv">A field watch <em>drawn</em> to be read in any weather.</h1>
      <p class="lede rv">The Aldermark Type 38 is a 38&nbsp;mm automatic instrument for people who work outdoors: a screw-down crown, a 120-click compass bezel, 200&nbsp;m of water resistance and a dial you can read at a glance in rain, glare or dusk.</p>
      <div class="ctas rv">
        <a class="btn primary" href="#configure">Configure yours <span class="mono" id="fromPrice">— from $1,150</span></a>
        <a class="btn ghost" href="#assembly">See the assembly</a>
      </div>
      <dl class="readout rv">
        <div><dt>Your local time</dt><dd id="clock" aria-hidden="true">--:--:--</dd></div>
        <div><dt>Beat</dt><dd>28,800<span class="mono"> vph</span></dd></div>
        <div><dt>Case</dt><dd>Ø 38.0</dd></div>
      </dl>
    </div>
    <div class="hero-stage">
      <div class="slot" data-slot="hero"><div class="fb"></div></div>
      <div class="dims" aria-hidden="true">
        <svg viewBox="0 0 260 260">
          <!-- case diameter -->
          <line class="ext draw" x1="30" y1="130" x2="30" y2="282"/><line class="ext draw" x1="230" y1="130" x2="230" y2="282"/>
          <path class="draw" d="M30 276 H230 M30 276 l7 -2.5 v5 z M230 276 l-7 -2.5 v5 z"/>
          <text class="fade" x="30" y="290" text-anchor="start">Ø 38.0 CASE</text>
          <!-- lug to lug -->
          <line class="ext draw" x1="190" y1="7.5" x2="296" y2="7.5"/><line class="ext draw" x1="190" y1="252.5" x2="296" y2="252.5"/>
          <path class="draw" d="M290 7.5 V252.5 M290 7.5 l-2.5 7 h5 z M290 252.5 l-2.5 -7 h5 z"/>
          <text class="fade" x="300" y="133" transform="rotate(90 300 133)" text-anchor="middle">46.5 L-L</text>
          <!-- lug width -->
          <path class="draw" d="M77.5 -16 H182.5 M77.5 -22 V-10 M182.5 -22 V-10"/>
          <text class="fade" x="130" y="-22" text-anchor="middle">20.0 LUG</text>
          <!-- centre lines -->
          <path class="ext draw" d="M130 -6 V266 M-6 130 H266"/>
        </svg>
      </div>
      <div class="dwgno mono" aria-hidden="true"><span>FIG. 1 — FRONT ELEVATION</span><span id="tz">LOCAL</span></div>
    </div>
  </section>

  <!-- 02 ASSEMBLY -->
  <section class="assembly" id="assembly" data-sheet="02|Exploded assembly" aria-labelledby="h2a">
    <div class="asm-pin wrap">
      <div class="asm-copy">
        <p class="eyebrow mono"><span class="dot"></span><span>Sheet 02 — Exploded assembly</span></p>
        <h2 id="h2a">Seven parts.<br>One axis.</h2>
        <p class="lede">Scroll to take the Type 38 apart along its own axis. Every part is drawn here from the same numbers we machine to; the hands still keep your time.</p>
        <div class="asm-progress mono" aria-hidden="true"><span>Separation <b id="sepVal">0.0</b> mm</span><div class="track"><span id="sepBar"></span></div></div>
      </div>
      <div class="slot asm-slot" data-slot="assembly"><div class="fb"></div><div class="pins" aria-hidden="true"></div></div>
      <ol class="asm-labels" id="asmLabels">
        <li><span class="num" aria-hidden="true">01</span><b>Sapphire crystal</b><span>Domed, 3.0 mm, anti-reflective inside and out.</span></li>
        <li><span class="num" aria-hidden="true">02</span><b>Compass bezel</b><span>Bidirectional, 120 clicks, filled engraved scale.</span></li>
        <li><span class="num" aria-hidden="true">03</span><b>Hands</b><span>Sword hour and minute, filled with lume; signal seconds.</span></li>
        <li><span class="num" aria-hidden="true">04</span><b>Dial</b><span>Matte lacquer, 24-hour inner track, printed in two passes.</span></li>
        <li><span class="num" aria-hidden="true">05</span><b>Case &amp; crown</b><span>Machined from bar; screw-down crown between guards.</span></li>
        <li><span class="num" aria-hidden="true">06</span><b>Movement</b><span>Automatic, 28,800 vph, 72 h reserve, hacking seconds.</span></li>
        <li><span class="num" aria-hidden="true">07</span><b>Caseback</b><span>Screw-down, engraved to order, sealed to 200 m.</span></li>
      </ol>
      <svg class="leaders" aria-hidden="true"></svg>
      <p class="fly-note mono" aria-hidden="true"><b>06 · Calibre AM-28</b><span>Balance 4 Hz · 25 jewels · blued screws · 72 h</span></p>
    </div>
  </section>

  <!-- 03 SPECS -->
  <section class="specs wrap" id="specs" data-sheet="03|Specification" aria-labelledby="h2s">
    <div class="spec-col"><div class="slot spec-slot" data-slot="specs"><div class="fb"></div></div></div>
    <div>
      <div class="spec-head rv">
        <div><p class="eyebrow mono"><span class="dot"></span><span>Sheet 03 — Specification</span></p><h2 id="h2s" style="margin-top:16px">Tolerances,<br>not adjectives.</h2></div>
      </div>
      <dl class="spec-table">
        <div class="row rv"><span class="idx" aria-hidden="true">A1</span><dt>Diameter</dt><dd><strong>38.0 mm</strong>Sized to sit under a cuff and over a glove.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">A2</span><dt>Height</dt><dd><strong>10.9 mm</strong>Including the domed crystal.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">A3</span><dt>Lug to lug</dt><dd><strong>46.5 mm · 20 mm lugs</strong>Drilled lugs for tool-free strap changes.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">B1</span><dt>Water resistance</dt><dd><strong>200 m / 20 bar</strong>Screw-down crown and caseback, tested individually.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">B2</span><dt>Crystal</dt><dd><strong>Sapphire, 3.0 mm, AR ×2</strong>Domed; readable at 70° off-axis.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">C1</span><dt>Movement</dt><dd><strong>Automatic · 28,800 vph · 25 jewels</strong>Hacking seconds; regulated in five positions.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">C2</span><dt>Accuracy</dt><dd><strong>−2 / +4 s per day</strong>Certified on our own timing machine before it ships.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">C3</span><dt>Power reserve</dt><dd><strong>72 h</strong>Off on Friday, still running on Monday.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">D1</span><dt>Lume</dt><dd><strong>Grade X1, 8 h legible</strong>Hands, hour plots and bezel pip.</dd></div>
        <div class="row rv"><span class="idx" aria-hidden="true">D2</span><dt>Weight</dt><dd><strong>58 g head · 49 g in titanium</strong>On canvas strap: 71 g.</dd></div>
      </dl>
      <div class="tol rv" aria-label="Key figures">
        <div><b>200<small style="font-size:.5em"> m</small></b><span>Water resistance</span></div>
        <div><b>72<small style="font-size:.5em"> h</small></b><span>Power reserve</span></div>
        <div><b>5<small style="font-size:.5em"> yr</small></b><span>Warranty</span></div>
      </div>
    </div>
  </section>

  <!-- 04 CONFIGURE -->
  <section class="config wrap" id="configure" data-sheet="04|Configuration" aria-labelledby="h2c">
    <div class="spec-head rv">
      <div><p class="eyebrow mono"><span class="dot"></span><span>Sheet 04 — Configuration</span></p><h2 id="h2c" style="margin-top:16px">Build the one<br>you'll wear.</h2></div>
      <p class="lede">27 combinations, assembled to order in eleven working days. Drag the watch to turn it; flip it to see your engraving.</p>
    </div>
    <div class="config-grid">
      <div class="cfg-stage">
        <div class="slot" data-slot="configure" id="cfgSlot" role="img" aria-label="Aldermark Type 38 in the selected configuration"><div class="fb"></div></div>
        <div class="stage-bar">
          <span class="mono cfg-code" id="cfgCode">AM38-ST-GR-CV</span>
          <div class="tools">
            <button class="icon-btn" type="button" id="rotL" aria-label="Rotate left"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M4 12a8 8 0 1 0 2.3-5.6M4 4v5h5"/></svg></button>
            <button class="icon-btn" type="button" id="rotR" aria-label="Rotate right"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M20 12a8 8 0 1 1-2.3-5.6M20 4v5h-5"/></svg></button>
            <button class="icon-btn" type="button" id="flip" aria-pressed="false" aria-label="Show caseback"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="12" cy="12" r="7"/><path d="M12 5v14M5 12h14" stroke-dasharray="2 2"/></svg></button>
          </div>
        </div>
      </div>
      <form class="cfg" id="cfg" novalidate>
        <fieldset>
          <legend><span>01 Case finish</span><span class="mono" id="lgCase">Bead-blasted steel</span></legend>
          <div class="opts">
            <div class="opt"><input type="radio" name="case" id="c-st" value="st" checked><label for="c-st"><span class="sw" style="background:linear-gradient(135deg,#c9cbcd,#8d9195)"></span><b>Bead-blasted 316L</b><small>Included</small></label></div>
            <div class="opt"><input type="radio" name="case" id="c-dlc" value="dlc"><label for="c-dlc"><span class="sw" style="background:linear-gradient(135deg,#46484c,#1d1f22)"></span><b>Black DLC</b><small>+ $180</small></label></div>
            <div class="opt"><input type="radio" name="case" id="c-ti" value="ti"><label for="c-ti"><span class="sw" style="background:linear-gradient(135deg,#aaa79f,#6f6c66)"></span><b>Grade 5 titanium</b><small>+ $260</small></label></div>
          </div>
        </fieldset>
        <fieldset>
          <legend><span>02 Dial</span><span class="mono" id="lgDial">Graphite</span></legend>
          <div class="opts">
            <div class="opt"><input type="radio" name="dial" id="d-gr" value="gr" checked><label for="d-gr"><span class="sw" style="background:#2b2e32"></span><b>Graphite</b><small>Included</small></label></div>
            <div class="opt"><input type="radio" name="dial" id="d-ch" value="ch"><label for="d-ch"><span class="sw" style="background:#e7e3d6"></span><b>Chalk</b><small>Included</small></label></div>
            <div class="opt"><input type="radio" name="dial" id="d-ol" value="ol"><label for="d-ol"><span class="sw" style="background:#4b5341"></span><b>Olive</b><small>Included</small></label></div>
          </div>
        </fieldset>
        <fieldset>
          <legend><span>03 Strap</span><span class="mono" id="lgStrap">Canvas webbing</span></legend>
          <div class="opts">
            <div class="opt"><input type="radio" name="strap" id="s-cv" value="cv" checked><label for="s-cv"><span class="sw" style="background:repeating-linear-gradient(90deg,#5d634a 0 3px,#535940 3px 5px)"></span><b>Canvas webbing</b><small>Included</small></label></div>
            <div class="opt"><input type="radio" name="strap" id="s-fk" value="fk"><label for="s-fk"><span class="sw" style="background:#222427"></span><b>FKM rubber</b><small>+ $40</small></label></div>
            <div class="opt"><input type="radio" name="strap" id="s-br" value="br"><label for="s-br"><span class="sw" style="background:repeating-linear-gradient(90deg,#b8bbbe 0 9px,#7c8085 9px 10px)"></span><b>Steel bracelet</b><small>+ $220</small></label></div>
          </div>
        </fieldset>
        <fieldset>
          <legend><span>04 Caseback engraving</span><span class="mono">+ $45, optional</span></legend>
          <div class="field">
            <label for="engr">Up to 18 characters · A–Z 0–9 · - / &amp;</label>
            <input id="engr" name="engr" maxlength="18" autocomplete="off" spellcheck="false" aria-describedby="engrHint" placeholder="e.g. N 61°·E 7° 2026">
            <span class="hint" id="engrHint" aria-live="polite">Shown live on the caseback — press the flip button to see it.</span>
          </div>
        </fieldset>
        <div class="price">
          <ul id="priceLines" aria-label="Price breakdown"></ul>
          <div class="total"><span class="mono">Total, incl. tax</span><b id="total" aria-live="polite">$1,150</b></div>
          <button class="btn primary" type="submit" id="addBtn">Add to bag</button>
          <p class="ship">Free insured shipping · 30-day returns · 5-year warranty</p>
        </div>
      </form>
    </div>
  </section>

  <!-- 05 FIELD -->
  <section class="fieldsec wrap" id="field" data-sheet="05|Field record" aria-labelledby="h2f">
    <div class="spec-head rv">
      <div><p class="eyebrow mono"><span class="dot"></span><span>Sheet 05 — Field record</span></p><h2 id="h2f" style="margin-top:16px">Tested where<br>it gets worn.</h2></div>
      <p class="lede">Every Type 38 prototype spent a season on the wrist of someone who works outside. These are their notes.</p>
    </div>
    <div class="figs">
      <figure class="f1 rv"><div class="ph"><img src="assets/field-rain.webp" width="1400" height="939" loading="lazy" decoding="async" alt="A hiker's wrist resting on a wet granite boulder in mountain rain, wearing the steel field watch on an olive canvas strap, misty pine forest behind."></div><figcaption><b>Fig. 2 — Trailhead, 06:10</b><span>Rain, 4 °C · canvas</span></figcaption></figure>
      <figure class="f2 rv"><div class="ph"><img src="assets/field-ridge.webp" width="1000" height="1241" loading="lazy" decoding="async" alt="A person in a grey shell jacket checks the watch, on a black rubber strap, at dawn on a foggy coastal ridge."></div><figcaption><b>Fig. 3 — Coastal ridge</b><span>Dawn · FKM rubber</span></figcaption></figure>
      <figure class="f3 rv"><div class="ph"><img src="assets/studio-plate.webp" width="1400" height="875" loading="lazy" decoding="async" alt="Studio render of the Type 38 in bead-blasted steel with a graphite dial on an olive canvas strap, lying on a dark slate block."></div><figcaption><b>Fig. 4 — Studio plate</b><span>Cycles render, same drawing</span></figcaption></figure>
      <figure class="f4 rv"><div class="ph"><img src="assets/field-map.webp" width="1300" height="872" loading="lazy" decoding="async" alt="Flat lay on a topographic map: the watch on an olive canvas strap, a brass compass, a pencil and a worn notebook."></div><figcaption><b>Fig. 5 — Route card</b><span>Bezel set to bearing</span></figcaption></figure>
    </div>
  </section>

  <!-- SERVICE -->
  <section class="service wrap" id="service" aria-labelledby="h2q">
    <div class="rv"><p class="eyebrow mono"><span class="dot"></span><span>Notes</span></p><h2 id="h2q" style="margin-top:16px">Service &amp;<br>questions.</h2></div>
    <div class="faq">
      <details><summary><span class="idx" aria-hidden="true">N1</span>How long until it ships?<span class="pm" aria-hidden="true"></span></summary><p>Each watch is assembled and regulated to order. Plan on eleven working days, then two to four days of insured courier delivery.</p></details>
      <details><summary><span class="idx" aria-hidden="true">N2</span>What does the warranty cover?<span class="pm" aria-hidden="true"></span></summary><p>Five years on the movement and case against defects in materials and workmanship, transferable with the watch. Straps and crystal scratches are wear items.</p></details>
      <details><summary><span class="idx" aria-hidden="true">N3</span>How often does it need a service?<span class="pm" aria-hidden="true"></span></summary><p>About every six years, or sooner if it drifts outside −2 / +4 seconds a day. Gaskets are pressure-tested and replaced at every service.</p></details>
      <details><summary><span class="idx" aria-hidden="true">N4</span>Can I change the strap myself?<span class="pm" aria-hidden="true"></span></summary><p>Yes. The lugs are drilled, so a pin pushed through from the side releases the spring bar. Every strap ships with its own bars fitted.</p></details>
      <details><summary><span class="idx" aria-hidden="true">N5</span>Can I return an engraved watch?<span class="pm" aria-hidden="true"></span></summary><p>Unworn watches come back within 30 days. Engraved casebacks are swapped for a plain one, and the $45 engraving is the only cost we keep.</p></details>
    </div>
  </section>
</main>

<footer class="wrap" aria-labelledby="ft">
  <div class="tb">
    <div>
      <h3 id="ft">Aldermark Instruments</h3>
      <p class="k">Dispatches, four a year</p>
      <form class="news" id="news" novalidate>
        <label class="sr" for="email">Email address</label>
        <input id="email" type="email" autocomplete="email" placeholder="you@example.com" aria-describedby="newsHint" required>
        <button class="btn primary" type="submit">Subscribe</button>
      </form>
      <p class="hint" id="newsHint" aria-live="polite" style="margin:8px 0 0">Field notes and release dates. No more than four emails a year.</p>
    </div>
    <div><p class="k">Watch</p><ul><li><a href="#assembly">Assembly</a></li><li><a href="#specs">Specification</a></li><li><a href="#configure">Configure</a></li></ul></div>
    <div><p class="k">Service</p><ul><li><a href="#service">Warranty</a></li><li><a href="#service">Shipping</a></li><li><a href="#service">Returns</a></li></ul></div>
    <div><p class="k">Workshop</p><ul><li><a href="#field">Field record</a></li><li><a href="#top">Drawings</a></li><li><a href="#service">Contact</a></li></ul></div>
  </div>
  <div class="tb-strip" aria-label="Drawing title block">
    <div><div class="k">Drawn</div><div class="v">A.M. Studio</div></div>
    <div><div class="k">Checked</div><div class="v">QC-07</div></div>
    <div><div class="k">Scale</div><div class="v">2 : 1</div></div>
    <div><div class="k">Units</div><div class="v">mm</div></div>
    <div><div class="k">Sheet</div><div class="v">05 / 05</div></div>
    <div><div class="k">©</div><div class="v">2026 Aldermark</div></div>
  </div>
</footer>

<dialog class="bag" id="bag" aria-labelledby="bagTitle">
  <div class="bag-inner">
    <div class="bag-head"><h2 id="bagTitle">Your bag</h2><button class="icon-btn" type="button" id="bagClose" aria-label="Close bag"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>
    <ul class="bag-list" id="bagList"></ul>
    <div class="bag-foot">
      <div class="row"><span>Subtotal</span><span id="bagSub">$0</span></div>
      <div class="row"><span>Insured shipping</span><span>Free</span></div>
      <div class="row big"><span>Total</span><span id="bagTotal">$0</span></div>
      <button class="btn primary" type="button" id="checkout">Checkout</button>
      <p class="bag-note" id="bagNote" aria-live="polite">Concept store: checkout reserves a build slot, no payment is taken.</p>
    </div>
  </div>
</dialog>
<div class="toast" id="toast" role="status" aria-live="polite"></div>

<script>
/* ========= shared state + UI (no three.js needed) ========= */
(() => {
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
const $ = (s, r = document) => r.querySelector(s);
const $$ = (s, r = document) => [...r.querySelectorAll(s)];
const money = n => '$' + n.toLocaleString('en-US');
const OPTS = {
  case:  { st:{name:'Bead-blasted steel', short:'ST', add:0}, dlc:{name:'Black DLC', short:'DL', add:180}, ti:{name:'Grade 5 titanium', short:'TI', add:260} },
  dial:  { gr:{name:'Graphite', short:'GR', add:0, hex:'#2b2e32'}, ch:{name:'Chalk', short:'CH', add:0, hex:'#e7e3d6'}, ol:{name:'Olive', short:'OL', add:0, hex:'#4b5341'} },
  strap: { cv:{name:'Canvas webbing', short:'CV', add:0}, fk:{name:'FKM rubber', short:'FK', add:40}, br:{name:'Steel bracelet', short:'BR', add:220} },
};
const BASE = 1150, ENGRAVE = 45;
const W = window.AM = { reduced, OPTS, cfg:{case:'st', dial:'gr', strap:'cv', engr:''}, listeners:new Set(), view:{yaw:0, back:false} };
W.on = fn => W.listeners.add(fn);
W.emit = () => W.listeners.forEach(f => { try { f(W.cfg); } catch (e) { console.warn(e); } });
W.price = c => BASE + OPTS.case[c.case].add + OPTS.strap[c.strap].add + (c.engr ? ENGRAVE : 0);
W.code = c => `AM38-${OPTS.case[c.case].short}-${OPTS.dial[c.dial].short}-${OPTS.strap[c.strap].short}${c.engr ? '-E' : ''}`;

/* clock readout */
const clock = $('#clock');
try { $('#tz').textContent = (Intl.DateTimeFormat().resolvedOptions().timeZone || 'LOCAL').toUpperCase().replace(/_/g, ' '); } catch (e) {}
const pad = n => String(n).padStart(2, '0');
const tickClock = () => { const d = new Date(); clock.textContent = `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`; };
tickClock(); setInterval(tickClock, 1000);

/* configurator form */
const form = $('#cfg'), engr = $('#engr'), hint = $('#engrHint');
const ENGR_OK = /^[A-Z0-9 \-\/&.°·]*$/;
function readForm() {
  const fd = new FormData(form);
  W.cfg.case = fd.get('case'); W.cfg.dial = fd.get('dial'); W.cfg.strap = fd.get('strap');
}
function renderPrice() {
  const c = W.cfg;
  $('#lgCase').textContent = OPTS.case[c.case].name;
  $('#lgDial').textContent = OPTS.dial[c.dial].name;
  $('#lgStrap').textContent = OPTS.strap[c.strap].name;
  const lines = [['Type 38 head, ' + OPTS.dial[c.dial].name.toLowerCase() + ' dial', BASE], ['Case — ' + OPTS.case[c.case].name, OPTS.case[c.case].add], ['Strap — ' + OPTS.strap[c.strap].name, OPTS.strap[c.strap].add]];
  if (c.engr) lines.push([`Engraving “${c.engr}”`, ENGRAVE]);
  $('#priceLines').innerHTML = lines.map(([k, v]) => `<li><span>${k.replace(/</g,'&lt;')}</span><span>${v ? (k.startsWith('Type') ? money(v) : '+ ' + money(v)) : 'incl.'}</span></li>`).join('');
  $('#total').textContent = money(W.price(c));
  $('#cfgCode').textContent = W.code(c);
  $('#cfgSlot').setAttribute('aria-label', `Aldermark Type 38: ${OPTS.case[c.case].name} case, ${OPTS.dial[c.dial].name} dial, ${OPTS.strap[c.strap].name}${W.view.back ? ', showing caseback' : ''}`);
}
function validateEngr() {
  const v = engr.value.toUpperCase();
  if (engr.value !== v) { const p = engr.selectionStart; engr.value = v; try { engr.setSelectionRange(p, p); } catch (e) {} }
  if (!ENGR_OK.test(v)) { engr.setAttribute('aria-invalid', 'true'); hint.textContent = 'Use letters, numbers, spaces and - / & only.'; hint.classList.add('err'); return false; }
  engr.removeAttribute('aria-invalid'); hint.classList.remove('err');
  hint.textContent = v.trim() ? `${18 - v.length} characters left · shown on the caseback.` : 'Shown live on the caseback — press the flip button to see it.';
  W.cfg.engr = v.trim(); return true;
}
form.addEventListener('change', e => { if (e.target.name !== 'engr') { readForm(); renderPrice(); W.emit(); } });
engr.addEventListener('input', () => { validateEngr(); renderPrice(); W.emit(); });

/* rotate / flip controls */
const flip = $('#flip');
$('#rotL').onclick = () => { W.view.yaw -= Math.PI / 6; };
$('#rotR').onclick = () => { W.view.yaw += Math.PI / 6; };
flip.onclick = () => { W.view.back = !W.view.back; flip.setAttribute('aria-pressed', W.view.back); flip.setAttribute('aria-label', W.view.back ? 'Show dial' : 'Show caseback'); renderPrice(); W.emit(); };
const cfgSlot = $('#cfgSlot');
let drag = null;
cfgSlot.addEventListener('pointerdown', e => { drag = { x: e.clientX, yaw: W.view.yaw }; cfgSlot.setPointerCapture(e.pointerId); });
cfgSlot.addEventListener('pointermove', e => { if (drag) W.view.yaw = drag.yaw + (e.clientX - drag.x) * 0.012; });
const endDrag = () => { drag = null; };
cfgSlot.addEventListener('pointerup', endDrag); cfgSlot.addEventListener('pointercancel', endDrag);

/* bag */
const bag = $('#bag'), bagBtn = $('#bagBtn');
let items = [];
try { items = JSON.parse(localStorage.getItem('am38-bag') || '[]'); if (!Array.isArray(items)) items = []; } catch (e) { items = []; }
const save = () => { try { localStorage.setItem('am38-bag', JSON.stringify(items)); } catch (e) {} };
function thumb(c) {
  const dial = OPTS.dial[c.dial].hex, caseC = { st:'#a9adb1', dlc:'#2f3135', ti:'#8f8c85' }[c.case], strap = { cv:'#5d634a', fk:'#222427', br:'#9a9ea2' }[c.strap];
  return `<svg class="thumb" viewBox="0 0 64 64" aria-hidden="true"><rect x="22" y="0" width="20" height="64" fill="${strap}"/><circle cx="32" cy="32" r="19" fill="${caseC}" stroke="#1b1e22" stroke-width="1"/><circle cx="32" cy="32" r="15" fill="${dial}"/><path d="M32 32V20M32 32l7 4" stroke="${c.dial === 'ch' ? '#1b1e22' : '#eee'}" stroke-width="2"/><path d="M32 34V18" stroke="#ff4f14" stroke-width="1"/></svg>`;
}
function renderBag() {
  const n = items.reduce((a, i) => a + i.qty, 0), sub = items.reduce((a, i) => a + i.qty * i.price, 0);
  const cnt = $('#bagCount'); cnt.textContent = n; cnt.setAttribute('aria-label', `${n} item${n === 1 ? '' : 's'}`);
  $('#bagSub').textContent = money(sub); $('#bagTotal').textContent = money(sub);
  $('#checkout').disabled = !n;
  const list = $('#bagList');
  if (!n) { list.innerHTML = '<li class="bag-empty" style="display:block;border:0">Your bag is empty. <a href="#configure" data-close>Configure a Type 38</a>.</li>'; return; }
  list.innerHTML = items.map((it, i) => {
    const c = it.cfg;
    return `<li>${thumb(c)}<div><b>Type 38</b><p>${OPTS.case[c.case].name} · ${OPTS.dial[c.dial].name} dial · ${OPTS.strap[c.strap].name}${c.engr ? ` · engraved “${c.engr.replace(/</g,'&lt;')}”` : ''}</p>
    <div class="qty" role="group" aria-label="Quantity"><button type="button" data-dec="${i}" aria-label="Decrease quantity">−</button><output aria-live="polite">${it.qty}</output><button type="button" data-inc="${i}" aria-label="Increase quantity">+</button></div><button class="rm" type="button" data-rm="${i}">Remove</button></div>
    <div class="line-price">${money(it.qty * it.price)}</div></li>`;
  }).join('');
}
$('#bagList').addEventListener('click', e => {
  const t = e.target.closest('button,a'); if (!t) return;
  if (t.dataset.close !== undefined) { bag.close(); return; }
  if (t.dataset.inc) items[+t.dataset.inc].qty = Math.min(5, items[+t.dataset.inc].qty + 1);
  if (t.dataset.dec) { const it = items[+t.dataset.dec]; it.qty--; if (!it.qty) items.splice(+t.dataset.dec, 1); }
  if (t.dataset.rm) items.splice(+t.dataset.rm, 1);
  save(); renderBag();
  const focusBack = $('#bagList button') || $('#bagClose'); if (!document.activeElement || document.activeElement === document.body) focusBack.focus();
});
bagBtn.onclick = () => { $('#bagNote').textContent = 'Concept store: checkout reserves a build slot, no payment is taken.'; bag.showModal(); };
$('#bagClose').onclick = () => bag.close();
bag.addEventListener('click', e => { if (e.target === bag) bag.close(); });
$('#checkout').onclick = () => {
  const ref = 'AM-' + Date.now().toString(36).toUpperCase().slice(-6);
  $('#bagNote').textContent = `Build slot ${ref} reserved for ${items.reduce((a, i) => a + i.qty, 0)} watch(es). This is a concept store — no payment was taken.`;
};
const toast = $('#toast'); let tt;
W.toast = m => { toast.textContent = m; toast.classList.add('on'); clearTimeout(tt); tt = setTimeout(() => toast.classList.remove('on'), 2600); };
form.addEventListener('submit', e => {
  e.preventDefault();
  if (!validateEngr()) { engr.focus(); return; }
  const c = { ...W.cfg }, price = W.price(c), key = W.code(c) + (c.engr || '');
  const hit = items.find(i => i.key === key);
  if (hit) hit.qty = Math.min(5, hit.qty + 1); else items.push({ key, cfg: c, price, qty: 1 });
  save(); renderBag();
  const btn = $('#addBtn'); btn.textContent = 'Added — add another'; setTimeout(() => btn.textContent = 'Add to bag', 2200);
  W.toast(`Type 38 ${W.code(c)} added · ${money(price)}`);
  bagBtn.classList.remove('bump'); void bagBtn.offsetWidth; bagBtn.classList.add('bump');
  if (!reduced) {
    const a = btn.getBoundingClientRect(), b = bagBtn.getBoundingClientRect();
    const dot = document.createElement('div'); dot.className = 'fly'; document.body.appendChild(dot);
    dot.animate([{ transform: `translate(${a.left + a.width / 2}px,${a.top + a.height / 2}px)` }, { transform: `translate(${(a.left + b.left) / 2}px,${Math.min(a.top, b.top) - 80}px) scale(1.4)`, offset: .45 }, { transform: `translate(${b.left + b.width - 12}px,${b.top + 8}px) scale(.6)` }], { duration: 750, easing: 'cubic-bezier(.5,0,.3,1)' }).onfinish = () => dot.remove();
  }
});

/* newsletter */
$('#news').addEventListener('submit', e => {
  e.preventDefault();
  const em = $('#email'), h = $('#newsHint');
  if (!em.value.trim() || !em.checkValidity() || !/\.[a-z]{2,}$/i.test(em.value.trim())) { em.setAttribute('aria-invalid', 'true'); h.textContent = 'Enter a full email address, like name@domain.com.'; h.classList.add('err'); em.focus(); return; }
  em.removeAttribute('aria-invalid'); h.classList.remove('err'); h.textContent = `Subscribed: ${em.value.trim()}. First dispatch in December.`; em.value = '';
});

/* header sheet indicator */
const secs = $$('[data-sheet]');
function updateSheet() {
  const mid = innerHeight * 0.45; let cur = secs[0];
  for (const s of secs) if (s.getBoundingClientRect().top < mid) cur = s;
  const [n, t] = cur.dataset.sheet.split('|');
  $('#sheetN').textContent = `${n} / 05`; $('#sheetT').textContent = t;
  const max = document.documentElement.scrollHeight - innerHeight;
  $('#sheetBar').style.setProperty('--p', max > 0 ? (scrollY / max).toFixed(3) : 0);
}
addEventListener('scroll', updateSheet, { passive: true }); updateSheet();

/* reveals */
const io = new IntersectionObserver(es => es.forEach(e => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }), { rootMargin: '0px 0px -8% 0px' });
$$('.rv').forEach(el => io.observe(el));


/* plotter curtain: gated on fonts + load + first WebGL frame, with floor and patience */
(() => {
  const cur = $('#curtain'), bar = $('#curtainBar'), pct = $('#curtainPct'); if (!cur) return;
  const paths = $$('#curtain svg [pathLength]');
  const t0 = performance.now(), FLOOR = 700, PATIENCE = 8000; let target = 0.08, shown = 0, done = false, gates = 0;
  const gate = () => { gates++; target = Math.min(1, 0.08 + gates * 0.31); if (gates >= 3) finish(); };
  document.fonts ? document.fonts.ready.then(gate) : gate();
  document.readyState === 'complete' ? gate() : addEventListener('load', gate, { once: true });
  addEventListener('am-ready', gate, { once: true });
  const kill = setTimeout(() => finish(), PATIENCE);
  function finish() {
    if (done) return; done = true; clearTimeout(kill); target = 1;
    setTimeout(() => { cur.classList.add('out'); document.documentElement.classList.add('ready'); setTimeout(() => { cur.hidden = true; }, 1000); }, Math.max(0, FLOOR - (performance.now() - t0)) + 260);
  }
  const step = () => {
    const ceil = done ? 1 : Math.min(0.97, target + 0.12);
    shown += (Math.min(ceil, Math.max(target, shown + 0.002)) - shown) * 0.08; if (done) shown += (1 - shown) * 0.2;
    bar.style.setProperty('--p', shown.toFixed(3)); pct.textContent = Math.round(shown * 100) + '%';
    paths.forEach((p, i) => { const k = Math.min(1, Math.max(0, shown * 1.3 - i * 0.18)); p.style.strokeDasharray = 1; p.style.strokeDashoffset = 1 - k; });
    if (!cur.hidden && !cur.classList.contains('out')) requestAnimationFrame(step);
  };
  requestAnimationFrame(step);
})();
/* drafting cursor: one writer, lerped, idle when the pointer is still */
(() => {
  if (reduced || !matchMedia('(hover: hover) and (pointer: fine)').matches) return;
  const root = document.documentElement, tag = $('#xtag'); let tx = 0, ty = 0, x = 0, y = 0, seen = false, raf = 0;
  const MM = 25.4 / 96;
  const tick = () => {
    x += (tx - x) * 0.22; y += (ty - y) * 0.22;
    root.style.setProperty('--mx', x.toFixed(1) + 'px'); root.style.setProperty('--my', y.toFixed(1) + 'px');
    root.style.setProperty('--lx', tx.toFixed(0) + 'px'); root.style.setProperty('--ly', ty.toFixed(0) + 'px');
    tag.textContent = `X ${(tx * MM).toFixed(1)} · Y ${((ty + scrollY) * MM).toFixed(1)} mm`;
    raf = Math.abs(tx - x) + Math.abs(ty - y) > 0.3 ? requestAnimationFrame(tick) : 0;
  };
  addEventListener('pointermove', e => { tx = e.clientX; ty = e.clientY; if (!seen) { seen = true; x = tx; y = ty; root.classList.add('drafting'); } if (!raf) raf = requestAnimationFrame(tick); }, { passive: true });
  document.addEventListener('pointerleave', () => root.classList.remove('drafting'));
  document.addEventListener('pointerenter', () => { if (seen) root.classList.add('drafting'); });
})();

/* field film: scroll -> currentTime, one seek in flight, latest target kept; HUD drawn live over the frames */
(() => {
  const sec = $('#film'); if (!sec) return;
  const v = $('#filmV'), hud = $('#filmHud'), copy = $('#filmCopy'), end = $('#filmEnd'), cue = $('#filmCue');
  const small = matchMedia('(max-width: 700px)').matches;
  const FPS = 24, DUR = 8;
  // annotation = [from, to, x, y, label, sub, side]; coordinates are the 1600x900 source frame
  const ANN = [
    [0.02, 0.2, 612, 300, 'NUMERALS 12 · 3 · 6 · 9', 'Lumed, printed in two passes', 'r'],
    [0.17, 0.34, 295, 737, 'SIGNAL SECONDS', '8 beats / s · hacking', 'r'],
    [0.32, 0.52, 1190, 372, 'SCREW-DOWN CROWN', '7.0 mm · knurled · 200 m', 'l'],
    [0.56, 0.75, 457, 470, 'CASE Ø 38.0', 'Bead-blasted 316L · 10.9 mm', 'l'],
    [0.78, 0.99, 812, 650, 'STRAP 20 MM', 'Canvas webbing · drilled lugs', 'r'],
  ];
  if (small) hud.setAttribute('viewBox', '547 0 506 900');
  const NS = 'http://www.w3.org/2000/svg';
  const mk = (tag, attrs, parent) => { const e = document.createElementNS(NS, tag); for (const k in attrs) e.setAttribute(k, attrs[k]); parent.appendChild(e); return e; };
  // viewfinder: corner brackets + centre ring
  const vf = mk('g', {}, hud);
  [[60, 60, 1, 1], [1540, 60, -1, 1], [60, 840, 1, -1], [1540, 840, -1, -1]].forEach(([x, y, sx, sy]) => mk('path', { class: 'ink', d: `M${x} ${y + 40 * sy}V${y}H${x + 40 * sx}` }, vf));
  const ring = mk('circle', { class: 'ink', cx: 800, cy: 450, r: 46, 'stroke-dasharray': '4 6' }, vf);
  mk('path', { class: 'ink', d: 'M786 450h28M800 436v28' }, vf);
  const anns = ANN.map(([a, b, x, y, label, sub, side]) => {
    const g = mk('g', { class: 'ann', opacity: 0 }, hud);
    const dir = side === 'l' ? -1 : 1, off = small ? 40 : 150, len = small ? 150 : 220, lx = x + dir * off, ly = y - (small ? 60 : 90);
    mk('circle', { class: 'sig', cx: x, cy: y, r: 16 }, g);
    const ln = mk('path', { class: 'ink', d: `M${x + dir * 16} ${y - 6}L${lx} ${ly}H${lx + dir * len}`, pathLength: 1, 'stroke-dasharray': 1, 'stroke-dashoffset': 1 }, g);
    const t1 = mk('text', { x: lx + dir * (side === 'l' ? len : 0), y: ly - 12, class: 'big' }, g); t1.textContent = small ? label.split(' · ')[0] : label;
    if (!small) { const t2 = mk('text', { x: lx + dir * (side === 'l' ? len : 0), y: ly + 26 }, g); t2.textContent = sub; }
    return { a, b, g, ln };
  });
  let dur = DUR, inView = false, seeking = false, target = 0, ready = false, raf = 0;
  const src = small ? 'assets/film-720.mp4' : 'assets/film-1600.mp4';
  if (!reduced) {
    v.src = src;
    v.addEventListener('loadeddata', () => { ready = true; dur = v.duration || DUR; v.classList.add('on'); seek(); });
    v.addEventListener('seeked', () => { seeking = false; if (Math.abs(v.currentTime - target) > 0.5 / FPS) seek(); });
    v.addEventListener('error', () => { v.classList.remove('on'); });
  }
  function seek() { if (!ready || seeking) return; if (Math.abs(v.currentTime - target) < 0.5 / FPS) return; seeking = true; try { v.currentTime = target; } catch (e) { seeking = false; } }
  const pad = (n, l = 2) => String(n).padStart(l, '0');
  function update() {
    const r = sec.getBoundingClientRect(), span = Math.max(1, r.height - innerHeight);
    const p = reduced ? 0 : Math.min(1, Math.max(0, -r.top / span));
    const tt = Math.min(dur - 0.05, p * dur); target = tt; seek();
    const fr = Math.round(tt * FPS);
    $('#fTc').textContent = `00:00:${pad(Math.floor(tt))}:${pad(fr % FPS)}`;
    $('#fFr').textContent = `${pad(fr, 3)} / ${pad(Math.round(dur * FPS), 3)}`;
    $('#fFo').textContent = (0.12 + p * p * 0.9).toFixed(2) + ' m';
    $('#fTrack').style.setProperty('--fp', p.toFixed(3));
    copy.classList.toggle('gone', p > 0.08); cue.style.opacity = p > 0.03 ? 0 : 1; end.classList.toggle('on', p > 0.9);
    ring.setAttribute('r', (46 + p * 60).toFixed(1));
    anns.forEach(o => { const k = Math.min(1, Math.max(0, Math.min((p - o.a) / 0.05, (o.b - p) / 0.05))); o.g.setAttribute('opacity', k.toFixed(2)); o.ln.setAttribute('stroke-dashoffset', (1 - k).toFixed(3)); });
  }
  const loop = () => { update(); raf = inView ? requestAnimationFrame(loop) : 0; };
  new IntersectionObserver(es => { inView = es[0].isIntersecting; if (inView && !raf) raf = requestAnimationFrame(loop); }).observe(sec);
  update();
})();
readForm(); validateEngr(); renderPrice(); renderBag();

/* ===== SVG fallback (no WebGL): technical drawing ===== */
W.enableFallback = (why) => {
  if (document.documentElement.classList.contains('no-gl')) return;
  setTimeout(() => dispatchEvent(new Event('am-ready')), 50);
  document.documentElement.classList.add('no-gl');
  console.info('Aldermark: drawing fallback in use —', why);
  const front = () => {
    let ticks = '';
    for (let i = 0; i < 60; i++) { const a = i * 6 * Math.PI / 180, r1 = i % 5 ? 86 : 82; ticks += `<line x1="${130 + Math.sin(a) * r1}" y1="${130 - Math.cos(a) * r1}" x2="${130 + Math.sin(a) * 90}" y2="${130 - Math.cos(a) * 90}"/>`; }
    let bz = ''; for (let i = 0; i < 12; i++) { const a = i * 30 * Math.PI / 180; bz += `<line x1="${130 + Math.sin(a) * 92}" y1="${130 - Math.cos(a) * 92}" x2="${130 + Math.sin(a) * 99}" y2="${130 - Math.cos(a) * 99}"/>`; }
    const nums = [['12', 130, 72], ['3', 190, 138], ['6', 130, 202], ['9', 70, 138]].map(([t, x, y]) => `<text x="${x}" y="${y}" text-anchor="middle" class="fbnum">${t}</text>`).join('');
    return `<svg viewBox="0 0 260 260" class="fbw"><g fill="none" stroke="#1b1e22" stroke-width="1">
      <path class="fbstrap" d="M77.5 0 H182.5 V40 H77.5 Z M77.5 220 H182.5 V260 H77.5 Z" fill="#5d634a"/>
      <rect x="62" y="20" width="20" height="40" rx="5" class="fbcase"/><rect x="178" y="20" width="20" height="40" rx="5" class="fbcase"/>
      <rect x="62" y="200" width="20" height="40" rx="5" class="fbcase"/><rect x="178" y="200" width="20" height="40" rx="5" class="fbcase"/>
      <rect x="226" y="120" width="14" height="20" rx="3" class="fbcase"/>
      <circle cx="130" cy="130" r="100" class="fbcase"/><circle cx="130" cy="130" r="91"/>
      <circle cx="130" cy="130" r="88" class="fbdial"/></g>
      <g stroke="#e9e6dc" stroke-width="1" class="fbink">${ticks}</g><g stroke="#1b1e22" stroke-width="1.4">${bz}</g>
      <path d="M130 30 l-4 -7 h8z" fill="#ff4f14"/>
      <g class="fbink2" fill="#e9e6dc" style="font:600 22px 'Barlow Condensed',sans-serif">${nums}<text x="130" y="100" text-anchor="middle" style="font:600 9px 'Barlow Condensed';letter-spacing:2px">ALDERMARK</text></g>
      <g class="hands"><path class="h" d="M127 134 L127 92 L130 84 L133 92 L133 134Z" fill="#e9e6dc" stroke="#1b1e22" stroke-width=".6"/><path class="m" d="M128 134 L128 62 L130 55 L132 62 L132 134Z" fill="#e9e6dc" stroke="#1b1e22" stroke-width=".6"/><g class="s"><line x1="130" y1="148" x2="130" y2="50" stroke="#ff4f14" stroke-width="1.2"/><circle cx="130" cy="142" r="3" fill="#ff4f14"/></g><circle cx="130" cy="130" r="3" fill="#1b1e22"/></g></svg>`;
  };
  const back = () => '';
  $$('.slot .fb').forEach(fb => {
    if (fb.parentElement.dataset.slot === 'assembly') {
      const parts = [['Crystal', 34, '#cfe0e6'], ['Bezel', 52, '#a9adb1'], ['Hands', 30, '#e9e6dc'], ['Dial', 44, '#2b2e32'], ['Case', 60, '#a9adb1'], ['Movement', 40, '#c8c1b0'], ['Caseback', 46, '#a9adb1']];
      fb.innerHTML = `<svg viewBox="0 0 260 520" preserveAspectRatio="xMidYMid meet">${parts.map((p, i) => `<g class="ex" data-i="${i}"><ellipse cx="130" cy="0" rx="${p[1] * 1.6}" ry="${p[1] * .35}" fill="${p[2]}" stroke="#1b1e22"/><text x="${130 + p[1] * 1.6 + 8}" y="4" style="font:500 10px 'IBM Plex Mono'">${String(i + 1).padStart(2, '0')}</text></g>`).join('')}<line x1="130" y1="10" x2="130" y2="510" stroke="#1b1e22" stroke-dasharray="6 3 1 3"/></svg>`;
    } else fb.innerHTML = front();
  });
  const paint = () => {
    const d = OPTS.dial[W.cfg.dial].hex, ink = W.cfg.dial === 'ch' ? '#1b1e22' : '#e9e6dc';
    const caseC = { st:'#b4b8bc', dlc:'#34363a', ti:'#99968f' }[W.cfg.case], strap = { cv:'#5d634a', fk:'#222427', br:'#a2a6aa' }[W.cfg.strap];
    $$('.fbdial').forEach(e => e.setAttribute('fill', d)); $$('.fbcase').forEach(e => e.setAttribute('fill', caseC)); $$('.fbstrap').forEach(e => e.setAttribute('fill', strap));
    $$('.fbink').forEach(e => e.setAttribute('stroke', ink)); $$('.fbink2').forEach(e => e.setAttribute('fill', ink));
    $$('.hands .h,.hands .m').forEach(e => e.setAttribute('fill', ink));
  };
  W.on(paint); paint();
  const tick = () => {
    const d = new Date(), s = d.getSeconds() + (reduced ? 0 : Math.floor(d.getMilliseconds() / 125) / 8), m = d.getMinutes() + s / 60, h = (d.getHours() % 12) + m / 60;
    $$('.fbw').forEach(svg => { svg.querySelector('.h').setAttribute('transform', `rotate(${h * 30} 130 130)`); svg.querySelector('.m').setAttribute('transform', `rotate(${m * 6} 130 130)`); svg.querySelector('.s').setAttribute('transform', `rotate(${s * 6} 130 130)`); });
    const sec = $('#assembly'), r = sec.getBoundingClientRect(), p = Math.min(1, Math.max(0, -r.top / Math.max(1, r.height - innerHeight)));
    const e = Math.min(1, Math.max(0, (p - .08) / .5));
    $$('.ex').forEach(g => { const i = +g.dataset.i; const y = 260 + (i - 3) * (22 + 46 * e); g.setAttribute('transform', `translate(0 ${y})`); });
    $$('#asmLabels li').forEach((li, i) => li.classList.toggle('on', e > i * 0.12));
    $('#sepVal').textContent = (e * 24).toFixed(1); $('#sepBar').style.setProperty('--e', e.toFixed(3));
  };
  setInterval(tick, reduced ? 1000 : 125); tick();
};
})();
</script>

<script type="module">
const W = window.AM;
const failSoon = setTimeout(() => { if (!window.__amGL) W.enableFallback('three.js did not load in time'); }, 9000);
let THREE, RoomEnvironment, RoundedBoxGeometry, POST = null;
try {
  const probe = document.createElement('canvas');
  if (!(probe.getContext('webgl2') || probe.getContext('webgl'))) throw new Error('WebGL unavailable');
  THREE = await import('three');
  ({ RoomEnvironment } = await import('three/addons/environments/RoomEnvironment.js'));
  ({ RoundedBoxGeometry } = await import('three/addons/geometries/RoundedBoxGeometry.js'));
  try {
    const mods = await Promise.all(['EffectComposer', 'RenderPass', 'UnrealBloomPass', 'OutputPass', 'ShaderPass'].map(n => import(`three/addons/postprocessing/${n}.js`)));
    POST = Object.assign({}, ...mods);
  } catch (e) { console.info('Aldermark: post-processing unavailable, plain render'); }
} catch (e) { clearTimeout(failSoon); W.enableFallback(e.message); }

if (THREE && !document.documentElement.classList.contains('no-gl')) {
  try { start(); window.__amGL = true; clearTimeout(failSoon); }
  catch (e) { console.warn(e); W.enableFallback('WebGL init failed'); }
}

function start() {
const reduced = W.reduced;
const fine = matchMedia('(hover: hover) and (pointer: fine)').matches;
const canvas = document.getElementById('gl');
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true, powerPreference: 'high-performance' });
renderer.setClearColor(0x000000, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
const DPR = Math.min(devicePixelRatio || 1, 1.75);
renderer.setPixelRatio(DPR);

const scene = new THREE.Scene();
const pm = new THREE.PMREMGenerator(renderer);
scene.environment = pm.fromScene(new RoomEnvironment(), 0.03).texture;
scene.environmentIntensity = 0.9;
const FOV = 26, CAMZ = 14;
const camera = new THREE.PerspectiveCamera(FOV, 1, 0.1, 60);
camera.position.set(0, 0, CAMZ);
const key = new THREE.DirectionalLight(0xffffff, 2.2); key.position.set(-3, 4, 6); scene.add(key);
const rim = new THREE.DirectionalLight(0xffe2cc, 1.4); rim.position.set(4, -1, -3); scene.add(rim);
scene.add(new THREE.HemisphereLight(0xffffff, 0x8a8c88, 0.5));

/* ---------- materials ---------- */
// bead-blast / brushing: a fine stripe-noise roughness map (lathe UVs run round the case, so stripes read as concentric brushing)
const brushTex = (() => { const c = document.createElement('canvas'); c.width = 64; c.height = 512; const g = c.getContext('2d');
  for (let y = 0; y < 512; y++) { const v = 150 + Math.random() * 70; g.fillStyle = `rgb(${v},${v},${v})`; g.fillRect(0, y, 64, 1); }
  const t = new THREE.CanvasTexture(c); t.wrapS = t.wrapT = THREE.RepeatWrapping; t.repeat.set(1, 3); return t; })();
const caseMat = new THREE.MeshStandardMaterial({ color: 0xc4c7ca, metalness: 1, roughness: 0.42, roughnessMap: brushTex });
const polishMat = new THREE.MeshStandardMaterial({ color: 0xd0d3d6, metalness: 1, roughness: 0.1 });
const tickMat = new THREE.MeshStandardMaterial({ color: 0x1b1e22, roughness: 0.7, metalness: 0.2 });
const signalMat = new THREE.MeshStandardMaterial({ color: 0xff4f14, roughness: 0.45, emissive: 0x3a0a00 });
const lumeMat = new THREE.MeshStandardMaterial({ color: 0xece6cf, roughness: 0.6, emissive: 0x8c8558, emissiveIntensity: 0.55 });
const handMat = new THREE.MeshStandardMaterial({ color: 0xe3e3e3, metalness: 1, roughness: 0.18 });
const glassMat = new THREE.MeshPhysicalMaterial({ color: 0xffffff, metalness: 0, roughness: 0.03, ior: 1.77, specularIntensity: 1, specularColor: new THREE.Color(0xd6e4ff), iridescence: 1, iridescenceIOR: 1.38, iridescenceThicknessRange: [180, 520], transparent: true, opacity: 0.07, depthWrite: false, envMapIntensity: 2.2 });
const plateMat = new THREE.MeshStandardMaterial({ color: 0x9a9384, metalness: 1, roughness: 0.55 });
const rotorMat = new THREE.MeshStandardMaterial({ color: 0xd8d9db, metalness: 1, roughness: 0.25 });
const jewelMat = new THREE.MeshStandardMaterial({ color: 0x9b1d22, roughness: 0.15, metalness: 0.1 });
const goldMat = new THREE.MeshStandardMaterial({ color: 0xc9a65a, metalness: 1, roughness: 0.35 });

/* canvas textures */
function canvasTex(size, draw, srgb = true) {
  const c = document.createElement('canvas'); c.width = c.height = size; const g = c.getContext('2d');
  draw(g, size); const t = new THREE.CanvasTexture(c); if (srgb) t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = 8; t.userData.draw = draw; t.userData.ctx = g; return t;
}
function redraw(t) { t.userData.draw(t.userData.ctx, t.image.width); t.needsUpdate = true; }

const DIALS = { gr: { bg: '#2a2d31', ink: '#ebe8de', mute: 'rgba(235,232,222,.55)' }, ch: { bg: '#e6e2d4', ink: '#1b1e22', mute: 'rgba(27,30,34,.55)' }, ol: { bg: '#4a5240', ink: '#efebdc', mute: 'rgba(239,235,220,.55)' } };
const dialTex = canvasTex(1024, (g, S) => {
  const d = DIALS[W.cfg.dial], c = S / 2;
  g.fillStyle = d.bg; g.fillRect(0, 0, S, S);
  const vg = g.createRadialGradient(c, c * .8, 50, c, c, c); vg.addColorStop(0, 'rgba(255,255,255,.06)'); vg.addColorStop(1, 'rgba(0,0,0,.12)'); g.fillStyle = vg; g.fillRect(0, 0, S, S);
  g.save(); g.translate(c, c);
  // minute track
  g.strokeStyle = d.ink;
  for (let i = 0; i < 60; i++) { g.save(); g.rotate(i * Math.PI / 30); g.lineWidth = i % 5 ? 3 : 6; g.beginPath(); g.moveTo(0, -500); g.lineTo(0, i % 5 ? -476 : -462); g.stroke(); g.restore(); }
  g.lineWidth = 2; g.beginPath(); g.arc(0, 0, 452, 0, Math.PI * 2); g.stroke();
  // hour plots
  for (let h = 1; h <= 12; h++) {
    if (h % 3 === 0) continue;
    g.save(); g.rotate(h * Math.PI / 6);
    g.fillStyle = '#ece6cf'; g.strokeStyle = d.ink; g.lineWidth = 3;
    g.beginPath(); g.roundRect(-17, -446, 34, 74, 6); g.fill(); g.stroke(); g.restore();
  }
  // numerals
  g.fillStyle = d.ink; g.textAlign = 'center'; g.textBaseline = 'middle';
  g.font = '700 190px "Barlow Condensed", "Arial Narrow", sans-serif';
  [[12, 0, -352], [3, 352, 8], [6, 0, 362], [9, -352, 8]].forEach(([t, x, y]) => g.fillText(t, x, y));
  // 24h inner
  g.font = '500 34px "IBM Plex Mono", monospace'; g.fillStyle = d.mute;
  for (let h = 1; h <= 12; h++) { if (h % 3 === 0) continue; const a = h * Math.PI / 6; g.fillText(h + 12, Math.sin(a) * 300, -Math.cos(a) * 300); }
  // brand
  g.fillStyle = d.ink; g.font = '600 56px "Barlow Condensed", sans-serif';
  g.letterSpacing = '12px'; g.fillText('ALDERMARK', 6, -170); g.letterSpacing = '0px';
  g.font = '500 26px "IBM Plex Mono", monospace'; g.fillStyle = d.mute; g.fillText('INSTRUMENTS', 0, -118);
  g.font = '600 40px "Barlow Condensed", sans-serif'; g.fillStyle = d.ink; g.fillText('TYPE 38 · AUTOMATIC', 0, 175);
  g.font = '500 26px "IBM Plex Mono", monospace'; g.fillStyle = '#ff4f14'; g.fillText('FIELD · 200 M', 0, 222);
  g.restore();
});
const backTex = canvasTex(1024, (g, S) => {
  const c = S / 2; g.fillStyle = '#9a9ea2'; g.fillRect(0, 0, S, S);
  g.save(); g.translate(c, c);
  for (let r = 500; r > 0; r -= 6) { g.strokeStyle = r % 12 ? 'rgba(255,255,255,.08)' : 'rgba(0,0,0,.06)'; g.lineWidth = 3; g.beginPath(); g.arc(0, 0, r, 0, 7); g.stroke(); }
  g.strokeStyle = 'rgba(20,22,25,.85)'; g.lineWidth = 4; g.beginPath(); g.arc(0, 0, 470, 0, 7); g.stroke(); g.beginPath(); g.arc(0, 0, 330, 0, 7); g.stroke();
  g.fillStyle = 'rgba(20,22,25,.88)'; g.font = '600 46px "IBM Plex Mono", monospace'; g.textAlign = 'center'; g.textBaseline = 'middle';
  const ring = 'ALDERMARK INSTRUMENTS · TYPE 38 · 316L · WATER RESISTANT 200 M · NO. 0386 · ';
  const step = Math.PI * 2 / ring.length;
  for (let i = 0; i < ring.length; i++) { g.save(); g.rotate(i * step); g.fillText(ring[i], 0, -402); g.restore(); }
  const txt = W.cfg.engr || '';
  if (txt) {
    let fs = 96; g.font = `600 ${fs}px "Barlow Condensed", sans-serif`;
    while (g.measureText(txt).width > 560 && fs > 40) { fs -= 4; g.font = `600 ${fs}px "Barlow Condensed", sans-serif`; }
    g.fillStyle = 'rgba(20,22,25,.9)'; g.fillText(txt, 0, 0);
    g.font = '500 30px "IBM Plex Mono", monospace'; g.fillText('ENGRAVED TO ORDER', 0, fs * .8 + 20);
  } else {
    g.strokeStyle = 'rgba(20,22,25,.85)'; g.lineWidth = 5;
    g.beginPath(); g.moveTo(-120, 70); g.lineTo(-40, -50); g.lineTo(10, 20); g.lineTo(60, -30); g.lineTo(140, 70); g.closePath(); g.stroke();
    g.font = '500 30px "IBM Plex Mono", monospace'; g.fillText('N 61° · FIELD TESTED', 0, 140);
  }
  g.restore();
});
const strapTex = canvasTex(256, (g, S) => {
  const s = W.cfg.strap;
  if (s === 'cv') { g.fillStyle = '#434a33'; g.fillRect(0, 0, S, S); for (let y = 0; y < S; y += 4) { g.fillStyle = y % 8 ? 'rgba(0,0,0,.14)' : 'rgba(255,255,255,.07)'; g.fillRect(0, y, S, 2); } for (let x = 0; x < S; x += 8) { g.fillStyle = 'rgba(0,0,0,.07)'; g.fillRect(x, 0, 2, S); } g.fillStyle = 'rgba(0,0,0,.25)'; g.fillRect(14, 0, 3, S); g.fillRect(S - 17, 0, 3, S); g.fillStyle = '#cfc9ab'; for (let y = 0; y < S; y += 16) { g.fillRect(24, y, 3, 10); g.fillRect(S - 27, y, 3, 10); } }
  else if (s === 'fk') { g.fillStyle = '#232528'; g.fillRect(0, 0, S, S); for (let y = 0; y < S; y += 32) { g.fillStyle = 'rgba(255,255,255,.05)'; g.fillRect(30, y, S - 60, 3); } }
  else { g.fillStyle = '#ffffff'; g.fillRect(0, 0, S, S); for (let y = 0; y < S; y += 32) { g.fillStyle = 'rgba(0,0,0,.6)'; g.fillRect(0, y, S, 3); } g.fillStyle = 'rgba(0,0,0,.35)'; g.fillRect(S * .3, 0, 2, S); g.fillRect(S * .7, 0, 2, S); }
});
strapTex.wrapS = strapTex.wrapT = THREE.RepeatWrapping; strapTex.repeat.set(1, 1.2);
const strapMat = new THREE.MeshStandardMaterial({ map: strapTex, bumpMap: strapTex, bumpScale: 1.4, roughness: 0.9, metalness: 0, transparent: true });

const dialMat = new THREE.MeshStandardMaterial({ map: dialTex, roughness: 0.62, metalness: 0.05 });
const backMat = new THREE.MeshStandardMaterial({ map: backTex, metalness: 1, roughness: 0.4, color: 0xffffff });

/* ---------- geometry ---------- */
const lathe = (pts, seg = 128) => new THREE.LatheGeometry(pts.map(([r, z]) => new THREE.Vector2(r, z)), seg);
// Lathe spins around Y; we build everything with axis = Y, then rotate the whole watch so Y→Z.
const watch = new THREE.Group();     // positioned in screen space
const turn = new THREE.Group();      // cursor turntable + pose
const axis = new THREE.Group();      // rotates lathe Y-axis onto Z
axis.rotation.x = Math.PI / 2;       // y(up) -> z(toward camera)
watch.add(turn); turn.add(axis); scene.add(watch);
const part = name => { const g = new THREE.Group(); g.name = name; axis.add(g); return g; };
// In axis space: +y = toward viewer (dial side). Lathe profile pairs are [radius, height].
const P = { crystal: part('crystal'), bezel: part('bezel'), hands: part('hands'), dial: part('dial'), case: part('case'), movement: part('movement'), back: part('back'), strap: part('strap') };

// case middle (closed profile)
P.case.add(new THREE.Mesh(lathe([[0.86, -0.2], [0.95, -0.22], [0.99, -0.19], [1.0, -0.1], [1.0, 0.13], [0.98, 0.19], [0.86, 0.2], [0.86, -0.2]]), caseMat));
// lugs
const lugGeo = new RoundedBoxGeometry(0.2, 0.26, 0.5, 4, 0.06);
for (const sx of [-1, 1]) for (const sz of [-1, 1]) {
  const m = new THREE.Mesh(lugGeo, caseMat); m.position.set(sx * 0.625, -0.04, sz * 0.97); m.rotation.x = sz * 0.16; P.case.add(m);
}
// crown + guards (at +x, 3 o'clock); dial up is -z in axis space after rotation? we map 12 o'clock to -z here (axis space) -> +y on screen
const crown = new THREE.Group(); crown.name = 'crown';
const crownBody = new THREE.Mesh(new THREE.CylinderGeometry(0.13, 0.13, 0.16, 40), polishMat); crownBody.rotation.z = Math.PI / 2; crown.add(crownBody);
const knurl = new THREE.BoxGeometry(0.16, 0.02, 0.03);
for (let i = 0; i < 20; i++) { const k = new THREE.Mesh(knurl, polishMat); const a = i / 20 * Math.PI * 2; k.position.set(0, Math.cos(a) * 0.132, Math.sin(a) * 0.132); k.rotation.x = -a; crown.add(k); }
const stem = new THREE.Mesh(new THREE.CylinderGeometry(0.06, 0.06, 0.1, 20), caseMat); stem.rotation.z = Math.PI / 2; stem.position.x = -0.1; crown.add(stem);
crown.position.set(1.12, 0, 0); P.case.add(crown);
for (const sz of [-1, 1]) { const gd = new THREE.Mesh(new RoundedBoxGeometry(0.2, 0.22, 0.1, 3, 0.03), caseMat); gd.position.set(1.04, -0.02, sz * 0.2); P.case.add(gd); }

// bezel
P.bezel.add(new THREE.Mesh(lathe([[0.86, 0.2], [1.0, 0.2], [1.025, 0.235], [1.01, 0.285], [0.92, 0.31], [0.86, 0.305], [0.86, 0.2]]), polishMat));
// bezel scalloped edge (120 clicks)
const notch = new THREE.BoxGeometry(0.018, 0.05, 0.03);
const notches = new THREE.InstancedMesh(notch, tickMat, 120); const m4 = new THREE.Matrix4(), q = new THREE.Quaternion(), v3 = new THREE.Vector3(), one = new THREE.Vector3(1, 1, 1);
for (let i = 0; i < 120; i++) { const a = i / 120 * Math.PI * 2; q.setFromAxisAngle(new THREE.Vector3(0, 1, 0), -a); v3.set(Math.cos(a) * 1.022, 0.245, Math.sin(a) * 1.022); m4.compose(v3, q, one); notches.setMatrixAt(i, m4); }
P.bezel.add(notches);
// engraved ticks on bezel top
const tickGeo = new THREE.BoxGeometry(0.012, 0.012, 1);
const ticks = new THREE.InstancedMesh(tickGeo, tickMat, 60);
for (let i = 0; i < 60; i++) {
  const a = i / 60 * Math.PI * 2, len = i % 5 ? 0.035 : 0.065, r = 0.985 - len / 2;
  q.setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI - a);
  // angle 0 at 12 o'clock which is -z in axis space
  v3.set(Math.sin(a) * r, 0.31 - (r - 0.92) / 0.09 * 0.025 - 0.002, -Math.cos(a) * r);
  m4.compose(v3, q, new THREE.Vector3(i % 5 ? 1 : 1.8, 1, len)); ticks.setMatrixAt(i, m4);
}
P.bezel.add(ticks);
const pip = new THREE.Mesh(new THREE.CylinderGeometry(0.035, 0.035, 0.02, 24), signalMat); pip.position.set(0, 0.315, -0.94); P.bezel.add(pip);

// crystal (domed)
const cr = new THREE.Mesh(lathe([[0.001, 0.335], [0.4, 0.332], [0.7, 0.322], [0.86, 0.305], [0.87, 0.22], [0.001, 0.22]], 96), glassMat);
P.crystal.add(cr);
{ const edge = new THREE.Mesh(new THREE.TorusGeometry(0.862, 0.012, 8, 96), new THREE.MeshStandardMaterial({ color: 0xbcd3e6, metalness: 0.2, roughness: 0.1, transparent: true, opacity: 0.55 })); edge.rotation.x = Math.PI / 2; edge.position.y = 0.3; P.crystal.add(edge); }

// dial
const dialDisc = new THREE.Mesh(new THREE.CircleGeometry(0.86, 96), dialMat);
dialDisc.rotation.x = -Math.PI / 2; dialDisc.position.y = 0.12;
// CircleGeometry faces +z; after rotation.x=-PI/2 it faces +y. Its texture top (v=1) maps to -z = 12 o'clock.
P.dial.add(dialDisc);
const dialEdge = new THREE.Mesh(new THREE.CylinderGeometry(0.86, 0.86, 0.03, 96, 1, true), dialMat); dialEdge.position.y = 0.105; P.dial.add(dialEdge);

// hands: built in XZ-plane pointing to -z (12 o'clock), pivot at origin, rotate around y
function handShape(w, len, tip, tail) {
  const s = new THREE.Shape(); s.moveTo(-w, -tail); s.lineTo(w, -tail); s.lineTo(w, len); s.lineTo(0, len + tip); s.lineTo(-w, len); s.closePath(); return s;
}
function flatMesh(shape, depth, mat) {
  const g = new THREE.ExtrudeGeometry(shape, { depth, bevelEnabled: false, curveSegments: 16 });
  g.rotateX(-Math.PI / 2); // shape y -> -z, extrude along +y
  return new THREE.Mesh(g, mat);
}
const hourH = new THREE.Group(), minH = new THREE.Group(), secH = new THREE.Group();
hourH.add(flatMesh(handShape(0.038, 0.4, 0.09, 0.09), 0.012, handMat));
{ const l = flatMesh(handShape(0.022, 0.36, 0.05, -0.1), 0.006, lumeMat); l.position.y = 0.012; hourH.add(l); }
minH.add(flatMesh(handShape(0.028, 0.64, 0.09, 0.1), 0.012, handMat));
{ const l = flatMesh(handShape(0.015, 0.6, 0.06, -0.12), 0.006, lumeMat); l.position.y = 0.012; minH.add(l); }
{ const s = new THREE.Shape(); s.moveTo(-0.007, -0.2); s.lineTo(0.007, -0.2); s.lineTo(0.004, 0.8); s.lineTo(-0.004, 0.8); s.closePath(); secH.add(flatMesh(s, 0.006, signalMat));
  const cw = new THREE.Shape(); cw.absarc(0, -0.16, 0.04, 0, Math.PI * 2); secH.add(flatMesh(cw, 0.006, signalMat));
  const lp = new THREE.Shape(); lp.absarc(0, 0.6, 0.022, 0, Math.PI * 2); const lpm = flatMesh(lp, 0.004, lumeMat); lpm.position.y = 0.006; secH.add(lpm); }
const cap = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.03, 0.06, 24), signalMat); cap.position.y = 0.16;
hourH.position.y = 0.128; minH.position.y = 0.145; secH.position.y = 0.162;
P.hands.add(hourH, minH, secH, cap);

// movement
const plate = new THREE.Mesh(new THREE.CylinderGeometry(0.8, 0.8, 0.16, 96), plateMat); plate.position.y = -0.06; P.movement.add(plate);
const rotor = new THREE.Group();
{ const s = new THREE.Shape(); s.absarc(0, 0, 0.76, 0, Math.PI, false); s.lineTo(-0.1, 0); s.absarc(0, 0, 0.1, Math.PI, 0, true); s.closePath();
  const g = new THREE.ExtrudeGeometry(s, { depth: 0.03, bevelEnabled: true, bevelSize: 0.01, bevelThickness: 0.01, bevelSegments: 2, curveSegments: 48 }); g.rotateX(Math.PI / 2);
  rotor.add(new THREE.Mesh(g, rotorMat)); const hub = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 0.05, 32), goldMat); rotor.add(hub); }
rotor.position.y = -0.16; P.movement.add(rotor);
const balance = new THREE.Mesh(new THREE.TorusGeometry(0.16, 0.018, 12, 48), goldMat); balance.rotation.x = Math.PI / 2; balance.position.set(0.38, 0.035, 0.3); P.movement.add(balance);
{ const sp = new THREE.BoxGeometry(0.3, 0.01, 0.016); for (let i = 0; i < 3; i++) { const m = new THREE.Mesh(sp, goldMat); m.rotation.z = i * Math.PI / 3; balance.add(m); }
  const pts = []; for (let i = 0; i <= 220; i++) { const a = i / 220 * Math.PI * 2 * 7, r = 0.02 + i / 220 * 0.11; pts.push(new THREE.Vector3(Math.cos(a) * r, 0.05, Math.sin(a) * r)); }
  const hs = new THREE.Line(new THREE.BufferGeometry().setFromPoints(pts), new THREE.LineBasicMaterial({ color: 0x3b5fa8 })); hs.position.set(0.38, 0.0, 0.3); P.movement.add(hs);
  const blued = new THREE.MeshStandardMaterial({ color: 0x2a4f9e, metalness: 1, roughness: 0.25 });
  const sg = new THREE.CylinderGeometry(0.03, 0.03, 0.02, 20);
  for (const [x, z] of [[-0.55, -0.2], [0.1, -0.55], [0.58, -0.15], [-0.2, 0.55], [0.15, 0.25], [-0.6, 0.25], [0.45, 0.5]]) { const m = new THREE.Mesh(sg, blued); m.position.set(x, 0.06, z); P.movement.add(m); }
  const bridge2 = new THREE.Mesh(new RoundedBoxGeometry(0.62, 0.035, 0.12, 3, 0.02), plateMat); bridge2.position.set(0.3, 0.05, 0.15); bridge2.rotation.y = -0.9; P.movement.add(bridge2); }
const bridge = new THREE.Mesh(new RoundedBoxGeometry(0.9, 0.04, 0.16, 3, 0.02), plateMat); bridge.position.set(-0.05, 0.03, -0.32); bridge.rotation.y = 0.4; P.movement.add(bridge);
for (const [x, z, r] of [[-0.3, 0.2, 0.18], [0.05, -0.05, 0.12], [-0.45, -0.25, 0.1]]) { const gr = new THREE.Mesh(new THREE.CylinderGeometry(r, r, 0.025, 30), goldMat); gr.position.set(x, 0.035, z); P.movement.add(gr); }
const jg = new THREE.SphereGeometry(0.022, 12, 8);
for (const [x, z] of [[0.38, 0.3], [-0.3, 0.2], [0.05, -0.05], [-0.45, -0.25], [0.3, -0.45], [-0.5, 0.4]]) { const j = new THREE.Mesh(jg, jewelMat); j.position.set(x, 0.05, z); P.movement.add(j); }

// caseback
P.back.add(new THREE.Mesh(lathe([[0.001, -0.31], [0.62, -0.31], [0.82, -0.29], [0.92, -0.25], [0.93, -0.21], [0.86, -0.2], [0.001, -0.2]]), caseMat));
const medallion = new THREE.Mesh(new THREE.CircleGeometry(0.62, 96), backMat); medallion.rotation.x = Math.PI / 2; medallion.rotation.z = Math.PI; medallion.position.y = -0.312; P.back.add(medallion);

// strap: ribbon geometry along a curve in the (y,z) axis-space plane
function ribbon(points, width, th, segs = 48) {
  const curve = new THREE.CatmullRomCurve3(points, false, 'centripetal');
  const pos = [], uv = [], idx = []; const L = curve.getLength();
  const ring = (t, i) => {
    const p = curve.getPointAt(t), tg = curve.getTangentAt(t); const n = new THREE.Vector3(0, tg.z, -tg.y).normalize();
    // n is perpendicular to tangent in the y/z plane; ensure it points "up" (toward dial side)
    if (n.y < 0) n.multiplyScalar(-1);
    const hw = width / 2, ht = th / 2;
    const c = [[-hw, ht], [hw, ht], [hw, -ht], [-hw, -ht]];
    return c.map(([x, o]) => [p.x + x, p.y + n.y * o, p.z + n.z * o]);
  };
  const rings = []; for (let i = 0; i <= segs; i++) rings.push(ring(i / segs, i));
  // 4 faces, each its own strip so normals stay crisp
  const faces = [[0, 1], [1, 2], [2, 3], [3, 0]];
  faces.forEach(([a, b], f) => {
    const base = pos.length / 3;
    for (let i = 0; i <= segs; i++) { const r = rings[i]; pos.push(...r[a], ...r[b]); const v = i / segs * L / 0.6; uv.push(0, v, 1, v); }
    for (let i = 0; i < segs; i++) { const k = base + i * 2; idx.push(k, k + 2, k + 1, k + 1, k + 2, k + 3); }
  });
  const g = new THREE.BufferGeometry(); g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3)); g.setAttribute('uv', new THREE.Float32BufferAttribute(uv, 2)); g.setIndex(idx); g.computeVertexNormals();
  return g;
}
const V = (y, z) => new THREE.Vector3(0, y, z);
// axis space: 12 o'clock = -z, 6 o'clock = +z; back of watch = -y
const strapTop = ribbon([V(-0.06, -1.12), V(-0.12, -1.55), V(-0.42, -1.95), V(-0.95, -2.2), V(-1.6, -2.22)], 1.02, 0.07);
const strapBot = ribbon([V(-0.06, 1.12), V(-0.12, 1.55), V(-0.42, 1.95), V(-0.95, 2.2), V(-1.6, 2.22)], 1.02, 0.07);
// each strap hangs from a pivot at its lug bar, so it can trail the head on a spring
const strapTopG = new THREE.Group(), strapBotG = new THREE.Group();
strapTopG.position.set(0, -0.06, -1.12); strapBotG.position.set(0, -0.06, 1.12);
strapTop.translate(0, 0.06, 1.12); strapBot.translate(0, 0.06, -1.12);
strapTopG.add(new THREE.Mesh(strapTop, strapMat)); strapBotG.add(new THREE.Mesh(strapBot, strapMat));
P.strap.add(strapTopG, strapBotG);
// keepers on canvas
const keeperMat = new THREE.MeshStandardMaterial({ color: 0xbfc2c5, metalness: 1, roughness: 0.3, transparent: true });
const keeper = new THREE.Mesh(new RoundedBoxGeometry(1.1, 0.12, 0.09, 2, 0.03), keeperMat); keeper.position.set(0, -0.14, 0.48); keeper.rotation.x = 0.7; strapBotG.add(keeper);
const keeper2 = keeper.clone(); keeper2.position.z = -0.48; keeper2.rotation.x = -0.7; strapTopG.add(keeper2);
// soft contact shadow behind the head, so the watch sits on the paper
const shadowTex = canvasTex(256, (g, S) => { const r = g.createRadialGradient(S / 2, S / 2, 0, S / 2, S / 2, S / 2); r.addColorStop(0, 'rgba(20,22,26,.42)'); r.addColorStop(.45, 'rgba(20,22,26,.18)'); r.addColorStop(1, 'rgba(20,22,26,0)'); g.fillStyle = r; g.fillRect(0, 0, S, S); });
const shadowMat = new THREE.MeshBasicMaterial({ map: shadowTex, transparent: true, depthWrite: false, toneMapped: false });
const shadow = new THREE.Mesh(new THREE.PlaneGeometry(3.4, 5.2), shadowMat); shadow.rotation.x = -Math.PI / 2; shadow.position.set(0.22, -1.9, 0.34); axis.add(shadow);

/* explode offsets along the axis (axis-space y) */
const EX = { crystal: 2.35, bezel: 1.75, hands: 1.2, dial: 0.78, case: 0, movement: -0.85, back: -1.7 };
const STACK_MID = (EX.crystal + EX.back) / 2;

/* ---------- apply configuration ---------- */
const FIN = {
  st: { c: 0xc4c7ca, r: 0.36, m: 1, tick: 0x1b1e22 },
  dlc: { c: 0x2b2d31, r: 0.42, m: 0.85, tick: 0xd7d5cc },
  ti: { c: 0x9d9a93, r: 0.5, m: 1, tick: 0x1b1e22 },
};
let lastDial = null, lastStrap = null, lastEngr = null;
function applyCfg(c) {
  const f = FIN[c.case]; caseMat.color.setHex(f.c); caseMat.roughness = f.r + 0.06; caseMat.metalness = f.m; polishMat.color.setHex(f.c).offsetHSL(0, 0, 0.03); polishMat.roughness = c.case === 'dlc' ? 0.22 : 0.1; polishMat.metalness = f.m; tickMat.color.setHex(f.tick);
  backMat.color.setHex(c.case === 'dlc' ? 0x4a4c50 : c.case === 'ti' ? 0xc9c5bc : 0xffffff);
  if (c.dial !== lastDial) { redraw(dialTex); lastDial = c.dial; const dark = c.dial !== 'ch'; handMat.color.setHex(dark ? 0xe3e3e3 : 0x2a2c30); handMat.roughness = dark ? 0.18 : 0.3; }
  if (c.strap !== lastStrap) {
    redraw(strapTex); lastStrap = c.strap;
    if (c.strap === 'br') { strapMat.color.copy(caseMat.color); strapMat.metalness = 1; strapMat.roughness = 0.32; strapTex.repeat.set(1, 0.35); }
    else { strapMat.color.setHex(0xffffff); strapMat.metalness = 0; strapMat.roughness = c.strap === 'fk' ? 0.55 : 0.95; strapTex.repeat.set(1, c.strap === 'fk' ? 0.4 : 1.2); }
    keeper.visible = keeper2.visible = c.strap === 'cv';
  }
  if (c.strap === 'br') strapMat.color.copy(caseMat.color);
  if (c.engr !== lastEngr) { redraw(backTex); lastEngr = c.engr; }
  dirty = true;
}
W.on(applyCfg);
let dirty = true;
applyCfg(W.cfg);
document.fonts && document.fonts.ready.then(() => { redraw(dialTex); redraw(backTex); dirty = true; });

/* ---------- slots & travel ---------- */
const POSES = {
  hero: { rx: 0.06, ry: -0.14, rz: 0.04, fit: 2.6, ex: 0, op: 1 },
  assembly: { rx: -1.2, ry: 0.38, rz: 0.0, fit: 5.4, ex: 1, op: 1 },
  specs: { rx: 0.22, ry: -0.95, rz: -0.12, fit: 2.75, ex: 0, op: 1 },
  configure: { rx: 0.08, ry: 0.22, rz: 0, fit: 3.5, ex: 0, op: 1 },
  exit: { rx: 0.08, ry: 0.22, rz: 0, fit: 3.5, ex: 0, op: 0 },
};
const slotEls = [...document.querySelectorAll('[data-slot]')];
const asmSec = document.getElementById('assembly'), fieldSec = document.getElementById('field');
let stops = [];
function stickyOf(el) { for (let n = el; n && n !== document.body; n = n.parentElement) if (getComputedStyle(n).position === 'sticky') return n; return null; }
function docTop(el) { let y = 0; while (el) { y += el.offsetTop; el = el.offsetParent; } return y; }
function layout() {
  const ih = innerHeight; stops = [];
  for (const el of slotEls) {
    const name = el.dataset.slot; let a, b;
    if (name === 'assembly') { a = docTop(asmSec); b = a + asmSec.offsetHeight - ih; }
    else if (stickyOf(el)) {
      const sk = stickyOf(el), col = sk.parentElement, h = sk.offsetHeight, stickTop = parseFloat(getComputedStyle(sk).top) || 0;
      const inner = el === sk ? 0 : el.getBoundingClientRect().top - sk.getBoundingClientRect().top;
      const centre = stickTop + inner + el.offsetHeight / 2 - ih / 2; // viewport offset of slot centre from mid-screen while stuck
      a = docTop(col) - stickTop; b = Math.max(a, docTop(col) + col.offsetHeight - h - stickTop);
      el._stickShift = centre;
    } else { const t = el.getBoundingClientRect().top + scrollY; a = b = t + el.offsetHeight / 2 - ih / 2; }
    if (name === 'hero') { a = -1e9; b = Math.max(0, b); }
    if (name === 'configure') { b = Math.max(a, b); }
    stops.push({ name, el, a, b });
  }
  // exit: fade while the field section rises
  const cfg = stops.find(s => s.name === 'configure');
  const fTop = docTop(fieldSec) - ih * 0.55;
  if (cfg.b > fTop - ih * 0.25) cfg.b = Math.max(cfg.a, fTop - ih * 0.25);
  stops.push({ name: 'exit', el: cfg.el, a: fTop, b: 1e12 });
  for (let i = 1; i < stops.length; i++) if (stops[i].a < stops[i - 1].b + 1) stops[i].a = stops[i - 1].b + 1;
  resize();
}
function resize() {
  renderer.setSize(innerWidth, innerHeight, false);
  if (composer) { composer.setPixelRatio(DPR); composer.setSize(innerWidth, innerHeight); bloom.resolution.set(innerWidth, innerHeight); }
  camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix(); dirty = true;
}
const ss = t => t * t * (3 - 2 * t);
const lerp = (a, b, t) => a + (b - a) * t;
function rectOf(el) { const r = el.getBoundingClientRect(); return { cx: r.left + r.width / 2, cy: r.top + r.height / 2, s: Math.min(r.width, r.height) }; }

/* ---------- motion state ---------- */
const spring = { x: 0, y: 0, vx: 0, vy: 0, tx: 0, ty: 0 };
let spinYaw = 0, spinV = 0, flipA = 0;
const lag = { y: 0, p: 0, vy: 0, vp: 0, init: true };
if (fine && !reduced) addEventListener('pointermove', e => { spring.tx = (e.clientX / innerWidth - 0.5) * 2; spring.ty = (e.clientY / innerHeight - 0.5) * 2; }, { passive: true });

/* leaders */
const asmLabels = [...document.querySelectorAll('#asmLabels li')];
const leaderSvg = document.querySelector('.leaders');
const pinBox = document.querySelector('.pins');
const ORDER = ['crystal', 'bezel', 'hands', 'dial', 'case', 'movement', 'back'];
const ANCH = { crystal: [0.75, 0.3, 0.1], bezel: [1.0, 0.26, 0.15], hands: [0.0, 0.16, -0.55], dial: [0.8, 0.12, 0.25], case: [1.0, 0.0, 0.25], movement: [0.78, -0.06, 0.25], back: [0.9, -0.24, 0.2] };
leaderSvg.innerHTML = ORDER.map(() => '<path/><circle r="3.5"/><circle r="3"/>').join('');
pinBox.innerHTML = ORDER.map((_, i) => `<span>${String(i + 1).padStart(2, '0')}</span>`).join('');
const lPaths = [...leaderSvg.querySelectorAll('path')], lDots = [...leaderSvg.querySelectorAll('circle')], pins = [...pinBox.children];
const sepVal = document.getElementById('sepVal'), sepBar = document.getElementById('sepBar');
const tmpV = new THREE.Vector3();

let firstDone = false;
let lastT = performance.now(), lastBeat = -1, lastScroll = -1, visible = true;
document.addEventListener('visibilitychange', () => { visible = !document.hidden; if (visible) { lastT = performance.now(); requestAnimationFrame(frame); } });
function frame(now) {
  if (!visible) return;
  requestAnimationFrame(frame);
  const dt = Math.min(0.05, (now - lastT) / 1000); lastT = now;
  const sy = scrollY;
  // find state
  let A = stops[0], B = stops[0], t = 0;
  for (let i = 0; i < stops.length; i++) {
    const s = stops[i];
    if (sy <= s.b) { if (sy >= s.a || i === 0) { A = B = s; t = 0; } else { A = stops[i - 1]; B = s; t = (sy - A.b) / Math.max(1, s.a - A.b); } break; }
    A = B = s;
  }
  t = Math.min(1, Math.max(0, t)); t = reduced ? (t < 0.5 ? 0 : 1) : ss(t);
  const pa = POSES[A.name], pb = POSES[B.name];
  const ra = rectOf(A.el), rb = A === B ? ra : rectOf(B.el);
  const cx = lerp(ra.cx, rb.cx, t), cy = lerp(ra.cy, rb.cy, t);
  // fit is in "units across the slot"; interpolate the pixel-per-unit, not the slot size
  const ppu = lerp(ra.s / pa.fit, rb.s / pb.fit, t);
  let ex = lerp(pa.ex, pb.ex, t), op = lerp(pa.op, pb.op, t);
  // assembly: explode driven by progress within the pin
  let asmP = 0;
  { const st = stops.find(s => s.name === 'assembly'); asmP = Math.min(1, Math.max(0, (sy - st.a) / Math.max(1, st.b - st.a))); }
  const exAmt = Math.min(1, Math.max(0, (asmP - 0.06) / 0.5));
  const exE = reduced ? exAmt : 1 - Math.pow(1 - exAmt, 3);
  if (A.name === 'assembly' && B.name === 'assembly') ex = exE; else if (B.name === 'assembly') ex = 0; else if (A.name === 'assembly') ex = exE * (1 - t);
  // phase 2 of the pin: the camera flies THROUGH the stack into the movement
  let fly = 0;
  if (A.name === 'assembly' && B.name === 'assembly') fly = reduced ? 0 : ss(Math.min(1, Math.max(0, (asmP - 0.6) / 0.34)));
  // world mapping
  const worldH = 2 * CAMZ * Math.tan(FOV * Math.PI / 360), k = worldH / innerHeight;
  watch.position.set((cx - innerWidth / 2) * k, -(cy - innerHeight / 2) * k, 0);
  watch.scale.setScalar(ppu * k * (1 + fly * 2.3));
  // springs
  if (!reduced) {
    const K = 38, C = 2 * Math.sqrt(K) * 0.62;
    spring.vx += ((spring.tx - spring.x) * K - spring.vx * C) * dt; spring.vy += ((spring.ty - spring.y) * K - spring.vy * C) * dt;
    spring.x += spring.vx * dt; spring.y += spring.vy * dt;
  }
  // configurator yaw (drag + buttons) springs to target
  const cfgW = (A.name === 'configure' ? 1 - t : 0) + (B.name === 'configure' ? t : 0) + (A.name === 'exit' ? 1 : 0);
  const yawT = W.view.yaw; const flipT = W.view.back ? Math.PI : 0;
  if (reduced) { spinYaw = yawT; flipA = flipT; } else {
    spinV += ((yawT - spinYaw) * 30 - spinV * 9) * dt; spinYaw += spinV * dt;
    flipA += (flipT - flipA) * (1 - Math.exp(-dt * 7));
  }
  turn.rotation.set(
    lerp(pa.rx, pb.rx, t) * (1 - fly * 0.72) + spring.y * 0.16,
    lerp(pa.ry, pb.ry, t) * (1 - fly * 0.6) + spring.x * 0.32 + (spinYaw + flipA) * cfgW,
    lerp(pa.rz, pb.rz, t), 'XYZ');
  // explode
  const mid = lerp(STACK_MID, EX.movement, fly);
  for (const n of ORDER) P[n].position.y = (EX[n] + (EX[n] > EX.movement ? fly * 9 : n === 'movement' ? 0 : -fly * 6)) * ex - mid * ex;
  P.strap.position.y = -mid * ex;
  for (const n of ['crystal', 'bezel', 'hands', 'dial']) P[n].visible = fly < 0.42; // they have flown past the lens
  P.back.visible = fly < 0.6;
  document.documentElement.style.setProperty('--fly', fly.toFixed(3)); crown.position.x = 1.12 + ex * 0.55;
  const sOp = Math.max(0, 1 - ex * 3.5); strapMat.opacity = sOp * op; keeperMat.opacity = sOp * op; P.strap.visible = sOp * op > 0.01;
  shadowMat.opacity = sOp * op; shadow.visible = sOp > 0.01;
  // the straps trail the head's turn on an underdamped spring (secondary motion)
  if (!reduced) {
    const yawNow = turn.rotation.y, pitNow = turn.rotation.x, K2 = 26, C2 = 2 * Math.sqrt(K2) * 0.32;
    if (lag.init) { lag.y = yawNow; lag.p = pitNow; lag.init = false; }
    lag.vy += ((yawNow - lag.y) * K2 - lag.vy * C2) * dt; lag.y += lag.vy * dt;
    lag.vp += ((pitNow - lag.p) * K2 - lag.vp * C2) * dt; lag.p += lag.vp * dt;
    const cl = v => Math.max(-0.38, Math.min(0.38, v));
    const oy = cl(lag.y - yawNow), op2 = cl(lag.p - pitNow);
    strapTopG.rotation.set(-op2 * 0.55, 0, -oy * 0.75); strapBotG.rotation.set(op2 * 0.55, 0, -oy * 0.75);
  }
  rotor.rotation.y += dt * (0.6 + Math.abs(spring.vx) * 4) * (reduced ? 0 : 1);
  balance.rotation.z = reduced ? 0 : Math.sin(now / 1000 * Math.PI * 8) * 1.4;
  // global opacity via canvas
  canvas.style.opacity = op.toFixed(3); window.__am = { A: A.name, B: B.name, t: +t.toFixed(3), op: +op.toFixed(3), stops: stops.map(s => [s.name, Math.round(s.a), Math.round(s.b)]) };
  // hands
  const d = new Date(); const ms = d.getMilliseconds();
  const sec = d.getSeconds() + (reduced ? 0 : Math.floor(ms / 125) / 8);
  const min = d.getMinutes() + sec / 60, hr = (d.getHours() % 12) + min / 60;
  secH.rotation.y = -sec / 60 * Math.PI * 2; minH.rotation.y = -min / 60 * Math.PI * 2; hourH.rotation.y = -hr / 12 * Math.PI * 2;
  const beat = Math.floor((d.getTime()) / 125);
  // leaders
  const inAsm = (A.name === 'assembly' || B.name === 'assembly');
  if (inAsm) {
    sepVal.textContent = (ex * 24).toFixed(1); sepBar.style.setProperty('--e', ex.toFixed(3));
    watch.updateMatrixWorld(true);
    const box = leaderSvg.getBoundingClientRect(), pbox = pinBox.getBoundingClientRect(); const showLeaders = innerWidth > 700;
    ORDER.forEach((n, i) => {
      const [ax, ay, az] = ANCH[n]; tmpV.set(ax, ay, az); P[n].localToWorld(tmpV); tmpV.project(camera);
      const px = (tmpV.x + 1) / 2 * innerWidth - box.left, py = (1 - tmpV.y) / 2 * innerHeight - box.top;
      const on = ex > 0.08 + i * 0.1 && (fly < 0.25 || n === 'movement'); asmLabels[i].classList.toggle('on', on);
      const vis = on ? Math.min(1, (ex - 0.08 - i * 0.1) * 6) * (n === 'movement' ? 1 : 1 - Math.min(1, fly * 4)) : 0;
      pins[i].style.transform = `translate(${px + box.left - pbox.left}px,${py + box.top - pbox.top}px)`; pins[i].style.setProperty('--o', vis);
      if (showLeaders) {
        const lr = asmLabels[i].querySelector('.num').getBoundingClientRect();
        const lx = lr.left - box.left - 6, ly = lr.top + lr.height / 2 - box.top;
        const elbow = lx - 28;
        lPaths[i].setAttribute('d', `M${px.toFixed(1)} ${py.toFixed(1)} L${elbow.toFixed(1)} ${ly.toFixed(1)} L${lx.toFixed(1)} ${ly.toFixed(1)}`);
        const len = Math.hypot(elbow - px, ly - py) + 28; lPaths[i].style.strokeDasharray = len; lPaths[i].style.strokeDashoffset = len * (1 - vis);
        lDots[i * 2].setAttribute('cx', px); lDots[i * 2].setAttribute('cy', py); lDots[i * 2].style.opacity = vis;
        lDots[i * 2 + 1].setAttribute('cx', lx); lDots[i * 2 + 1].setAttribute('cy', ly); lDots[i * 2 + 1].style.opacity = vis;
        lDots[i * 2].classList.toggle('hot', i === 2);
      }
    });
  }
  // render only when something changed
  const moving = Math.abs(lag.vy) + Math.abs(lag.vp) + Math.abs(spring.vx) + Math.abs(spring.vy) + Math.abs(spring.tx - spring.x) + Math.abs(spinV) + Math.abs(flipT - flipA) > 0.002;
  if (op < 0.005) { if (sy !== lastScroll) { lastScroll = sy; renderer.clear(); } return; }
  if (dirty || moving || fly > 0.01 || sy !== lastScroll || beat !== lastBeat) {
    if (composer) { gradePass.uniforms.uTime.value = now / 1000; gradePass.uniforms.uVig.value = 0.18 + fly * 0.5; bloom.strength = 0.42 - fly * 0.18; renderer.toneMappingExposure = 1.05 - fly * 0.4; composer.render(); } else renderer.render(scene, camera); dirty = false; lastScroll = sy; lastBeat = beat;
    if (!firstDone) { firstDone = true; dispatchEvent(new Event('am-ready')); }
  }
}
/* ---------- cinematic post: bloom on lume + specular, ACES via OutputPass, grain / vignette / ≤0.0016 CA ---------- */
let composer = null, bloom = null, gradePass = null;
if (POST && !reduced && (fine || innerWidth > 900)) {
  try {
    const rt = new THREE.WebGLRenderTarget(innerWidth, innerHeight, { type: THREE.HalfFloatType, format: THREE.RGBAFormat });
    composer = new POST.EffectComposer(renderer, rt);
    composer.addPass(new POST.RenderPass(scene, camera));
    bloom = new POST.UnrealBloomPass(new THREE.Vector2(innerWidth, innerHeight), 0.42, 0.55, 0.9);
    // bloom adds light but must not touch alpha: the canvas stays transparent over the paper (premultiplied glow reads as additive light)
    bloom.blendMaterial.blending = THREE.CustomBlending; bloom.blendMaterial.blendEquation = THREE.AddEquation;
    bloom.blendMaterial.blendSrc = THREE.OneFactor; bloom.blendMaterial.blendDst = THREE.OneFactor;
    bloom.blendMaterial.blendSrcAlpha = THREE.ZeroFactor; bloom.blendMaterial.blendDstAlpha = THREE.OneFactor;
    composer.addPass(bloom);
    composer.addPass(new POST.OutputPass());
    gradePass = new POST.ShaderPass({
      uniforms: { tDiffuse: { value: null }, uTime: { value: 0 }, uVig: { value: 0.18 }, uCA: { value: 0.0016 } },
      vertexShader: 'varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }',
      fragmentShader: `uniform sampler2D tDiffuse; uniform float uTime, uVig, uCA; varying vec2 vUv;
        float h(vec2 p){ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
        void main(){
          vec2 d = vUv - 0.5;
          vec4 c = texture2D(tDiffuse, vUv);
          c.r = texture2D(tDiffuse, vUv + d * uCA).r; c.b = texture2D(tDiffuse, vUv - d * uCA).b;
          float g = h(vUv * 1000.0 + uTime) - 0.5;
          c.rgb += g * 0.03 * c.a;
          c.rgb *= 1.0 - uVig * dot(d, d) * 2.2;
          gl_FragColor = c;
        }`
    });
    composer.addPass(gradePass);
  } catch (e) { console.info('Aldermark: composer init failed, plain render'); composer = null; }
}
layout();
addEventListener('resize', () => { layout(); });
new ResizeObserver(() => layout()).observe(document.body);
addEventListener('load', layout);
requestAnimationFrame(frame);
}
</script>
</body>
</html>

````
