# Prompt: rebuild "Understudy" (a rehearsal studio for first jobs, with a scroll that pushes you through the stage)

Paste everything below the line into your AI coding agent.

---

Build a landing page in **Next.js 16 (App Router) + React 19 + TypeScript + Tailwind CSS v4** at `/understudy` for a fictional company called **Understudy**: a rehearsal studio for first jobs. You play a real role (a *part*) at one of eighteen simulated companies, with a *cast* (team), a *director* (manager) and real briefs, and leave with a *reel* (portfolio) that the 3,400 companies *casting* from the studio can open. Opening night (the first week) is free, then $89 a month. Slogan: *"Your first job, rehearsed."* Install `npm i next react react-dom lenis`. Read the installed Next docs before using any API. Keep the whole copy unit inside `src/app/(understudy)/`, importing only npm packages and files from that folder.

**Reference (look, pacing and motion vocabulary; build your own brand):** learnwithzero.com: one held hero that zooms into the logo mark until its black fills the screen, a figure that rises digit by digit over two rows of logos bent through a wide lens, a row of tall cards (here an endless drifting ring), a held line a colour wave runs through, a scroll-drawn thread, a matching stage with an odometer, a signed offer letter between two words, a living world at the foot, a glass dock as the only navigation. Every name, mark, illustration, line of copy and company here is invented.

**The central idea: a stage you push into, so the page scrolls you through a proscenium into the dark house and then runs like a show.** The logo mark is a proscenium arch, and the same arch is the dark house's `clip-path` in the hero.

Mood: quiet, cinematic, precise, warm, confident. Use the theatre vocabulary everywhere, plainly: parts, cast, director, notes, reel, callbacks, opening night, call time, call sheet. Specific numbers only: 10 hours a week, 5–8 weeks, 62% callbacks, $89.

## Brand

- **Palette (eight colours; tints only via `color-mix()`, registered in `scripts/templates.config.ts`):** house `#F4F4F1` (page), white `#FFFFFF` (windows, glass), ink `#0D0D10` (text, the dark house, the arch), night `#1A1A1F` (cards, curtains), graphite `#66666E` (muted text), cue `#5B3CF0` (the one accent on light: the wave, numbers, focus, errors), cue light `#AE9CFF` (the accent on dark), tape `#FFC547` (rare: spike tape, the ghost light, the highlighter; never text).
- **Type (`next/font/google`, distinct variables):** Google Sans Flex with the `ROND` axis (`--font-us-flex`, `font-variation-settings: "ROND" 70`) for display (light 340–400, tracking −0.04 to −0.05em) and body; Google Sans Code (`--font-us-code`, `preload: false`) for 11–12px uppercase labels; Literata italic (`--font-us-literata`, `preload: false`) for the director's notes and serif wordmarks.
- **Logo:** a rounded-top arch with the curtain parted at its foot, `M6 46V22C6 12.06 14.06 4 24 4s18 8.06 18 18v24H28.6L24 30.5 19.4 46H6Z` in a 48 viewBox, plus the lowercase wordmark "understudy" (weight 520, −0.045em). Ship `brand/Logo.tsx` (Mark + lockup), `icon.svg` and a 1200×630 `opengraph-image.tsx`.
- **Signature details:** the arch is the door; a purple light slit where the curtains part; spike-tape X/T/L floor marks; the ghost light; a cue dot (a small face in a cue ring) that pops at the end of each held line; a live "Rehearsing now 1,284" readout; a call sheet with a stable `US-XXXX` reference and a "Cast" stamp.
- **Art:** no photography is required. Draw the studio from above in SVG (`brand/StageFloor.tsx`: stage with apron and wings, three blocks of seat rows as dashed arcs around a centre, aisles, spike marks, the ghost light), pale in the hero and lit in the finale. Part cards show a line-drawn prop (chart, braces, cursor, nib, megaphone, gear, flask, compass, bubble, stack) standing in a spotlight that follows the pointer. Eighteen invented companies are wordmarks made of a glyph and one of six type treatments (bold, light, caps, mono, serif, round). `Picture` swaps in optional `part-<id>` photos.

