# Recreate this site as a single HTML file: Argent

You are an expert creative front-end developer. Produce one self-contained `index.html` (inline CSS
and JS, no build step) that reproduces the landing page below. Hardcode every value given here.

## What it is

A landing page for **Argent**, a fictional AI notebook that links your notes for you. The hero is a
**raymarched liquid-metal blob** (a fullscreen SDF shader) that bulges toward the cursor like a
magnet, circled by an accretion ring of GPU dust. As you scroll, a **scripted camera orbits the
blob, then flies through it as it shatters into 14 chrome droplets joined by thin liquid threads
that stretch and snap**, and pulls back to reveal the result. Each droplet lands on a node of a **real 3D knowledge graph** of 42 notes.
Then 28 smaller leaf notes pop out of their parent nodes and the links draw in. The graph is the
product demo: drag to orbit, hover a node to trace its links, click to open the note in a side card,
filter by type, and type a question to watch a lit path travel from today's note to the answers.
The page then turns to warm paper for features, pricing (billing toggle and seat calculator), an FAQ
accordion and a dark footer. **Signature:** one continuous object goes from liquid metal to droplets
to a working graph. The raymarched droplets and the rasterised graph nodes use the *same* chrome
shading function and the *same* camera maths, so the hand-off at the end of the split has no seam.
The post stack is cinematic: UnrealBloom, then an ACES / split-tone / chromatic-aberration / grain
grade, with depth of field from point-size spread. Up to 640k particles form the ring in the hero
and become nerve fibres along every link, carrying synapse flashes. A short preloader measures real
readiness. Without WebGL the page runs the same story as an SVG "goo" blob and an SVG graph.

## Page shell & libraries

- `<html lang="en">`, viewport meta, title "Argent — notes that find each other".
- Fonts (Google Fonts, one request): **Instrument Serif** (400, regular and italic) for display,
  **Geist** 400/500/600 for UI and body, **Geist Mono** 400/500 for eyebrows and metadata.
- **three.js 0.170.0**, ES module, through an 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/"}}`. The addons used are
  `postprocessing/EffectComposer.js`, `RenderPass.js`, `UnrealBloomPass.js` and `ShaderPass.js`.
  Load it with a dynamic `await import('three')` inside try/catch, so a failed import falls back to SVG.
- Two scripts. A **classic script** runs all ordinary UI (nav, dialog, pricing, FAQ, forms,
  reveals), so it works even if modules or WebGL fail. A **module script** runs the graph, search and
  rendering.
- Fixed layers, back to front: `.backdrop` (z −1), `canvas#stage` (z 0), `svg#svgStage` (z 0, only
  in fallback), the labels layer (z 1), the transparent story sections (z 2, `pointer-events:none`;
  their links, buttons, inputs and `.pe` children are `auto`), the paper sections and footer (z 3,
  opaque, they slide over the canvas), the note card (z 30), the header (z 40).
- Renderer: opaque (`alpha:false`), `outputColorSpace = LinearSRGBColorSpace`. One scene, drawn in
  this order: backdrop quad (renderOrder −2), raymarch quad (−1), node instances, edge lines, dust
  points. Then the composer runs RenderPass → UnrealBloomPass(half-res, strength .55, radius .45,
  threshold .78) → grade ShaderPass. The grade pass does chromatic aberration
  `.0018·(1 + 2.5r²)`, ACES at exposure 1.12, split-tone (shadows ×(.93,.98,1.07), highlights
  ×(1.05,1,.94)), a vignette of .3 and per-pixel film grain of .045. The CSS `.backdrop` only shows
  in the fallback.

## Tokens

```
--ink #0a0b0d   --ink-2 #131418   --ink-3 #1b1d22   --fg #ecebe7   --muted #a3a5ab
--line rgba(236,235,231,.13)
--paper #efece6 --paper-2 #e4e0d7 --ink-text #111214 --ink-muted #56585e --paper-line rgba(17,18,20,.14)
--ember #ff5b2e (accent, path glow, focus ring)   --ember-deep #b8360f (accent text on paper)
radii 10 / 18 / 28 px, pills 999px.  --gut clamp(16px, 3.4vw, 48px).  ease cubic-bezier(.22,1,.36,1)
```
Type scale: hero h1 Instrument Serif `clamp(52px,7.4vw,124px)`/.9, tracking −.02em, with the second
line in italic using a moving silver gradient fill (`#fff → #9ea1a9 → #fff → #7d8089 → #e8e9ec`,
background-clip text). Section h2 `clamp(40px,4.4vw,68px)`/.95. Paper h2 `.big-h`
`clamp(42px,5.6vw,88px)`/.95, italic words in `--ember-deep`. Body 16px/1.55 Geist. Eyebrows: Geist
Mono 12px uppercase, tracking .08em, `--muted`, with a 7px ember dot that has a 12px ember glow.
Focus ring everywhere: `2px solid var(--ember)`, offset 3px.

Backdrop: two radial glows (grey-blue at 70% 40%, ember 7% at 15% 90%) over `--ink`, plus a dot grid
(1px dots, 28px pitch, 9% white) masked to a central ellipse.

## Layout & structure

1. **Header**: a fixed pill, centred, `top:14px`, `width:min(980px, 100% − 24px)`, background
   `rgba(10,11,13,.9)` with a 14px blur and a 1px `--line` border. It holds the logo (an 18px chrome
   sphere made from a radial gradient, then "Argent" in Instrument Serif 24px), anchor links Graph ·
   Ask · Features · Pricing · FAQ (14px, muted, pill hover), and a light "Start free" button. Below
   1024px the links and button hide, and a 40px round burger (two bars that turn into an ×) opens a
   full-screen menu with 44px serif links. Escape closes the menu and returns focus to the burger.
0. **Preloader** (`#loader`, z 90, #060708): an "Argent" wordmark (serif `clamp(64px,12vw,120px)`)
   whose silver sheen fill is clipped to the progress, a 1px bar (white → ember), and a mono row
   with a status message and a `000` counter. Progress is real: fonts ready, engine imported, env
   map loaded, `renderer.compileAsync(scene,camera)` done, first composed frame. It eases by .12 per
   frame and never runs ahead of 900ms of wall time (hard cap 6s). At 100% it holds 220ms, then a
   `clip-path: inset(0 0 100% 0)` curtain wipes up over .9s (cubic-bezier(.76,0,.24,1)). `body.ready`
   reveals the hero copy (fade + 26px rise + 6px blur over 1.1s, staggered 0/.12/.26/.38/.6s). The
   intro clock runs for 2.6s: the 14 droplets fly in from a scattered shell (radius 3.2–4.8)
   with ease-out-cubic and merge into the blob, and the dust ring spirals in from 2.4× its radius.
2. **Hero track** (`height:220vh`; the `.hero` inside is sticky at 100svh; text left, max width `min(640px,52vw)`): eyebrow "Argent · a
   notebook that links itself"; h1 "Notes that find *each other.*"; lede (max 470px, muted); "Start
   free" (light) and "See a real graph ↓" (ghost, links to #graph). In the bottom row, mono text
   reads "42 notes · 75 links · 0 folders" (counts computed from the data), then "Move your cursor —
   the metal follows", then a 42px scroll cue (a hairline with an ember tick falling on a 2.2s
   loop). The blob sits to the right of the copy.
3. **Graph section** `#graph` (height 170vh, sticky 100svh inner, padding 104px gut 32px): eyebrow
   "01 — The graph", h2 "One week of thinking, *already linked.*", one line of copy. The labels layer
   sits here in the DOM. At the bottom are the filter chips (All 42, Projects 15, People 7, Ideas 10,
   Reading 6, Daily 4, all `aria-pressed`) and keyboard hints (Drag to orbit · Hover to trace links ·
   Tab + Enter opens a note · ← → rotate).
4. **Ask section** `#ask` (height 150vh, sticky): a glass panel on the left, `min(460px,100%)`,
   radius 28, background `rgba(13,14,17,.78)` with a 14px blur. It holds the eyebrow "02 — Ask", the
   h2 "Ask a question. *Watch the path light up.*", and a `role=search` form (magnifier icon, input
   with the placeholder "Ask your notes…", and a light "Ask" button; the focus ring turns the border
   ember with a 4px ember glow at 18%). Below it are four suggestion chips, a mono status line
   (`role=status`), and a results list. The graph sits to the right.
5. **Note card** (fixed `top:92px; right:gut; width:min(360px,…)`, radius 28, background
   `rgba(16,17,20,.92)`): a type tag, a close ×, the title (Instrument Serif 34px), the body, "N
   linked notes", and the linked notes as chips. It slides in 24px from the right over .45s.
6. **Features** (paper, radius 28 on the top corners, a large shadow above it so it reads as a sheet
   sliding over the graph): a two-column intro (h2 "You write. *The links* write themselves." and a
   paragraph). Below it is a 6-column bento: **A** span 4, "Auto-linking", with two mini note cards
   whose shared word ("connects" / "connect") gets an ember highlighter underline; **B** span 2, a
   photo card using `notebook.webp`; **C** span 2, a dark card "Resurfacing" with an 8-bar meter in
   ink and ember; **D** span 2, a photo card using `mercury.webp`, "Local-first"; **E** span 2,
   "Import", with format pills. Photo cards put the caption on a gradient (`transparent → rgba(8,9,11,.86)`).
