# AI Concepts as Little Machines: replication prompt

Paste the prompt below into Claude Code, Cursor or any coding agent to rebuild this page from scratch. The finished file in this folder (`index.html`) is the reference build.

---

## The prompt

```
Build ONE self-contained file, index.html (inline CSS, vanilla JS, inline SVG, Google Fonts only,
no libraries), titled "AI Concepts as Little Machines".

GOAL
An editorial explainer page where 6 AI concepts are each shown as a small interactive physical
machine. The reader presses one big control and the machine moves.

DESIGN SYSTEM
- Background #F8F8F7. Cards: white, 1px #E6E6E5 border, 22px radius, 18px padding.
- Ink #151513, muted #706e68, accent orange #ff5a1f, forest green #2f6b4f, soft peach #ffe3d6.
- Fonts: Fraunces (headlines, italic accent words in orange), Inter (body), JetBrains Mono (labels, readouts).
- Header: mono eyebrow "Explainer kit" with an orange dot, big Fraunces H1
  "AI concepts as <em>little machines</em>", short dek and three pill chips.
- Grid: 2 columns on desktop, 1 column under 900px. Use minmax(0,1fr) columns and min-width:0 on cards
  so nothing overflows on mobile.
- Each card, top to bottom: mono tag row ("01 TOKENS" + short hint), a "stage" (rounded panel #FBF9F6
  with a faint 16px dot grid) holding an SVG with viewBox 0 0 400 260, a controls row (big black pill
  button with an orange dot icon + a mono "Readout" box), then a caption: Fraunces H2 like
  "Tokens are a <em>label maker</em>." and 1-2 plain-English sentences.
- Illustration style: flat shapes, rounded corners, consistent 2px #151513 outlines, subtle shading
  (a 12% black band on the lower part of each body), small white highlight strokes, a soft 7% ink
  ellipse shadow under each object.
- No em dashes anywhere in the copy.

MOTION
- One tween(ms, fn, ease) helper on requestAnimationFrame that returns a Promise, plus sleep(ms).
- Easing: a cubic-bezier solver; main ease is (.2,.8,.2,1), plus easeInOut (.65,0,.35,1),
  easeIn and a light overshoot (.3,1.45,.5,1) for drops.
- Animate SVG by setting transform attributes (translate/rotate/scale) inside the tween.
- Wrap each machine in machine(n, asyncRun): it ignores clicks while busy and sets aria-busy on the button.
- prefers-reduced-motion: tween durations become 0, so every action jumps straight to its end state.

THE SIX MACHINES
1. Tokens = label maker. Orange label maker with a dark LCD, 16 keys and a side lever. A select picks one
   of 4 sentences. Pressing the button types the sentence on the LCD, swings the lever, then punches
   word-piece labels (e.g. Un | believ | able | ·token | ization | !) out of the slot onto a label
   strip. A middot marks a leading space. Readout: token count, characters, chars per token.
2. Context window = conveyor belt with 5 slots and an orange bracket "CONTEXT WINDOW · 5 MSGS".
   "Add message": the belt shifts one slot left (rollers spin, tread dashes move), a new numbered box
   (alternating YOU/AI colours) drops in from an "incoming" funnel, and the box that passes the left
   end falls, shrinking, into a bin labelled "forgotten" where a small pile grows.
   Readout: "remembering #a to #b · forgotten n".
3. Temperature = gumball machine with a TEMP gauge and a crank, plus a range slider (0.1 to 2.0).
   Next word for "The cat sat on the ___": mat .55, sofa .20, floor .12, roof .07, moon .04,
   keyboard .02. Re-weight with p^(1/T), normalised. A bar chart shows the odds, and the 35 balls in
   the globe are recoloured in proportion to the odds (largest remainder rounding). Turning the crank
   spins it, jiggles the balls, samples a word, rolls a ball into the tray and fills the blank.
4. Embeddings = magnet board with three dashed cluster zones (animals, weather, money). "Add a word"
   drops the next tile (kitten, receipt, rain, puppy, budget, snow, hamster, tax) into the middle of the
   board, then slides it to its cluster and draws dashed lines to its 2 nearest neighbours.
   Readout: '"kitten" lands near cat (0.92), dog (0.83)'. Reset when the queue runs out.
5. RAG = card catalog + dumbwaiter + answer printer. A question card slides in, the lamp sweeps the
   six labelled drawers, the matching drawer pulls out, 2-3 source cards hop into the lift, ride up the
   shaft, get paper-clipped under the question, and an answer ticket with citations [1][2] prints
   upward out of a green printer. Cycle 3 questions.
6. Agent loop = a little robot on a circular track with 4 station pills: Observe (top), Think (right),
   Act (bottom), Check (left). "Run task" sends it 3 laps; each stop lights the station and appends a
   line to a dark terminal log under the stage. A centre goal light goes amber while running and green
   with a soft glow when the goal is met.

RECORDING MODES
- ?autoplay=1 runs a looping tour: scroll each card into view, outline it in orange, run its demo,
  move on. Set window.DEMO_DURATION to the length of one full pass in seconds.
- ?machine=N&autoplay=1 hides the header and every other card, centres card N at max 820px wide and
  loops only its demo. Set window.DEMO_DURATION to one loop of that machine.
- Autoplay ignores prefers-reduced-motion so screen recordings always move.

QUALITY BAR
Check at 1440x900 and 390x844: no horizontal overflow, no clipped SVG text, no overlapping parts,
and no console errors. It should feel like a small museum of tactile objects, not a dashboard.
```