## Page

1. **Top bar** (fixed): lockup left, live readout right. Ink flips to house over dark scenes.
2. **Hero** (`#top`, held for 340svh, sticky stage): the pale floor under a mist; eyebrow "The rehearsal studio for first jobs"; the headline "Your first job, / rehearsed." plus a cue dot; the arch under it (width `clamp(76px, 7.2vw, 112px)`, height ×1.1667, centred at `50% + clamp(84px, 12svh, 130px)`), its curtain breathing, rings of cue leaving its foot, and a "Scroll to enter" nudge. Inside the same stage, the **dark house** is a full-screen ink layer whose `clip-path` is the arch: curtains (night with fold stripes), a light slit, then "3,400+ / companies casting from our studio." over two rows of companies.
3. **Parts** (`#parts`, ink, one screen): "We cast you in the parts companies are hiring for." with chips (Popular, Product, Engineering, Data, Design, Growth, Operations; a pill glides between them as a `clip-path`, and ←/→ move it) and an **endless ring** of ten tall cards that drifts right to left (−36 px/s) in a gentle arc and loops with no seam: `loopX(i, n, slot, offset) = wrap(i·slot + offset + slot, n·slot) − slot`; short filtered sets repeat (`repsFor`) with the repeats hidden from readers; each card lifts and turns as it comes round the edges (`y = 34·d²`, `rotate = 5°·d`, `scale = 1 − 0.05·d²`, radius never under 560px). The page scroll pulls the ring along (0.32 px per px); drag it 1:1 and fling it (eased back with a frame-rate-independent `coast`); hover glides it to a stop; pause, keyboard focus or an open card brake it hard; previous / next (and ←/→ on the region) glide one card; a focused card glides fully into view; a drag never opens a card. One rAF loop writes the transforms and sleeps when still or off screen. Under reduced motion (and without JS) it's a plain row that scrolls natively. Each card shows: tag (Hot / Rising / New), "{weeks}-week run · {company}", title, tools, and a "Brief →" key. The card turns over (rotateY, inert faces) to the brief, three things you ship, and "Rehearse this part", which opens Start with that part chosen. Parts: AI Engineer (Quillo), Product Analyst (Parcelpost), Product Manager (fernway), Product Designer (Brightloop), Growth Marketer (sundry), Data Scientist (Tidewell), Frontend Engineer (LUMEN GAMES), Content Designer (Halcyon Bank), Operations Analyst (Saltbox), Customer Success Lead (Ledgerly).
4. **Rehearsal** (`#rehearsal`): a dark bowl (the parts' black ends in an ellipse) that flattens with the scroll; the held line "Learn the part by playing it." (sticky, behind a house fade); four scenes strung on one thread: a lead-in path from the line to a rail on the left, a node beside each scene. Scenes: "Join a company that runs like a *real one.*" (a lot of eight company buildings and a brief card: "31% of carts stall at the address step. Find out why."), "Run lines with your *cast.*" (a team chat whose messages arrive one by one and a standup checklist), "Get notes from your *director.*" (a readout with highlighted findings, three margin notes in Literata, "Approved"), "Walk out with a *reel.*" (Maya Ortiz, Product Analyst · Level 7, −18% drop-off, 4 fixes, 9 notes counting up). Each window has a three-light bar and a mono title.
5. **Casting** (`#casting`, held for 280svh): "You rehearse. We *cast.*", the reel in the middle of a 1200×600 stage, ten companies placed five each side; for each, a curve draws from the reel and then the company pops in; a "Callbacks" odometer rolls 00 → 10; a halo rings the reel when all ten are in.
6. **Contract** (`#pricing`, held for 250svh): "Built to get you [contract] *cast.*": a cue wave runs through the letters, a small two-sheet contract scales out of the gap, a signature draws on it, a cue seal stamps; then "Opening night is free. Then $89 a month.", the CTA "Book your first call time" (magnetic) and "Ask a question first", and three facts (10 h a week · 5–8 weeks to a reel · 62% got a callback).
7. **Finale** (the footer, held for 200svh): the floor pale, then the lit floor revealed by a `clip-path: circle()` growing from the ghost light; "House lights up. *Take the stage.*"; a glass ring whose text "START · TAKE THE STAGE ·" turns on a `textPath` around an ink core with the mark: the whole ring is the Start key. Legal links and "a fictional brand for a landing-page template".
8. **Dock** (fixed, bottom centre, glass that turns dark over dark scenes): Start (ink, cue on dark, sheen on hover, a halo pulse), menu (two bars morph to ×), "?" (Ask). A hairline across it fills with page progress. Any `[data-us-start]`, `[data-us-ask]` or `[data-us-go]` elsewhere opens the matching sheet or scrolls. Sheets open out of the dock with a `clip-path`, hold the page still (Lenis stops), trap focus, close on Escape or the scrim, and give focus back.
   - **Menu:** five scenes, a pill that slides to the current one.
   - **Start:** floating-label name, email and part select. Rules in `forms/audition.ts` (tested): name 1–60, a valid email, a listed part. Invalid fields shake once, their messages slide down, focus goes to the first error. Submit rolls the label out to bouncing dots for 950ms, then the form clips away and a call sheet slides up: "You're on the call sheet, {first name}.", ref, part, company, first call (the next weekday at 09:00), a "Cast" stamp; "Book another part" resets. No network request.
   - **Ask:** the FAQ is a question you type. `ask/answer.ts` (tested) scores keyword hits (plural-tolerant) across eight answers (price, experience, hours, real companies, getting hired, cast, director, reel) with a polite fallback; a typing beat of 750ms; suggestion chips.

## The mechanic: one scene clock

Pure, tested maths in `stage/` and `motion/math.ts`:

- `pinProgress(y, top, height, vh) = clamp((y − top) / (height − vh))`, `flowProgress(y, top, height, vh, line)`, and `toneAt(boxes, y, vh, probe)` (a scene may turn dark part-way via `data-dark-from`; the hero does at 0.42).
- `archInset(t, vw, vh, rest)`: insets that leave exactly the resting arch at `t = 0` and nothing at `t = 1`, eased by `t³` (the camera accelerates into the opening); top radius `w / 2 → 0`. `t = range(p, 0.04, 0.52)`.
- `lensPlace(x, half, bend)`: `y = −46·d²·bend`, `rotate = −9°·d·bend`, `scale = 1 − 0.16·d²·bend`, `d = x / half` clamped to ±1.4 (the rows bow like the inside of a cylinder). `rowLayout(count, slot, offset)` wraps a looping row; rows drift 26 px/s in opposite directions.
- `callbacksAt(p, n)` and `digitsOf(n, width)` for the casting slice and the odometer.

`stage/ScrollDirector.tsx` (the only scroll owner) measures scenes on resize and, in one rAF, writes `--p` on every `[data-scene]`; it writes only the arch `clip-path`, the lens transforms (in a rAF loop that runs only while the house is open and on screen), the callbacks' `data-on` and the odometer digits itself. Everything else is CSS reading `--p` through `clamp()`. **The wave:** letters carry `--i`, the line carries `--n`; `w = wp·(n + 10) − 5`, `d = w − i`, `hot = clamp(0, 1 − max(d, −d) / 3.5, 1)`, `lit = clamp(0, d / 2.5, 1)`, colour = `color-mix(in oklab, cue hot%, color-mix(ink lit%, dim))`. A sticky line can't be measured, so a measuring strip feeds its progress to it (`data-feeds` → `--fed`).

## Motion

- **Identity:** technical / cinematic. The verbs are **push in** and **cue**. The signature moment is the push through the proscenium.
- **Tokens in `@theme`:** ease-out `cubic-bezier(0.2, 0.715, 0.205, 0.99)`, expo `cubic-bezier(0.16, 1, 0.3, 1)`, in-out `cubic-bezier(0.625, 0.05, 0, 1)`, spring `linear(0, 0.35 8%, 0.82 20%, 1.06 30%, 1.02 42%, 0.99 58%, 1)`, pop `cubic-bezier(0.3, 1.45, 0.45, 1)`; durations 90 / 180 / 420 / 800 / 1200ms; shift 28px; stagger 70ms.
- **Load (CSS keyframes, before hydration, using `translate`/`scale` so scroll transforms never collide):** floor settles from 1.06 at 0ms, logo drops at 150ms, eyebrow slides at 200ms, headline lines rise through masks at 260 and 380ms, dock rises at 420ms, the arch rises at 640ms, the cue dot pops at 1s, rings start at 1.1s, the curtain breathes from 1.6s, the nudge appears at 1.9s.
- **Reveals (one shared IntersectionObserver flips `data-in`; observe the unclipped parent of masks and wipes):** mask-rise for titles, rise for body, slide for labels, pop-scale for nodes, clip-path wipe with an inner 1.08 → 1 settle for windows, stroke-draw for props and the thread, count-up for stats. Each window then plays its scene (buildings pop, the brief slides in, messages arrive, ticks draw, the highlighter wipes, notes slide in, the stamp lands).
- **States:** buttons fill-wipe from the cursor side and roll their label (the duplicate label is `content: attr(data-text) / ""` so screen readers hear it once), press to .97 with a spring release; cards lift 8px with a pointer spotlight and dim their siblings; windows lift and glow; links draw their underline; inputs tighten their focus ring; the ring scales and its core turns cue.
- **Ambient (paused off screen and in hidden tabs):** the curtain's breath and the rings, the lens rows, the live readout, the dock halo, the lot pin, the turning ring.
- **Smooth scroll:** Lenis (`lerp 0.105`) on fine pointers with motion allowed, dynamically imported; it also answers `us:goto` and `us:lock`.
- **Reduced motion and no JS:** every held, hidden or clipped state lives inside `@media (prefers-reduced-motion: no-preference) and (scripting: enabled)`, so the default CSS is the finished page: the headline with the mark, the dark house as a normal section with straight rows, parts scrolling natively with snap, every line lit, the contract signed, the finale lit. Add a `<noscript>` reveal override, and give Start links an email fallback.

## Quality bar

- Animate only `transform`, `translate`, `scale`, `opacity`, `clip-path` and stroke offsets. CLS 0. No horizontal overflow at 375px. Base resets wrapped in `:where()` so component classes always win.
- One h1, landmarks, real buttons and links, AA contrast, visible focus rings, dialog titles as labelled paragraphs (not headings), live regions only for the form status and the Ask log.
- Structure: `brand/`, `content/` (typed data + tests), `stage/` (maths + tests, the director), `motion/` (math + tests, Reveal, WaveLine, SmoothScroll, Magnetic, CountUp, LiveCount), `parts/` (ring maths + tests, the ring hook, the cards), `rehearsal/`, `sections/`, `dock/`, `forms/` (rules + tests), `ask/` (matcher + tests), `assets.tsx`.
- Playwright covers the push-in (clip-path opens, chrome turns dark, rows drift), the ring (drift, seamless loop under repeated flings, hover stop, pause, next, no click after a drag), refilled short sets, chip filtering and arrow keys, the card flip and the prefilled Start, validation, focus, success with no request, reset and focus return, Ask, the menu, reveals and the thread, callbacks and the odometer, the contract's seal, hover and press, reduced motion (static, nothing hidden), no-JS, and the phone dock and menu.