7. **Pricing**: h2 "Free until it's *indispensable.*" and a billing radiogroup (Monthly / Yearly
   −20%, Yearly selected by default). Three plans: Free $0; **Pro** (an ink card with an ember "Most
   picked" badge and an ember button) at $10 monthly or $8 yearly; Team at $15 or $12 per seat, with
   a seat stepper from 2 to 50 (default 5) and a live total ("$720 billed yearly for 5 seats" /
   "$75 per month for 5 seats"). Every button opens the sign-up dialog with that plan preselected.
8. **FAQ**: a 1:1.4 grid with h2 "Asked *often.*" and five accordion rows. The first row starts open.
9. **Footer** (ink): h2 "Field notes, *once a month.*" next to a newsletter form; then a huge
   "Argent" wordmark (Instrument Serif `clamp(120px,36vw,560px)`, line-height 1.02, a vertical
   silver gradient fill); then a bottom bar with a fictional-product credit and anchor links.
10. **Sign-up `<dialog>`**: three plan radio pills, an email field, and "Send my link". It validates
    the email and shows a success message.

## The data (embed it)

There are 42 notes as `[title, tag, body, links[]]`. Tags are project, people, idea, reading and
daily. **Indices 0–13 are hubs** (these are the droplets). Hubs: Today — Nov 26, Atlas launch,
Pricing v3, Customer calls, Mara Okafor, Onboarding flow, Spaced repetition, Book: The Slip-Box
Habit, Weekly review, Design system, Retention cohort Q3, Writing voice, Jun Park, Reading list. The
28 leaves cover pricing ideas, customer calls, churn reasons, onboarding steps, design tokens,
1:1s, books and a Nov 25 daily note. Every note has a one- or two-sentence body (see the reference).
Links are undirected and de-duplicated, giving 75 edges. Node radius: hubs `min(.2, .115 + deg·.011)`,
leaves `min(.1, .066 + deg·.007)`. Each leaf's parent is its lowest-index hub neighbour.

## Behaviour & interaction

**Force layout** (deterministic, computed once at load): seeded PRNG (mulberry32, seed 11) with
random starts in ±2. Run 520 iterations. Repulsion `.95·mᵢ·mⱼ/d²` (hub mass 2.2, leaf 1). Springs
pull with `(d − rest)·.9`, rest 1.7 between two hubs and .95 otherwise. Gravity is −.06·p. Each
force component is clamped to 3, and the step is `.06·(1 − it/520) + .004`. Centre the result,
then normalise so the largest of `hypot(x, 1.15y, z)` is 1, and scale the axes by (2.6, 2.05, 2.0).

**Shared camera maths.** Use fov 40°, camera at z = 7 looking down −z, and `TAN = tan(20°)`.
project(v): `z = 7 − v.z`; `x = (v.x/(z·TAN·aspect)+1)/2·W`; `y = (1 − v.y/(z·TAN))/2·H`;
pixels-per-unit `k = H/(2·z·TAN)`. The graph is transformed on the CPU: `world = Rx(pitch)·Ry(yaw)·(p·s) + off`.
Instance matrices, line vertices, labels, picking and the shader droplets all read these same world
positions. No scene-graph transforms.

**Scroll clock** (`vh = innerHeight`). Camera clock target `p = clamp(scrollY / 1.45vh)`, smoothed
each frame with `1 − .0009^dt` so the camera has inertia. Shatter progress is
`ps = clamp((p − .38)/.62)`. Leaf growth is `q = clamp((scrollY − 1.45vh)/.45vh)`. The hero copy
fades, rises 60px and blurs 8px over scrollY .06–.48vh. Two cinematic captions (mono ember kicker
plus serif `clamp(34px,4.6vw,72px)`, centred at 14vh from the bottom) fade and unblur in over 7% of
p and out again: "Every note / is a drop of the same metal." for p .22–.44, and "Argent pulls them
apart / and keeps every thread." for p .56–.80.

**Camera path** (Catmull-Rom through 6 keys; C = blob centre, G = graph offset, offsets × blob
scale; roll and fov ease between keys). At t=0 and t=1 the camera is exactly the standard pose, so
the label and picking maths stay valid:

| t | position | look at | roll | fov |
|---|---|---|---|---|
| 0 | (0,0,7) | (0,0,0) | 0 | 40 |
| .26 | C+(2.5,.85,3.3) | C+(0,.05,0) | .10 | 38 |
| .46 | C+(−1.1,.3,2.2) | C | −.08 | 44 |
| .60 | C+(.05,.02,−.1) (inside) | C+(−.4,−.1,−3) | .02 | 58 |
| .80 | G+(1.1,.7) at z 4.6 | G | .05 | 46 |
| 1 | (0,0,7) | (0,0,0) | 0 | 40 |

The raymarch takes `uCamPos`, `uCamMat` (the camera's world rotation) and `uTan`, so it follows the
same camera. If the ray origin is inside the metal (`map(ro) < 0`), draw `env(rd)·.35` so the dive
through the blob reads as passing through mercury. Layout targets per viewport (in world units; halfH = 7·TAN,
halfW = halfH·aspect):
- desktop ≥1024: hero blob centre `(.42·halfW, −.05)`, blob scale 1.05; graph offset `(.24·halfW, −.12)`,
  scale `min(1.2, .92·halfH/2.1, .62·halfW/2.6)`; ask offset `(.3·halfW, −.08)`, scale `min(1.05, .84·halfH/2.1, .58·halfW/2.6)`.
- tablet 641–1023: hero `(.18·halfW, .3·halfH)`, scale .85; graph `(0, −.1)`, scale `min(1, .8·halfW/2.3)`;
  ask `(.38·halfW, .15)`, scale `min(.8, .5·halfW/2.3)`.
- phone ≤640: hero `(0, .42·halfH)`, scale .68; graph `(0, .1)`, scale `min(1, 1.3·halfW/2.6)`;
  ask `(0, .55·halfH)` at .62 × the graph scale.
Blend hero → graph with `smoothstep(scrollY / graphTop)`, and graph → ask with
`smoothstep((scrollY − (askTop − vh))/vh)`. While a note card is open on desktop, the graph eases
left by `.2·halfW`.

**The blob (raymarch)** is a fullscreen triangle with a `ShaderMaterial`, drawn before the graph
scene. Its uniforms are 15 spheres (14 hubs plus the cursor droplet), up to 12 hub-to-hub thread
capsules, `uK`, `uNoise` and `uBound`. The map is the polynomial smooth-min of all spheres with k = `uK`; the
cursor sphere smooth-mins with k .55; each thread is a capsule whose radius narrows by 55% at the
middle (`r·(1 − .55·sin(πh))`), smooth-min k .14. Add a noise term
`uNoise·sin(3.1x+.9t)·sin(2.7y−.7t)·sin(3.3z+.55t)`.
- (Below, p in the droplet formulas means the shatter progress `ps`.) Each droplet's progress is `pᵢ = clamp(1.3p − .3·stagᵢ)` (stagᵢ random), eased in-out cubic.
  Position goes from its cluster spot (random in a sphere of radius .46, z .4, × blob scale) to its
  node's world position. Radius goes from `.4–.53 × blob scale` to `node.r × s`.
- `uK = mix(.72, 0, smoothstep(p/.85)) × blob scale`. `uNoise = .05 × blob scale × (1 − smoothstep(p/.8))`.
  Thread radius `(.05·(1 − smoothstep((p−.2)/.75)) + .005) × min(1, 1.2s)`; threads exist only while .12 < p < .985.
- Ray: `ro = (0,0,7)`, `rd = normalize(ndc.x·TAN·aspect, ndc.y·TAN, −1)`. Intersect a bounding
  sphere first (CPU-computed: AABB of the droplets + k + noise + .1) and discard misses. Then up to
  72 steps with step = .9·d and hit when `d < .0008·t`. Normal from a 4-tap tetrahedron (e = .0015).
- **Edge anti-aliasing:** track the minimum `d/(t·pixelSize)` along the ray. On a miss, alpha is
  `1 − min/1.6`, shaded at the closest point. Output premultiplied colour.
- **Cursor magnet:** convert the pointer to world space on z = 0, then clamp it to 1.35 × blob scale
  from the blob centre, with z .25. A spring (stiffness 110, damping 13, so it wobbles) follows that
  target. Proximity is `1 − smoothstep((d − .5bs)/2.6bs)`. The cursor droplet radius is
  `.27·bs·proximity`, every droplet shifts 12% toward the cursor, and the area near the cursor gets a
  molten tint (`heat = .55·prox·smoothstep(.75, 0, dist)`). On touch, or before the first pointer
  move, the target orbits the blob instead (`cos(.55t)·.95, sin(.8t)·.45`, proximity .55). The magnet
  fades out by p = .35.
- Lighting: the env map lookup and Fresnel described below, a 5-tap SDF ambient occlusion along
  the normal (step .035, falloff .62, `ao = clamp(1 − 2.6·sum)`, colour × (.35 + .65·ao)), and a
  soft elliptical contact shadow with an ember bounce under the blob, drawn in the backdrop
  shader. Both fade out by p .12.
- At p ≥ .995 stop drawing the raymarch pass and give the hub instances their radius. Because the
  shading is identical, the swap cannot be seen.

**Chrome shading (shared GLSL, used by both passes).** `env(r)`:
- Procedural studio: a vertical gradient from `.012` to `.27`, a top softbox
  (`pow(smoothstep(.62,1,y),2)·1.5`), a strip light at x = −.62 and a dimmer one at x = .7, and a
  faint ember floor bounce (`.16`).
- When `studio-env.webp` has loaded, mix in the equirect lookup (`u = atan(r.x,−r.z)/2π + .5 + yaw·.08`,
  `v = acos(r.y)/π`, squared ×1.6) at 62%, plus 25% of the procedural layer.
- `metal(n, v, heat, dim)`: reflect, Fresnel `pow(1−n·v, 4)`, colour `env·(.93,.95,1)·(.78 + .5F)`.
  Heat mixes toward `c·molten·1.25 + molten·(.22 + .5F)` with molten = (1, .36, .16).
  Dim multiplies by `1 − .78·dim`.

**Thought dust (GPU particles).** Tiers are resolved once: ≥1440 → 640k points, ≥1024 → 420k,
≥641 → 220k, phones → 150k (no bloom). Software GL (SwiftShader/llvmpipe) gets 90k at DPR 1. The
only buffer is `position` = (ring radius, angle, height) per point: 70% in a ring at r 1.42–2.3,
30% as haze out to 5.5. Everything else is hashed in the vertex shader from `gl_VertexID` (a
pcg-style uint hash): edge index `id % 75`, t along the edge, seed, Gaussian offset. The edge table
(`uEN`), node positions (`uN`, w = radius) and per-edge state (`uE` = fire time, path, hot, dim)
are uniform arrays.
- Hero: a ring tilted .42 rad on x and −.22 on z around the blob, with differential rotation
  `.32/(.5 + r)`. Points behind the blob's silhouette (tested in view space) are hidden.
- Morph: `m = smoothstep(clamp(1.6·morph − .6·seed))` blends ring → fibre, with a sinusoidal swirl
  `m(1−m)·1.6` in transit. Fibres are `mix(A,B,t) + gauss·(.012 + .085·sin πt)·s`, and points
  stream along the edge at `.018·(.4+seed)`. 16% of points form shells around their node.
- Flashes: `exp(−((T − fire)·1.7 − t)²·55)` makes a pulse run along the edge in about .6s.
  Ambient firing every .07–.27s; the focused note's links every .9s; search-path links every 1.6s,
  staggered .22s per hop. Path fibres turn ember with a moving stream `sin(14t − 5T)`.
- Cursor halo: screen-space Gaussian (×26), pushes points .16 away and brightens them ×4.
- Depth of field: `coc = min(|depth − focus|·aperture, 5)`; size ×(1 + coc), alpha ÷(1 + coc)²,
  sprite falloff softens with coc. The aperture goes .09 → .32 → .09 along the camera path. Alpha
  is normalised per tier with `sqrt(160k/count)`.

**Graph rendering**: an `InstancedMesh` of `IcosahedronGeometry(1,4)` with per-instance `aHeat` and
`aDim` attributes. Edges are `LineSegments` with additive vertex colours, trimmed at both ends to
the sphere surfaces. Base brightness `.16·(1 − .85·dim)`, +.6 when touching the focused node, and
blended to ember (1, .4, .16) when on the search path. Edges fade in over p .85–1. Leaves grow with
`qᵢ = clamp(1.6q − .6·rank)`, easeOutBack(1.4), travelling out from their parent hub. The pulses on the lit path are carried by
the thought-dust fibres (see above). There is no separate sprite system.

**Rotation**: idle auto-rotate .12 rad/s after 2.5s with no interaction. Drag gives yaw .006 rad/px
and pitch .004 rad/px (clamped ±.9; yaw only on touch), with inertia decaying by `.08^dt`. Pitch
eases back to .18. Opening a linked note spring-rotates the graph so that node faces the camera.

**Hover, labels and the card**: every note has a real `<button class="lbl">` positioned each frame
at `(x + r·k + 6, y − 11)` with z-index by depth. Hub labels are always visible. Leaf labels are
invisible (`opacity:0; pointer-events:none`) until hot, on the path, matching the active filter, or
focused by keyboard. Canvas picking is screen-space: the nearest projected node within `r·k + 8`
px, front-most wins. The focused node gets heat .55. Its neighbours stay bright, everything else
dims .7, and its edges light up white. Click (under 5px of movement) or Enter opens the card, and
Escape closes it and returns focus. Filter chips dim non-matching nodes .85. All highlight values
ease with `1 − .0005^dt`.

**Search**: tokenise the query and drop stop-words. Map synonyms (churn/leave/quit → churn,
onboard → onboarding, team → seats…). Score each note: title hit +3, body hit +1, tag prefix +1.
Prefix matching works both ways for words of 4+ letters. Take the top 3, then BFS from "Today — Nov
26" to each one. Path nodes light hop by hop at .24s per hop, the targets at full heat and the rest
of the path at .75, and everything off the path dims .55. Results show the title, the trail ("Today
→ Pricing v3 → Customer calls") in ember mono, and a snippet with `<mark>` on the matched words.
Clicking a result opens and faces that note. The status line reports real counts and the measured
search time in ms. Input is debounced at 200ms. The first time the section is 45% visible, it types
"why do customers churn" at 45–85 ms per character (instantly under reduced motion).

**Other UI**: billing radiogroup with arrow keys; seat stepper with disabled ends; FAQ panels with
the height measured from `scrollHeight` and set to `auto` after the transition (.45s), one open at a
time; email validation with inline error or success text (`aria-live`); `.rv` reveals (opacity and
22px rise, .9s, staggered 80ms) via IntersectionObserver.

**Performance**: Raymarch pixel ratio starts at `min(dpr,1.5)` (1.25 on phones). If the smoothed
frame time goes over 22ms for 12 frames, step it down .25 at a time (floor .4). After the shatter,
the scene renders at the tier's DPR cap (2 / 1.75 / 1.5 / 1.5). If a frame took over 300ms (software
GL), skip drawing for 3× that time, capped at 4s, so the page stays responsive. The raymarch pass is
skipped entirely after the shatter. Once the features sheet covers the viewport, the canvas and
labels are hidden and nothing is drawn. rAF pauses in hidden tabs on its own.

## Responsive

- **1440**: blob on the right of the hero copy; graph on the right 60%; ask panel on the left with
  the graph on the right; the card pushes the graph left.
- **768**: hero copy at the bottom (`padding-bottom:110px`) with the blob above it; graph centred;
  bento in 2 columns (A spans the full width); plans stack (max 560px); FAQ in one column.
- **390**: blob in the upper 45%, copy at the bottom, h1 `clamp(46px,13.4vw,62px)`; graph fills the
  width; keyboard hints hidden; labels 11px; ask panel docked to the bottom (`max-height:64svh`,
  scrolls inside) with the graph above it; the note card becomes a bottom sheet; bento in 1 column;
  the newsletter form stacks. `overflow-x:clip` on html and body, and there must be no horizontal scroll.

## Accessibility & reduced motion

Skip link; landmarks; one h1; every graph note reachable as a button with an aria-label ("Pricing
v3 — Project note, 8 links"); ← → rotate while a label has focus; the card is labelled by its title
and gets focus when it opens; the FAQ uses `aria-expanded`/`aria-controls` with region panels; the
pricing toggle is a radiogroup; the stepper output is `aria-live`; the dialog is a native `<dialog>`
with focus returned to the button that opened it. AA contrast is held on both ink and paper (muted
text #a3a5ab on ink, #56585e on paper). Under `prefers-reduced-motion`: shader time is frozen; there
is no auto-rotate or inertia; the split snaps (p and q switch at 50% of the range) instead of
morphing, and the camera stays at the standard pose; highlights and path lighting apply instantly; the auto-type is instant; CSS transitions
and animations are cut to near zero; reveals are shown immediately.

## Fallbacks

If there is no WebGL, the three import fails, or the URL has `?nogl`, add `.no-webgl` and draw the
same frame data into an SVG. Droplets are circles under an feGaussianBlur + feColorMatrix "goo"
filter (blur = k·18·H/900; the camera path is skipped in the fallback, alpha matrix `26 −11`) filled with a chrome radial gradient, so the
split still reads as liquid. Nodes are chrome circles (molten gradient when heated), and edges are
lines with hot and path classes. Labels, picking, the card, filters and search are shared code and
behave the same. If `studio-env.webp` fails to load, the shader falls back to the procedural studio.

## Assets

- `assets/studio-env.webp` (1024×512, ~9 KB): an equirectangular dark studio with an overhead
  softbox, two vertical strip lights, a small warm floor light and a glossy black floor. It is used
  only as the chrome reflection map.
- `assets/notebook.webp` (900×1205): top-down view of a black notebook with a hand-drawn silver
  network of circles and lines, a steel pen beside it. Used on the "Paper counts too" card.
- `assets/mercury.webp` (1200×900): macro of liquid-silver beads on black slate, some joined by thin
  threads. Used on the "Local-first" card.

## 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 graph data.** Replace Argent and the 42 notes with your own product's world: a
   reading app's books and authors, a CRM's accounts and contacts, a course's lessons and concepts.
   Keep 12–16 hubs (they are the droplets) and 25–35 leaves. Keep every leaf linked to at least one
   hub, and make the BFS root a note that a first-time visitor understands, such as "Today" or "Start here". Rewrite the
   four Ask suggestions, the synonym map and the auto-typed demo query to match questions your users ask.
2. **The camera journey.** Keep the 6-key path but re-block it for your object: a slow crane
   down from above, a dolly through the ring instead of the blob, or a 360° orbit before the dive.
   Keep the first and last keys at the standard pose.
3. **The material of the blob.** The liquid metal is the signature. Re-theme it by changing only
   `env()` and `metal()`: **molten glass** (tint the env teal, add `.35` transmission-style
   brightening at grazing angles), **black ink** (env `×.25`, a single white softbox, no strips),
   **gold** (multiply by `(1, .78, .42)`, a warmer floor bounce), or **soap bubble** (add a
   thin-film hue from `fract(F·3)`). The nodes use the same function, so the hand-off stays seamless.
4. **The split choreography.** Keep the droplets-to-nodes mapping and change how they travel:
   change the stagger (`1.3p − .3·stag`) to a ripple ordered by distance from the cursor, swap the
   threads for none (cleaner) or for every hub edge (stringier), or slow the split to `scrollY/1.2vh`
   for a more cinematic hero.
5. **Palette.** Replace `--ink`, `--paper` and `--ember` with your brand colours, and the molten
   tint (1, .36, .16) with your accent in linear RGB. Keep `--muted` at ≥ 4.5:1 contrast on `--ink`,
   and `--ink-muted` at ≥ 4.5:1 on `--paper`.
6. **Type pairing.** Swap Instrument Serif + Geist + Geist Mono for another trio, for example
   Fraunces + Inter Tight + JetBrains Mono, or Newsreader + Manrope + IBM Plex Mono. Keep an italic
   display face, because the italic second line of each headline is part of the voice.
7. **Images.** Regenerate `studio-env.webp` as an equirectangular room that fits your material
   (a sunset window for gold, a neon alley for glass) at 2:1, compressed under 30 KB. Replace
   `notebook.webp` and `mercury.webp` with two photos from your product's world in the same low-key
   light.
8. **Copy.** Rewrite every headline in your own voice and say concretely what the product does
   ("links your call notes to the deal", not "supercharge your knowledge").

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/ai-notes-liquid-metal-knowledge-graph/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>Argent — notes that find each other</title>
<meta name="description" content="Argent is a notebook that links what you write into a living graph you can walk, search and ask.">
<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=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&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{
  --ink:#0a0b0d; --ink-2:#131418; --ink-3:#1b1d22;
  --fg:#ecebe7; --muted:#a3a5ab; --line:rgba(236,235,231,.13);
  --paper:#efece6; --paper-2:#e4e0d7; --ink-text:#111214; --ink-muted:#56585e; --paper-line:rgba(17,18,20,.14);
  --ember:#ff5b2e; --ember-deep:#b8360f;
  --serif:'Instrument Serif', 'Times New Roman', serif;
  --sans:'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r-s:10px; --r-m:18px; --r-l:28px;
  --gut:clamp(16px, 3.4vw, 48px);
  --ease:cubic-bezier(.22,1,.36,1);
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
html,body{overflow-x:clip}
body{margin:0;background:var(--ink);color:var(--fg);font:400 16px/1.55 var(--sans);-webkit-font-smoothing:antialiased}
img{max-width:100%;display:block}
button,input{font:inherit;color:inherit}
a{color:inherit}
:focus-visible{outline:2px solid var(--ember);outline-offset:3px;border-radius:6px}
.sr-only{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:fixed;left:12px;top:-60px;z-index:100;background:var(--fg);color:var(--ink);padding:10px 14px;border-radius:8px;text-decoration:none;font-weight:500}
.skip:focus{top:12px}
.mono{font-family:var(--mono);font-size:12px;letter-spacing:.06em;text-transform:uppercase}
.eyebrow{font-family:var(--mono);font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);display:flex;gap:10px;align-items:center}
.eyebrow::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--ember);box-shadow:0 0 12px var(--ember)}
h1,h2,h3{font-weight:400;margin:0}
.serif{font-family:var(--serif)}
em{font-style:italic}

/* ---------- stage (canvas) ---------- */
#stage{position:fixed;inset:0;z-index:0;width:100%;height:100%;display:block;touch-action:pan-y;cursor:default}
#stage.grab{cursor:grab}#stage.grabbing{cursor:grabbing}#stage.pointing{cursor:pointer}
#svgStage{position:fixed;inset:0;z-index:0;width:100%;height:100%;display:none;touch-action:pan-y}
.no-webgl #svgStage{display:block}.no-webgl #stage{display:none}
.backdrop{position:fixed;inset:0;z-index:-1;background:
  radial-gradient(60% 50% at 70% 40%, rgba(120,125,140,.16), transparent 70%),
  radial-gradient(40% 35% at 15% 90%, rgba(255,91,46,.07), transparent 70%), var(--ink)}
.backdrop::after{content:"";position:absolute;inset:0;background-image:radial-gradient(rgba(236,235,231,.09) 1px, transparent 1.2px);background-size:28px 28px;mask-image:radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 85%)}
.covered #stage,.covered #svgStage,.covered .labels{visibility:hidden}

/* ---------- loader ---------- */
.loader{position:fixed;inset:0;z-index:90;background:#060708;display:grid;place-items:center;clip-path:inset(0 0 0 0);transition:clip-path .9s cubic-bezier(.76,0,.24,1)}
.loader.out{clip-path:inset(0 0 100% 0)}
.loader.gone{display:none}
.ld-in{width:min(420px,78vw);display:flex;flex-direction:column;gap:18px}
.ld-word{position:relative;font-family:var(--serif);font-size:clamp(64px,12vw,120px);line-height:1;letter-spacing:-.03em;color:rgba(236,235,231,.08)}
.ld-fill{position:absolute;inset:0;background:linear-gradient(100deg,#fff 0%,#8d9099 30%,#fff 48%,#6f727b 70%,#e6e7ea 100%);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;clip-path:inset(0 calc(100% - var(--lp,0%)) 0 0);animation:sheen 2.4s linear infinite}
@keyframes sheen{to{background-position:-200% 0}}
.ld-bar{height:1px;background:rgba(236,235,231,.14);position:relative;overflow:hidden}
.ld-bar i{position:absolute;inset:0;background:linear-gradient(90deg,var(--fg),var(--ember));transform-origin:left;transform:scaleX(var(--lpn,0))}
.ld-row{display:flex;justify-content:space-between;color:var(--muted)}
.ld-row span:last-child{color:var(--fg);font-variant-numeric:tabular-nums}
#heroCopy{will-change:opacity,transform,filter}
.hero-copy>*,.hero-meta{opacity:0;transform:translateY(26px);filter:blur(6px);transition:opacity 1.1s var(--ease),transform 1.1s var(--ease),filter 1.1s var(--ease)}
body.ready .hero-copy>*,body.ready .hero-meta{opacity:1;transform:none;filter:none}
body.ready .hero-copy>:nth-child(2){transition-delay:.12s}body.ready .hero-copy>:nth-child(3){transition-delay:.26s}body.ready .hero-copy>:nth-child(4){transition-delay:.38s}body.ready .hero-meta{transition-delay:.6s}
.gl .backdrop{display:none}

/* ---------- header ---------- */
.site-head{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:40;width:min(980px, calc(100% - 24px));display:flex;align-items:center;gap:18px;padding:8px 8px 8px 18px;border:1px solid var(--line);border-radius:999px;background:rgba(10,11,13,.9);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.logo{display:flex;align-items:center;gap:10px;text-decoration:none;font-family:var(--serif);font-size:24px;line-height:1;letter-spacing:-.01em}
.logo i{width:18px;height:18px;border-radius:50%;background:radial-gradient(circle at 35% 30%, #fff 0 12%, #b9bcc4 30%, #3a3c42 62%, #d9dbe0 85%, #6d7079);box-shadow:0 0 0 1px rgba(255,255,255,.15)}
.nav{display:flex;gap:4px;margin-left:auto}
.nav a{text-decoration:none;font-size:14px;color:var(--muted);padding:8px 12px;border-radius:999px;transition:color .2s,background .2s}
.nav a:hover{color:var(--fg);background:rgba(255,255,255,.06)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;cursor:pointer;text-decoration:none;font-weight:500;font-size:15px;border-radius:999px;padding:12px 20px;transition:background .2s,color .2s,box-shadow .2s,transform .2s var(--ease)}
.btn:active{transform:translateY(1px)}
.btn-light{background:var(--fg);color:var(--ink)}
.btn-light:hover{background:#fff;box-shadow:0 0 0 4px rgba(255,255,255,.12)}
.btn-ember{background:var(--ember);color:#160803}
.btn-ember:hover{background:#ff7a55;box-shadow:0 0 0 4px rgba(255,91,46,.22)}
.btn-ghost{background:transparent;color:var(--fg);box-shadow:inset 0 0 0 1px var(--line)}
.btn-ghost:hover{box-shadow:inset 0 0 0 1px rgba(236,235,231,.4)}
.btn-ink{background:var(--ink-text);color:var(--paper)}
.btn-ink:hover{background:#000;box-shadow:0 0 0 4px rgba(17,18,20,.12)}
.site-head .btn{padding:9px 16px;font-size:14px}
.burger{display:none;margin-left:auto;width:40px;height:40px;border-radius:50%;border:1px solid var(--line);background:transparent;cursor:pointer;position:relative}
.burger span{position:absolute;left:12px;right:12px;height:1.5px;background:var(--fg);transition:transform .3s var(--ease),top .3s var(--ease)}
.burger span:nth-child(1){top:16px}.burger span:nth-child(2){top:22px}
.burger[aria-expanded="true"] span:nth-child(1){top:19px;transform:rotate(45deg)}
.burger[aria-expanded="true"] span:nth-child(2){top:19px;transform:rotate(-45deg)}
.mnav{position:fixed;inset:0;z-index:39;background:rgba(10,11,13,.96);display:flex;flex-direction:column;justify-content:center;padding:0 28px;gap:6px;opacity:0;visibility:hidden;transition:opacity .3s,visibility .3s}
.mnav.open{opacity:1;visibility:visible}
.mnav a{font-family:var(--serif);font-size:44px;text-decoration:none;line-height:1.15}
.mnav .btn{margin-top:20px;align-self:flex-start;font-size:16px}

/* ---------- transparent story sections ---------- */
.story{position:relative;z-index:2;pointer-events:none}
.story a,.story button,.story input,.story .pe{pointer-events:auto}
.hero-track{height:220vh}
.hero{position:sticky;top:0;height:100vh;height:100svh;display:flex;flex-direction:column;justify-content:center;padding:120px var(--gut) 40px}
.cine-cap{position:absolute;left:50%;bottom:14vh;transform:translateX(-50%);text-align:center;width:min(760px,calc(100% - 32px));opacity:0;will-change:opacity,transform,filter}
.cine-cap .mono{color:var(--ember)}
.cine-cap p{font-family:var(--serif);font-size:clamp(34px,4.6vw,72px);line-height:1;margin:10px 0 0;letter-spacing:-.015em;text-shadow:0 2px 30px rgba(0,0,0,.6)}
.hero-copy{max-width:min(640px, 52vw)}
.hero h1{font-family:var(--serif);font-size:clamp(52px, 7.4vw, 124px);line-height:.9;letter-spacing:-.02em;margin:22px 0 26px}
.hero h1 em{color:#d7d9de;background:linear-gradient(100deg,#fff 0%,#9ea1a9 35%,#fff 50%,#7d8089 70%,#e8e9ec 100%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;padding-right:.08em}
.hero p.lede{font-size:clamp(16px, 1.3vw, 19px);color:var(--muted);max-width:470px;margin:0 0 32px}
.hero-ctas{display:flex;gap:10px;flex-wrap:wrap}
.hero-meta{position:absolute;left:var(--gut);right:var(--gut);bottom:28px;display:flex;justify-content:space-between;align-items:end;color:var(--muted)}
.hero-meta .hint{display:flex;align-items:center;gap:10px}
.scrollcue{width:1px;height:42px;background:linear-gradient(var(--fg),transparent);position:relative;overflow:hidden}
.scrollcue::after{content:"";position:absolute;left:0;top:-40%;width:1px;height:40%;background:var(--ember);animation:cue 2.2s var(--ease) infinite}
@keyframes cue{to{top:110%}}

.graph-sec{height:170vh}
.ask-sec{height:150vh}
.sticky{position:sticky;top:0;height:100vh;height:100svh;padding:104px var(--gut) 32px;display:flex;flex-direction:column}
.sec-head{max-width:430px}
.sec-head h2{font-family:var(--serif);font-size:clamp(40px, 4.4vw, 68px);line-height:.95;letter-spacing:-.015em;margin:16px 0 14px}
.sec-head p{color:var(--muted);margin:0}
.graph-foot{margin-top:auto;display:flex;flex-wrap:wrap;gap:16px 28px;align-items:end;justify-content:space-between}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{border:1px solid var(--line);background:rgba(10,11,13,.6);border-radius:999px;padding:7px 13px;font-size:13px;cursor:pointer;display:inline-flex;gap:8px;align-items:center;transition:background .2s,border-color .2s,color .2s;color:var(--muted)}
.chip:hover{color:var(--fg);border-color:rgba(236,235,231,.35)}
.chip[aria-pressed="true"]{background:var(--fg);color:var(--ink);border-color:var(--fg)}
.chip b{font-weight:500;font-family:var(--mono);font-size:11px;opacity:.7}
.kbd-hint{color:var(--muted);font-size:13px;display:flex;gap:14px;flex-wrap:wrap}
.kbd-hint span{display:inline-flex;gap:6px;align-items:center}
.kbd-hint kbd{font-family:var(--mono);font-size:11px;border:1px solid var(--line);border-radius:5px;padding:1px 6px;color:var(--fg)}

/* labels over graph */
.labels{position:fixed;inset:0;z-index:1;pointer-events:none;opacity:0;visibility:hidden}
.labels.on{visibility:visible}
.lbl{position:absolute;left:0;top:0;pointer-events:auto;white-space:nowrap;border:0;cursor:pointer;background:rgba(10,11,13,.62);color:var(--fg);font:500 12px/1 var(--sans);padding:5px 8px;border-radius:999px;transition:opacity .25s,background .2s,color .2s;will-change:transform}
.lbl.leaf{font-weight:400;color:#c8c9cd;font-size:11.5px}
.lbl.hot{background:var(--fg);color:var(--ink)}
.lbl.path{background:var(--ember);color:#160803}
.lbl.dim{opacity:.18}
.lbl.quiet{opacity:0;pointer-events:none}
.lbl.quiet:focus-visible{opacity:1}
.lbl:focus-visible{outline-offset:2px;opacity:1}

/* ask panel */
.ask-panel{pointer-events:auto;width:min(460px,100%);background:rgba(13,14,17,.78);border:1px solid var(--line);border-radius:var(--r-l);padding:26px;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);display:flex;flex-direction:column;gap:16px;max-height:calc(100svh - 136px);overflow:auto}
.ask-panel h2{font-family:var(--serif);font-size:clamp(34px,3.4vw,52px);line-height:.98;margin:2px 0 0;letter-spacing:-.01em}
.search{display:flex;align-items:center;gap:10px;border:1px solid rgba(236,235,231,.22);border-radius:14px;padding:4px 6px 4px 14px;background:rgba(0,0,0,.35);transition:border-color .2s,box-shadow .2s}
.search:focus-within{border-color:var(--ember);box-shadow:0 0 0 4px rgba(255,91,46,.18)}
.search svg{flex:none;opacity:.7}
.search input{flex:1;min-width:0;background:transparent;border:0;outline:0;padding:11px 0;font-size:16px}
.search input::placeholder{color:#8d8f96}
.search button{border:0;background:var(--fg);color:var(--ink);border-radius:10px;padding:9px 14px;font-weight:500;cursor:pointer;font-size:14px}
.search button:hover{background:#fff}
.sugg{display:flex;flex-wrap:wrap;gap:6px}
.sugg button{font-size:12.5px;padding:6px 11px}
.ask-status{font-family:var(--mono);font-size:12px;color:var(--muted);min-height:18px;letter-spacing:.02em}
.results{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.res{border:1px solid var(--line);border-radius:14px;padding:12px 14px;cursor:pointer;background:rgba(255,255,255,.02);text-align:left;width:100%;display:block;transition:border-color .2s,background .2s}
.res:hover{border-color:rgba(255,91,46,.6);background:rgba(255,91,46,.05)}
.res strong{display:block;font-weight:500;font-size:15px}
.res .trail{display:block;font-family:var(--mono);font-size:11px;color:var(--ember);margin:4px 0 6px;letter-spacing:.02em;white-space:normal}
.res .snip{display:block;font-size:13.5px;color:var(--muted);line-height:1.45}
.res mark{background:rgba(255,91,46,.22);color:var(--fg);border-radius:3px;padding:0 2px}

/* note card */
.note-card{position:fixed;z-index:30;top:92px;right:var(--gut);width:min(360px, calc(100% - 24px));background:rgba(16,17,20,.92);border:1px solid var(--line);border-radius:var(--r-l);padding:22px;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);transform:translateX(24px);opacity:0;visibility:hidden;transition:transform .45s var(--ease),opacity .3s,visibility .45s;box-shadow:0 30px 80px rgba(0,0,0,.45)}
.note-card.open{transform:none;opacity:1;visibility:visible}
.note-card:focus{outline:none}
.nc-top{display:flex;justify-content:space-between;align-items:center;gap:12px}
.tag{font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:.08em;border:1px solid var(--line);border-radius:999px;padding:4px 9px;color:var(--muted)}
.x{width:34px;height:34px;border-radius:50%;border:1px solid var(--line);background:transparent;cursor:pointer;display:grid;place-items:center}
.x:hover{background:rgba(255,255,255,.07)}
.note-card h3{font-family:var(--serif);font-size:34px;line-height:1;margin:16px 0 10px}
.note-card p{margin:0 0 16px;color:#c9cacf;font-size:15px}
.nc-meta{font-family:var(--mono);font-size:11px;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;margin:0 0 8px}
.nc-links{display:flex;flex-wrap:wrap;gap:6px}
.nc-links button{font-size:12.5px;padding:6px 11px}

/* ---------- paper sections ---------- */
.paper{position:relative;z-index:3;background:var(--paper);color:var(--ink-text)}
.paper .eyebrow{color:var(--ink-muted)}
.features{border-radius:var(--r-l) var(--r-l) 0 0;padding:clamp(80px,10vw,140px) var(--gut) 40px;box-shadow:0 -40px 80px rgba(0,0,0,.35)}
.wrap{max-width:1240px;margin:0 auto}
.big-h{font-family:var(--serif);font-size:clamp(42px, 5.6vw, 88px);line-height:.95;letter-spacing:-.02em;margin:18px 0 0;max-width:15ch}
.big-h em{color:var(--ember-deep)}
.sec-intro{display:grid;grid-template-columns:1.3fr 1fr;gap:40px;align-items:end;margin-bottom:56px}
.sec-intro p{color:var(--ink-muted);font-size:17px;margin:0;max-width:440px}
.bento{display:grid;grid-template-columns:repeat(6,1fr);gap:14px}
.card{background:#f8f6f2;border:1px solid var(--paper-line);border-radius:var(--r-l);padding:26px;display:flex;flex-direction:column;gap:12px;overflow:hidden;position:relative;min-height:300px}
.card h3{font-family:var(--serif);font-size:32px;line-height:1}
.card p{margin:0;color:var(--ink-muted);font-size:15px;max-width:40ch}
.card .num{font-family:var(--mono);font-size:11px;color:var(--ink-muted);letter-spacing:.08em}
.c-a{grid-column:span 4}.c-b{grid-column:span 2}.c-c{grid-column:span 2}.c-d{grid-column:span 2}.c-e{grid-column:span 2}
.card.dark{background:var(--ink-2);color:var(--fg);border-color:transparent}
.card.dark p{color:var(--muted)}.card.dark .num{color:var(--muted)}
.card.photo{padding:0;min-height:340px}
.card.photo img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.card.photo .cap{position:relative;margin-top:auto;padding:26px;background:linear-gradient(transparent, rgba(8,9,11,.86) 45%);color:var(--fg)}
.card.photo .cap p{color:#c5c6cb}
.linkdemo{margin-top:auto;display:flex;gap:12px;align-items:stretch;flex-wrap:wrap}
.mini{flex:1 1 200px;background:#fff;border:1px solid var(--paper-line);border-radius:14px;padding:14px 16px;font-size:14px;line-height:1.5;color:#2a2c30}
.mini small{display:block;font-family:var(--mono);font-size:10.5px;letter-spacing:.06em;color:var(--ink-muted);text-transform:uppercase;margin-bottom:6px}
.wl{background:linear-gradient(transparent 60%, rgba(255,91,46,.28) 60%);border-radius:2px;transition:background-size .6s}
.mini .wl{font-weight:500}
.meter{display:flex;gap:4px;align-items:end;height:64px;margin-top:auto}
.meter i{flex:1;background:#d6d1c6;border-radius:4px 4px 0 0}
.meter i.on{background:var(--ink-text)}
.meter i.hot{background:var(--ember)}
.formats{display:flex;flex-wrap:wrap;gap:6px;margin-top:auto}
.formats span{font-family:var(--mono);font-size:11.5px;border:1px solid var(--paper-line);border-radius:999px;padding:5px 10px;background:#fff}

/* pricing */
.pricing{padding:clamp(80px,9vw,130px) var(--gut)}
.bill{display:inline-flex;border:1px solid var(--paper-line);border-radius:999px;padding:4px;background:#f8f6f2;gap:2px}
.bill button{border:0;background:transparent;border-radius:999px;padding:9px 16px;cursor:pointer;font-size:14px;font-weight:500;color:var(--ink-muted)}
.bill button[aria-checked="true"]{background:var(--ink-text);color:var(--paper)}
.bill .save{font-family:var(--mono);font-size:10.5px;color:var(--ember-deep);margin-left:6px}
.bill button[aria-checked="true"] .save{color:#ffb39b}
.plans{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:36px}
.plan{border:1px solid var(--paper-line);border-radius:var(--r-l);padding:28px;background:#f8f6f2;display:flex;flex-direction:column;gap:18px}
.plan.feat{background:var(--ink-text);color:var(--fg);border-color:transparent;position:relative}
.plan.feat .pmuted{color:var(--muted)}
.plan h3{font-size:16px;font-weight:500;display:flex;justify-content:space-between;align-items:center}
.badge{font-family:var(--mono);font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;background:var(--ember);color:#160803;border-radius:999px;padding:4px 9px}
.price{display:flex;align-items:baseline;gap:6px}
.price b{font-family:var(--serif);font-weight:400;font-size:64px;line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.pmuted{color:var(--ink-muted);font-size:14px}
.plan ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:9px;font-size:14.5px}
.plan li{display:flex;gap:10px}
.plan li::before{content:"";flex:none;width:6px;height:6px;margin-top:8px;border-radius:50%;background:currentColor;opacity:.55}
.plan .btn{margin-top:auto;width:100%}
.seats{display:flex;align-items:center;gap:10px;font-size:14px}
.step{display:inline-flex;align-items:center;border:1px solid var(--paper-line);border-radius:999px;background:#fff}
.step button{width:34px;height:34px;border:0;background:transparent;border-radius:50%;cursor:pointer;font-size:18px;line-height:1}
.step button:hover{background:var(--paper-2)}
.step button:disabled{opacity:.35;cursor:not-allowed}
.step output{min-width:30px;text-align:center;font-variant-numeric:tabular-nums;font-weight:500}
.total{font-family:var(--mono);font-size:12px;color:var(--ink-muted)}

/* faq */
.faq{padding:0 var(--gut) clamp(80px,9vw,130px)}
.faq-grid{display:grid;grid-template-columns:1fr 1.4fr;gap:48px;border-top:1px solid var(--paper-line);padding-top:56px}
.acc{border-top:1px solid var(--paper-line)}
.acc-item{border-bottom:1px solid var(--paper-line)}
.acc-item h3{font:inherit}
.acc-btn{width:100%;display:flex;justify-content:space-between;align-items:center;gap:20px;padding:22px 4px;background:transparent;border:0;cursor:pointer;text-align:left;font-size:18px;font-weight:500}
.acc-btn:hover{color:var(--ember-deep)}
.plus{flex:none;width:28px;height:28px;border-radius:50%;border:1px solid var(--paper-line);position:relative;transition:transform .35s var(--ease),background .2s}
.plus::before,.plus::after{content:"";position:absolute;left:8px;right:8px;top:13px;height:1.5px;background:currentColor}
.plus::after{transform:rotate(90deg)}
.acc-btn[aria-expanded="true"] .plus{transform:rotate(45deg);background:var(--ink-text);color:var(--paper)}
.acc-panel{overflow:hidden;height:0;transition:height .45s var(--ease)}
.acc-panel p{margin:0;padding:0 4px 24px;color:var(--ink-muted);max-width:60ch}

/* footer */
.foot{position:relative;z-index:3;background:var(--ink);padding:clamp(70px,8vw,110px) var(--gut) 28px;overflow:hidden}
.foot-top{display:grid;grid-template-columns:1.2fr 1fr;gap:40px;align-items:end}
.foot h2{font-family:var(--serif);font-size:clamp(40px,4.6vw,72px);line-height:.95}
.news{display:flex;flex-direction:column;gap:8px}
.news-row{display:flex;gap:8px}
.field{flex:1;min-width:0;background:var(--ink-2);border:1px solid var(--line);border-radius:999px;padding:13px 18px;outline:0;transition:border-color .2s,box-shadow .2s}
.field:focus{border-color:var(--ember);box-shadow:0 0 0 4px rgba(255,91,46,.18)}
.field[aria-invalid="true"]{border-color:#ff8a6a}
.msg{font-size:13.5px;min-height:20px;color:var(--muted)}
.msg.err{color:#ff9d82}.msg.ok{color:#9be3b5}
.wordmark{font-family:var(--serif);font-size:clamp(120px, 36vw, 560px);line-height:1.02;letter-spacing:-.04em;margin:40px 0 0;padding-bottom:.04em;background:linear-gradient(180deg,#e9eaed 0%,#7e818a 45%,#2a2c31 100%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;user-select:none}
.foot-bot{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:22px;color:var(--muted);font-size:14px}
.foot-bot nav{display:flex;gap:18px;flex-wrap:wrap}
.foot-bot a{text-decoration:none}.foot-bot a:hover{color:var(--fg)}

/* dialog */
dialog{border:1px solid var(--line);border-radius:var(--r-l);background:#121317;color:var(--fg);padding:30px;width:min(440px, calc(100% - 32px))}
dialog::backdrop{background:rgba(5,5,7,.7);backdrop-filter:blur(4px)}
dialog h2{font-family:var(--serif);font-size:40px;line-height:1;margin:6px 0 10px}
dialog p{color:var(--muted);margin:0 0 20px}
dialog form{display:flex;flex-direction:column;gap:10px}
dialog label{font-size:13px;color:var(--muted)}
dialog .field{border-radius:12px}
.plan-pick{display:flex;gap:6px;flex-wrap:wrap}
.plan-pick label{display:inline-flex}
.plan-pick input{position:absolute;opacity:0;pointer-events:none}
.plan-pick span{border:1px solid var(--line);border-radius:999px;padding:7px 13px;cursor:pointer;color:var(--fg);font-size:14px}
.plan-pick input:checked + span{background:var(--fg);color:var(--ink)}
.plan-pick input:focus-visible + span{outline:2px solid var(--ember);outline-offset:2px}
.dlg-x{position:absolute;top:16px;right:16px}

/* reveal */
.rv{opacity:0;transform:translateY(22px);transition:opacity .9s var(--ease),transform .9s var(--ease)}
.rv.in{opacity:1;transform:none}

/* fallback svg */
#svgStage .edge{stroke:rgba(236,235,231,.22);stroke-width:1}
#svgStage .edge.hot{stroke:rgba(255,255,255,.85)}
#svgStage .edge.path{stroke:var(--ember);stroke-width:2}

/* ---------- responsive ---------- */
@media (max-width:1023px){
  .nav,.site-head .btn{display:none}
  .burger{display:block}
  .site-head{padding:6px 6px 6px 16px}
  .hero-copy{max-width:100%}
  .sec-intro{grid-template-columns:1fr;gap:18px}
  .c-a{grid-column:span 6}.c-b,.c-c{grid-column:span 3}.c-d,.c-e{grid-column:span 3}
  .plans{grid-template-columns:1fr;max-width:560px}
  .faq-grid{grid-template-columns:1fr;gap:28px}
  .foot-top{grid-template-columns:1fr}
}
@media (max-width:1023px) and (min-width:641px){
  .hero{justify-content:flex-end;padding-bottom:110px}
  .hero-copy{max-width:560px}
}
@media (max-width:640px){
  .hero{justify-content:flex-end;padding:0 var(--gut) 96px}
  .hero h1{font-size:clamp(46px, 13.4vw, 62px);margin:14px 0 16px}
  .hero p.lede{font-size:15.5px;margin-bottom:22px}
  .hero-meta .hint{display:none}
  .sticky{padding:84px var(--gut) 20px}
  .sec-head h2{font-size:38px;margin:10px 0 8px}
  .sec-head p{font-size:14.5px}
  .kbd-hint{display:none}
  .chip{padding:6px 11px;font-size:12.5px}
  .lbl{font-size:11px;padding:4px 7px}
  .ask-sec .sticky{justify-content:flex-end}
  .ask-panel{padding:18px;gap:12px;border-radius:22px;max-height:64svh}
  .ask-panel h2{font-size:30px}
  .res{padding:10px 12px}
  .note-card{top:auto;bottom:12px;left:12px;right:12px;width:auto;transform:translateY(24px);max-height:62svh;overflow:auto}
  .bento{grid-template-columns:1fr}
  .c-a,.c-b,.c-c,.c-d,.c-e{grid-column:auto}
  .card{min-height:0}
  .card.photo{min-height:320px}
  .price b{font-size:54px}
  .news-row{flex-direction:column}
  .acc-btn{font-size:16px;padding:18px 2px}
}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
  .rv{opacity:1;transform:none}
  .hero-copy>*,.hero-meta{opacity:1;transform:none;filter:none}
}
</style>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<div class="loader" id="loader" aria-hidden="true"><div class="ld-in"><div class="ld-word">Argent<span class="ld-fill">Argent</span></div><div class="ld-bar"><i></i></div><div class="ld-row mono"><span id="ldMsg">Reading 42 notes</span><span id="ldNum">000</span></div></div></div>
<div class="backdrop" aria-hidden="true"></div>
<canvas id="stage" aria-hidden="true"></canvas>
<svg id="svgStage" aria-hidden="true"></svg>

<header class="site-head">
  <a class="logo" href="#top" aria-label="Argent home"><i aria-hidden="true"></i>Argent</a>
  <nav class="nav" aria-label="Primary">
    <a href="#graph">Graph</a><a href="#ask">Ask</a><a href="#features">Features</a><a href="#pricing">Pricing</a><a href="#faq">FAQ</a>
  </nav>
  <button class="btn btn-light" type="button" data-signup="Pro">Start free</button>
  <button class="burger" type="button" aria-expanded="false" aria-controls="mnav" aria-label="Open menu"><span></span><span></span></button>
</header>
<nav class="mnav" id="mnav" aria-label="Mobile">
  <a href="#graph">Graph</a><a href="#ask">Ask</a><a href="#features">Features</a><a href="#pricing">Pricing</a><a href="#faq">FAQ</a>
  <button class="btn btn-light" type="button" data-signup="Pro">Start free</button>
</nav>

<main id="main">
  <section class="story hero-track" id="top" aria-labelledby="hero-h">
   <div class="hero" id="heroStick">
    <div class="hero-copy" id="heroCopy">
      <div class="eyebrow">Argent · a notebook that links itself</div>
      <h1 id="hero-h">Notes that find <em>each&nbsp;other.</em></h1>
      <p class="lede">Write the way you think. Argent reads every note and draws the links for you — people, projects, half-finished ideas — into a graph you can walk, search and ask.</p>
      <div class="hero-ctas">
        <button class="btn btn-light" type="button" data-signup="Free">Start free</button>
        <a class="btn btn-ghost" href="#graph">See a real graph <span aria-hidden="true">↓</span></a>
      </div>
    </div>
    <div class="hero-meta mono" aria-hidden="true">
      <span>42 notes · 71 links · 0 folders</span>
      <span class="hint">Move your cursor — the metal follows</span>
      <span class="scrollcue"></span>
    </div>
    <div class="cine-cap" id="cap1" aria-hidden="true"><span class="mono">Every note</span><p>is a drop of the same metal.</p></div>
    <div class="cine-cap" id="cap2" aria-hidden="true"><span class="mono">Argent pulls them apart</span><p>and keeps every thread.</p></div>
   </div>
  </section>

  <section class="story graph-sec" id="graph" aria-labelledby="graph-h">
    <div class="sticky">
      <div class="sec-head">
        <div class="eyebrow">01 — The graph</div>
        <h2 id="graph-h">One week of thinking, <em>already linked.</em></h2>
        <p>Forty-two notes from a product designer's week. Nobody filed anything — Argent drew every line.</p>
      </div>
      <div class="labels" id="labels" role="group" aria-label="Notes in the graph — press Enter to open one"></div>
      <div class="graph-foot">
        <div class="chips" role="group" aria-label="Filter notes by type" id="filters"></div>
        <div class="kbd-hint"><span>Drag to orbit</span><span>Hover to trace links</span><span><kbd>Tab</kbd> + <kbd>Enter</kbd> opens a note</span><span><kbd>←</kbd><kbd>→</kbd> rotate</span></div>
      </div>
    </div>
  </section>

  <section class="story ask-sec" id="ask" aria-labelledby="ask-h">
    <div class="sticky">
      <div class="ask-panel">
        <div class="eyebrow">02 — Ask</div>
        <h2 id="ask-h">Ask a question. <em>Watch the path light up.</em></h2>
        <form class="search" id="askForm" role="search">
          <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
          <label class="sr-only" for="q">Ask your notes</label>
          <input id="q" type="search" autocomplete="off" placeholder="Ask your notes…" aria-describedby="askStatus">
          <button type="submit">Ask</button>
        </form>
        <div class="sugg" id="sugg" aria-label="Example questions"></div>
        <div class="ask-status" id="askStatus" role="status" aria-live="polite"></div>
        <ul class="results" id="results"></ul>
      </div>
    </div>
  </section>

  <aside class="note-card" id="card" tabindex="-1" aria-labelledby="ncTitle" aria-hidden="true">
    <div class="nc-top"><span class="tag" id="ncTag">Project</span><button class="x" type="button" id="ncClose" aria-label="Close note"><svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M1 1l10 10M11 1 1 11" stroke="currentColor" stroke-width="1.5"/></svg></button></div>
    <h3 id="ncTitle">Note</h3>
    <p id="ncBody"></p>
    <div class="nc-meta" id="ncMeta"></div>
    <div class="nc-links" id="ncLinks"></div>
  </aside>

  <section class="paper features" id="features" aria-labelledby="feat-h">
    <div class="wrap">
      <div class="sec-intro">
        <div><div class="eyebrow">03 — Why it works</div><h2 class="big-h rv" id="feat-h">You write. <em>The links</em> write themselves.</h2></div>
        <p class="rv">No folders, no tagging rituals, no weekly cleanup. Argent understands what a note is about and quietly connects it to everything it touches.</p>
      </div>
      <div class="bento">
        <article class="card c-a rv">
          <span class="num">AUTO-LINKING</span>
          <h3>It spots the connection while you type.</h3>
          <p>Mention a person, a project or an idea you've written about before and Argent suggests the link inline. Accept with <kbd style="font-family:var(--mono);font-size:12px">Tab</kbd>, or ignore it.</p>
          <div class="linkdemo" aria-label="Example: two notes linked by a shared phrase">
            <div class="mini"><small>Call: Lumen Foods · Tue</small>They stopped opening the app in week two — "too many notes, nothing <span class="wl">connects</span>."</div>
            <div class="mini"><small>Churn reasons · suggested link</small>Week-two drop-off is about notes that never <span class="wl">connect</span> to anything else.</div>
          </div>
        </article>
        <article class="card photo c-b rv">
          <img src="assets/notebook.webp" alt="An open black notebook with a hand-drawn network of silver circles and lines, a steel pen beside it" loading="lazy" width="900" height="1205">
          <div class="cap"><span class="num" style="color:#c5c6cb">HANDWRITING IN</span><h3>Paper counts too.</h3><p>Photograph a page — Argent reads your handwriting and links it like any other note.</p></div>
        </article>
        <article class="card dark c-c rv">
          <span class="num">RESURFACING</span>
          <h3>Old notes come back at the right time.</h3>
          <p>A forgetting curve brings forgotten notes back to your daily page, just before you'd lose them.</p>
          <div class="meter" aria-hidden="true"><i class="on" style="height:90%"></i><i class="on" style="height:62%"></i><i class="on" style="height:44%"></i><i class="hot" style="height:78%"></i><i class="on" style="height:52%"></i><i style="height:36%"></i><i class="hot" style="height:70%"></i><i style="height:28%"></i></div>
        </article>
        <article class="card photo c-d rv">
          <img src="assets/mercury.webp" alt="Beads of liquid silver on black slate, joined by thin threads" loading="lazy" width="1200" height="900">
          <div class="cap"><span class="num" style="color:#c5c6cb">LOCAL-FIRST</span><h3>Yours, on your disk.</h3><p>Plain Markdown files, end-to-end encrypted sync, works offline on a plane.</p></div>
        </article>
        <article class="card c-e rv">
          <span class="num">IMPORT</span>
          <h3>Bring ten years of notes.</h3>
          <p>Drop in a folder and Argent links your whole archive in about a minute per thousand notes.</p>
          <div class="formats"><span>.md</span><span>.txt</span><span>HTML export</span><span>Web clips</span><span>PDF highlights</span><span>Photos of paper</span></div>
        </article>
      </div>
    </div>
  </section>

  <section class="paper pricing" id="pricing" aria-labelledby="price-h">
    <div class="wrap">
      <div class="sec-intro">
        <div><div class="eyebrow">04 — Pricing</div><h2 class="big-h rv" id="price-h">Free until it's <em>indispensable.</em></h2></div>
        <div class="rv">
          <div class="bill" role="radiogroup" aria-label="Billing period" id="bill">
            <button type="button" role="radio" aria-checked="false" data-period="monthly">Monthly</button>
            <button type="button" role="radio" aria-checked="true" data-period="yearly">Yearly <span class="save">−20%</span></button>
          </div>
        </div>
      </div>
      <div class="plans">
        <article class="plan rv">
          <h3>Free</h3>
          <div class="price"><b>$0</b><span class="pmuted">forever</span></div>
          <p class="pmuted" style="margin:0">For trying it with your real notes.</p>
          <ul><li>Up to 500 notes</li><li>Auto-linking and the graph</li><li>Ask: 20 questions a month</li><li>One device</li></ul>
          <button class="btn btn-ink" type="button" data-signup="Free">Start free</button>
        </article>
        <article class="plan feat rv">
          <h3>Pro <span class="badge">Most picked</span></h3>
          <div class="price"><b data-price="pro">$8</b><span class="pmuted" data-per="pro">/ month, billed yearly</span></div>
          <p class="pmuted" style="margin:0">For one brain that writes a lot.</p>
          <ul><li>Unlimited notes and links</li><li>Unlimited Ask with path view</li><li>Handwriting import</li><li>Encrypted sync on every device</li></ul>
          <button class="btn btn-ember" type="button" data-signup="Pro">Start 14-day trial</button>
        </article>
        <article class="plan rv">
          <h3>Team</h3>
          <div class="price"><b data-price="team">$12</b><span class="pmuted" data-per="team">/ seat / month</span></div>
          <div class="seats"><span id="seatLbl">Seats</span>
            <div class="step" role="group" aria-labelledby="seatLbl"><button type="button" id="seatMinus" aria-label="Remove a seat">−</button><output id="seatN" aria-live="polite">5</output><button type="button" id="seatPlus" aria-label="Add a seat">+</button></div>
          </div>
          <div class="total" id="teamTotal" aria-live="polite">$720 billed yearly</div>
          <ul><li>Everything in Pro</li><li>Shared graphs across the team</li><li>Permissions per space</li><li>SSO and audit log</li></ul>
          <button class="btn btn-ink" type="button" data-signup="Team">Start team trial</button>
        </article>
      </div>
    </div>
  </section>

  <section class="paper faq" id="faq" aria-labelledby="faq-h">
    <div class="wrap faq-grid">
      <div><div class="eyebrow">05 — Questions</div><h2 class="big-h rv" id="faq-h" style="font-size:clamp(40px,4.6vw,72px)">Asked <em>often.</em></h2></div>
      <div class="acc" id="acc">
        <div class="acc-item"><h3><button class="acc-btn" type="button" aria-expanded="true" aria-controls="a1" id="b1">How does Argent decide what to link?<span class="plus" aria-hidden="true"></span></button></h3><div class="acc-panel" id="a1" role="region" aria-labelledby="b1"><p>It reads each note for people, projects, places and ideas, compares them with everything you've written, and proposes a link when two notes are about the same thing. You can accept, reject or pin any link; it learns from those choices.</p></div></div>
        <div class="acc-item"><h3><button class="acc-btn" type="button" aria-expanded="false" aria-controls="a2" id="b2">Do my notes leave my device?<span class="plus" aria-hidden="true"></span></button></h3><div class="acc-panel" id="a2" role="region" aria-labelledby="b2" hidden><p>Linking runs on your device. Sync is end-to-end encrypted, so our servers only ever store ciphertext. Ask can run fully offline on recent laptops.</p></div></div>
        <div class="acc-item"><h3><button class="acc-btn" type="button" aria-expanded="false" aria-controls="a3" id="b3">Can I leave and take everything with me?<span class="plus" aria-hidden="true"></span></button></h3><div class="acc-panel" id="a3" role="region" aria-labelledby="b3" hidden><p>Yes. Your notes are plain Markdown files, and links are written as ordinary [[wiki-links]], so any editor can open them the day you leave.</p></div></div>
        <div class="acc-item"><h3><button class="acc-btn" type="button" aria-expanded="false" aria-controls="a4" id="b4">What happens when I hit 500 notes on Free?<span class="plus" aria-hidden="true"></span></button></h3><div class="acc-panel" id="a4" role="region" aria-labelledby="b4" hidden><p>Nothing disappears. You can keep reading, searching and editing; new notes just won't be auto-linked until you upgrade or archive a few.</p></div></div>
        <div class="acc-item"><h3><button class="acc-btn" type="button" aria-expanded="false" aria-controls="a5" id="b5">Is the graph on this page real?<span class="plus" aria-hidden="true"></span></button></h3><div class="acc-panel" id="a5" role="region" aria-labelledby="b5" hidden><p>It's a real force-directed layout of 42 sample notes, and the Ask box runs a real search over them in your browser. The notes themselves are fictional.</p></div></div>
      </div>
    </div>
  </section>
</main>

<footer class="foot" aria-labelledby="foot-h">
  <div class="wrap">
    <div class="foot-top">
      <h2 id="foot-h">Field notes, <em>once a month.</em></h2>
      <form class="news" id="news" novalidate>
        <label class="sr-only" for="newsEmail">Email address</label>
        <div class="news-row"><input class="field" id="newsEmail" type="email" placeholder="you@studio.com" autocomplete="email" aria-describedby="newsMsg" required><button class="btn btn-light" type="submit">Subscribe</button></div>
        <div class="msg" id="newsMsg" aria-live="polite">One letter about thinking tools. No tracking pixels.</div>
      </form>
    </div>
    <div class="wordmark" aria-hidden="true">Argent</div>
    <div class="foot-bot">
      <span>© 2026 Argent Labs — a fictional product.</span>
      <nav aria-label="Footer"><a href="#graph">Graph</a><a href="#ask">Ask</a><a href="#features">Features</a><a href="#pricing">Pricing</a><a href="#faq">FAQ</a><a href="#top">Back to top ↑</a></nav>
    </div>
  </div>
</footer>

<dialog id="signup" aria-labelledby="dlgTitle">
  <button class="x dlg-x" type="button" id="dlgClose" aria-label="Close"><svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M1 1l10 10M11 1 1 11" stroke="currentColor" stroke-width="1.5"/></svg></button>
  <div id="dlgForm">
    <div class="eyebrow">Get started</div>
    <h2 id="dlgTitle">Start your graph.</h2>
    <p>We'll send a sign-in link. No password, no card.</p>
    <form id="signupForm" novalidate>
      <div class="plan-pick" role="radiogroup" aria-label="Plan">
        <label><input type="radio" name="plan" value="Free"><span>Free</span></label>
        <label><input type="radio" name="plan" value="Pro" checked><span>Pro trial</span></label>
        <label><input type="radio" name="plan" value="Team"><span>Team trial</span></label>
      </div>
      <label for="suEmail" style="margin-top:8px">Work or personal email</label>
      <input class="field" id="suEmail" type="email" autocomplete="email" placeholder="you@studio.com" aria-describedby="suMsg" required>
      <div class="msg" id="suMsg" aria-live="polite"></div>
      <button class="btn btn-ember" type="submit">Send my link</button>
    </form>
  </div>
</dialog>

<!-- ============ UI (works without WebGL or modules) ============ -->
<script>
(function(){
  const $=s=>document.querySelector(s), $$=s=>[...document.querySelectorAll(s)];
  const RM=matchMedia('(prefers-reduced-motion: reduce)');
  // safety: never let the loader trap the page
  setTimeout(()=>{if(!document.body.classList.contains('ready')){document.body.classList.add('ready');const l=document.getElementById('loader');if(l)l.classList.add('gone')}},7000);
  // mobile nav
  const burger=$('.burger'), mnav=$('#mnav');
  function setNav(open){burger.setAttribute('aria-expanded',open);burger.setAttribute('aria-label',open?'Close menu':'Open menu');mnav.classList.toggle('open',open);document.body.style.overflow=open?'hidden':'';}
  burger.addEventListener('click',()=>setNav(burger.getAttribute('aria-expanded')!=='true'));
  mnav.addEventListener('click',e=>{if(e.target.closest('a'))setNav(false)});
  addEventListener('keydown',e=>{if(e.key==='Escape'&&mnav.classList.contains('open')){setNav(false);burger.focus()}});
  // email check
  const okEmail=v=>/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v.trim());
  function validate(input,msg,okText){
    const v=input.value;
    if(!v.trim()){input.setAttribute('aria-invalid','true');msg.className='msg err';msg.textContent='Please enter your email address.';input.focus();return false}
    if(!okEmail(v)){input.setAttribute('aria-invalid','true');msg.className='msg err';msg.textContent='That doesn’t look like an email — check for a typo.';input.focus();return false}
    input.removeAttribute('aria-invalid');msg.className='msg ok';msg.textContent=okText;return true;
  }
  $('#news').addEventListener('submit',e=>{e.preventDefault();const i=$('#newsEmail');if(validate(i,$('#newsMsg'),'Subscribed. The next letter goes out on the 1st.'))i.value=''});
  // signup dialog
  const dlg=$('#signup');let opener=null;
  $$('[data-signup]').forEach(b=>b.addEventListener('click',()=>{
    opener=b; const plan=b.dataset.signup; const r=dlg.querySelector(`input[value="${plan}"]`); if(r) r.checked=true;
    $('#suMsg').textContent='';$('#suMsg').className='msg';$('#suEmail').removeAttribute('aria-invalid');
    const f=$('#signupForm'); f.querySelector('button[type=submit]').disabled=false;
    if(mnav.classList.contains('open')) setNav(false);
    dlg.showModal(); setTimeout(()=>$('#suEmail').focus(),30);
  }));
  $('#dlgClose').addEventListener('click',()=>dlg.close());
  dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});
  dlg.addEventListener('close',()=>{opener&&opener.focus()});
  $('#signupForm').addEventListener('submit',e=>{e.preventDefault();const i=$('#suEmail');const plan=dlg.querySelector('input[name=plan]:checked').value;
    if(validate(i,$('#suMsg'),`Link sent to ${i.value.trim()} — ${plan==='Free'?'your free graph':'your '+plan+' trial'} is ready when you are.`)){i.value='';}});
  // pricing
  const PRICES={monthly:{pro:10,team:15},yearly:{pro:8,team:12}};
  let period='yearly', seats=5;
  function renderPrice(){
    const p=PRICES[period];
    $('[data-price=pro]').textContent='$'+p.pro;
    $('[data-per=pro]').textContent=period==='yearly'?'/ month, billed yearly':'/ month';
    $('[data-price=team]').textContent='$'+p.team;
    const tot=period==='yearly'?p.team*seats*12:p.team*seats;
    $('#teamTotal').textContent=`$${tot.toLocaleString('en-US')} ${period==='yearly'?'billed yearly':'per month'} for ${seats} seats`;
    $('#seatN').textContent=seats; $('#seatMinus').disabled=seats<=2; $('#seatPlus').disabled=seats>=50;
    $$('#bill [role=radio]').forEach(b=>{const on=b.dataset.period===period;b.setAttribute('aria-checked',on);b.tabIndex=on?0:-1});
  }
  $$('#bill [role=radio]').forEach(b=>{
    b.addEventListener('click',()=>{period=b.dataset.period;renderPrice()});
    b.addEventListener('keydown',e=>{if(['ArrowLeft','ArrowRight','ArrowUp','ArrowDown'].includes(e.key)){e.preventDefault();period=period==='yearly'?'monthly':'yearly';renderPrice();$(`#bill [data-period=${period}]`).focus()}});
  });
  $('#seatMinus').addEventListener('click',()=>{seats=Math.max(2,seats-1);renderPrice()});
  $('#seatPlus').addEventListener('click',()=>{seats=Math.min(50,seats+1);renderPrice()});
  renderPrice();
  // accordion
  const items=$$('.acc-btn');
  function setAcc(btn,open){
    const panel=document.getElementById(btn.getAttribute('aria-controls'));
    btn.setAttribute('aria-expanded',open);
    if(open){panel.hidden=false;panel.style.height='0px';requestAnimationFrame(()=>{panel.style.height=panel.scrollHeight+'px'});}
    else{panel.style.height=panel.scrollHeight+'px';requestAnimationFrame(()=>{panel.style.height='0px'});}
  }
  items.forEach(b=>{
    const panel=document.getElementById(b.getAttribute('aria-controls'));
    if(b.getAttribute('aria-expanded')==='true'){panel.hidden=false;panel.style.height='auto'}
    panel.addEventListener('transitionend',()=>{if(b.getAttribute('aria-expanded')==='true')panel.style.height='auto';else panel.hidden=true});
    b.addEventListener('click',()=>{const open=b.getAttribute('aria-expanded')!=='true';
      items.forEach(o=>{if(o!==b&&o.getAttribute('aria-expanded')==='true')setAcc(o,false)});
      setAcc(b,open); if(RM.matches){panel.style.height=open?'auto':'0px';panel.hidden=!open}});
  });
  // reveals
  const io=new IntersectionObserver(es=>es.forEach(en=>{if(en.isIntersecting){en.target.classList.add('in');io.unobserve(en.target)}}),{rootMargin:'0px 0px -8% 0px'});
  $$('.rv').forEach((el,i)=>{el.style.transitionDelay=((i%3)*80)+'ms';io.observe(el)});
})();
</script>

<!-- ============ Graph + liquid metal ============ -->
<script type="module">
const $ = s => document.querySelector(s);
const RMq = matchMedia('(prefers-reduced-motion: reduce)');
let RM = RMq.matches; RMq.addEventListener('change', e => { RM = e.matches; });
const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));
const lerp = (a, b, t) => a + (b - a) * t;
const smooth = t => t * t * (3 - 2 * t);
const easeIO = t => t < .5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
const easeBack = t => { const c = 1.4; return 1 + (c + 1) * Math.pow(t - 1, 3) + c * Math.pow(t - 1, 2); };
function mulberry(a) { return () => { a |= 0; a = a + 0x6D2B79F5 | 0; let t = Math.imul(a ^ a >>> 15, 1 | a); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }

/* ---------------- loader: real progress (fonts, engine, environment map, first scene) ---------------- */
const LD = { steps: new Set(), need: ['fonts', 'engine', 'env', 'scene', 'frame'], shown: 0, t0: performance.now(), done: false };
const ldEl = document.getElementById('loader'), ldNum = document.getElementById('ldNum'), ldMsg = document.getElementById('ldMsg');
const LDMSG = { fonts: 'Setting type', engine: 'Warming the metal', env: 'Lighting the studio', scene: 'Linking 42 notes' };
function loadStep(k) { LD.steps.add(k); if (LDMSG[k]) ldMsg.textContent = LDMSG[k]; }
document.fonts.ready.then(() => loadStep('fonts'));
function tickLoader(now) {
  if (LD.done) return;
  const target = LD.need.filter(k => LD.steps.has(k)).length / LD.need.length;
  const minT = clamp((now - LD.t0) / 900);
  LD.shown = RM ? target : Math.min(lerp(LD.shown, target, .12) + .004, target, minT * 1.0001 + (target >= 1 ? 0 : 0));
  ldEl.style.setProperty('--lp', (LD.shown * 100).toFixed(1) + '%'); ldEl.style.setProperty('--lpn', LD.shown.toFixed(3));
  ldNum.textContent = String(Math.round(LD.shown * 100)).padStart(3, '0');
  if (LD.shown > .995 || (now - LD.t0) > 6000) {
    LD.done = true; ldNum.textContent = '100';
    setTimeout(() => { ldEl.classList.add('out'); document.body.classList.add('ready'); S.introStart = performance.now(); setTimeout(() => ldEl.classList.add('gone'), 950); }, RM ? 0 : 220);
  }
}

/* ---------------- data: 42 notes, first 14 are hubs (the droplets) ---------------- */
const TAGS = { project: 'Projects', people: 'People', idea: 'Ideas', reading: 'Reading', daily: 'Daily' };
const N = [
 ['Today — Nov 26','daily','Finish the pricing table, reply to Mara about the onboarding test, read two chapters of the slip-box book.',[2,4,5,8,7,41]],
 ['Atlas launch','project','Public launch of Atlas, our sharing feature, set for January 14. Jun owns it. Blockers: pricing and the first-run checklist.',[2,5,12,9,14,15,16]],
 ['Pricing v3','project','Moving from pure seats to seats plus usage. Annual gets two months free. The free tier keeps 500 notes.',[3,10,17,18,19]],
 ['Customer calls','project','Twelve calls this month. The pattern: people churn in week two, when notes pile up and nothing connects.',[4,10,20,21,22,23,16]],
 ['Mara Okafor','people','Head of research. Ran the onboarding test. Strong opinions on empty states; prefers async video to meetings.',[5,24,25]],
 ['Onboarding flow','project','Three steps: import, first link, first question. Drop-off is worst at the first link.',[25,26,27,28,18]],
 ['Spaced repetition','idea','Resurface old notes on a forgetting curve so they get linked instead of buried.',[7,8,29,30,36]],
 ['Book: The Slip-Box Habit','reading','Write small notes in your own words, link each one to at least one other, never file by topic.',[13,30,36]],
 ['Weekly review','daily','Fridays, thirty minutes. Close open loops, merge duplicates, star three notes to resurface next week.',[6,31]],
 ['Design system','project','Tokens, type and icons for the app and the site. Version two has to ship before Atlas.',[12,32,33,34,38]],
 ['Retention cohort Q3','project','Week-two retention is 41%. People who make five links in week one retain at 68%.',[5,21,28,31]],
 ['Writing voice','idea','Short sentences. Name the thing. Never write leverage. Read it aloud before sending.',[25,35,36]],
 ['Jun Park','people','Engineering lead on Atlas. Wants fewer meetings and a real launch checklist.',[37,38,14]],
 ['Reading list','reading','Books queued for the winter: systems, archives, interviewing, and one novel for balance.',[23,39,40]],
 ['Launch checklist','project','Docs, changelog, status page, support macros, press kit, a rollback plan nobody hopes to use.',[15,26]],
 ['Press kit','project','Screenshots of the graph, one paragraph, founder quotes, logo files. Due January 7.',[]],
 ['Beta feedback','project','Forty beta users. Most loved: Ask with the path view. Most asked: handwriting import.',[]],
 ['Annual plan discount','idea','Two months free on yearly. Test whether showing monthly-equivalent price lifts conversion.',[19]],
 ['Free tier limits','idea','500 notes is generous enough to get hooked, small enough that heavy writers upgrade.',[]],
 ['Seats vs usage','idea','Seats are predictable for buyers; usage is fair for light teams. Hybrid: seats with an Ask allowance.',[]],
 ['Call: Lumen Foods','people','Ops lead. They stopped opening the app in week two: too many notes, nothing connects.',[21]],
 ['Churn reasons','idea','Top three: notes never connect, import was painful, no reason to come back on day eight.',[28]],
 ['Call: Halden Studio','people','Architecture studio, nine seats. Want shared graphs per project and a client-safe view.',[21,19]],
 ['Book: Ask Better Questions','reading','Interview about the past, not hypotheticals. Customers lie about the future, kindly.',[]],
 ['1:1 with Mara','people','She wants the empty state to show an example graph, not a blank page. Agreed to test it.',[25]],
 ['Empty-state copy','project','Draft: "Your first note is lonely. Write a second one." Mara thinks it is too cute.',[]],
 ['First-run checklist','project','Import notes, accept one suggested link, ask one question. Three ticks, then confetti, maybe.',[27]],
 ['Invite teammates step','project','Move the invite step after the first link; inviting into an empty graph converts poorly.',[]],
 ['Activation metric','idea','Activated means five accepted links in the first seven days. Correlates best with week-four retention.',[]],
 ['Forgetting curve','reading','Memory decays fast, then slower. Reviews just before forgetting stretch the curve.',[]],
 ['Evergreen notes','idea','Notes written to last: one idea each, titled as a claim, improved every time you touch them.',[40]],
 ['Q3 retro','daily','Shipped linking v2 and the graph. Missed handwriting import. Lesson: fewer bets, finished.',[]],
 ['Color tokens','project','Ink, paper, silver and one ember accent. Every UI colour maps back to those four.',[33]],
 ['Type scale','project','A serif for headlines, a grotesk for UI, a mono for metadata. Eight steps, no more.',[]],
 ['Icon audit','project','Ninety-one icons, thirty-four duplicates. Redraw on a 20px grid with a 1.5px stroke.',[]],
 ['Plain words','idea','Use instead of utilize. Help instead of facilitate. If a word needs a meeting, cut it.',[]],
 ['Essay draft: tools for thought','idea','Argument: a notebook should behave like a garden, not a filing cabinet. Needs a better ending.',[30]],
 ['1:1 with Jun','people','Agreed: freeze scope on December 15, launch checklist owned by Jun, daily async updates.',[14]],
 ['Hiring: design engineer','people','Someone who can prototype the graph in the browser and argue about easing curves.',[]],
 ['Book: Thinking in Loops','reading','Systems have stocks, flows and feedback. Most product problems are a delay you did not see.',[]],
 ['Book: The Patient Archive','reading','An archivist on keeping things findable for a hundred years: names matter more than places.',[]],
 ['Daily — Nov 25','daily','Long call with Mara about onboarding. Started the pricing doc. Too much coffee.',[24,2]],
];
const HUBS = 14, ROOT = 0;
const nodes = N.map(([title, tag, body], i) => ({ i, title, tag, body, hub: i < HUBS, nb: new Set() }));
const edges = []; const ekey = new Set();
N.forEach(([, , , l], i) => l.forEach(j => { const k = i < j ? i + '-' + j : j + '-' + i; if (!ekey.has(k)) { ekey.add(k); edges.push([Math.min(i, j), Math.max(i, j)]); nodes[i].nb.add(j); nodes[j].nb.add(i); } }));
nodes.forEach(n => {
  const d = n.nb.size;
  n.r = n.hub ? Math.min(.2, .115 + d * .011) : Math.min(.1, .066 + d * .007);
  n.parent = n.hub ? n.i : ([...n.nb].filter(j => j < HUBS).sort((a, b) => a - b)[0] ?? [...n.nb][0]);
});
document.querySelector('.hero-meta span').textContent = `${nodes.length} notes · ${edges.length} links · 0 folders`;

/* ---------------- force layout (deterministic, once) ---------------- */
(function layout() {
  const rnd = mulberry(11); const P = nodes.map(() => [rnd() * 4 - 2, rnd() * 4 - 2, rnd() * 4 - 2]);
  const M = nodes.map(n => n.hub ? 2.2 : 1);
  for (let it = 0; it < 520; it++) {
    const F = nodes.map(() => [0, 0, 0]); const step = .06 * (1 - it / 520) + .004;
    for (let i = 0; i < P.length; i++) for (let j = i + 1; j < P.length; j++) {
      const dx = P[i][0] - P[j][0], dy = P[i][1] - P[j][1], dz = P[i][2] - P[j][2];
      const d2 = Math.max(dx * dx + dy * dy + dz * dz, .02), d = Math.sqrt(d2), f = .95 * M[i] * M[j] / d2;
      F[i][0] += dx / d * f; F[i][1] += dy / d * f; F[i][2] += dz / d * f; F[j][0] -= dx / d * f; F[j][1] -= dy / d * f; F[j][2] -= dz / d * f;
    }
    for (const [a, b] of edges) {
      const dx = P[b][0] - P[a][0], dy = P[b][1] - P[a][1], dz = P[b][2] - P[a][2], d = Math.hypot(dx, dy, dz) || 1e-3;
      const rest = (a < HUBS && b < HUBS) ? 1.7 : .95, f = (d - rest) * .9;
      F[a][0] += dx / d * f; F[a][1] += dy / d * f; F[a][2] += dz / d * f; F[b][0] -= dx / d * f; F[b][1] -= dy / d * f; F[b][2] -= dz / d * f;
    }
    for (let i = 0; i < P.length; i++) { for (let k = 0; k < 3; k++) { F[i][k] -= P[i][k] * .06; const m = Math.abs(F[i][k]); P[i][k] += Math.sign(F[i][k]) * Math.min(m, 3) * step; } }
  }
  const c = [0, 0, 0]; P.forEach(p => { c[0] += p[0]; c[1] += p[1]; c[2] += p[2]; }); c.forEach((v, k) => c[k] = v / P.length);
  let R = 0; P.forEach(p => { p[0] -= c[0]; p[1] -= c[1]; p[2] -= c[2]; R = Math.max(R, Math.hypot(p[0], p[1] * 1.15, p[2])); });
  P.forEach((p, i) => { nodes[i].p = [p[0] / R * 2.6, p[1] / R * 2.05, p[2] / R * 2.0]; });
})();
// hero cluster for the hubs
{ const rnd = mulberry(5); nodes.slice(0, HUBS).forEach(n => { let x, y, z; do { x = rnd() * 2 - 1; y = rnd() * 2 - 1; z = rnd() * 2 - 1; } while (x * x + y * y + z * z > 1); n.cl = [x * .46, y * .46, z * .4]; n.cr = .4 + rnd() * .13; n.st = rnd(); const th = rnd() * 6.283, ph = Math.acos(rnd() * 2 - 1), rr = 3.2 + rnd() * 1.6; n.sc = [Math.sin(ph) * Math.cos(th) * rr, Math.cos(ph) * rr * .7, Math.sin(ph) * Math.sin(th) * rr * .5]; }); }
const threads = edges.filter(([a, b]) => a < HUBS && b < HUBS).slice(0, 12);

/* ---------------- camera math shared by WebGL, SVG, labels and picking ---------------- */
const FOV = 40, TAN = Math.tan(FOV * Math.PI / 360), CAMZ = 7;
let W = innerWidth, H = innerHeight, ASPECT = W / H;
function project(v, o) { const z = CAMZ - v[2]; o.x = (v[0] / (z * TAN * ASPECT) + 1) * .5 * W; o.y = (1 - v[1] / (z * TAN)) * .5 * H; o.k = H / (2 * z * TAN); o.z = z; return o; }
function unproject(sx, sy) { return [((sx / W) * 2 - 1) * CAMZ * TAN * ASPECT, (1 - (sy / H) * 2) * CAMZ * TAN, 0]; }

/* ---------------- state ---------------- */
const S = {
  yaw: .4, pitch: .18, yawV: 0, pitchV: 0, dragging: false, lastInteract: -1e9,
  off: [0, 0, 0], scale: 1, blobS: 1, blobC: [0, 0, 0], p: 0, q: 0, covered: false,
  intro: 0, introStart: 0,
  hover: -1, selected: -1, filter: null, path: null, pathStart: 0, pointer: null,
  cur: [0, 0, 0], curV: [0, 0, 0], prox: 0, time: 0, yawTarget: null,
};
const world = nodes.map(() => [0, 0, 0]), wr = new Float32Array(nodes.length), scr = nodes.map(() => ({ x: 0, y: 0, k: 1, z: 1 }));
const heat = new Float32Array(nodes.length), dim = new Float32Array(nodes.length), eHot = new Float32Array(edges.length), ePath = new Float32Array(edges.length);
const elGraph = $('#graph'), elAsk = $('#ask'), elFeat = $('#features');
let tops = {};
function measure() {
  W = innerWidth; H = innerHeight; ASPECT = W / H;
  const y = scrollY; tops = { graph: elGraph.getBoundingClientRect().top + y, ask: elAsk.getBoundingClientRect().top + y, askH: elAsk.offsetHeight, graphH: elGraph.offsetHeight, feat: elFeat.getBoundingClientRect().top + y };
}
function layoutTargets() {
  const halfH = CAMZ * TAN, halfW = halfH * ASPECT, mobile = W < 641, tablet = W < 1024;
  if (mobile) return {
    hero: { off: [0, halfH * .42, 0], blob: .68 },
    graph: { off: [0, .1, 0], s: Math.min(1, halfW * 1.3 / 2.6) },
    ask: { off: [0, halfH * .55, 0], s: Math.min(1, halfW * 1.3 / 2.6) * .62 } };
  if (tablet) return {
    hero: { off: [halfW * .18, halfH * .3, 0], blob: .85 },
    graph: { off: [0, -.1, 0], s: Math.min(1, halfW * .8 / 2.3) },
    ask: { off: [halfW * .38, .15, 0], s: Math.min(.8, halfW * .5 / 2.3) } };
  return {
    hero: { off: [halfW * .42, -.05, 0], blob: 1.05 },
    graph: { off: [halfW * .24, -.12, 0], s: Math.min(1.2, halfH * .92 / 2.1, halfW * .62 / 2.6) },
    ask: { off: [halfW * .3, -.08, 0], s: Math.min(1.05, halfH * .84 / 2.1, halfW * .58 / 2.6) } };
}

/* ---------------- labels (real buttons: keyboard + screen reader path) ---------------- */
const labelsEl = $('#labels');
const labels = nodes.map(n => {
  const b = document.createElement('button'); b.type = 'button'; b.className = 'lbl' + (n.hub ? '' : ' leaf'); b.textContent = n.title;
  b.setAttribute('aria-label', `${n.title} — ${TAGS[n.tag].replace(/s$/, '')} note, ${n.nb.size} links`);
  b.addEventListener('mouseenter', () => { S.hover = n.i; }); b.addEventListener('mouseleave', () => { if (S.hover === n.i) S.hover = -1; });
  b.addEventListener('focus', () => { S.hover = n.i; }); b.addEventListener('blur', () => { if (S.hover === n.i) S.hover = -1; });
  b.addEventListener('click', () => openNote(n.i, b));
  labelsEl.appendChild(b); return b;
});
labelsEl.addEventListener('keydown', e => { if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') { e.preventDefault(); S.yawV += (e.key === 'ArrowLeft' ? -1 : 1) * 1.6; S.lastInteract = S.time; } });

/* filters */
const filtersEl = $('#filters');
[['all', 'All', nodes.length], ...Object.entries(TAGS).map(([k, v]) => [k, v, nodes.filter(n => n.tag === k).length])].forEach(([k, v, c]) => {
  const b = document.createElement('button'); b.type = 'button'; b.className = 'chip'; b.dataset.tag = k; b.setAttribute('aria-pressed', k === 'all');
  b.innerHTML = `${v} <b>${c}</b>`; b.addEventListener('click', () => { S.filter = k === 'all' ? null : k; filtersEl.querySelectorAll('.chip').forEach(x => x.setAttribute('aria-pressed', x.dataset.tag === k)); });
  filtersEl.appendChild(b);
});

/* note card */
const card = $('#card'); let cardOpener = null;
function openNote(i, opener) {
  const n = nodes[i]; S.selected = i; cardOpener = opener || labels[i];
  $('#ncTag').textContent = TAGS[n.tag].replace(/s$/, ''); $('#ncTitle').textContent = n.title; $('#ncBody').textContent = n.body;
  $('#ncMeta').textContent = `${n.nb.size} linked note${n.nb.size === 1 ? '' : 's'}`;
  const L = $('#ncLinks'); L.innerHTML = '';
  [...n.nb].sort((a, b) => nodes[b].nb.size - nodes[a].nb.size).forEach(j => { const b = document.createElement('button'); b.type = 'button'; b.className = 'chip'; b.textContent = nodes[j].title; b.addEventListener('click', () => { openNote(j, labels[j]); faceNode(j); }); L.appendChild(b); });
  card.classList.add('open'); card.setAttribute('aria-hidden', 'false'); card.focus({ preventScroll: true });
}
function closeNote(restore = true) { if (!card.classList.contains('open')) return; card.classList.remove('open'); card.setAttribute('aria-hidden', 'true'); S.selected = -1; if (restore && cardOpener && cardOpener.isConnected && !S.covered) cardOpener.focus({ preventScroll: true }); }
$('#ncClose').addEventListener('click', () => closeNote());
addEventListener('keydown', e => { if (e.key === 'Escape' && card.classList.contains('open')) closeNote(); });
function faceNode(j) { const p = nodes[j].p; S.yawTarget = -Math.atan2(p[0], p[2]); S.lastInteract = S.time; }

/* ---------------- search ---------------- */
const STOP = new Set('the a an of to and or in on for with what who why how did does do is are was about from my me i we our you it at by be say said notes note any'.split(' '));
const SYN = { price: 'pricing', prices: 'pricing', churn: 'churn', leave: 'churn', leaving: 'churn', quit: 'churn', onboard: 'onboarding', signup: 'onboarding', memory: 'forgetting', remember: 'forgetting', review: 'resurface', team: 'seats', teams: 'seats', launch: 'launch', ship: 'launch', book: 'book', books: 'book', reading: 'book' };
function terms(q) { return (q.toLowerCase().match(/[a-z0-9]+/g) || []).filter(t => t.length > 2 && !STOP.has(t)).map(t => SYN[t] || t); }
function wordsOf(s) { return s.toLowerCase().match(/[a-z0-9]+/g) || []; }
function hit(ws, t) { return ws.some(w => w === t || (t.length >= 4 && w.startsWith(t)) || (w.length >= 5 && t.startsWith(w))); }
function bfs(from, to) { const prev = new Map([[from, -1]]), Q = [from]; while (Q.length) { const u = Q.shift(); if (u === to) break; for (const v of nodes[u].nb) if (!prev.has(v)) { prev.set(v, u); Q.push(v); } } const path = []; let c = to; while (c !== -1 && c !== undefined) { path.unshift(c); c = prev.get(c); } return path[0] === from ? path : [to]; }
const resultsEl = $('#results'), statusEl = $('#askStatus'), qEl = $('#q');
function runSearch(q) {
  const t0 = performance.now(); const T = terms(q);
  resultsEl.innerHTML = '';
  if (!q.trim()) { S.path = null; statusEl.textContent = ''; return; }
  if (!T.length) { S.path = null; statusEl.textContent = 'Try a few more specific words.'; return; }
  const scored = nodes.map(n => { const tw = wordsOf(n.title), bw = wordsOf(n.body); let s = 0; T.forEach(t => { if (hit(tw, t)) s += 3; if (hit(bw, t)) s += 1; if (n.tag.startsWith(t)) s += 1; }); return [n.i, s]; }).filter(x => x[1] > 0).sort((a, b) => b[1] - a[1] || nodes[b[0]].nb.size - nodes[a[0]].nb.size).slice(0, 3);
  if (!scored.length) { S.path = null; statusEl.textContent = `No note mentions “${q.trim()}”. Try “pricing”, “Mara” or “churn”.`; return; }
  const hops = new Map(); const pathEdges = new Map(); const trails = [];
  scored.forEach(([i]) => { const pth = bfs(ROOT, i); trails.push(pth); pth.forEach((v, h) => { if (!hops.has(v) || hops.get(v) > h) hops.set(v, h); if (h) { const a = Math.min(v, pth[h - 1]), b = Math.max(v, pth[h - 1]); const ei = edges.findIndex(e => e[0] === a && e[1] === b); if (ei >= 0 && (!pathEdges.has(ei) || pathEdges.get(ei) > h)) pathEdges.set(ei, h); } }); });
  S.path = { nodes: hops, edges: pathEdges, targets: new Set(scored.map(s => s[0])) }; S.pathStart = S.time;
  const ms = (performance.now() - t0).toFixed(1);
  statusEl.textContent = `${scored.length} note${scored.length > 1 ? 's' : ''} · ${pathEdges.size} links lit · searched ${nodes.length} notes in ${ms} ms`;
  const esc = s => s.replace(/[&<>]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;' }[c]));
  scored.forEach(([i], k) => {
    const n = nodes[i]; const li = document.createElement('li'); const b = document.createElement('button'); b.type = 'button'; b.className = 'res';
    const body = esc(n.body).replace(/[A-Za-z0-9]+/g, w => T.some(t => hit([w.toLowerCase()], t)) ? `<mark>${w}</mark>` : w);
    b.innerHTML = `<strong>${esc(n.title)}</strong><span class="trail">${trails[k].map(v => esc(nodes[v].title)).join(' → ')}</span><span class="snip">${body}</span>`;
    b.addEventListener('click', () => { openNote(i, b); faceNode(i); }); li.appendChild(b); resultsEl.appendChild(li);
  });
}
let deb; qEl.addEventListener('input', () => { clearTimeout(deb); deb = setTimeout(() => runSearch(qEl.value), 200); });
$('#askForm').addEventListener('submit', e => { e.preventDefault(); clearTimeout(deb); runSearch(qEl.value); });
const SUGG = ['Why do customers churn?', 'What did Mara say about onboarding?', 'Pricing for teams', 'Notes on spaced repetition'];
SUGG.forEach(s => { const b = document.createElement('button'); b.type = 'button'; b.className = 'chip'; b.textContent = s; b.addEventListener('click', () => { qEl.value = s; runSearch(s); }); $('#sugg').appendChild(b); });
let demoed = false;
new IntersectionObserver(es => { if (es[0].isIntersecting && !demoed && !qEl.value) { demoed = true; const s = 'why do customers churn'; if (RM) { qEl.value = s; runSearch(s); return; } let k = 0; const tick = () => { if (document.activeElement === qEl && k > 0 && qEl.value !== s.slice(0, k)) return; qEl.value = s.slice(0, ++k); if (k < s.length) setTimeout(tick, 45 + Math.random() * 40); else runSearch(s); }; tick(); } }, { threshold: .45 }).observe(elAsk);

/* ---------------- pointer: magnet cursor, hover pick, drag orbit ---------------- */
const canvas = $('#stage'), svg = $('#svgStage');
function pick(x, y) { let best = -1, bd = 1e9; nodes.forEach((n, i) => { if (wr[i] <= 0.001 || dim[i] > .8) return; const s = scr[i], rr = wr[i] * s.k + 8, d = Math.hypot(s.x - x, s.y - y); if (d < rr && s.z < bd) { bd = s.z; best = i; } }); return best; }
let down = null;
addEventListener('pointermove', e => { S.pointer = [e.clientX, e.clientY, e.pointerType]; });
function onDown(e) { if (S.q < .6) return; down = { x: e.clientX, y: e.clientY, lx: e.clientX, ly: e.clientY, moved: false, id: e.pointerId }; }
function onMove(e) {
  const tgt = e.currentTarget;
  if (down && e.pointerId === down.id) {
    const dx = e.clientX - down.lx, dy = e.clientY - down.ly; down.lx = e.clientX; down.ly = e.clientY;
    if (!down.moved && Math.hypot(e.clientX - down.x, e.clientY - down.y) > 5) { down.moved = true; S.dragging = true; tgt.setPointerCapture?.(e.pointerId); }
    if (down.moved) { S.yaw += dx * .006; S.pitch = clamp(S.pitch + (e.pointerType === 'touch' ? 0 : dy * .004), -.9, .9); S.yawV = dx * .006 * 60; S.pitchV = 0; S.lastInteract = S.time; S.yawTarget = null; }
  } else if (S.q > .6 && e.pointerType !== 'touch') { const h = pick(e.clientX, e.clientY); S.hoverCanvas = h; }
  tgt.classList.toggle('pointing', !S.dragging && S.hoverCanvas >= 0); tgt.classList.toggle('grabbing', S.dragging); tgt.classList.toggle('grab', S.q > .6 && !S.dragging && !(S.hoverCanvas >= 0));
}
function onUp(e) {
  if (down && !down.moved && S.q > .6) { const h = pick(e.clientX, e.clientY); if (h >= 0) openNote(h); else if (card.classList.contains('open')) closeNote(false); }
  down = null; S.dragging = false; e.currentTarget.classList.remove('grabbing');
}
[canvas, svg].forEach(el => { el.addEventListener('pointerdown', onDown); el.addEventListener('pointermove', onMove); el.addEventListener('pointerup', onUp); el.addEventListener('pointercancel', () => { down = null; S.dragging = false; }); el.addEventListener('pointerleave', () => { S.hoverCanvas = -1; }); });
S.hoverCanvas = -1;

/* ---------------- per-frame simulation ---------------- */
/* scripted scroll camera: orbit the blob, dive through it as it shatters, pull back to reveal the graph */
const heroCopyEl = document.getElementById('heroCopy'), heroMetaEl = document.querySelector('.hero-meta'), cap1El = document.getElementById('cap1'), cap2El = document.getElementById('cap2');
S.cam = { pos: [0, 0, CAMZ], look: [0, 0, 0], roll: 0, fov: FOV, focus: CAMZ };
const CR = (a, b, c, d, u) => { const u2 = u * u, u3 = u2 * u; return .5 * ((2 * b) + (-a + c) * u + (2 * a - 5 * b + 4 * c - d) * u2 + (-a + 3 * b - 3 * c + d) * u3); };
function cameraPath(p) {
  const C = S.blobC, G = S.off, bs = S.blobS, add = (v, o) => [v[0] + o[0] * bs, v[1] + o[1] * bs, v[2] + o[2] * bs];
  const K = [
    { t: 0, pos: [0, 0, CAMZ], look: [0, 0, 0], roll: 0, fov: FOV },
    { t: .26, pos: add(C, [2.5, .85, 3.3]), look: add(C, [0, .05, 0]), roll: .1, fov: 38 },
    { t: .46, pos: add(C, [-1.1, .3, 2.2]), look: C, roll: -.08, fov: 44 },
    { t: .6, pos: add(C, [.05, .02, -.1]), look: add(C, [-.4, -.1, -3]), roll: .02, fov: 58 },
    { t: .8, pos: [G[0] + 1.1, G[1] + .7, 4.6], look: G, roll: .05, fov: 46 },
    { t: 1, pos: [0, 0, CAMZ], look: [0, 0, 0], roll: 0, fov: FOV }];
  if (RM || p <= 0 || p >= 1) { const k = p >= 1 ? K[5] : K[0]; S.cam.pos = k.pos.slice(); S.cam.look = k.look.slice(); S.cam.roll = 0; S.cam.fov = FOV; S.cam.focus = Math.hypot(C[0], C[1], CAMZ - C[2]); return; }
  let i = 0; while (i < K.length - 2 && p > K[i + 1].t) i++;
  const u = (p - K[i].t) / (K[i + 1].t - K[i].t), A = K[Math.max(0, i - 1)], B = K[i], Cc = K[i + 1], D = K[Math.min(K.length - 1, i + 2)];
  for (let j = 0; j < 3; j++) { S.cam.pos[j] = CR(A.pos[j], B.pos[j], Cc.pos[j], D.pos[j], u); S.cam.look[j] = CR(A.look[j], B.look[j], Cc.look[j], D.look[j], u); }
  const e = smooth(u); S.cam.roll = lerp(B.roll, Cc.roll, e); S.cam.fov = lerp(B.fov, Cc.fov, e);
  S.cam.focus = Math.max(.6, Math.hypot(S.cam.pos[0] - C[0], S.cam.pos[1] - C[1], S.cam.pos[2] - C[2]) * (1 - S.ps) + Math.hypot(S.cam.pos[0] - G[0], S.cam.pos[1] - G[1], S.cam.pos[2] - G[2]) * S.ps);
}
function update(dt) {
  const y = scrollY, vh = H, T = layoutTargets();
  // scroll phases
  let pT = clamp(y / (vh * 1.45)), q = clamp((y - vh * 1.45) / (vh * .45));
  if (RM) { pT = pT > .5 ? 1 : 0; q = pT; }
  // smoothed scroll clock gives the camera inertia
  S.p = RM ? pT : lerp(S.p, pT, 1 - Math.pow(.0009, dt)); if (Math.abs(S.p - pT) < .0004) S.p = pT;
  const p = S.p; S.ps = clamp((p - .38) / .62); S.q = q;
  // hero copy and cinematic captions
  const hc = smooth(clamp((y - vh * .06) / (vh * .42)));
  heroCopyEl.style.opacity = 1 - hc; heroCopyEl.style.transform = `translateY(${-hc * 60}px)`; heroCopyEl.style.filter = hc > .01 ? `blur(${hc * 8}px)` : '';
  heroMetaEl.style.opacity = document.body.classList.contains('ready') ? 1 - hc * 2 : '';
  const capA = (a, b, x) => smooth(clamp((x - a) / .07)) * (1 - smooth(clamp((x - b) / .07)));
  [[cap1El, .22, .44], [cap2El, .56, .8]].forEach(([el, a, b]) => { const o = capA(a, b, p); el.style.opacity = o; el.style.transform = `translate(-50%, ${(1 - o) * 24}px)`; el.style.filter = o < .99 ? `blur(${(1 - o) * 10}px)` : ''; });
  S.covered = tops.feat - y <= 0;
  document.body.classList.toggle('covered', S.covered);
  if (S.covered && card.classList.contains('open')) closeNote(false);
  const t1 = smooth(clamp(y / (vh * 1.45))), t2 = smooth(clamp((y - (tops.ask - vh)) / vh));
  for (let k = 0; k < 3; k++) S.off[k] = lerp(lerp(T.hero.off[k], T.graph.off[k], t1), T.ask.off[k], t2);
  S.scale = lerp(T.graph.s, T.ask.s, t2); S.blobS = T.hero.blob;
  const cardShift = (W >= 1024 && S.selected >= 0) ? 1 : 0; S.cardK = lerp(S.cardK || 0, cardShift, RM ? 1 : 1 - Math.pow(.02, dt)); S.off[0] -= S.cardK * CAMZ * TAN * ASPECT * .2;
  S.blobC = T.hero.off.slice(); S.blobC[2] = 0;
  cameraPath(p, dt);
  // rotation: spring to target, inertia, idle auto-rotate
  if (!S.dragging) {
    if (S.yawTarget != null) { let d = S.yawTarget - S.yaw; d = Math.atan2(Math.sin(d), Math.cos(d)); S.yawV = RM ? 0 : d * 5; if (RM) S.yaw += d; if (Math.abs(d) < .002) S.yawTarget = null; }
    else { S.yawV *= Math.pow(.08, dt); if (!RM && S.time - S.lastInteract > 2.5 && S.hover < 0 && S.hoverCanvas < 0 && S.selected < 0) S.yawV = lerp(S.yawV, .12, 1 - Math.pow(.3, dt)); }
    if (RM && S.yawTarget == null) S.yawV = 0;
    S.yaw += S.yawV * dt; S.pitch = lerp(S.pitch, .18, 1 - Math.pow(.5, dt) * (S.time - S.lastInteract > 3 ? 1 : 0) || 0);
  }
  const cy = Math.cos(S.yaw), sy = Math.sin(S.yaw), cp = Math.cos(S.pitch), sp = Math.sin(S.pitch), s = S.scale;
  const tf = (v, out) => { const x = v[0] * s, yy = v[1] * s, z = v[2] * s; const x1 = cy * x + sy * z, z1 = -sy * x + cy * z; out[0] = x1 + S.off[0]; out[1] = cp * yy - sp * z1 + S.off[1]; out[2] = sp * yy + cp * z1 + S.off[2]; return out; };
  // node world positions
  const tmp = [0, 0, 0];
  nodes.forEach((n, i) => {
    tf(n.p, world[i]);
    if (n.hub) { wr[i] = p >= .995 ? n.r * s : 0; }
    else {
      const qi = clamp(q * 1.6 - (i - HUBS) / (nodes.length - HUBS) * .6), e = RM ? (qi > 0 ? 1 : 0) : easeBack(qi);
      tf(nodes[n.parent].p, tmp); for (let k = 0; k < 3; k++) world[i][k] = lerp(tmp[k], world[i][k], Math.min(e, 1.1));
      wr[i] = qi > 0 ? n.r * s * clamp(e) : 0;
    }
    project(world[i], scr[i]);
  });
  // highlight targets
  const focus = S.hover >= 0 ? S.hover : (S.hoverCanvas >= 0 ? S.hoverCanvas : S.selected);
  const k = 1 - Math.pow(.0005, dt), pt = S.time - S.pathStart;
  nodes.forEach((n, i) => {
    let h = 0, d = 0;
    if (S.path) { const hp = S.path.nodes.get(i); if (hp !== undefined && (RM || pt > hp * .24)) h = S.path.targets.has(i) ? 1 : .75; else d = .55; }
    if (focus >= 0) { if (i === focus) h = Math.max(h, .55); else if (!nodes[focus].nb.has(i)) d = Math.max(d, .7); }
    if (S.filter && n.tag !== S.filter) d = Math.max(d, .85);
    heat[i] = RM ? h : lerp(heat[i], h, k); dim[i] = RM ? d : lerp(dim[i], d, k);
  });
  edges.forEach(([a, b], ei) => {
    let hot = 0, ph = 0;
    if (focus >= 0 && (a === focus || b === focus)) hot = 1;
    if (S.path && S.path.edges.has(ei) && (RM || pt > S.path.edges.get(ei) * .24 - .12)) ph = 1;
    eHot[ei] = RM ? hot : lerp(eHot[ei], hot, k); ePath[ei] = RM ? ph : lerp(ePath[ei], ph, k * .8);
  });
  // magnet cursor (hero only)
  const bs = S.blobS, bc = S.blobC;
  let tgt, prox;
  if (S.pointer && S.pointer[2] !== 'touch') { const cw = unproject(S.pointer[0], S.pointer[1]); const dx = cw[0] - bc[0], dy = cw[1] - bc[1], d = Math.hypot(dx, dy) || 1e-3, lim = 1.35 * bs, m = Math.min(d, lim); tgt = [bc[0] + dx / d * m, bc[1] + dy / d * m, .25 * bs]; prox = 1 - smooth(clamp((d - .5 * bs) / (2.6 * bs))); }
  else { const t = S.time; tgt = [bc[0] + Math.cos(t * .55) * .95 * bs, bc[1] + Math.sin(t * .8) * .45 * bs, .3 * bs]; prox = .55; }
  if (RM) { S.cur = tgt.slice(); S.curV = [0, 0, 0]; }
  else for (let j = 0; j < 3; j++) { const a = 110 * (tgt[j] - S.cur[j]) - 13 * S.curV[j]; S.curV[j] += a * dt; S.cur[j] += S.curV[j] * dt; }
  S.prox = lerp(S.prox, prox * (1 - smooth(clamp(p / .2))), 1 - Math.pow(.02, dt));
}

/* droplet set for the raymarch / goo fallback */
const drops = Array.from({ length: HUBS + 1 }, () => [0, 0, 0, 0]);
function computeDrops() {
  const p = S.ps, bs = S.blobS, bc = S.blobC, pull = [(S.cur[0] - bc[0]) * .12 * S.prox, (S.cur[1] - bc[1]) * .12 * S.prox];
  for (let i = 0; i < HUBS; i++) {
    const n = nodes[i]; const pi = clamp(p * 1.3 - n.st * .3), e = easeIO(pi);
    let c = [bc[0] + n.cl[0] * bs + pull[0], bc[1] + n.cl[1] * bs + pull[1], bc[2] + n.cl[2] * bs];
    const ii = 1 - Math.pow(1 - clamp(S.intro * 1.45 - n.st * .45), 3);
    if (ii < 1) c = [lerp(bc[0] + n.sc[0] * bs, c[0], ii), lerp(bc[1] + n.sc[1] * bs, c[1], ii), lerp(bc[2] + n.sc[2] * bs, c[2], ii)];
    const w = world[i];
    drops[i][0] = lerp(c[0], w[0], e); drops[i][1] = lerp(c[1], w[1], e); drops[i][2] = lerp(c[2], w[2], e);
    drops[i][3] = lerp(n.cr * bs * (.3 + .7 * ii), n.r * S.scale, e);
  }
  drops[HUBS][0] = S.cur[0]; drops[HUBS][1] = S.cur[1]; drops[HUBS][2] = S.cur[2]; drops[HUBS][3] = .27 * bs * S.prox;
  return { k: lerp(.72, 0, smooth(clamp(p / .85))) * bs, noise: .05 * bs * (1 - smooth(clamp(p / .8))), thread: p > .12 && p < .985 ? (.05 * (1 - smooth(clamp((p - .2) / .75))) + .005) * Math.min(1, S.scale * 1.2) : 0 };
}

/* ---------------- renderers ---------------- */
let renderer = null;
const forceSVG = new URLSearchParams(location.search).has('nogl');
function hasGL() { try { const c = document.createElement('canvas'); return !!(c.getContext('webgl2') || c.getContext('webgl')); } catch (e) { return false; } }

async function initGL() {
  const THREE = await import('three');
  const [{ EffectComposer }, { RenderPass }, { UnrealBloomPass }, { ShaderPass }] = await Promise.all([
    import('three/addons/postprocessing/EffectComposer.js'), import('three/addons/postprocessing/RenderPass.js'),
    import('three/addons/postprocessing/UnrealBloomPass.js'), import('three/addons/postprocessing/ShaderPass.js')]);
  loadStep('engine');
  const gl = new THREE.WebGLRenderer({ canvas, antialias: false, alpha: false, powerPreference: 'high-performance' });
  gl.outputColorSpace = THREE.LinearSRGBColorSpace; gl.setClearColor(0x0a0b0d, 1);
  document.documentElement.classList.add('gl');
  // device tier, resolved once from width (fill-rate is the budget)
  const ctx = gl.getContext(), dbgI = ctx.getExtension('WEBGL_debug_renderer_info');
  const SOFT = /swiftshader|llvmpipe|software|basic render/i.test(dbgI ? ctx.getParameter(dbgI.UNMASKED_RENDERER_WEBGL) : '');
  const TIER = SOFT ? { pts: 90000, bloom: true, dprMax: 1 } : W >= 1440 ? { pts: 640000, bloom: true, dprMax: 2 } : W >= 1024 ? { pts: 420000, bloom: true, dprMax: 1.75 } : W >= 641 ? { pts: 220000, bloom: true, dprMax: 1.5 } : { pts: 150000, bloom: false, dprMax: 1.5 };
  window.__tier = { ...TIER, soft: SOFT };
  const DPR_MAX = Math.min(devicePixelRatio || 1, TIER.dprMax);
  let rmTier = Math.min(DPR_MAX, W < 641 ? 1.25 : 1.5), curDpr = 0;
  const camera = new THREE.PerspectiveCamera(FOV, ASPECT, .1, 100); camera.position.set(0, 0, CAMZ);
  const scene = new THREE.Scene();
  const composer = new EffectComposer(gl);
  composer.addPass(new RenderPass(scene, camera));
  const bloom = new UnrealBloomPass(new THREE.Vector2(W / 2, H / 2), .55, .45, .78);
  const DBG = new URLSearchParams(location.search).get('dbg') || '';
  if (TIER.bloom && !DBG.includes('nobloom')) composer.addPass(bloom);
  // cinematic grade: ACES, split-tone, vignette, chromatic aberration (<= .0018), film grain
  const grade = new ShaderPass({ uniforms: { tDiffuse: { value: null }, uTime: { value: 0 }, uCA: { value: .0018 }, uGrain: { value: .045 }, uExpo: { value: 1.12 }, uRes: { value: new THREE.Vector2(W, H) } },
    vertexShader: `varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.); }`,
    fragmentShader: `precision highp float; uniform sampler2D tDiffuse; uniform float uTime,uCA,uGrain,uExpo; uniform vec2 uRes; varying vec2 vUv;
      vec3 aces(vec3 x){ return clamp(x*(2.51*x+.03)/(x*(2.43*x+.59)+.14),0.,1.); }
      void main(){ vec2 d=vUv-.5; float r2=dot(d,d); vec2 o=d*uCA*(1.+r2*2.5);
        vec3 c=vec3(texture2D(tDiffuse,vUv+o).r, texture2D(tDiffuse,vUv).g, texture2D(tDiffuse,vUv-o).b);
        c=aces(c*uExpo);
        float l=dot(c,vec3(.299,.587,.114)); c=mix(c,c*vec3(.93,.98,1.07),(1.-l)*.45); c=mix(c,c*vec3(1.05,1.,.94),l*.35);
        c*=1.-.3*smoothstep(.1,.55,r2);
        float g=fract(sin(dot(floor(vUv*uRes)+fract(uTime*7.)*vec2(91.7,47.3),vec2(12.9898,78.233)))*43758.5453)-.5;
        c+=g*uGrain*(1.-l*.5);
        gl_FragColor=vec4(c,1.); }` });
  composer.addPass(grade);
  const setDpr = d => { if (Math.abs(d - curDpr) > .01) { curDpr = d; gl.setPixelRatio(d); gl.setSize(W, H, false); composer.setPixelRatio(d); composer.setSize(W, H); bloom.resolution.set(W * d / 2, H * d / 2); grade.uniforms.uRes.value.set(W * d, H * d); } };
  // shared environment: photo env map if it loads, procedural studio otherwise
  const envTex = new THREE.Texture(); let envOn = 0;
  const img = new Image(); img.decoding = 'async';
  img.onload = () => { envTex.image = img; envTex.colorSpace = THREE.NoColorSpace; envTex.wrapS = THREE.RepeatWrapping; envTex.minFilter = THREE.LinearFilter; envTex.generateMipmaps = false; envTex.needsUpdate = true; envOn = 1; loadStep('env'); };
  img.onerror = () => loadStep('env'); img.src = 'assets/studio-env.webp';
  const ENV = `
  uniform sampler2D uEnv; uniform float uEnvOn; uniform float uYaw;
  vec3 proc(vec3 r){
    float y=r.y; vec3 c=mix(vec3(.012,.013,.016),vec3(.26,.27,.30),smoothstep(-.5,.7,y));
    c+=vec3(1.)*pow(smoothstep(.62,1.,y),2.)*1.5;
    c+=vec3(.92,.94,1.)*smoothstep(.09,0.,abs(r.x+.62))*smoothstep(-.4,.5,y)*1.3;
    c+=vec3(.8)*smoothstep(.06,0.,abs(r.x-.7))*smoothstep(-.2,.6,y)*.7;
    c+=vec3(1.,.36,.18)*smoothstep(.0,-.85,y)*.16;
    return c;}
  vec3 env(vec3 r){
    vec3 pc=proc(r);
    if(uEnvOn<.5) return pc;
    float u=atan(r.x,-r.z)/6.28318+.5+uYaw*.08, v=acos(clamp(r.y,-1.,1.))/3.14159;
    vec3 t=texture2D(uEnv,vec2(u,v)).rgb; t=t*t*1.6;
    return mix(pc,t,.62)+pc*.25;}
  vec3 metal(vec3 n, vec3 v, float heat, float dimv){
    vec3 r=reflect(-v,n); float f=pow(1.-max(dot(n,v),0.),4.);
    vec3 c=env(r)*vec3(.93,.95,1.)*(.78+.5*f);
    vec3 molten=vec3(1.,.36,.16);
    c=mix(c,c*molten*1.25+molten*(.22+.5*f),heat);
    c*=1.-dimv*.78;
    return c;}`;
  const shared = { uEnv: { value: envTex }, uEnvOn: { value: 0 }, uYaw: { value: 0 } };
  const quadGeo = new THREE.PlaneGeometry(2, 2);
  const FSV = `void main(){gl_Position=vec4(position.xy,0.,1.);}`;
  // 1) always-alive backdrop: slow domain-warped smoke, ember wisps, dot grid, cursor glow
  const bgMat = new THREE.ShaderMaterial({ depthTest: false, depthWrite: false,
    uniforms: { uRes: { value: new THREE.Vector2() }, uTime: { value: 0 }, uDpr: { value: 1 }, uMouse: { value: new THREE.Vector2(-9, -9) }, uWarm: { value: 1 }, uShadow: { value: new THREE.Vector4() } },
    vertexShader: FSV,
    fragmentShader: `precision highp float; uniform vec2 uRes,uMouse; uniform float uTime,uDpr,uWarm; uniform vec4 uShadow;
    float h(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}
    float n(vec2 p){vec2 i=floor(p),f=fract(p);f=f*f*(3.-2.*f);return mix(mix(h(i),h(i+vec2(1,0)),f.x),mix(h(i+vec2(0,1)),h(i+vec2(1,1)),f.x),f.y);}
    float fbm(vec2 p){float a=.5,s=0.;for(int i=0;i<4;i++){s+=a*n(p);p=p*2.03+vec2(1.7,9.2);a*=.5;}return s;}
    void main(){
      vec2 uv=gl_FragCoord.xy/uRes; vec2 p=(uv-.5)*vec2(uRes.x/uRes.y,1.);
      vec2 q=vec2(fbm(p*1.3+uTime*.025),fbm(p*1.3+vec2(4.1,1.3)-uTime*.02));
      float f=fbm(p*1.1+q*1.7+vec2(0.,uTime*.015));
      vec3 col=vec3(.039,.043,.051);
      col+=vec3(.15,.16,.19)*pow(f,2.4)*.75;
      col+=vec3(1.,.36,.16)*pow(fbm(p*.8+q*2.2+7.),3.)*.16*smoothstep(.25,-.65,p.y)*uWarm;
      vec2 g=fract(gl_FragCoord.xy/(28.*uDpr))-.5; float dot1=smoothstep(.07,.03,length(g));
      col+=vec3(.9)*dot1*.05*smoothstep(.95,.2,length(p*vec2(.8,1.1)));
      float m=length((uv-uMouse)*vec2(uRes.x/uRes.y,1.)); col+=vec3(1.,.45,.25)*.035*exp(-m*m*9.);
      vec2 sd=(gl_FragCoord.xy/uDpr-uShadow.xy)/vec2(uShadow.z,uShadow.z*.16);
      float sh=exp(-dot(sd,sd)*1.6); col*=1.-.55*sh*uShadow.w; col+=vec3(1.,.4,.18)*.05*exp(-dot(sd*.45,sd*.45))*uShadow.w;
      col*=1.-.35*smoothstep(.45,1.1,length(p));
      gl_FragColor=vec4(col,1.);
    }` });
  const bg = new THREE.Mesh(quadGeo, bgMat); bg.frustumCulled = false; bg.renderOrder = -2; scene.add(bg);
  // 2) raymarched liquid metal
  const MAXT = 12;
  const rmMat = new THREE.ShaderMaterial({
    depthTest: false, depthWrite: false, transparent: true,
    uniforms: { ...shared, uCamPos: { value: new THREE.Vector3(0, 0, CAMZ) }, uCamMat: { value: new THREE.Matrix3() }, uTan: { value: TAN }, uRes: { value: new THREE.Vector2() }, uTime: { value: 0 }, uAspect: { value: 1 }, uK: { value: .7 }, uNoise: { value: .05 }, uThreadR: { value: 0 }, uThreads: { value: 0 }, uHeatC: { value: 0 },
      uD: { value: Array.from({ length: HUBS + 1 }, () => new THREE.Vector4()) }, uTA: { value: Array.from({ length: MAXT }, () => new THREE.Vector3()) }, uTB: { value: Array.from({ length: MAXT }, () => new THREE.Vector3()) }, uBound: { value: new THREE.Vector4() } },
    vertexShader: FSV,
    fragmentShader: `precision highp float;
    uniform vec2 uRes; uniform float uTime,uAspect,uK,uNoise,uThreadR,uHeatC,uTan; uniform int uThreads; uniform vec3 uCamPos; uniform mat3 uCamMat;
    uniform vec4 uD[${HUBS + 1}]; uniform vec3 uTA[${MAXT}]; uniform vec3 uTB[${MAXT}]; uniform vec4 uBound;
    ${ENV}
    float smin(float a,float b,float k){ if(k<=0.0001) return min(a,b); float h=max(k-abs(a-b),0.)/k; return min(a,b)-h*h*k*.25; }
    float cap(vec3 p,vec3 a,vec3 b,float r){ vec3 pa=p-a,ba=b-a; float h=clamp(dot(pa,ba)/max(dot(ba,ba),1e-5),0.,1.); return length(pa-ba*h)-r*(1.-.55*sin(h*3.14159)); }
    float map(vec3 p){
      float d=1e5;
      for(int i=0;i<${HUBS};i++){ vec4 s=uD[i]; d=smin(d,length(p-s.xyz)-s.w,uK); }
      vec4 c=uD[${HUBS}]; if(c.w>.002) d=smin(d,length(p-c.xyz)-c.w,.55);
      if(uThreadR>0.){ for(int i=0;i<${MAXT};i++){ if(i>=uThreads) break; d=smin(d,cap(p,uTA[i],uTB[i],uThreadR),.14); } }
      d+=uNoise*sin(p.x*3.1+uTime*.9)*sin(p.y*2.7-uTime*.7)*sin(p.z*3.3+uTime*.55);
      return d;}
    vec3 nrm(vec3 p){ vec2 e=vec2(.0015,-.0015); return normalize(e.xyy*map(p+e.xyy)+e.yyx*map(p+e.yyx)+e.yxy*map(p+e.yxy)+e.xxx*map(p+e.xxx)); }
    void main(){
      vec2 ndc=gl_FragCoord.xy/uRes*2.-1.;
      vec3 ro=uCamPos, rd=normalize(uCamMat*vec3(ndc.x*uTan*uAspect, ndc.y*uTan, -1.));
      vec3 oc=ro-uBound.xyz; float b=dot(oc,rd), cc=dot(oc,oc)-uBound.w*uBound.w, disc=b*b-cc;
      if(disc<0.) discard;
      float sq=sqrt(disc), t=max(-b-sq,0.), tEnd=-b+sq; float px=2.*uTan/uRes.y;
      if(map(ro)<0.){ gl_FragColor=vec4(env(rd)*.35*vec3(.9,.92,1.),1.); return; }
      float md=1e5, mt=t; bool hit=false;
      for(int i=0;i<72;i++){ vec3 p=ro+rd*t; float d=map(p); float ratio=d/(t*px); if(ratio<md){md=ratio; mt=t;} if(d<.0008*t){hit=true;break;} t+=d*.9; if(t>tEnd) break; }
      float a=hit?1.:clamp(1.-md/1.6,0.,1.);
      if(a<=0.) discard;
      vec3 p=ro+rd*(hit?t:mt); vec3 n=nrm(p);
      vec4 c=uD[${HUBS}]; float h=uHeatC*smoothstep(.75,0.,length(p-c.xyz)-c.w);
      float ao=0., sc=1.; for(int k=1;k<=5;k++){ float hh=.035*float(k); ao+=(hh-map(p+n*hh))*sc; sc*=.62; }
      ao=clamp(1.-2.6*ao,0.,1.);
      vec3 col=metal(n,-rd,h,0.)*(.35+.65*ao);
      gl_FragColor=vec4(col,a);
    }`
  });
  const rmQuad = new THREE.Mesh(quadGeo, rmMat); rmQuad.frustumCulled = false; rmQuad.renderOrder = -1; scene.add(rmQuad);
  // 3) graph nodes
  const geo = new THREE.IcosahedronGeometry(1, 4);
  const aHeat = new THREE.InstancedBufferAttribute(new Float32Array(nodes.length), 1), aDim = new THREE.InstancedBufferAttribute(new Float32Array(nodes.length), 1);
  geo.setAttribute('aHeat', aHeat); geo.setAttribute('aDim', aDim);
  const nodeMat = new THREE.ShaderMaterial({ uniforms: { ...shared },
    vertexShader: `attribute float aHeat; attribute float aDim; varying vec3 vN; varying vec3 vW; varying float vH; varying float vD;
      void main(){ vec4 w=modelMatrix*instanceMatrix*vec4(position,1.); vW=w.xyz; vN=normalize(mat3(modelMatrix*instanceMatrix)*normal); vH=aHeat; vD=aDim; gl_Position=projectionMatrix*viewMatrix*w; }`,
    fragmentShader: `precision highp float; varying vec3 vN; varying vec3 vW; varying float vH; varying float vD; ${ENV}
      void main(){ vec3 v=normalize(cameraPosition-vW); gl_FragColor=vec4(metal(normalize(vN),v,vH,vD),1.); }` });
  const inst = new THREE.InstancedMesh(geo, nodeMat, nodes.length); inst.frustumCulled = false; scene.add(inst);
  // 4) crisp edge lines
  const ePos = new Float32Array(edges.length * 6), eCol = new Float32Array(edges.length * 6);
  const eGeo = new THREE.BufferGeometry(); eGeo.setAttribute('position', new THREE.BufferAttribute(ePos, 3)); eGeo.setAttribute('color', new THREE.BufferAttribute(eCol, 3));
  const lines = new THREE.LineSegments(eGeo, new THREE.LineBasicMaterial({ vertexColors: true, transparent: true, blending: THREE.AdditiveBlending, depthWrite: false })); lines.frustumCulled = false; scene.add(lines);
  // 5) thought dust: 26k–120k points. Hero: an accretion ring orbiting the blob. Graph: nerve fibres along every link, with synapse flashes.
  const PC = TIER.pts, rnd = mulberry(23), gauss = () => { let u = 0, v = 0; while (!u) u = rnd(); v = rnd(); return Math.sqrt(-2 * Math.log(u)) * Math.cos(6.2832 * v); };
  // only the hero nebula coordinates live in a buffer (12 bytes/point); everything else is hashed from gl_VertexID on the GPU
  const neb = new Float32Array(PC * 3);
  for (let i = 0; i < PC; i++) {
    const ring = rnd() < .7; const r = ring ? 1.42 + Math.abs(gauss()) * .36 + rnd() * .5 : 1.3 + Math.pow(rnd(), 1.4) * 4.2;
    neb[i * 3] = r; neb[i * 3 + 1] = rnd() * 6.2832; neb[i * 3 + 2] = gauss() * (ring ? .03 + (r - 1.42) * .05 : .3);
  }
  const dGeo = new THREE.BufferGeometry(); dGeo.setAttribute('position', new THREE.BufferAttribute(neb, 3));
  const uN = Array.from({ length: nodes.length }, () => new THREE.Vector4()), uE = Array.from({ length: edges.length }, () => new THREE.Vector4());
  const uEN = edges.map(([a, b]) => new THREE.Vector2(a, b));
  const NE = edges.length;
  const dustMat = new THREE.ShaderMaterial({ transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
    uniforms: { uN: { value: uN }, uE: { value: uE }, uEN: { value: uEN }, uTime: { value: 0 }, uMorph: { value: 0 }, uScale: { value: 1 }, uBlobS: { value: 1 }, uBlobC: { value: new THREE.Vector3() }, uBlobV: { value: new THREE.Vector3(0, 0, -7) }, uBlobOn: { value: 1 }, uPx: { value: 1 }, uMouse: { value: new THREE.Vector2(9, 9) }, uMouseOn: { value: 0 }, uAspect: { value: 1 }, uIntro: { value: 0 }, uFib: { value: 0 }, uSpin: { value: 0 }, uDens: { value: Math.min(2.4, Math.sqrt(160000 / PC)) }, uFocus: { value: 7 }, uAper: { value: .2 } },
    vertexShader: `precision highp float; precision highp int;
    uniform vec4 uN[${nodes.length}]; uniform vec4 uE[${NE}]; uniform vec2 uEN[${NE}];
    uniform float uTime,uMorph,uScale,uBlobS,uPx,uMouseOn,uAspect,uIntro,uFib,uSpin,uDens,uFocus,uAper,uBlobOn; uniform vec3 uBlobC,uBlobV; uniform vec2 uMouse;
    varying vec3 vCol; varying float vA; varying float vB;
    uint hsh(uint x){x^=x>>16u;x*=0x7feb352du;x^=x>>15u;x*=0x846ca68bu;x^=x>>16u;return x;}
    float rn(uint s){return float(hsh(s))*(1./4294967295.);}
    void main(){
      uint id=uint(gl_VertexID); int ei=int(id%${NE}u);
      float aT=rn(id*6u+1u), aSd=rn(id*6u+2u), u1=max(rn(id*6u+3u),1e-6), u2=rn(id*6u+4u), u3=max(rn(id*6u+5u),1e-6), u4=rn(id*6u+6u);
      vec3 aOff=vec3(sqrt(-2.*log(u1))*cos(6.2832*u2), sqrt(-2.*log(u1))*sin(6.2832*u2), sqrt(-2.*log(u3))*cos(6.2832*u4));
      vec2 en=uEN[ei]; vec4 A=uN[int(en.x+.5)], B=uN[int(en.y+.5)], E=uE[ei];
      float dir=aSd>.5?1.:-1.;
      float t=fract(aT+uTime*.018*dir*(.4+aSd));
      vec3 fib;
      if(aSd>.84){ vec4 C=aT<.5?A:B; fib=C.xyz+normalize(aOff)*(C.w*1.35+uScale*.07*fract(aSd*37.)); }
      else { float taper=.012+.085*sin(3.14159*t); fib=mix(A.xyz,B.xyz,t)+aOff*taper*uScale; }
      float r=position.x*(1.+(1.-uIntro)*2.4*(.5+aSd)); float th=position.y+uTime*.32/(.5+position.x)+uSpin;
      vec3 nb=vec3(cos(th)*r, position.z, sin(th)*r)*uBlobS;
      float ct=cos(.42), st=sin(.42); nb=vec3(nb.x, nb.y*ct-nb.z*st, nb.y*st+nb.z*ct);
      float cz=cos(-.22), sz=sin(-.22); nb=vec3(nb.x*cz-nb.y*sz, nb.x*sz+nb.y*cz, nb.z)+uBlobC;
      float m=smoothstep(0.,1.,clamp(uMorph*1.6-aSd*.6,0.,1.));
      vec3 pos=mix(nb,fib,m);
      pos+=vec3(sin(aSd*40.+uTime*.6),cos(aSd*31.+uTime*.5),sin(aSd*17.))*m*(1.-m)*1.6*uBlobS;
      vec4 cl=projectionMatrix*modelViewMatrix*vec4(pos,1.); vec2 nd=cl.xy/cl.w; vec2 dv=(nd-uMouse)*vec2(uAspect,1.);
      float halo=exp(-dot(dv,dv)*26.)*uMouseOn;
      pos.xy+=normalize(dv+1e-4)*halo*.16*(1.-m*.5);
      float gA=min(A.w>0.?1.:0.,B.w>0.?1.:0.);
      float flash=exp(-pow((uTime-E.x)*1.7-t,2.)*55.)*step(E.x,uTime)*m;
      float path=E.y*m, hot=E.z*m, dimv=E.w*m;
      float a=(.05+.16*fract(aSd*91.))*uDens*(1.-m*.1);
      vec3 col=mix(vec3(.72,.76,.86),vec3(1.,.55,.32),step(.955,fract(aSd*53.)));
      float stream=.5+.5*sin(t*14.-uTime*5.*dir);
      col=mix(col,vec3(1.,.42,.18),path); a*=1.+path*(1.2+1.6*stream)+hot*1.6+flash*5.;
      col=mix(col,vec3(1.,.93,.86),clamp(flash,0.,1.));
      a*=1.-dimv*.85; a*=mix(1.,gA*uFib,m); a*=uIntro;
      a*=1.+halo*3.; col=mix(col,vec3(1.,.62,.42),halo*.7);
      vec4 mv=modelViewMatrix*vec4(pos,1.);
      float dz=max(-mv.z,.05);
      // the blob occludes ring points that are behind it (view space)
      if(uBlobOn>0.){ vec2 sp=mv.xy/dz, sb=uBlobV.xy/-uBlobV.z; float rad=uBlobS*.95/-uBlobV.z;
        a*=1.-step(-uBlobV.z,dz)*(1.-smoothstep(.78*rad,1.02*rad,length(sp-sb)))*(1.-m)*uBlobOn; }
      // depth of field by point-size spread (energy conserving)
      float coc=min(abs(dz-uFocus)*uAper,5.);
      float size=uPx*(.7+fract(aSd*7.)*1.3)*(1.+flash*1.6+halo*1.2+path*.6)/dz;
      gl_PointSize=size*(1.+coc);
      a/=(1.+coc)*(1.+coc);
      a*=smoothstep(.15,.6,dz);
      gl_Position=projectionMatrix*mv; vCol=col; vA=a; vB=clamp(coc*.4,0.,1.);
    }`,
    fragmentShader: `precision highp float; varying vec3 vCol; varying float vA; varying float vB;
      void main(){ vec2 c=gl_PointCoord-.5; float d=dot(c,c); if(d>.25) discard; float g=1.-d*4.; g=mix(g*g,g,vB); gl_FragColor=vec4(vCol*vA*g,1.); }` });
  const dust = new THREE.Points(dGeo, dustMat); dust.frustumCulled = false; if (!DBG.includes('nodust')) scene.add(dust);
  // synapse firing schedule
  const fire = new Float32Array(edges.length).fill(-99); let nextFire = 0, focusFire = 0, pathFire = 0;
  const m4 = new THREE.Matrix4();
  let fAvg = 16, fN = 0;
  try { if (ctx.getExtension('KHR_parallel_shader_compile')) await gl.compileAsync(scene, camera); else gl.compile(scene, camera); } catch (e) { /* compile on first frame instead */ }
  loadStep('scene');
  let firstFrame = true;
  return {
    resize() { camera.aspect = ASPECT; camera.updateProjectionMatrix(); curDpr = 0; },
    draw(dt, rawMs) {
      const rmActive = S.p < .995;
      if (rmActive) { fAvg = lerp(fAvg, rawMs, .15); if (++fN > 12 && fAvg > 22 && rmTier > .4) { rmTier = Math.max(.4, rmTier - .25); fN = 0; } setDpr(rmTier); } else setDpr(DPR_MAX);
      shared.uEnvOn.value = envOn; shared.uYaw.value = S.yaw;
      camera.position.set(...S.cam.pos); camera.up.set(0, 1, 0); camera.lookAt(...S.cam.look); camera.rotateZ(S.cam.roll);
      if (Math.abs(camera.fov - S.cam.fov) > 1e-4 || camera.aspect !== ASPECT) { camera.fov = S.cam.fov; camera.aspect = ASPECT; camera.updateProjectionMatrix(); }
      camera.updateMatrixWorld();
      rmMat.uniforms.uCamPos.value.copy(camera.position); rmMat.uniforms.uCamMat.value.setFromMatrix4(camera.matrixWorld); rmMat.uniforms.uTan.value = Math.tan(camera.fov * Math.PI / 360);
      grade.uniforms.uTime.value = S.time;
      const bw = W * curDpr, bh = H * curDpr;
      bgMat.uniforms.uRes.value.set(bw, bh); bgMat.uniforms.uTime.value = S.time; bgMat.uniforms.uDpr.value = curDpr;
      if (S.pointer) bgMat.uniforms.uMouse.value.set(S.pointer[0] / W, 1 - S.pointer[1] / H);
      rmQuad.visible = rmActive;
      { const o = project([S.blobC[0], S.blobC[1] - 1.32 * S.blobS, S.blobC[2]], {}); bgMat.uniforms.uShadow.value.set(o.x, H - o.y, 1.05 * S.blobS * o.k, (1 - smooth(clamp(S.p / .12))) * S.intro); }
      if (rmActive) {
        const D = computeDrops(); const u = rmMat.uniforms;
        u.uRes.value.set(bw, bh); u.uTime.value = S.time; u.uAspect.value = ASPECT; u.uK.value = D.k; u.uNoise.value = D.noise; u.uHeatC.value = S.prox * .55;
        const mn = [1e9, 1e9, 1e9], mx = [-1e9, -1e9, -1e9];
        drops.forEach((d, i) => { u.uD.value[i].set(d[0], d[1], d[2], d[3]); if (d[3] > 0) for (let k = 0; k < 3; k++) { mn[k] = Math.min(mn[k], d[k] - d[3]); mx[k] = Math.max(mx[k], d[k] + d[3]); } });
        const c = [(mn[0] + mx[0]) / 2, (mn[1] + mx[1]) / 2, (mn[2] + mx[2]) / 2]; u.uBound.value.set(c[0], c[1], c[2], Math.hypot(mx[0] - mn[0], mx[1] - mn[1], mx[2] - mn[2]) / 2 + D.k + D.noise + .1);
        u.uThreadR.value = D.thread; u.uThreads.value = D.thread > 0 ? threads.length : 0;
        threads.forEach(([a, b], i) => { u.uTA.value[i].set(drops[a][0], drops[a][1], drops[a][2]); u.uTB.value[i].set(drops[b][0], drops[b][1], drops[b][2]); });
      }
      nodes.forEach((n, i) => { const r = wr[i]; m4.makeScale(r || 1e-5, r || 1e-5, r || 1e-5); m4.setPosition(world[i][0], world[i][1], world[i][2]); inst.setMatrixAt(i, m4); aHeat.array[i] = heat[i]; aDim.array[i] = dim[i]; });
      inst.instanceMatrix.needsUpdate = true; aHeat.needsUpdate = true; aDim.needsUpdate = true;
      const lineA = smooth(clamp((S.ps - .85) / .15));
      // synapses: ambient random firing, the focused note's links, the lit search path
      const T = S.time, focus = S.hover >= 0 ? S.hover : (S.hoverCanvas >= 0 ? S.hoverCanvas : S.selected);
      if (!RM) {
        if (T > nextFire) { fire[(rnd() * edges.length) | 0] = T; nextFire = T + .07 + rnd() * .2; }
        if (focus >= 0 && T > focusFire) { edges.forEach(([a, b], ei) => { if (a === focus || b === focus) fire[ei] = T + rnd() * .15; }); focusFire = T + .9; }
        if (S.path && T > pathFire) { S.path.edges.forEach((hop, ei) => { fire[ei] = T + hop * .22; }); pathFire = T + 1.6; }
      }
      edges.forEach(([a, b], ei) => {
        const A = world[a], B = world[b], ra = a < HUBS && S.p < .995 ? drops[a][3] : wr[a], rb = b < HUBS && S.p < .995 ? drops[b][3] : wr[b];
        const vis = (a < HUBS || wr[a] > 0) && (b < HUBS || wr[b] > 0) ? 1 : 0;
        const dx = B[0] - A[0], dy = B[1] - A[1], dz = B[2] - A[2], L = Math.hypot(dx, dy, dz) || 1, ux = dx / L, uy = dy / L, uz = dz / L;
        const grow = a < HUBS && b < HUBS ? 1 : clamp(Math.min(wr[a] / (nodes[a].r * S.scale || 1), wr[b] / (nodes[b].r * S.scale || 1)));
        ePos.set([A[0] + ux * ra, A[1] + uy * ra, A[2] + uz * ra, B[0] - ux * rb, B[1] - uy * rb, B[2] - uz * rb], ei * 6);
        const dimE = Math.max(dim[a], dim[b]);
        const w = (.16 * (1 - dimE * .85) + eHot[ei] * .6) * lineA * vis * grow, pr = ePath[ei] * lineA;
        const cr = w * (1 - pr) + pr, cg = w * (1 - pr) + pr * .4, cb = w * (1 - pr) * 1.04 + pr * .16;
        eCol.set([cr, cg, cb, cr, cg, cb], ei * 6);
        uE[ei].set(fire[ei], ePath[ei], eHot[ei], dimE);
      });
      eGeo.attributes.position.needsUpdate = true; eGeo.attributes.color.needsUpdate = true;
      nodes.forEach((n, i) => uN[i].set(world[i][0], world[i][1], world[i][2], n.hub ? Math.max(wr[i], n.r * S.scale * .6) : wr[i]));
      const du = dustMat.uniforms;
      du.uTime.value = T; du.uScale.value = S.scale; du.uBlobS.value = S.blobS; du.uBlobC.value.set(S.blobC[0], S.blobC[1], S.blobC[2]);
      du.uPx.value = curDpr * H / (2 * TAN) * .0105; du.uAspect.value = ASPECT; du.uIntro.value = S.intro; du.uFib.value = .35 + .65 * smooth(clamp(S.q * 1.2));
      du.uSpin.value = -S.yaw * .3;
      du.uMorph.value = smooth(clamp((S.ps - .05) / .95));
      { const v = new THREE.Vector3(S.blobC[0], S.blobC[1], S.blobC[2]).applyMatrix4(camera.matrixWorldInverse); du.uBlobV.value.copy(v); du.uBlobOn.value = v.z < -S.blobS * 1.2 ? 1 - S.ps : 0; }
      du.uFocus.value = S.cam.focus; du.uAper.value = lerp(.09, .32, Math.sin(Math.PI * clamp(S.p)) ) * (1 - smooth(clamp(S.q)) * .6);
      if (S.pointer && S.pointer[2] !== 'touch' && !RM) { du.uMouse.value.set(S.pointer[0] / W * 2 - 1, 1 - S.pointer[1] / H * 2); du.uMouseOn.value = lerp(du.uMouseOn.value, 1, .1); } else du.uMouseOn.value = lerp(du.uMouseOn.value, 0, .1);
      composer.render();
      if (firstFrame) { firstFrame = false; requestAnimationFrame(() => loadStep('frame')); }
    }
  };
}

function initSVG() {
  document.documentElement.classList.add('no-webgl'); ['engine', 'env', 'scene', 'frame'].forEach(loadStep);
  const NS = 'http://www.w3.org/2000/svg', mk = (t, a = {}, p) => { const e = document.createElementNS(NS, t); for (const k in a) e.setAttribute(k, a[k]); p && p.appendChild(e); return e; };
  const defs = mk('defs', {}, svg);
  defs.innerHTML = `<radialGradient id="chrome" cx="35%" cy="30%" r="75%"><stop offset="0" stop-color="#ffffff"/><stop offset=".22" stop-color="#c9ccd3"/><stop offset=".55" stop-color="#3a3c42"/><stop offset=".8" stop-color="#9da0a8"/><stop offset="1" stop-color="#e3e4e8"/></radialGradient>
  <radialGradient id="molten" cx="35%" cy="30%" r="75%"><stop offset="0" stop-color="#fff3ea"/><stop offset=".3" stop-color="#ff9a6e"/><stop offset=".7" stop-color="#a8300c"/><stop offset="1" stop-color="#ff6a3d"/></radialGradient>
  <filter id="goo" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur in="SourceGraphic" stdDeviation="14" result="b"/><feColorMatrix in="b" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 26 -11"/></filter>`;
  const blur = defs.querySelector('feGaussianBlur');
  const gE = mk('g', {}, svg), gN = mk('g', {}, svg), gB = mk('g', { filter: 'url(#goo)' }, svg);
  const eEls = edges.map(() => mk('line', { class: 'edge' }, gE));
  const nEls = nodes.map(() => mk('circle', { fill: 'url(#chrome)' }, gN));
  const bEls = drops.map(() => mk('circle', { fill: 'url(#chrome)' }, gB));
  const o = { x: 0, y: 0, k: 1 };
  return {
    resize() { svg.setAttribute('viewBox', `0 0 ${W} ${H}`); },
    draw() {
      const rm = S.p < .995; gB.style.display = rm ? '' : 'none';
      if (rm) { const D = computeDrops(); blur.setAttribute('stdDeviation', Math.max(.01, D.k * 18 * (H / 900))); drops.forEach((d, i) => { project(d, o); const e = bEls[i]; e.setAttribute('cx', o.x.toFixed(1)); e.setAttribute('cy', o.y.toFixed(1)); e.setAttribute('r', Math.max(0, d[3] * o.k).toFixed(1)); }); }
      const lineA = smooth(clamp((S.ps - .85) / .15));
      edges.forEach(([a, b], ei) => { const e = eEls[ei], A = scr[a], B = scr[b]; const vis = (a < HUBS || wr[a] > 0) && (b < HUBS || wr[b] > 0); e.setAttribute('x1', A.x.toFixed(1)); e.setAttribute('y1', A.y.toFixed(1)); e.setAttribute('x2', B.x.toFixed(1)); e.setAttribute('y2', B.y.toFixed(1)); e.style.opacity = vis ? (lineA * (1 - Math.max(dim[a], dim[b]) * .8)).toFixed(2) : 0; e.classList.toggle('hot', eHot[ei] > .5); e.classList.toggle('path', ePath[ei] > .5); });
      nodes.forEach((n, i) => { const e = nEls[i], s = scr[i]; e.setAttribute('cx', s.x.toFixed(1)); e.setAttribute('cy', s.y.toFixed(1)); e.setAttribute('r', (wr[i] * s.k).toFixed(1)); e.setAttribute('fill', heat[i] > .5 ? 'url(#molten)' : 'url(#chrome)'); e.style.opacity = (1 - dim[i] * .78).toFixed(2); });
    }
  };
}

/* labels each frame */
function drawLabels() {
  const a = smooth(clamp((S.q - .45) / .4)); labelsEl.style.opacity = a; labelsEl.classList.toggle('on', a > .02 && !S.covered);
  const focus = S.hover >= 0 ? S.hover : (S.hoverCanvas >= 0 ? S.hoverCanvas : S.selected);
  nodes.forEach((n, i) => {
    const s = scr[i], b = labels[i]; const r = wr[i] * s.k;
    b.style.transform = `translate3d(${(s.x + r + 6).toFixed(1)}px,${(s.y - 11).toFixed(1)}px,0)`;
    const onPath = S.path && heat[i] > .5, hot = i === focus || (focus >= 0 && nodes[focus].nb.has(i));
    b.classList.toggle('path', !!onPath);
    b.classList.toggle('quiet', !n.hub && !onPath && !hot && !(S.filter && n.tag === S.filter)); b.classList.toggle('hot', !onPath && hot); b.classList.toggle('dim', dim[i] > .5 && !hot);
    b.style.zIndex = Math.round(100 - s.z * 10) + (hot || onPath ? 100 : 0);
    if (!n.hub && wr[i] <= 0) b.style.visibility = 'hidden'; else b.style.visibility = '';
  });
}

/* ---------------- boot ---------------- */
(async function boot() {
  measure();
  try { renderer = (!forceSVG && hasGL()) ? await initGL() : initSVG(); }
  catch (err) { console.warn('WebGL path unavailable, using SVG graph', err); renderer = initSVG(); }
  renderer.resize();
  let ro; addEventListener('resize', () => { clearTimeout(ro); ro = setTimeout(() => { measure(); renderer.resize(); }, 80); });
  new ResizeObserver(() => measure()).observe(document.body);
  let last = performance.now();
  function frame(now) {
    const rawMs = now - last, dt = Math.min(.05, rawMs / 1000); last = now;
    if (!RM) S.time += dt; else S.time += dt * 0; // time frozen under reduced motion (shader still, no idle motion)
    if (RM) S.timeReal = (S.timeReal || 0) + dt;
    tickLoader(now);
    S.intro = RM ? 1 : (S.introStart ? clamp((now - S.introStart) / 2600) : 0);
    update(dt);
    // a software renderer can take seconds per frame: then draw sparsely so the page itself stays responsive
    if (S.drew && rawMs > 300) S.skipUntil = now + Math.min(4000, rawMs * 3);
    S.drew = false;
    if (!S.covered && now >= (S.skipUntil || 0)) { renderer.draw(dt, rawMs); S.drew = true; }
    if (!S.covered) drawLabels();
    requestAnimationFrame(frame);
  }
  requestAnimationFrame(frame);
})();
</script>
</body>
</html>

````