---

## How to add your own machine

Each machine follows the same three-part pattern: markup for the card, a static SVG scene, and a `machine()` wrapper with an async run function.

### 1. Add the card

```html
<article class="card" data-m="7">
  <div class="card-head"><span class="tag"><span class="num">07</span>Fine-tuning</span><span class="hint">press to train</span></div>
  <div class="stage">
    <svg id="m7" viewBox="0 0 400 260" role="img" aria-label="Describe the machine here">
      <!-- static parts: bodies, outlines (stroke="#151513" stroke-width="2"), shadows -->
      <g id="m7-moving"></g>
    </svg>
  </div>
  <div class="controls">
    <button class="btn" id="m7-btn"><span class="dot"></span>Train</button>
    <div class="readout"><small>Readout</small><span id="m7-out">idle</span></div>
  </div>
  <div class="caption">
    <h2>Fine-tuning is a <em>pottery wheel</em>.</h2>
    <p>One or two plain sentences. Bold the single idea you want people to remember.</p>
  </div>
</article>
```

### 2. Write the run function

```js
const M7 = (() => {
  const part = $('#m7-moving'), out = $('#m7-out');
  const g = S('rect', { x: 180, y: 100, width: 40, height: 40, rx: 8,
                        fill: '#ffe3d6', stroke: INK, 'stroke-width': 2 }, part);

  const run = machine(7, async () => {          // ignores clicks while busy
    await tween(600, e => g.setAttribute('transform', `rotate(${e * 360} 200 120)`), easeInOut);
    await sleep(150);
    out.innerHTML = 'trained on <b>500</b> examples';
  });

  return { run, demo: () => run() };            // demo() is what autoplay calls
})();
```

### 3. Register it for autoplay

Add `M7` to the `MACHINES` array, and add its measured demo length in seconds to `DUR`. The `?machine=7&autoplay=1` mode then works automatically.

### Rules that keep it looking premium

- Keep every outline at 2px ink, and use the palette only.
- One big control per machine. Extra inputs (select, slider) sit next to it in a `.field`.
- Animate only through `tween()` so reduced motion keeps working.
- Keep text inside the SVG at 8px or larger. The viewBox is 400 wide, so it shrinks on phones.
