Sitepeel

Tallyline

Software · Invoicing API

An invoicing API for freelancers told on a frozen lake: unpaid work is ice, and firing the webhook thaws your invoice to water.

Free to copy and download. No account needed.

About this prompt

Files, steps and what happens on the site

What happens on the site

Tallyline, an invoicing API for freelancers, set on a frozen lake in ice blue with thin black serif type and mono code. A slip runs one invoice from draft to paid while the heading is sawn into the ice. You type what a client owes and how late, and a borehole shows the interest. The ice is sawn into a grid, you type your own invoice lines, and the block floats down a channel past draft, sent, viewed, overdue and paid. Press Fire the webhook and your block thaws into floes on black water: invoice.paid.

About this site

A one-page site for a made-up invoicing API for freelancers. The heading is sawn into a live WebGL lake, your own invoice lines freeze into a block that floats down a channel, and firing the paid webhook thaws it into black water.

  • Software
  • Scroll story
  • WebGL
  • Interactive

What the prompt covers

  • All fifteen chapters with their full text
  • Type, sizes and the sawn-ice look
  • Colors for ice, snow, sawdust and black water
  • Desktop, tablet and phone layouts
  • Every scroll effect and interaction, with timings
  • Setup, and how to check the finished site

How to use it

  1. Add the files

    Download the required files and unzip them in a new project folder.

  2. Paste the prompt

    Copy the prompt into your AI coding tool and let it build the site.

  3. Compare the result

    Open what your AI tool made next to the live preview of Tallyline, and ask it to fix what differs.

Tested with

Tool
Claude Code
Model
Claude Opus 5.5 (high effort)
Built from
Prompt and required files, in an empty folder
Date
2026-11-19

A clean build wrote every file exactly as specified and matched the demo's text and every section height at desktop and phone size, with no errors. A one-line fix it suggested is now in the prompt. Checked in Chromium.

What you get

This is a prompt plus the files it depends on. The prompt alone is not enough.

  • Prompt

    Markdown, 126 KB

    The full brief to give your AI coding tool.

    Download prompt
  • Required files

    ZIP, 434 KB

    The fonts, pictures and the three code files for the scroll clock and the WebGL lake, with licence details. The prompt has your AI tool download them.

    Download files

See the list of files

Good to know

  • Free to copy and download. No account needed.
  • Use it for your own sites and for client sites. Please don’t resell or share the prompt or its files as they are.
  • AI tools and models build differently, so the result can differ from the preview.
  • The names, projects and contact details are made up. Replace them with your own before you publish.

The prompt

Show the prompt1650 lines
# Build the Tallyline website

You are working in an AI coding tool. Build this website in the current project from the specification below. It is a one-page site for a fictional product, Tallyline, an invoicing API for freelancers. Its idea: finished work you have not been paid for is frozen money. The whole page is one frozen lake drawn live in WebGL. You scroll down the ice like a sawyer cutting blocks: the heading is sawn into the ice on arrival, a long saw line runs down the left edge, every chapter is scored off with a sawn row, the visitor's own invoice lines are frozen into a block that floats down a channel, sits in an ice house, and finally thaws into black water when the `invoice.paid` webhook fires. At the end the camera rises over the whole lake and the page itself is read back as an invoice. Type is Bodoni Moda (display) and IBM Plex Mono (everything else) on pale lake blue, with black water, sawdust gold and one red flag colour.

Build everything yourself except the supporting files listed in section 2. Do not substitute a different stack, font, library or design system. Keep the copy exactly as written. Do not add analytics, trackers, external embeds, CDN links or any request to another domain.

This prompt comes with a required pack of fonts, pictures and three code files (the scroll clock, the WebGL lake shader and the code that runs it). It is not a text-only prompt. Results differ between AI tools and models. Follow the specification closely, but report honestly what you built and tested.

## 1. Stack and project setup

- Plain HTML, CSS and JavaScript. No framework, no build step, no npm packages, no TypeScript, no Tailwind. Classic scripts (not modules) that share globals on `window` (`window.TL`, `window.TL_FRAG`, `window.TALLYLINE_CONFIG`).
- Every path is relative (`site.css`, `js/...`, `img/...`, `fonts/...`), so the site works from a domain root and from any sub-folder. Never write a leading-slash URL.
- No inline `<script>` code anywhere (the JSON-LD data block in the head is the only inline script element). The page must run under this Content Security Policy without violations: `default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' blob: data:`.

Target layout of the finished project:

```text
index.html              (section 4, written by you)
404.html                (section 4, written by you)
site.css                (section 5, written by you)
js/config.js            (section 6, written by you)
js/film.js              (from the required pack, supporting code)
js/shader.js            (from the required pack, supporting code)
js/stage.js             (from the required pack, supporting code)
js/chrome.js            (section 6, written by you)
js/chapters/*.js        (section 7, fourteen files written by you)
fonts/                  (from the required pack)
img/                    (from the required pack)
licenses/               (from the required pack)
```

To look at it, serve the folder with any static file server, for example `npx --yes http-server -p 8080 -c-1 .` or `python -m http.server 8080`, and open the address it prints. Opening `index.html` from the file system will not work well, because the shader reads pictures into canvases.

## 2. Required files

Required pack, version 1:

- URL: https://sitepeel.dev/website-prompts/tallyline/assets-v1.zip
- SHA-256: `f62c246b03a9d9a8bb98f44771cf11914ee9c877675b0179575a58d8957cc7d2`
- Size: 444041 bytes

Download it with your tool's web fetch, `curl -fL -o assets-v1.zip <URL>`, or `Invoke-WebRequest`. If `assets-v1.zip` is already in the project root, use that copy. If you cannot download it, stop and ask the person to save the file into the project root, then continue. Check the SHA-256 (`shasum -a 256`, `sha256sum` or `certutil -hashfile assets-v1.zip SHA256`) and stop if it differs. Unzip it into the project root so that `fonts/`, `img/`, `js/` and `licenses/` sit next to `index.html`. Delete the zip afterwards. You may delete the pack's `README.md` and `SHA256SUMS.txt` once the hashes are checked.

Files in the pack (path, SHA-256):

| File | SHA-256 |
|---|---|
| `README.md` | `3e9b49a5f168152d72c20fd6fa1689224c9d859a1849ac3da595b10851937609` |
| `fonts/OFL-BodoniModa.txt` | `6c64f717433eadd29b058d6254fe25c1ee2d249ce3772f843bb21f73285779c2` |
| `fonts/OFL-IBMPlexMono.txt` | `23b0a9d0c6d3f140a0b77e483c5cfa6bba574325ef5cb189ed9f2fec4884533f` |
| `fonts/bodoni-moda-latin-opsz-normal.woff2` | `c032219ef636f7b4932f7d1dc91bdab602c970f090770b546bea4effaab3463c` |
| `fonts/ibm-plex-mono-latin-400-normal.woff2` | `08949f728dc52d528e69b1667d15c89a5686a4ee9a296ff90983985f99c380f7` |
| `fonts/ibm-plex-mono-latin-500-normal.woff2` | `01d285447409c8a588692162439a038b8cbd7871309ee20267b0d2d91c6e8e22` |
| `img/cracked-ice.jpg` | `0741614ca4bc7af249d80dc6e6776b6f687c77fcfb13304d08be5592bd184add` |
| `img/frozen-lake.jpg` | `a6d81e741355b0454e06ca0f9ec607600421f29f16fe1bd3004e268d20046dbc` |
| `img/ice-block.webp` | `4ccf8055d16c03b1bedd38bff935cd91e94a528977e750716158754e37ebe8b3` |
| `img/ice-grid-underwater.jpg` | `07a826bacdb393a3567216c89416111abc1d8340dee05d8433704301c7214bb4` |
| `img/ice-shards.jpg` | `dc51489e6fbc2497c5ccd42150a51939a5be8a5a61cc66b83a7c520d7aaa7164` |
| `img/share.jpg` | `e1c3b8c98b0beae0ac26c7303903740e66c717ac3b8ec75c97545536528cdea8` |
| `js/film.js` | `e7d5de329315ef034313247fc6fffd960aaf4b9f83d4eb4b6e95079e6c68d10b` |
| `js/shader.js` | `aa1fcd2548c35d2fdc9a6339d645f98d8c9981448ab84402ae48ab72cb148bfc` |
| `js/stage.js` | `61ab2c7805f8180a3bb227648d8f1fa8cdcb9da04316f50008a98e42af81254f` |
| `licenses/OFL-BodoniModa.txt` | `6c64f717433eadd29b058d6254fe25c1ee2d249ce3772f843bb21f73285779c2` |
| `licenses/OFL-IBMPlexMono.txt` | `23b0a9d0c6d3f140a0b77e483c5cfa6bba574325ef5cb189ed9f2fec4884533f` |
| `licenses/PROVENANCE.md` | `7d9064a75e4720f9cd2bd8434d032d288203d70c631fa3b19443f6636717e659` |
| `licenses/THIRD-PARTY.md` | `50609f110c58fb4d1b3f09e7b2267f34f746458a915b1002c900ffb3f755c2e9` |

What the three supporting files are. Do not rewrite them; the look depends on their exact numbers. They load first (section 8) and everything you write builds on them.

- `js/film.js` defines `window.TL`, one clock for the whole page. Scroll position is time. Each frame it sets `TL.y` (scroll), `TL.vh`, `TL.vw`, `TL.dt`, `TL.time`, `TL.current` (index of the chapter under the middle of the screen) and calls every function registered with `TL.on(fn)`. `TL.measure()` runs on load, resize, font load and page-height changes; it lists every `[data-chapter]` element in `TL.chapters` and `TL.byId[id]` as `{ id, el, top, h, pin }` (`pin` is true when the chapter's `:scope > .pin-stage` is sticky and the chapter is taller than the screen) and then calls every function registered with `TL.onMeasure(fn)`. Helpers: `TL.p(id)` (0 to 1: progress through a pinned chapter, or through the chapter's pass across the screen), `TL.near(id, margin)`, `TL.clamp`, `TL.local(t, a, b)`, `TL.smooth`, `TL.reduced` (prefers reduced motion), `TL.coarse` (touch pointer), `TL.store.get/set` (localStorage under `tallyline.`, safe without storage).
- `js/shader.js` defines `window.TL_FRAG`, the fragment shader of the lake: ice with fractures and bubbles, the saw line and sawn chapter rows, the carved heading, the frozen invoice block, the melt into floes, the channel of open water and the black water.
- `js/stage.js` compiles that shader in the background where the browser supports it (so a slow compile never freezes the page) and then draws `canvas#lake` every frame something changed. The canvas stays hidden until its first frame. It adds the class `gl-ready` to `<html>` after the first frame and fades `.rime` out. It gives the chapters these hooks: `TL.uploadHead(canvas)` and `TL.setHead(x, y, w, h, a)` (the heading's distance field and its page rectangle), `TL.revealHead()` (saws the heading in over 1.7 seconds), `TL.uploadInvoice(canvas)` and `TL.setInv(x, y, w, h, a)` (the frozen invoice picture and its screen rectangle), `TL.setChan(top, bottom, x, a)` (the channel of water and the block's wake), `TL.melt` (0 to 1, the thaw), `TL.scratch(x0, y0, x1, y1)` (a saw stroke in the ice), `TL.dirty()`, and it publishes `TL.zoom`, `TL.viewY` and `TL.noGL`. The pointer scores a groove in the ice that heals in about nine seconds. During the whole-lake chapter the camera rises until the full page fits on screen. Without WebGL2, on a software renderer (SwiftShader, llvmpipe, the Windows basic render driver) unless the address has `?gl=force`, or if the shader fails, it removes `gl-ready`, adds `no-gl` (the CSS switches the channel, the thaw and the whole lake to plain fallbacks), sets `TL.noGL` and the CSS lake stays: the page still reads top to bottom. While the shader is still compiling, the page keeps its WebGL layout with the CSS lake behind it, so nothing jumps when the lake arrives.

## 3. Rights and honesty

- Bodoni Moda and IBM Plex Mono are under the SIL Open Font License 1.1. Their licences are in the pack and must stay with the font files. Do not rename or modify them.
- The five ice pictures in `img/` were generated for this project with an image model; `img/share.jpg` is a screenshot of the demo. `js/film.js`, `js/shader.js` and `js/stage.js` were written for this project.
- Tallyline, its API, `api.example.invalid`, the field names and the invoice examples are invented. The key request form sends nothing until `keyRequestEndpoint` in `js/config.js` is set. The history and the late-payment and VAT notes are short summaries, not advice. Before anyone publishes the site, the product name, copy and facts should be replaced or checked, and the `noindex` tag removed.

## 4. Page markup

Create `index.html` exactly as below. It holds the structure, every hook the scripts need and all of the copy. Each chapter is a `section[data-chapter]` (the last is the `footer`); `data-surface` names its colour family (`ice`, `snow`, `sawdust`, `water`); `data-pin` chapters have a sticky `.pin-stage` and the inline `--len` sets how many extra screens the chapter stays pinned (times .7 on phones).

```html
<!doctype html>
<!-- Fictional demo site. Tallyline, its API and its examples are invented. -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>Tallyline, an invoicing API for freelancers</title>
<meta name="description" content="Tallyline is an invoicing API for freelancers. Post your line items and it cuts the invoice, numbers it, sends it and tells your server the day it is paid.">
<meta name="theme-color" content="#a4c0c8">
<meta property="og:title" content="Tallyline, an invoicing API for freelancers">
<meta property="og:description" content="Finished work is frozen money. Tallyline cuts the invoice and tells your server the day it thaws.">
<meta property="og:image" content="img/share.jpg">
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23a4c0c8'/%3E%3Cpath d='M11 0v32' stroke='%230a1519' stroke-width='3'/%3E%3Cpath d='M12.5 0v32' stroke='%23e9f0f1' stroke-width='1'/%3E%3C/svg%3E">
<link rel="preload" href="fonts/bodoni-moda-latin-opsz-normal.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="fonts/ibm-plex-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="site.css">
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "WebApplication", "name": "Tallyline", "applicationCategory": "BusinessApplication", "description": "An invoicing API for freelancers." }
</script>
<script src="js/config.js"></script>
</head>
<body data-surface="ice">
<noscript><style>section[data-pin]{height:auto}.pin-stage{position:relative;height:auto;min-height:60svh}.sr{position:static;width:auto;height:auto;clip-path:none;white-space:normal}.thaw-event,.thaw-end,.wl-head{opacity:1!important;position:static}.wl-table,.wl-table tbody{position:static}</style><p style="padding:90px 24px 0;position:relative;z-index:3">The lake needs JavaScript to move. Everything Tallyline says is still written below.</p></noscript>
<a class="skip" href="#the-cut">Skip to the request</a>
<canvas id="lake" aria-hidden="true"></canvas>
<div class="rime" aria-hidden="true"></div>
<div class="blade" aria-hidden="true">
  <svg viewBox="0 0 26 40" width="26" height="40"><path d="M13 40V10" stroke="currentColor" stroke-width="2"/><path d="M4 12h18l-3-4 3-4-3 4-3-4-3 4-3-4-3 4-3-4z" fill="currentColor"/></svg>
</div>
<header class="bar">
  <a class="mark" href="#first-furrow" aria-label="Tallyline, back to the top">Tallyline<span class="mark-note" aria-hidden="true"></span></a>
  <nav aria-label="Main">
    <a href="#the-cut">The cut</a>
    <a href="#the-thaw">The thaw</a>
    <a href="#ice-cores">Questions</a>
    <a href="#open-water" class="nav-key">Get a key</a>
  </nav>
  <p class="sheet" aria-hidden="true">INV 0001, sheet <span id="sheet-n">01</span> of 15</p>
</header>
<main>
<!-- chapter: first-furrow -->
<section id="first-furrow" data-chapter="first-furrow" data-surface="ice" class="furrow">
  <div class="tally-fallback" aria-hidden="true"></div>
  <figure class="slip" id="slip" aria-label="Example: one invoice, from request to paid">
    <figcaption>One invoice, start to paid</figcaption>
    <p class="slip-req"><b>POST</b> /v1/invoices</p>
    <ol class="slip-log">
      <li><span>201</span>INV-0001 created, draft</li>
      <li><span>event</span>invoice.sent</li>
      <li><span>event</span>invoice.viewed</li>
      <li><span>event</span>invoice.overdue, reminder 1</li>
      <li class="paid"><span>event</span>invoice.paid, to your server</li>
    </ol>
    <p class="slip-total"><span>Total, USD</span><strong>1035.00</strong></p>
  </figure>
  <div class="wrap furrow-in">
    <h1><span class="w">Finished</span> <span class="w">work</span> <span class="w">is</span> <span class="w">frozen</span> <span class="w">money.</span></h1>
    <div class="furrow-foot">
      <p class="lead">Tallyline is an invoicing API for freelancers. Send it your lines. It cuts the invoice, numbers it, sends it, chases it and tells your server the day it is paid.</p>
      <div class="furrow-acts">
        <a class="slab" href="#open-water">Get an API key</a>
        <a class="slab ghost" href="#the-cut">Read a request</a>
      </div>
    </div>
  </div>
</section>

<!-- chapter: frozen-word -->
<section id="frozen-word" data-chapter="frozen-word" data-surface="ice" data-pin class="fw" style="--len:1.6">
  <div class="pin-stage">
    <div class="wrap fw-in">
      <p class="sr">Accountants already call paid money liquid. Everything still owed to you is ice.</p>
      <p class="fw-big" id="fw-text" aria-hidden="true"></p>
      <p class="fw-note small">Most freelancers can name an invoice that sat unpaid for weeks after the work was done.</p>
    </div>
  </div>
</section>

<!-- chapter: the-borehole -->
<section id="the-borehole" data-chapter="the-borehole" data-surface="ice" class="bore">
  <div class="wrap bore-grid">
    <form class="bore-form" id="bore-form" novalidate>
      <h2>Bore a hole in it.</h2>
      <p>Type what one client owes you and how late it is. The rate starts at 8%, the part of UK statutory interest that sits above the Bank of England base rate. Add the current base rate yourself, or use the rate in your contract.</p>
      <div class="field"><label for="b-owed">Owed to you</label><input id="b-owed" inputmode="decimal" autocomplete="off" aria-describedby="b-owed-e"><p class="err" id="b-owed-e"></p></div>
      <div class="field"><label for="b-days">Days late</label><input id="b-days" inputmode="numeric" autocomplete="off" aria-describedby="b-days-e"><p class="err" id="b-days-e"></p></div>
      <div class="field"><label for="b-rate">Rate per year, %</label><input id="b-rate" inputmode="decimal" autocomplete="off" value="8" aria-describedby="b-rate-e"><p class="err" id="b-rate-e"></p></div>
      <p class="bore-res"><span>What that lateness has cost so far</span><output id="b-out" aria-live="polite">0.00</output></p>
      <p class="small" id="b-note">Nothing typed yet, so the hole is dry.</p>
      <p class="small">Amount times rate times days, over 365. Interest only, no fixed recovery fees. UK law, business debts only, and a contract rate replaces it.</p>
    </form>
    <div class="hole-wrap">
      <div class="hole" id="hole" aria-hidden="true">
        <div class="ring r1"></div><div class="ring r2"></div><div class="ring r3"></div><div class="ring r4"></div><div class="ring r5"></div>
      </div>
    </div>
  </div>
</section>

<!-- chapter: wyeths-grid -->
<section id="wyeths-grid" data-chapter="wyeths-grid" data-surface="ice" data-pin class="wy" style="--len:2">
  <div class="pin-stage">
    <div class="wy-pic" role="img" aria-label="Square blocks of ice seen under clear water, diced into a grid along straight saw lines.">
      <div class="wy-cells" id="wy-cells"></div>
      <div class="wy-tint" aria-hidden="true"></div>
    </div>
    <div class="wy-text wrap">
      <h2>A horse pulled the first table across a pond.</h2>
      <p>In the 1820s, ice cutters near Boston put a blade behind a horse. Ponds came up scored in a grid. Blocks of one size could be stacked, counted and sold by weight.</p>
      <p class="wy-turn">A line that says Design work, 2,400 is a lump nobody can check. Hours, rate and description are the grid.</p>
    </div>
  </div>
</section>

<!-- chapter: the-cut -->
<section id="the-cut" data-chapter="the-cut" data-surface="ice" class="cut">
  <div class="wrap cut-grid">
    <div class="cut-left">
      <h2>POST your lines.</h2>
      <p class="cut-intro">These lines are an example. Type over them. Nothing leaves your browser, this block is sawn by JavaScript on this page.</p>
      <table class="lines">
        <caption class="sr">Invoice lines you can edit</caption>
        <thead><tr><th scope="col">Line</th><th scope="col">Hours</th><th scope="col">Rate</th><th scope="col">Amount</th><th scope="col"><span class="sr">Remove</span></th></tr></thead>
        <tbody id="lines"></tbody>
      </table>
      <div class="cut-tools">
        <button class="slab ghost" id="add-line" type="button">Saw another line</button>
        <label class="cur">Currency
          <select id="currency"><option>USD</option><option>EUR</option><option>GBP</option></select>
        </label>
        <p class="cut-total">Total <strong id="total">0.00</strong></p>
      </div>
    </div>
    <div class="cut-kerf" aria-hidden="true"></div>
    <div class="cut-right">
      <details class="req" open><summary>Request</summary><pre id="request" tabindex="0" aria-label="The request these lines produce"></pre></details>
      <details class="req" open><summary>Response, 201</summary><pre id="response" tabindex="0" aria-label="The response"></pre></details>
      <p class="small">Example request. Field names show the shape of the API; the published reference is the final word.</p>
      <div class="block" id="block" aria-hidden="true"></div>
      <p class="block-cap">This block goes with you. Keep scrolling.</p>
    </div>
  </div>
</section>

<!-- chapter: the-channel -->
<section id="the-channel" data-chapter="the-channel" data-surface="ice" data-pin class="ch" style="--len:1.7">
  <div class="pin-stage">
    <h2 class="ch-head wrap">Floated down the channel, one state at a time.</h2>
    <div class="ch-band" id="ch-band" aria-hidden="true"></div>
    <div class="ch-block" id="ch-block" aria-hidden="true"></div>
    <ol class="ch-marks" id="ch-marks">
      <li><b>draft</b><p>Yours to change. Nothing has left the shore.</p><code>invoice.created</code></li>
      <li><b>sent</b><p>A number is fixed to it and it goes to your client.</p><code>invoice.sent</code></li>
      <li><b>viewed</b><p>Your client opened it.</p><code>invoice.viewed</code></li>
      <li><b>overdue</b><p>The due date passed. Reminders run on the dates you set.</p><code>invoice.overdue</code></li>
      <li><b>paid</b><p>This one does not get a block here. Keep going.</p><code>invoice.paid</code></li>
    </ol>
    <p class="ch-small small wrap">Each change sends one event to the URL you register.</p>
  </div>
</section>

<!-- chapter: the-ice-house -->
<section id="the-ice-house" data-chapter="the-ice-house" data-surface="sawdust" class="ih">
  <canvas class="ih-dust" id="ih-dust" aria-hidden="true"></canvas>
  <div class="wrap ih-in">
    <h2>Packed in sawdust, kept till summer.</h2>
    <p class="ih-lead">Sawdust was mill waste, and it kept ice whole through a hot season. These are the fields Article 226 of the EU VAT Directive asks for, packed the same way.</p>
    <ol class="ih-wall" id="ih-wall">
      <li style="--c:3;--r:1" data-short>Date of issue</li>
      <li style="--c:5;--r:2">A sequential number that identifies the invoice <span class="ih-n" id="ih-n"></span></li>
      <li style="--c:4;--r:1" data-short>Your VAT number</li>
      <li style="--c:3;--r:2">Your full name and address</li>
      <li style="--c:4;--r:1" data-short>VAT rate</li>
      <li style="--c:5;--r:2">Your client’s VAT number, where they account for the tax</li>
      <li style="--c:4;--r:2">Quantity and nature of the goods or services</li>
      <li style="--c:3;--r:2">Your client’s full name and address</li>
      <li style="--c:4;--r:2">Date the work was done or finished, if different</li>
      <li style="--c:7;--r:1">Taxable amount per rate, unit price, discounts</li>
      <li style="--c:5;--r:1" data-short>VAT amount payable</li>
    </ol>
    <p class="small ih-small">This list follows Article 226 of the EU VAT Directive (2006/112/EC) in short form. It is a summary and not tax advice, and rules differ by country.</p>
  </div>
</section>

<!-- chapter: the-tallyman -->
<section id="the-tallyman" data-chapter="the-tallyman" data-surface="ice" class="ty">
  <div class="ty-grid">
    <div class="ty-stick" id="ty-stick" aria-hidden="true"></div>
    <div class="ty-text">
      <h2>One stick, split down the middle.</h2>
      <p>For centuries the English Exchequer notched a stick and split it, and each side kept a half. The notches only proved anything when the two halves met. Send the same Idempotency-Key twice and the second request meets the first. You get the same invoice back.</p>
      <button class="slab" id="ty-send" type="button">Send it again</button>
      <p class="ty-out" id="ty-out" aria-live="polite">Sent 1 time. One invoice.</p>
      <ol class="ty-log" id="ty-log" aria-label="What the API answered">
        <li><code>POST /v1/invoices</code><span>Idempotency-Key: 0001</span><b>201 Created, inv_0001</b></li>
      </ol>
    </div>
  </div>
</section>

<!-- chapter: the-voyage -->
<section id="the-voyage" data-chapter="the-voyage" data-surface="snow" class="vy">
  <div class="wrap vy-top">
    <h2>Boston to Calcutta, 1833.</h2>
    <p>The Tuscany sailed with about 180 tons of ice and landed about 100. Everyone expected some melt, so nobody panicked. An unpaid invoice loses value the same way, more slowly. You set the reminder dates once and they run while you work on something else.</p>
  </div>
  <div class="vy-ribbon" id="vy-ribbon">
    <div class="vy-damp"><i></i><i></i><i></i><i></i></div>
    <div class="vy-bar frozen" id="vy-bar"><img src="img/frozen-lake.jpg" alt=""></div>
    <p class="vy-tons" id="vy-tons" aria-hidden="true">180 tons</p>
  </div>
  <div class="vy-labels wrap">
    <span>180 tons, Boston, 12 May</span>
    <span class="vy-end">About 100 tons, Calcutta, September<small class="vy-note"><br>Calcutta sold it anyway.</small></span>
  </div>
</section>

<!-- chapter: the-thaw -->
<section id="the-thaw" data-chapter="the-thaw" data-surface="ice" data-pin class="thaw" style="--len:4.5">
  <div class="pin-stage">
    <p class="thaw-cap" id="thaw-cap">Your block, as you sawed it.</p>
    <h2 class="thaw-event" id="thaw-event">invoice.paid</h2>
    <button class="slab thaw-fire" id="thaw-fire" type="button">Fire the webhook</button>
    <pre class="thaw-load" id="thaw-load" aria-hidden="true"></pre>
    <p class="thaw-end" id="thaw-end">That is the whole product.</p>
    <p class="sr" id="thaw-sr" aria-live="polite"></p>
    <div class="still-block" id="still-block" aria-hidden="true"></div>
  </div>
</section>

<!-- chapter: black-water -->
<section id="black-water" data-chapter="black-water" data-surface="water" class="bw">
  <div class="bw-in wrap">
    <div class="bw-floe frozen" aria-hidden="true"><img src="img/cracked-ice.jpg" alt=""></div>
    <p class="bw-aside">Nothing is frozen here.</p>
    <h2 class="bw-word">Liquid.</h2>
    <div class="bw-mirror" aria-hidden="true">Liquid.</div>
    <p class="bw-note">The webhook arrives at the URL you registered. Then your own code does whatever comes next.</p>
  </div>
</section>

<!-- chapter: ice-cores -->
<section id="ice-cores" data-chapter="ice-cores" data-surface="water" class="ic">
  <div class="wrap">
    <h2>Five cores, pulled from the middle.</h2>
    <dl class="ic-cores">
      <div class="core" style="--l:74%"><dt>Is this accounting software?</dt><dd>No. It makes invoices, sends them and tracks them. Your books stay wherever they are.</dd></div>
      <div class="core" style="--l:58%"><dt>Will it sort out my tax?</dt><dd>No. You set the rate on each line. Your accountant still has a job.</dd></div>
      <div class="core" style="--l:86%"><dt>What does it cost?</dt><dd>Prices are not on this page yet. Ask when you request a key and you will get a straight number.</dd></div>
      <div class="core" style="--l:100%"><dt>Is the code on this page real?</dt><dd>The requests show the shape of the API. The block on this page was sawn by JavaScript in your browser, and no request went anywhere.</dd></div>
      <div class="core" style="--l:92%"><dt>Why ice?</dt><dd>Because money you have earned and not received behaves like it. And because the name is the line you score before you cut.</dd></div>
    </dl>
  </div>
</section>

<!-- chapter: whole-lake -->
<section id="whole-lake" data-chapter="whole-lake" data-surface="ice" data-pin class="wl" style="--len:2.5">
  <div class="pin-stage">
    <h2 class="wl-head wrap" id="wl-head">You have been standing on an invoice.</h2>
    <table class="wl-table" id="wl-table">
      <caption class="sr">This page as one invoice, with each chapter as a line, billed at nothing.</caption>
      <thead class="sr"><tr><th scope="col">Line</th><th scope="col">Sheets crossed</th><th scope="col">Rate</th><th scope="col">Amount</th></tr></thead>
      <tbody id="wl-rows"></tbody>
    </table>
    <div class="wl-foot" id="wl-foot">
      <p>INV 0001. Bill to: whoever is reading this. Every chapter was a line. No charge for reading.</p>
      <dl>
        <div><dt>Time on the ice</dt><dd id="wl-time">0:00</dd></div>
        <div><dt>Sheets crossed</dt><dd id="wl-sheets">0.0</dd></div>
        <div><dt>Subtotal</dt><dd>0.00</dd></div>
        <div class="bal"><dt>Balance due</dt><dd>0.00</dd></div>
      </dl>
    </div>
  </div>
</section>

<!-- chapter: open-water -->
<section id="open-water" data-chapter="open-water" data-surface="ice" class="ow">
  <svg class="ow-flag" id="ow-flag" viewBox="0 0 54 100" aria-hidden="true"><path d="M6 100V4" stroke="#0a1519" stroke-width="3"/><path id="ow-cloth" d="M7 6h42l-8 12 8 12H7z" fill="#b93320"/></svg>
  <div class="wrap ow-in">
    <h2>Start your own line.</h2>
    <form class="ow-form" id="ow-form" novalidate>
      <label for="ow-email">Email for the key</label>
      <div class="ow-slot">
        <input id="ow-email" name="email" type="email" autocomplete="email" required aria-describedby="ow-msg">
        <button class="slab" id="ow-btn" type="submit">Ask for a key</button>
      </div>
      <p class="ow-msg" id="ow-msg" role="status"></p>
    </form>
    <p class="small" id="ow-balance">Balance still 0.00.</p>
  </div>
</section>

<!-- chapter: far-bank -->
<footer id="far-bank" data-chapter="far-bank" data-surface="snow" class="fb" role="contentinfo">
  <svg class="fb-flag" viewBox="0 0 54 100" aria-hidden="true"><path d="M6 100V4" stroke="#0a1519" stroke-width="3"/><path d="M7 6h42l-8 12 8 12H7z" fill="#b93320"/><path d="M0 100q14-16 40 0" fill="#e9f0f1" stroke="rgb(10 21 25 / .2)"/></svg>
  <div class="wrap">
    <div class="fb-close">
      <p class="fb-mark" aria-hidden="true">Tallyline</p>
      <p class="fb-what">An invoicing API for freelancers. Send your lines; Tallyline cuts the invoice, numbers it, sends it, chases it and tells your server the day it is paid.</p>
      <div class="fb-acts">
        <a class="slab" href="#open-water">Get an API key</a>
        <a class="slab ghost" href="#the-cut">Read a request</a>
      </div>
    </div>
    <p class="fb-line" id="fb-line">Cut from one lake, set in Bodoni Moda and IBM Plex Mono, with no customer logos because nobody has been asked yet, no prices because they are not written yet and no testimonials because we would have to make them up.</p>
    <p class="small fb-c">The ice-trade history comes from public accounts of the 1800s; the late-payment and VAT notes are short summaries, not advice. The pictures are generated and are not photographs of the real ice trade.</p>
    <p class="fb-end"><span>Tallyline. An invoicing API for freelancers.</span> <span id="fb-count"></span> <span class="fb-bank" id="fb-bank"></span></p>
  </div>
</footer>
</main>
<script src="js/film.js" defer></script>
<script src="js/shader.js" defer></script>
<script src="js/stage.js" defer></script>
<script src="js/chrome.js" defer></script>
<script src="js/chapters/first-furrow.js" defer></script>
<script src="js/chapters/frozen-word.js" defer></script>
<script src="js/chapters/the-borehole.js" defer></script>
<script src="js/chapters/wyeths-grid.js" defer></script>
<script src="js/chapters/the-cut.js" defer></script>
<script src="js/chapters/the-channel.js" defer></script>
<script src="js/chapters/the-ice-house.js" defer></script>
<script src="js/chapters/the-tallyman.js" defer></script>
<script src="js/chapters/the-voyage.js" defer></script>
<script src="js/chapters/the-thaw.js" defer></script>
<script src="js/chapters/ice-cores.js" defer></script>
<script src="js/chapters/whole-lake.js" defer></script>
<script src="js/chapters/open-water.js" defer></script>
<script src="js/chapters/far-bank.js" defer></script>
</body>
</html>
```

Create `404.html` exactly as below.

```html
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="robots" content="noindex"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Thin ice. Tallyline</title><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23a4c0c8'/%3E%3Cpath d='M11 0v32' stroke='%230a1519' stroke-width='3'/%3E%3Cpath d='M12.5 0v32' stroke='%23e9f0f1' stroke-width='1'/%3E%3C/svg%3E"><link rel="stylesheet" href="site.css"></head>
<body data-surface="ice" style="min-height:100svh;display:grid;place-items:center;padding:24px">
<main style="max-width:680px">
  <h1 style="font-size:clamp(60px,12vw,150px)">Thin ice.</h1>
  <p style="margin:18px 0 26px">Nothing is sawn out here. The page you wanted is not on this lake.</p>
  <a class="slab" href="index.html">Back to the shore</a>
</main>
</body></html>
```

## 5. Styles

Create `site.css` exactly as below. It contains the fonts, colour tokens, the four surfaces, the sawn headings and buttons, every chapter's layout and the phone layout (breakpoints at 760 and 860 pixels wide; tablets use the desktop rules with fluid `clamp()` sizes), plus the reduced-motion and no-WebGL fallbacks.

How the page is put together, so you understand the CSS: the colours are snow `#e9f0f1`, lake `#a4c0c8`, black water `#0a1519`, sawdust `#c8964a` and flag red `#b93320` (red only for marks: the blade, the flags, focus rings, hover underlines and the saw line under a heading as it arrives). Headings on ice look sawn into it (a dark floor and one lit wall in the text shadow). Buttons are "slabs": square corners, a lit top edge and a hard dark lower wall; the ghost slab is a 1px outline. The fixed bar on top changes colour with the chapter under it (`body[data-surface]`). The fixed `canvas#lake` sits behind everything (`z-index: 0`), `main` above it (`z-index: 2`). When the shader is not running, `body::before` paints a still lake and `.tally-fallback` draws the saw line.

```css
/* world/00-tokens.css */
@font-face { font-family: 'Bodoni Moda'; src: url(fonts/bodoni-moda-latin-opsz-normal.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --snow: #e9f0f1; --lake: #a4c0c8; --black-water: #0a1519; --sawdust: #c8964a; --flag: #b93320;
  --ink: var(--black-water); --ink-2: rgb(10 21 25 / .72); --line: rgb(10 21 25 / .34);
  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, Menlo, monospace;
  --gutter: clamp(38px, 6vw, 96px);
  --arrive: cubic-bezier(.16, 1, .3, 1); --answer: cubic-bezier(.2, .8, .2, 1); --carry: cubic-bezier(.65, 0, .35, 1);
  scrollbar-color: var(--lake) var(--black-water); scrollbar-width: thin;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; font-synthesis: none; }
body { background: var(--lake); color: var(--ink); font: 400 16px/1.55 var(--mono); font-variant-numeric: tabular-nums; overflow-x: clip; }
::selection { background: var(--flag); color: var(--black-water); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
main { position: relative; z-index: 2; }
h1, h2 { font-family: var(--display); font-weight: 500; font-variation-settings: 'opsz' 30; line-height: .98; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-variation-settings: 'opsz' 96; letter-spacing: -.02em; }
h2 { font-size: clamp(44px, 7.4vw, 118px); }
p { text-wrap: pretty; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The same four surfaces colour every chapter. */
[data-surface="ice"], [data-surface="snow"] { --ink: var(--black-water); --ink-2: rgb(10 21 25 / .8); --line: rgb(10 21 25 / .36); --bar: #bfd2d8; }
[data-surface="snow"] { --bar: var(--snow); }
[data-surface="sawdust"] { --ink: #1c0f03; --ink-2: rgb(28 15 3 / .82); --line: rgb(28 15 3 / .4); --bar: var(--sawdust); }
[data-surface="water"] { --ink: var(--snow); --ink-2: rgb(233 240 241 / .78); --line: rgb(233 240 241 / .32); --bar: var(--black-water); }
section[data-surface], footer[data-surface] { color: var(--ink); position: relative; }

/* Every heading on ice is sawn: dark floor, one lit wall. */
[data-surface="ice"] h2, [data-surface="snow"] h2 { text-shadow: .012em .016em 0 rgb(255 255 255 / .75), -.006em -.008em 0 rgb(10 21 25 / .25); }

/* Headings are sawn in as they arrive: the blade runs along the baseline and the words open behind it. */
@media (prefers-reduced-motion: no-preference) {
  html.js h2.saw { clip-path: inset(-.25em 100% -.35em -.1em); transition: clip-path 1100ms var(--carry); }
  html.js h2.saw.in { clip-path: inset(-.25em -.3em -.35em -.1em); }
  html.js h2.saw::after { content: ''; position: absolute; left: 0; bottom: -.08em; width: 100%; height: 2px; background: var(--flag); transform: scaleX(0); transform-origin: 0 50%; opacity: 0; pointer-events: none; }
  html.js h2.saw.in::after { animation: saw-run 1300ms var(--carry) both; }
  html.js h2.saw:not([class*="-head"]) { position: relative; }
}
@keyframes saw-run { 0% { transform: scaleX(0); opacity: 1; } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

#lake { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; opacity: 0; }
html.gl-ready #lake { opacity: 1; }   /* a new WebGL canvas is black until its first frame: keep it hidden until then */
body::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 8% 0%, rgb(255 255 255 / .55), transparent 55%),
    linear-gradient(170deg, #b7cfd5, var(--lake) 45%, #8fafb9); }
html.gl-ready body::before { display: none; }
.rime { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; background:
    radial-gradient(45% 40% at 0 0, var(--snow), transparent 70%), radial-gradient(45% 40% at 100% 0, var(--snow), transparent 70%),
    radial-gradient(45% 40% at 0 100%, var(--snow), transparent 70%), radial-gradient(45% 40% at 100% 100%, var(--snow), transparent 70%); }
html.js:not(.gl-ready) .rime { opacity: .9; }
html.gl-ready .rime { transition: opacity 900ms var(--carry); }

.pin-stage { position: sticky; top: 0; height: 100svh; overflow: clip; }
section[data-pin] { height: calc(100svh * (1 + var(--len, 1))); }
@media (max-width: 760px) { section[data-pin] { height: calc(100svh * (1 + var(--len, 1) * .7)); } }

.wrap { padding-inline: var(--gutter) clamp(20px, 5vw, 72px); }
.small { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.cut-link { display: inline-block; padding-block: 13px; margin-block: -13px; background: linear-gradient(currentColor, currentColor) 0 calc(100% - 13px) / 100% 1px no-repeat; }
@media (hover: hover) and (pointer: fine) {
  .cut-link { background-size: 0 1px, 100% 1px; background-image: linear-gradient(var(--flag), var(--flag)), linear-gradient(var(--line), var(--line)); background-position: 0 calc(100% - 13px); transition: background-size 220ms var(--answer); }
  .cut-link:hover { background-size: 100% 1px, 100% 1px; }
}
:focus-visible { outline: 2px solid var(--flag); outline-offset: 3px; border-radius: 0; }
.skip { position: fixed; left: var(--gutter); top: -60px; z-index: 40; background: var(--snow); color: var(--black-water); padding: 10px 14px; }
.skip:focus { top: 10px; }

/* A slab sawn from the lake: square corners, a lit top edge, a dark lower wall. */
.slab { display: inline-flex; align-items: center; min-height: 48px; padding: 12px 22px; background: var(--black-water); color: var(--snow); border: 0; cursor: pointer; box-shadow: inset 0 1px 0 rgb(233 240 241 / .45), 0 3px 0 rgb(10 21 25 / .28); transition: transform 90ms var(--answer), box-shadow 90ms var(--answer), background-color 140ms var(--answer); }
.slab.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.slab:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgb(233 240 241 / .45), 0 1px 0 rgb(10 21 25 / .28); }
@media (hover: hover) and (pointer: fine) { .slab:hover { background: var(--flag); color: var(--snow); } .slab.ghost:hover { box-shadow: inset 0 0 0 2px var(--flag); background: transparent; color: var(--ink); } }
.slab:disabled { opacity: .55; cursor: not-allowed; }
[data-surface="water"] .slab { background: var(--snow); color: var(--black-water); }
[data-surface="water"] .slab:hover { background: var(--flag); color: var(--snow); }

/* Picture treatment: frozen under the ice. */
.frozen { position: relative; overflow: hidden; background: var(--lake); }
.frozen img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.15) brightness(1.05); mix-blend-mode: multiply; }
.frozen::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, rgb(233 240 241 / .3), transparent 42%); box-shadow: inset 1px 1px 0 rgb(233 240 241 / .75), inset -2px -2px 0 rgb(10 21 25 / .4); pointer-events: none; }

.bar { position: fixed; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: clamp(14px, 3vw, 44px); padding: 10px clamp(20px, 5vw, 72px) 10px var(--gutter); color: var(--ink); background: var(--bar); box-shadow: 0 2px 0 rgb(10 21 25 / .55), 0 3px 0 rgb(233 240 241 / .6); transition: color 220ms var(--answer), background-color 220ms var(--answer); }
.mark { font-family: var(--display); font-size: 25px; font-weight: 600; letter-spacing: -.01em; padding-block: 8px; display: inline-block; min-height: 44px; }
.mark-note { font: 400 12px var(--mono); margin-left: 10px; color: var(--ink-2); }
.bar nav { display: flex; gap: clamp(12px, 2.4vw, 30px); margin-left: auto; font-size: 14px; }
.bar nav a { padding: 12px 0; position: relative; white-space: nowrap; }
.bar nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--flag); transform: scaleX(0); transform-origin: 0 50%; transition: transform 220ms var(--answer); }
.bar nav a[aria-current]::after { transform: scaleX(1); height: 2px; }
@media (hover: hover) and (pointer: fine) { .bar nav a:hover::after { transform: scaleX(1); } }
.sheet { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.blade { position: fixed; z-index: 15; left: calc(max(20px, 3.5vw) - 13px); top: 68vh; color: var(--flag); transform: translateY(-40px); pointer-events: none; }
html.zooming .blade { opacity: 0; }
@media (max-width: 1100px) { .sheet { display: none; } }
@media (max-width: 760px) { .bar nav a:not(.nav-key) { display: none; } .bar nav { font-size: 15px; } }
@media (max-width: 420px) { .mark-note { display: none; } }   /* the returning-visitor note would wrap the bar on small phones */

@media (prefers-reduced-motion: reduce) {
  section[data-pin] { height: auto; }
  .pin-stage { position: relative; height: auto; min-height: 100svh; }
  html.gl-ready .rime { transition: none; }
}
html:not(.gl-ready) .tally-fallback { display: block; }
.tally-fallback { display: none; position: fixed; left: max(20px, 3.5vw); top: 0; bottom: 0; width: 2px; background: var(--black-water); z-index: 1; }
@media print {
  body > *, main > * { display: none !important; }
  main, [data-chapter="whole-lake"], [data-chapter="whole-lake"] .pin-stage { display: block !important; position: static !important; height: auto !important; }
}


/* chapter: first-furrow */
.furrow { min-height: 112svh; }
.furrow-in { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: clamp(30px, 7vh, 72px); padding-top: 90px; }
.furrow h1 { font-size: clamp(66px, 13.4vw, 232px); line-height: .9; letter-spacing: -.035em; max-width: 12ch; text-shadow: .012em .016em 0 rgb(255 255 255 / .75), -.006em -.008em 0 rgb(10 21 25 / .25); }
html.carved .furrow h1 { color: transparent; text-shadow: none; }
html.wait-carve:not(.carved) .furrow h1 { opacity: 0; }
/* A sawn slip of ice in the corner: one invoice going through the API, line by line. */
.slip { position: absolute; z-index: 2; top: 116px; right: clamp(20px, 5vw, 72px); width: 352px; margin: 0; padding: 16px 18px 14px; display: none; color: var(--black-water);
  background: rgb(233 240 241 / .74); box-shadow: inset 2px 2px 0 #fff, inset -3px -3px 0 rgb(10 21 25 / .3), 7px 9px 0 rgb(10 21 25 / .18); font-size: 13px; line-height: 1.35; }
@media (min-width: 1180px) and (min-height: 700px), (min-width: 700px) and (min-height: 960px) { .slip { display: block; } }
html.slip-off .slip { display: none; }
.slip figcaption { font: 500 21px/1.05 var(--display); font-variation-settings: 'opsz' 30; margin-bottom: 12px; }
.slip-req { padding: 7px 10px; background: var(--black-water); color: var(--snow); }
.slip-req b { font-weight: 500; color: #f0a593; margin-right: 6px; }
.slip-log { list-style: none; padding: 0; margin: 0; }
.slip-log li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 7px 0 6px; border-bottom: 1px solid rgb(10 21 25 / .3); position: relative; }
.slip-log li span { color: rgb(10 21 25 / .62); }
.slip-log li.paid { font-weight: 500; }
.slip-log li.paid span { color: var(--flag); }
.slip-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.slip-total strong { font: 500 34px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  html.js .slip-log li { opacity: .18; transition: opacity 320ms var(--answer); }
  html.js .slip-log li::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--black-water); transform: scaleX(0); transform-origin: 0 50%; transition: transform 520ms var(--carry); }
  html.js .slip-log li.on { opacity: 1; }
  html.js .slip-log li.on::after { transform: scaleX(1); }
  html.js .slip-log li.paid.on::after { background: var(--flag); }
  html.js .slip-total strong { transition: color 320ms var(--answer); }
  html.js .slip.is-paid .slip-total strong { color: var(--flag); }
}
.furrow-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px clamp(30px, 6vw, 90px); margin-top: clamp(22px, 4vh, 44px); }
.lead { font-size: clamp(16px, 1.45vw, 21px); line-height: 1.42; max-width: 56ch; font-weight: 500; }
.furrow-acts { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .furrow h1 { font-size: 19.5vw; } .furrow-acts .slab { flex: 1 1 100%; justify-content: center; min-height: 54px; } }


/* chapter: frozen-word */
.fw-in { height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 26px; padding-top: 70px; }
.fw-big { font: 500 min(9.2vw, 15.4vh)/.98 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.025em; max-width: 17ch; }
.fw-big .w { opacity: .17; display: inline-block; margin-right: .22em; transition: opacity 260ms var(--answer); position: relative; text-shadow: -.012em -.014em 0 rgb(255 255 255 / .7); }
.fw-big .w.on { opacity: 1; }
.fw-big .w.last::after { content: ''; position: absolute; left: -6vw; right: -12vw; top: 56%; height: 3px; background: var(--black-water); box-shadow: 0 2px 0 rgb(233 240 241 / .75); transform: scaleX(0); transform-origin: 0 50%; transition: transform 420ms var(--carry); }
.fw-big .w.last.on::after { transform: scaleX(1); }
.fw-note { max-width: 62ch; }
@media (max-width: 760px) { .fw-big { font-size: 14.2vw; } }
@media (prefers-reduced-motion: reduce) { .fw-big .w { opacity: 1; transition: none; } .fw-big .w.last::after { transform: scaleX(1); transition: none; } }


/* chapter: the-borehole */
.bore { padding-block: clamp(70px, 12vh, 130px); }
.bore-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 5vw, 80px); align-items: center; }
.bore-form > p { max-width: 54ch; }
.bore-form h2 { margin-bottom: 18px; }
.field { margin-top: 14px; max-width: 360px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.field input { width: 100%; min-height: 48px; padding: 10px 12px; background: rgb(233 240 241 / .6); border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; font-size: 17px; }
.field input:focus { background: var(--snow); outline: 2px solid var(--flag); outline-offset: 0; }
.err { min-height: 18px; font-size: 13px; color: #8c1e10; }
.bore-res { margin-top: 12px; display: flex; flex-direction: column; font-size: 13px; }
.bore-res output { font: 500 clamp(52px, 6.4vw, 96px)/1 var(--display); font-variation-settings: 'opsz' 96; font-variant-numeric: lining-nums tabular-nums; }
.bore-form .small { margin-top: 8px; }
.hole-wrap { display: grid; place-items: center; min-height: 460px; align-self: start; position: sticky; top: 16vh; }
.hole { width: min(100%, 560px); aspect-ratio: 1; position: relative; border-radius: 50%; display: grid; place-items: center; transform: scale(var(--s, .62)); transition: transform 500ms var(--arrive); cursor: ew-resize; touch-action: none; }
.ring { position: absolute; border-radius: 50%; }
.r1 { inset: 0; background: radial-gradient(circle at 30% 26%, #eef4f5, #bcd0d6 62%, #8eaab3); box-shadow: inset -5px -6px 0 rgb(10 21 25 / .22), inset 3px 3px 0 #fff, 7px 9px 16px rgb(10 21 25 / .35); }
.r2 { inset: 5%; background: linear-gradient(142deg, #4f6f7a, #9db9c1 58%, #d6e3e6); }           /* the shaft wall: bright where the low sun reaches, dark under the rim */
.r3 { inset: 12%; background: linear-gradient(142deg, #2d4852, #6b8c97 62%, #b6ccd2); }
.r4 { inset: 20%; background: linear-gradient(142deg, #152a31, #3e5e69 64%, #7e9ca6); }
.r5 { inset: 29%; background: radial-gradient(circle at 34% 30%, #16303a, var(--black-water) 58%); box-shadow: inset 10px 12px 26px #000, inset -2px -2px 0 rgb(233 240 241 / .35); }
.hole[data-dry="1"] .r5 { background: #8ba9b3; box-shadow: inset 3px 3px 8px rgb(10 21 25 / .25); }
@media (max-width: 860px) { .bore-grid { grid-template-columns: minmax(0, 1fr); } .hole-wrap { min-height: 340px; order: -1; position: static; } .hole { width: min(92%, 340px); cursor: default; touch-action: auto; } .field { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .hole { transition: none; } }


/* chapter: wyeths-grid */
.wy .pin-stage { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; }
.wy-pic { position: relative; height: 100%; margin-left: max(20px, 3.5vw); padding: 64px 0 28px; }
.wy-cells { position: relative; width: 100%; height: 100%; overflow: clip; filter: grayscale(1) contrast(1.2) brightness(1.3); }
.wy-cell { position: absolute; background-image: url(img/ice-grid-underwater.jpg); background-repeat: no-repeat; box-shadow: inset 1px 1px 0 rgb(233 240 241 / .75), inset -2px -2px 0 rgb(10 21 25 / .5); transition: scale 400ms var(--answer); }
.wy-tint { position: absolute; inset: 64px 0 28px; background: var(--lake); mix-blend-mode: multiply; pointer-events: none; }
.wy-text { padding-left: clamp(18px, 3vw, 44px); padding-top: 60px; }
.wy-text h2 { font-size: clamp(38px, 4.8vw, 76px); margin-bottom: 18px; }
.wy-text p { max-width: 42ch; margin-top: 12px; }
.wy-turn { font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .wy-cell:hover { scale: 1.02; } }
@media (max-width: 760px) {
  .wy .pin-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44svh auto; align-items: start; }
  .wy-pic { margin-left: 0; padding: 62px 0 0 max(20px, 3.5vw); }
  .wy-tint { inset: 62px 0 0 max(20px, 3.5vw); }
  .wy-text { padding: 16px 20px 0 var(--gutter); } .wy-text h2 { font-size: 34px; }
  .wy-text p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .wy .pin-stage { min-height: 100svh; } .wy-pic { min-height: 60svh; } }


/* chapter: the-cut */
.cut { padding-block: clamp(90px, 14vh, 150px) clamp(80px, 12vh, 130px); }
.cut-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) 3px minmax(0, 1fr); gap: clamp(20px, 3.4vw, 56px); align-items: start; }
.cut h2 { font-size: clamp(56px, 8.6vw, 140px); }
.cut-intro { margin-top: 16px; max-width: 54ch; font-weight: 500; }
.lines { width: 100%; border-collapse: collapse; margin-top: 32px; table-layout: fixed; }
.lines th:nth-child(2), .lines th:nth-child(3) { width: 72px; } .lines th:nth-child(4) { width: 88px; text-align: right; } .lines th:nth-child(5) { width: 46px; }
.lines th { text-align: left; font-weight: 500; font-size: 13px; padding: 6px 8px 6px 0; border-bottom: 2px solid var(--ink); }
.lines td { border-bottom: 1px solid var(--line); padding: 0; }
.lines input { width: 100%; background: rgb(233 240 241 / .42); border: 0; padding: 12px 8px; min-height: 46px; border-radius: 0; }
.lines input:focus { background: rgb(233 240 241 / .85); outline: 2px solid var(--flag); outline-offset: -2px; }
.lines .amt { padding: 0 8px; text-align: right; white-space: nowrap; }
.lines .x { background: transparent; border: 0; width: 44px; height: 46px; cursor: pointer; font-size: 18px; }
.lines .x:hover { color: var(--flag); }
.cut-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 18px; }
.cur { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cur select { background: rgb(233 240 241 / .6); border: 0; padding: 0 10px; height: 48px; border-radius: 0; }
.cut-tools .slab { height: 48px; min-height: 0; }   /* the key and the select in this row share one height */
.cut-total { margin-left: auto; font-size: 15px; }
.cut-total strong { font-family: var(--display); font-size: 40px; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; margin-left: 8px; }
.cut-kerf { align-self: stretch; background: var(--black-water); box-shadow: 2px 0 0 rgb(233 240 241 / .75); }
.req summary { font-size: 13px; font-weight: 500; cursor: pointer; padding: 12px 0; min-height: 44px; }
.req pre { background: rgb(10 21 25 / .9); color: var(--snow); padding: 14px 16px; font: 400 13.5px/1.5 var(--mono); overflow: auto; max-height: 280px; box-shadow: inset 0 1px 0 rgb(233 240 241 / .3); }
.req + .req { margin-top: 10px; }
.cut-right .small { margin-top: 10px; }
.block { margin-top: 22px; background: rgb(233 240 241 / .78); box-shadow: inset 2px 2px 0 #fff, inset -3px -3px 0 rgb(10 21 25 / .32), 6px 7px 0 rgb(10 21 25 / .2); }
.block div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 14px; border-bottom: 2px solid rgb(10 21 25 / .68); position: relative; }
.block div:last-child { border-bottom: 0; font-weight: 500; }
.block div.fresh::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--flag); transform-origin: 0 50%; animation: saw-row 420ms var(--carry) both; }
@keyframes saw-row { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.block-cap { margin-top: 12px; font-family: var(--display); font-size: 24px; font-weight: 500; }
@media (max-width: 860px) {
  .cut-grid { grid-template-columns: minmax(0, 1fr); }
  .cut-kerf { height: 3px; }
  .req:not([open]) { border-bottom: 1px solid var(--line); }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; border-bottom: 2px solid var(--ink); padding: 8px 0; }
  .lines td { border: 0; }
  .lines td:first-child { grid-column: 1 / -1; }
  .lines td:nth-child(4) { display: flex; align-items: center; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .block div.fresh::after { animation: none; display: none; } }


/* chapter: the-channel */
.ch .pin-stage { --band-top: 40svh; --band: 26svh; }
.ch-head { position: absolute; top: 76px; left: 0; font-size: clamp(34px, 4.6vw, 74px); max-width: 16ch; }
.ch-band { position: absolute; left: 0; right: 0; top: var(--band-top); height: var(--band); }
html:not(.gl-ready) .ch-band { background: var(--black-water); }
.ch-block { position: absolute; left: 0; top: calc(var(--band-top) + var(--band) / 2); width: clamp(170px, 18vw, 260px); translate: -50% -50%; padding: 11px 14px; background: var(--snow); color: var(--black-water); box-shadow: inset 2px 2px 0 #fff, inset -3px -3px 0 rgb(10 21 25 / .35), 5px 7px 0 rgb(0 0 0 / .55); z-index: 2; font-size: 12px; line-height: 1.3; will-change: transform; }
.ch-block b { font: 500 25px/1 var(--display); display: block; margin-bottom: 6px; }
.ch-block div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid rgb(10 21 25 / .55); }
.ch-block div:last-child { border-bottom: 0; font-weight: 500; }
/* Five flags stand on the bank. The block passes them; only the nearest one speaks. */
.ch-marks { position: absolute; left: var(--gutter); right: 28px; top: calc(var(--band-top) + var(--band) + 12px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; list-style: none; padding: 0; margin: 0; }
.ch-marks li { position: relative; padding-left: 20px; opacity: .55; transition: opacity 220ms var(--answer); }
.ch-marks li::before { content: ''; position: absolute; left: 0; top: 4px; width: 12px; height: 20px; border: 1px solid var(--ink); }
.ch-marks li.on { opacity: 1; }
.ch-marks li.on::before { background: var(--flag); border-color: var(--flag); }
.ch-marks b { font: 500 clamp(28px, 3vw, 46px)/1 var(--display); font-variation-settings: 'opsz' 30; display: block; margin-bottom: 6px; }
.ch-marks p { font-size: 14px; line-height: 1.34; }
.ch-marks code { font: 500 13px var(--mono); display: inline-block; margin-top: 6px; border-top: 2px solid var(--ink); padding-top: 2px; }
.ch-marks li:not(.now) p, .ch-marks li:not(.now) code { opacity: 0; transition: opacity 180ms var(--answer); }
.ch-marks li.now p, .ch-marks li.now code { opacity: 1; }
.ch-small { position: absolute; right: 0; bottom: 14px; }
@media (max-width: 760px) {
  section.ch[data-pin] { height: auto; }
  .ch .pin-stage { position: relative; height: auto; overflow: visible; padding: 76px 0 40px; }
  .ch-head { position: static; padding-bottom: 18px; }
  .ch-band, .ch-block { display: none; }
  .ch-marks { position: static; display: block; margin-left: var(--gutter); padding-left: 14px; border-left: 14px solid var(--black-water); }
  .ch-marks li { opacity: 1; padding: 12px 0 14px 24px; } .ch-marks li::before { background: var(--flag); border-color: var(--flag); }
  .ch-marks li p, .ch-marks li code { opacity: 1 !important; }
  .ch-small { position: static; padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  section.ch[data-pin] { height: auto; }
  .ch .pin-stage { position: relative; height: auto; padding: 86px 0 40px; }
  .ch-head { position: static; } .ch-band, .ch-block { display: none; }
  .ch-marks { position: static; display: block; margin-left: var(--gutter); margin-top: 20px; }
  .ch-marks li { opacity: 1; padding: 12px 0 14px 24px; }
  .ch-marks li p, .ch-marks li code { opacity: 1 !important; }
  .ch-small { position: static; padding-top: 16px; }
}
html:is(.no-gl, :not(.js)) section.ch[data-pin] { height: auto; }
html:is(.no-gl, :not(.js)) .ch .pin-stage { position: relative; height: auto; padding: 86px 0 40px; }
html:is(.no-gl, :not(.js)) .ch-head { position: static; } html:is(.no-gl, :not(.js)) .ch-band, html:is(.no-gl, :not(.js)) .ch-block { display: none; }
html:is(.no-gl, :not(.js)) .ch-marks { position: static; display: block; margin-left: var(--gutter); margin-top: 20px; }
html:is(.no-gl, :not(.js)) .ch-marks li p, html:is(.no-gl, :not(.js)) .ch-marks li code { opacity: 1; } html:is(.no-gl, :not(.js)) .ch-marks li { opacity: 1; padding: 12px 0 14px 24px; }


/* chapter: the-ice-house */
.ih { background: var(--sawdust); padding-block: clamp(90px, 13vh, 150px) clamp(50px, 8vh, 90px); overflow: clip; box-shadow: 0 -3px 0 var(--black-water), 0 3px 0 var(--black-water); }
.ih-dust { position: absolute; inset: 0; width: 100%; height: 100%; }
.ih-in { position: relative; }
.ih h2 { font-size: clamp(44px, 6.6vw, 106px); }
.ih-lead { max-width: 58ch; margin-top: 14px; font-weight: 500; }
/* One sheet of ice, sawn into blocks of unequal size and packed so tight only a seam of sawdust shows. */
.ih-wall { list-style: none; padding: 0; margin: 34px 0 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: clamp(78px, 11vh, 108px); grid-auto-flow: dense; gap: 7px; }
.ih-wall li { grid-column: span var(--c); grid-row: span var(--r); position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 16px; color: var(--snow); font: 500 clamp(19px, 2.05vw, 32px)/1.06 var(--display); font-variation-settings: 'opsz' 30;
  background-color: #10252c; background-image: linear-gradient(142deg, rgb(10 21 25 / .32), rgb(10 21 25 / .7)), url(img/ice-block.webp); background-repeat: no-repeat; box-shadow: inset 1px 1px 0 rgb(242 215 162 / .9), inset -2px -2px 0 rgb(0 0 0 / .6); transform: translateY(var(--drop, 0px)); transition: transform 500ms var(--arrive), box-shadow 140ms var(--answer); }
.ih-n { display: block; margin-top: 6px; font: 400 13px var(--mono); color: var(--sawdust); }
.ih-small { margin-top: 20px; max-width: 74ch; width: fit-content; padding: 12px 16px; background: rgb(233 240 241 / .92); color: var(--ink); box-shadow: inset 0 0 0 1px rgb(10 21 25 / .18); }
@media (hover: hover) and (pointer: fine) { .ih-wall li:hover { box-shadow: inset 2px 2px 0 #f2d7a2, inset -2px -2px 0 rgb(0 0 0 / .6); } }
@media (max-width: 760px) { .ih-wall { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(74px, auto); } .ih-wall li { grid-column: span 6; grid-row: span 1; font-size: 20px; } .ih-wall li[data-short] { grid-column: span 3; font-size: 18px; padding: 10px 12px; } }
@media (prefers-reduced-motion: reduce) { .ih-wall li { transform: none; transition: none; } }


/* chapter: the-tallyman */
.ty { padding-block: clamp(70px, 12vh, 120px); min-height: 110svh; display: flex; align-items: center; }
.ty-grid { display: grid; grid-template-columns: clamp(110px, 18vw, 240px) minmax(0, 54ch); gap: clamp(26px, 7vw, 110px); padding-left: var(--gutter); }
.ty-stick { position: relative; min-height: 560px; }
.ty-stick svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ty-text h2 { font-size: clamp(40px, 5.4vw, 86px); margin-bottom: 18px; }
.ty-text p { margin-bottom: 14px; }
.ty-out { font-weight: 500; margin-top: 12px; }
.ty-log { list-style: none; padding: 0; margin: 22px 0 0; max-width: 54ch; font-size: 13px; line-height: 1.4; }
.ty-log li { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 2px 14px; padding: 9px 12px; background: rgb(10 21 25 / .88); color: var(--snow); box-shadow: inset 0 1px 0 rgb(233 240 241 / .3); }
.ty-log li + li { margin-top: 4px; }
.ty-log code { font: inherit; color: #f0a593; }
.ty-log span { color: rgb(233 240 241 / .72); }
.ty-log b { grid-column: 1 / -1; font-weight: 500; }
.ty-log li.same b::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; background: var(--flag); vertical-align: 0; }
@media (prefers-reduced-motion: no-preference) { .ty-log li.new { animation: ty-in 520ms var(--arrive) both; } }
@keyframes ty-in { from { transform: translateX(-28px); clip-path: inset(0 100% 0 0); } to { transform: none; clip-path: inset(0 0 0 0); } }
.ty-tip { position: absolute; left: 100%; margin-left: 8px; font-size: 13px; white-space: nowrap; background: var(--black-water); color: var(--snow); padding: 3px 7px; opacity: 0; pointer-events: none; transition: opacity 120ms var(--answer); z-index: 3; }
.ty-tip.on { opacity: 1; }
.tick { position: absolute; left: -16px; height: 2px; width: 12px; background: var(--flag); }
@media (max-width: 760px) { .ty-grid { grid-template-columns: minmax(0, 1fr); padding-right: 20px; } .ty-stick { min-height: 130px; } .ty-tip { display: none; } }


/* chapter: the-voyage */
.vy { padding-block: clamp(90px, 15vh, 150px) clamp(60px, 9vh, 100px); }
.vy-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 60px); align-items: end; }
.vy h2 { font-size: clamp(44px, 6.2vw, 100px); }
.vy-top p { max-width: 54ch; }
.vy-ribbon { position: relative; height: clamp(64px, 10vh, 104px); margin: clamp(60px, 13vh, 120px) clamp(20px, 5vw, 72px) 14px var(--gutter); }
.vy-damp { position: absolute; inset: 0; background: rgb(143 175 185 / .55); }
.vy-bar { position: absolute; inset: 0; transform-origin: 0 50%; }
.vy-bar img { height: 100%; }
.vy-bar { box-shadow: 0 4px 0 rgb(10 21 25 / .18); }
.vy-tons { position: absolute; bottom: calc(100% + 10px); left: calc(var(--s, 1) * 100%); transform: translateX(-100%); white-space: nowrap; font: 500 clamp(30px, 3.4vw, 52px)/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.vy-tons::after { content: ''; position: absolute; right: 0; top: calc(100% + 2px); width: 2px; height: 10px; background: var(--ink); }
/* What melted on the way drips out of the lost part of the ribbon. */
.vy-damp i { position: absolute; top: 100%; width: 3px; height: 9px; border-radius: 2px; background: #6f95a1; opacity: 0; }
.vy-damp i:nth-child(1) { left: 64%; } .vy-damp i:nth-child(2) { left: 74%; } .vy-damp i:nth-child(3) { left: 86%; } .vy-damp i:nth-child(4) { left: 95%; }
@media (prefers-reduced-motion: no-preference) {
  .vy-damp i { animation: vy-drip 1700ms cubic-bezier(.55, 0, 1, .45) infinite; animation-play-state: var(--drip, paused); }
  .vy-damp i:nth-child(2) { animation-delay: -500ms; } .vy-damp i:nth-child(3) { animation-delay: -1100ms; } .vy-damp i:nth-child(4) { animation-delay: -300ms; }
}
@keyframes vy-drip { 0% { transform: translateY(0) scaleY(.4); opacity: 0; } 12% { opacity: .9; } 100% { transform: translateY(70px) scaleY(1.2); opacity: 0; } }
.vy-labels { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; }
.vy-end { text-align: right; }
.vy-note { font-size: 13px; color: var(--ink-2); }
.vy-src { margin-top: 12px; }
@media (max-width: 760px) { .vy-top { grid-template-columns: minmax(0, 1fr); } .vy-ribbon { height: 300px; width: 64px; margin-inline: var(--gutter) 0; } .vy-bar { transform-origin: 50% 0; }
  .vy-tons { bottom: auto; left: calc(100% + 14px); top: calc(var(--s, 1) * 100%); transform: translateY(-100%); font-size: 34px; } .vy-tons::after { display: none; }
  .vy-damp i { left: 30% !important; top: auto; bottom: 0; } .vy-damp i:nth-child(even) { left: 62% !important; }
  .vy-labels { flex-direction: column; } .vy-end { text-align: left; } }


/* chapter: the-thaw */
.thaw .pin-stage { display: grid; place-items: center; }
.thaw-cap { position: absolute; left: var(--gutter); top: 96px; font-family: var(--display); font-size: clamp(22px, 2.4vw, 38px); font-weight: 500; }
.thaw-event { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); margin: 0; font: 400 clamp(40px, 11vw, 190px)/1 var(--display); font-variation-settings: 'opsz' 96; color: var(--snow); opacity: 0; white-space: nowrap; text-shadow: none; pointer-events: none; }
.thaw-fire { position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%); white-space: nowrap; }
.thaw-fire:active { transform: translateX(-50%) translateY(2px); }
.thaw-load { position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%); color: var(--snow); font: 400 clamp(11px, 1vw, 15px)/1.5 var(--mono); opacity: 0; white-space: pre-wrap; max-width: 90vw; text-align: center; }
.thaw-end { position: absolute; left: 50%; top: 66%; transform: translateX(-50%); color: var(--snow); font-size: clamp(16px, 1.5vw, 22px); opacity: 0; white-space: nowrap; }
.thaw[data-melted="1"] .thaw-fire { visibility: hidden; }
.still-block { display: none; }
html:is(.no-gl, :not(.js)) .still-block, html.reduced-still .still-block { display: block; width: min(88vw, 900px); background: rgb(233 240 241 / .78); padding: 24px; box-shadow: inset 2px 2px 0 #fff, inset -3px -3px 0 rgb(10 21 25 / .32); font-size: 15px; }
html:is(.no-gl, :not(.js)) .thaw[data-melted="1"] .still-block { display: none; }
html:is(.no-gl, :not(.js)) .thaw[data-melted="1"] .pin-stage { background: var(--black-water); }
.still-block div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .thaw .pin-stage { min-height: 100svh; } .thaw[data-melted="1"] .thaw-event, .thaw[data-melted="1"] .thaw-load, .thaw[data-melted="1"] .thaw-end { opacity: 1; } .thaw[data-melted="1"] .pin-stage { color: var(--snow); } }
html:is(.no-gl, :not(.js)) .thaw[data-melted="1"] .thaw-event, html:is(.no-gl, :not(.js)) .thaw[data-melted="1"] .thaw-load, html:is(.no-gl, :not(.js)) .thaw[data-melted="1"] .thaw-end { opacity: 1; }
@media (max-width: 760px) { .thaw-event { font-size: 15vw; } .thaw-cap { top: 76px; } }


/* chapter: black-water */
html:not(.gl-ready) [data-surface="water"] { background: var(--black-water); }
.bw { min-height: 112svh; display: flex; align-items: flex-end; }
.bw-in { position: relative; padding-bottom: 12svh; width: 100%; }
.bw-floe { position: absolute; right: 8vw; top: -24svh; width: clamp(120px, 15vw, 220px); aspect-ratio: 1; clip-path: polygon(4% 8%, 62% 0, 100% 22%, 93% 74%, 58% 100%, 12% 88%); background: #6d8e99; }
.bw-floe::after { display: none; }
.bw-aside { font-family: var(--display); font-size: 28px; opacity: .9; }
.bw-word { font: 500 26vw/.82 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.045em; margin-left: -.03em; white-space: nowrap; }
.bw-mirror { font: 500 26vw/.82 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.045em; margin-left: -.03em; transform: scaleY(-1); opacity: .08; pointer-events: none; height: .24em; overflow: hidden; }
.bw-note { max-width: 42ch; margin-top: 26px; font-size: 18px; }
@media (max-width: 760px) { .bw-word, .bw-mirror { font-size: 30vw; } .bw-floe { top: -32svh; } .bw-note { font-size: 19px; } }


/* chapter: ice-cores */
.ic { padding-block: clamp(100px, 14vh, 150px) clamp(120px, 18vh, 200px); }
.ic h2 { font-size: clamp(44px, 6.6vw, 104px); margin-bottom: clamp(30px, 6vh, 64px); max-width: 15ch; }
.ic-cores { margin: 0; display: grid; gap: clamp(10px, 1.5vh, 18px); }
/* Each answer is printed along a drilled ice core lying on the water. Length follows what it has to say. */
.core { --c1: #e7eff1; --c2: #cadbdf; --c3: #a9c3ca; position: relative; width: var(--l); display: grid; grid-template-columns: minmax(150px, 3fr) minmax(0, 6fr); gap: 0 26px; align-items: center; min-height: clamp(70px, 9.5vh, 96px); padding: 12px 54px 12px 22px; color: var(--black-water);
  background:
    linear-gradient(180deg, rgb(255 255 255 / .55), transparent 28%, transparent 58%, rgb(10 21 25 / .34)),
    linear-gradient(90deg, var(--c1) 0 7%, var(--c2) 7% 9%, var(--c1) 9% 21%, var(--c3) 21% 22.5%, var(--c1) 22.5% 37%, var(--c2) 37% 44%, var(--c1) 44% 63%, var(--c3) 63% 64%, var(--c1) 64% 81%, var(--c2) 81% 90%, var(--c1) 90%);
  box-shadow: inset 2px 0 0 #fff; }
.core:nth-child(2) { background-position: 0 0, 38% 0; background-size: auto, 140% 100%; }
.core:nth-child(3) { background-size: auto, 90% 100%; }
.core:nth-child(4) { background-size: auto, 170% 100%; background-position: 0 0, 72% 0; }
.core::after { content: ''; position: absolute; right: -11px; top: 0; bottom: 0; width: 22px; border-radius: 50%; background: radial-gradient(ellipse at 40% 34%, #f4f8f9, #9fbcc5 72%); box-shadow: inset -2px -2px 0 rgb(10 21 25 / .32); }
.core dt { font: 500 clamp(21px, 2vw, 30px)/1.06 var(--display); font-variation-settings: 'opsz' 30; }
.core dd { margin: 0; font-size: 15px; line-height: 1.38; }
.core dd { justify-self: start; padding: 6px 10px; background: rgb(240 245 246 / .82); box-shadow: inset 0 0 0 1px rgb(10 21 25 / .1); }
@media (prefers-reduced-motion: no-preference) {
  html.js .core.drill { clip-path: inset(-6px 100% -6px 0); transform: translateX(-36px); transition: clip-path 1000ms var(--carry) calc(var(--i, 0) * 110ms), transform 1000ms var(--arrive) calc(var(--i, 0) * 110ms); }
  html.js .core.drill.in { clip-path: inset(-6px -16px -6px 0); transform: none; }
}
.core::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--flag); transform: scaleX(0); transform-origin: 0 50%; transition: transform 260ms var(--answer); }
@media (hover: hover) and (pointer: fine) { .core:hover::before { transform: scaleX(1); } }
@media (max-width: 860px) { .core { width: 100%; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 40px 14px 18px; } .core dt { font-size: 25px; } .core dd { justify-self: stretch; } }


/* chapter: whole-lake */
.wl-head { position: absolute; top: 34%; left: 0; font-size: clamp(50px, 9vw, 150px); max-width: 13ch; opacity: var(--ha, 0); color: var(--snow); text-shadow: 0 2px 0 rgb(10 21 25 / .55); }
.wl-bill { position: absolute; top: 84px; right: clamp(20px, 5vw, 72px); text-align: right; font-size: 14px; opacity: var(--a, 0); }
.wl-table { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-collapse: collapse; }
.wl-table tbody { display: block; position: absolute; inset: 0; }
.wl-table tr { position: absolute; left: var(--gutter); right: clamp(20px, 5vw, 72px); display: grid; grid-template-columns: minmax(0, 1fr) 90px 70px 70px; align-items: center; font-size: 15px; font-weight: 500; cursor: pointer; opacity: var(--a, 0); color: var(--black-water); transition: background-color 120ms var(--answer); }
.wl-table tr.wet { color: var(--snow); }
.wl-table td { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-table td:nth-child(n+2) { text-align: right; }
.wl-table a { display: block; }
@media (hover: hover) and (pointer: fine) { .wl-table tr:hover { background: rgb(233 240 241 / .45); } .wl-table tr.wet:hover { background: rgb(233 240 241 / .16); } }
.wl-foot { position: absolute; right: clamp(20px, 5vw, 72px); bottom: 14px; display: flex; align-items: flex-end; gap: clamp(20px, 4vw, 60px); opacity: var(--fa, 0); background: var(--snow); padding: 12px 16px; box-shadow: inset 2px 2px 0 #fff, inset -3px -3px 0 rgb(10 21 25 / .32), 5px 6px 0 rgb(10 21 25 / .3); }
.wl-foot p { max-width: 28ch; font-size: 14px; }
.wl-foot dl { display: grid; grid-template-columns: repeat(4, auto); gap: 4px clamp(14px, 2.4vw, 34px); }
.wl-foot dt { font-size: 12px; color: var(--ink-2); }
.wl-foot dd { margin: 0; font-size: 16px; }
.wl-foot .bal dd { font: 500 clamp(40px, 5vw, 76px)/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 760px) {
  .wl-table tr { grid-template-columns: minmax(0, 1fr) 78px 54px; font-size: 11px; right: 12px; }
  .wl-table td:nth-child(3) { display: none; }
  .wl-head { font-size: 30px; top: 66px; }
  .wl-bill { display: none; }
  .wl-foot { left: var(--gutter); right: 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .wl-foot dl { grid-template-columns: repeat(2, auto); }
}
@media (prefers-reduced-motion: reduce) {
  .wl .pin-stage { height: auto; padding: 90px 20px 30px var(--gutter); }
  .wl-head, .wl-bill, .wl-foot, .wl-table { position: static; opacity: 1; }
  .wl-head { color: var(--ink); text-shadow: none; }
  .wl-table, .wl-table tbody { display: block; position: static; }
  .wl-table tr { position: static; opacity: 1; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .wl-table tr.wet { color: inherit; }
  .wl-foot { margin-top: 18px; flex-wrap: wrap; }
}
html:is(.no-gl, :not(.js)) .wl .pin-stage { position: relative; height: auto; padding: 90px 20px 30px var(--gutter); }
html:is(.no-gl, :not(.js)) .wl-head, html:is(.no-gl, :not(.js)) .wl-bill, html:is(.no-gl, :not(.js)) .wl-foot, html:is(.no-gl, :not(.js)) .wl-table { position: static; opacity: 1; }
html:is(.no-gl, :not(.js)) .wl-table, html:is(.no-gl, :not(.js)) .wl-table tbody { display: block; position: static; }
html:is(.no-gl, :not(.js)) .wl-head { color: var(--ink); text-shadow: none; }
html:is(.no-gl, :not(.js)) .wl-table tr { position: static; opacity: 1; padding: 6px 0; border-bottom: 1px solid var(--line); }
html:is(.no-gl, :not(.js)) .wl-table tr.wet { color: inherit; }
html:is(.no-gl, :not(.js)) section.wl[data-pin] { height: auto; }


/* chapter: open-water */
.ow { padding-block: clamp(90px, 16vh, 170px) clamp(60px, 10vh, 110px); position: relative; }
.ow-in { max-width: 860px; }
.ow h2 { font-size: clamp(58px, 10.5vw, 170px); margin-bottom: 26px; }
.ow-flag { position: absolute; left: calc(max(20px, 3.5vw) - 5px); top: 40px; width: 42px; height: 80px; transition: transform 320ms var(--answer); }
.ow-form label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.ow-slot { display: flex; }
.ow-slot input { flex: 1; min-width: 0; min-height: 56px; padding: 14px 16px; background: rgb(10 21 25 / .12); border: 0; border-radius: 0; font-size: 18px; caret-color: var(--flag); box-shadow: inset 3px 3px 0 rgb(10 21 25 / .4), inset -1px -1px 0 rgb(233 240 241 / .8); }
.ow-slot input:focus { outline: 2px solid var(--flag); outline-offset: 0; background: rgb(233 240 241 / .75); }
.ow-slot .slab { min-height: 56px; }
.ow-msg { min-height: 24px; margin-top: 8px; font-size: 15px; font-weight: 500; }
.ow-msg.bad { color: #8c1e10; }
.ow-in .small { margin-top: 10px; }
@media (max-width: 560px) { .ow-slot { flex-direction: column; gap: 10px; } .ow-slot .slab { justify-content: center; } }


/* chapter: far-bank */
.fb { min-height: 100svh; padding-block: clamp(70px, 14vh, 140px) 40px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.fb-flag { position: absolute; left: calc(max(20px, 3.5vw) - 4px); top: 30px; width: 42px; height: 80px; transition: transform 240ms var(--answer); }
.fb-close { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 18px 48px; padding: 90px 0 46px; border-bottom: 1px solid rgb(10 21 25 / .28); margin-bottom: 34px; }
.fb-mark { grid-column: 1 / -1; margin: 0 0 .2em; font: 500 clamp(64px, 13.5vw, 230px)/.86 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.035em; }
.fb-what { margin: 0; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.5; max-width: 52ch; }
.fb-acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
@media (max-width: 760px) { .fb-close { grid-template-columns: minmax(0, 1fr); padding-top: 70px; } .fb-acts { justify-content: stretch; } .fb-acts .slab { flex: 1 1 100%; justify-content: center; min-height: 54px; } }
.fb-line { font: 500 clamp(19px, 1.7vw, 26px)/1.25 var(--display); font-variation-settings: 'opsz' 30; letter-spacing: -.005em; max-width: 52ch; clip-path: inset(0 calc(100% - var(--r, 100%)) 0 0); }
.fb-c { margin-top: 26px; max-width: 74ch; }
.fb-end { margin-top: 22px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.fb-bank { color: var(--flag); }
@media (max-width: 760px) { .fb-line { font-size: 19px; } }
@media (prefers-reduced-motion: reduce) { .fb-line { clip-path: none; } }
```

## 6. Head script and shared chrome

Create `js/config.js` exactly as below. It runs in the head before first paint: it holds the key-request endpoint, adds the `js` class, and with motion allowed adds `wait-carve` (the heading stays hidden until the shader saws it in, at most 1.2 seconds; after that the heading shows as plain type and is carved in place once the lake is ready).

```js
// Runs in the head before first paint.
// Where the key request form posts. Leave empty and the form says plainly that nothing was sent.
window.TALLYLINE_CONFIG = { keyRequestEndpoint: "" };
document.documentElement.classList.add('js');
// With motion allowed, the heading waits a moment so the shader can saw it in. Never longer than 1.2 seconds: after that the heading shows as plain type and is carved in place when the lake is ready.
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
  document.documentElement.classList.add('wait-carve');
  setTimeout(() => document.documentElement.classList.remove('wait-carve'), 1200);
}
```

Create `js/chrome.js` exactly as below. It handles everything around the chapters: the bar's surface colour and the "sheet NN of 15" counter, the nav link of the part you are on (`aria-current`), the `j` and `k` keys (next and previous chapter), smooth anchor scrolling, the tab title when the tab is hidden ("Still frozen. Tallyline"), the "Back on the ice" note for returning visitors, a console note, `TL.arrive(elements, className, at)` (adds the class, then `in` once an element's top passes `at` of the screen height; used for the sawn-in headings and the ice cores; it checks boxes every frame because an IntersectionObserver treats a fully clipped element as never visible), and `TL.carveHeading()`, which turns the real `h1` into a signed distance field the shader saws into the ice (the `h1` stays in the page for screen readers and turns transparent once carved).

```js
/* Tallyline website: chrome. */
// Everything around the chapters: the bar, the sheet count, keys, the tab, the first furrow's carved heading.
(function () {
  const TL = window.TL, bar = document.querySelector('.bar'), sheetN = document.getElementById('sheet-n');
  let last = -1;
  // The nav link for the part of the lake you are standing on stays underlined.
  const NAV = { 'the-cut': 'the-cut', 'the-thaw': 'the-thaw', 'black-water': 'the-thaw', 'ice-cores': 'ice-cores', 'open-water': 'open-water' };
  const links = [...document.querySelectorAll('.bar nav a')];
  TL.on(() => {
    if (TL.current === last) return; last = TL.current;
    const c = TL.chapters[TL.current]; if (!c) return;
    document.body.dataset.surface = c.el.dataset.surface || 'ice';
    if (sheetN) sheetN.textContent = String(TL.current + 1).padStart(2, '0');
    const here = NAV[c.id];
    links.forEach(a => { if (here && a.getAttribute('href') === '#' + here) a.setAttribute('aria-current', 'true'); else a.removeAttribute('aria-current'); });
  });

  // Headings are sawn in the first time they come into view. Checked each frame from their boxes:
  // an IntersectionObserver would see a fully clipped heading as never visible.
  TL.arrive = (els, cls, at = .86) => {
    if (TL.reduced) return;
    let wait = [...els]; wait.forEach(el => el.classList.add(cls));
    TL.on(() => {
      if (!wait.length) return;
      wait = wait.filter(el => { const r = el.getBoundingClientRect(); if (r.height && r.top < TL.vh * at && r.bottom > 0) { el.classList.add('in'); return false; } return true; });
    });
  };
  TL.arrive([...document.querySelectorAll('main h2')].filter(h => !h.matches('.thaw-event, .wl-head, .bw-word')), 'saw');
  addEventListener('keydown', e => {
    if (e.altKey || e.ctrlKey || e.metaKey || /input|select|textarea/i.test(e.target.tagName)) return;
    const d = e.key === 'j' ? 1 : e.key === 'k' ? -1 : 0; if (!d) return;
    const c = TL.chapters[TL.clamp(TL.current + d, 0, TL.chapters.length - 1)];
    if (c) scrollTo({ top: c.top, behavior: TL.reduced ? 'auto' : 'smooth' });
  });
  document.addEventListener('click', e => {
    const a = e.target.closest('a[href^="#"]'); if (!a) return;
    const c = TL.byId[a.getAttribute('href').slice(1)]; if (!c) return;
    e.preventDefault(); scrollTo({ top: c.top + 1, behavior: TL.reduced ? 'auto' : 'smooth' });
  });
  const title = document.title;
  document.addEventListener('visibilitychange', () => { document.title = document.hidden ? 'Still frozen. Tallyline' : title; });
  const seen = TL.store.get('seen', false); TL.store.set('seen', true);
  if (seen) { const n = document.querySelector('.mark-note'); if (n) n.textContent = 'Back on the ice'; }
  console.log('%cTallyline', 'font:600 20px serif', '\nYou read the console, so here is the example request:\n\ncurl -X POST https://api.example.invalid/v1/invoices \\\n  -H "Authorization: Bearer $TALLYLINE_KEY" \\\n  -H "Idempotency-Key: 0001" \\\n  -d @invoice.json\n\nField names are examples. The published reference is the final word.');

  // The first furrow: the real h1 stays in the DOM, a distance field of it is sawn into the ice by the shader.
  function textSDF(draw, w, h, spread) {
    const c = document.createElement('canvas'); c.width = w; c.height = h; const x = c.getContext('2d', { willReadFrequently: true });
    x.fillStyle = '#000'; x.fillRect(0, 0, w, h); x.fillStyle = '#fff'; draw(x);
    const img = x.getImageData(0, 0, w, h), d = img.data, n = w * h, INF = 1e20, m = Math.max(w, h);
    const solve = inside => { const g = new Float64Array(n); for (let i = 0; i < n; i++) { const a = d[i * 4] / 255, b = inside ? a : 1 - a; g[i] = b >= 1 ? INF : b <= 0 ? 0 : Math.max(0, b - .5) ** 2; }
      const v = new Int32Array(m), z = new Float64Array(m + 1), f = new Float64Array(m);
      const pass = (len, off, step) => { for (let q = 0; q < len; q++) f[q] = g[off + q * step];
        let k = 0; v[0] = 0; z[0] = -INF; z[1] = INF;
        for (let q = 1; q < len; q++) { let s; do { s = (f[q] + q * q - f[v[k]] - v[k] * v[k]) / (2 * q - 2 * v[k]); } while (s <= z[k] && --k >= 0); k++; v[k] = q; z[k] = s; z[k + 1] = INF; }
        k = 0; for (let q = 0; q < len; q++) { while (z[k + 1] < q) k++; g[off + q * step] = (q - v[k]) * (q - v[k]) + f[v[k]]; } };
      for (let j = 0; j < h; j++) pass(w, j * w, 1); for (let i = 0; i < w; i++) pass(h, i, w); return g; };
    const a = solve(true), b = solve(false);
    for (let i = 0; i < n; i++) { const s = .5 + (Math.sqrt(a[i]) - Math.sqrt(b[i])) / (2 * spread), v = Math.max(0, Math.min(1, s)) * 255; d[i * 4] = d[i * 4 + 1] = d[i * 4 + 2] = v; d[i * 4 + 3] = 255; }
    x.putImageData(img, 0, 0); return c;
  }
  let carvedOnce = false;
  TL.carveHeading = function () {
    const h1 = document.querySelector('h1'); if (!h1 || TL.noGL || !TL.lakeLinked) return;   // stage.js calls this again once its shader is linked
    const words = [...h1.querySelectorAll('.w')], r = h1.getBoundingClientRect(), y0 = r.top + scrollY, pad = 24;
    const css = getComputedStyle(h1), scale = Math.min(2, 1800 / (r.width + pad * 2));
    const W = Math.ceil((r.width + pad * 2) * scale), H = Math.ceil((r.height + pad * 2) * scale);
    const c = textSDF(x => {
      x.font = `${css.fontWeight} ${parseFloat(css.fontSize) * scale}px ${css.fontFamily}`; x.fontVariationSettings = css.fontVariationSettings; x.textBaseline = 'alphabetic';
      if ('letterSpacing' in x) x.letterSpacing = parseFloat(css.letterSpacing) * scale + 'px';
      const m = x.measureText('Hg');
      for (const w of words) { const b = w.getBoundingClientRect(); x.fillText(w.textContent, (b.left - r.left + pad) * scale, (b.top - r.top + pad) * scale + m.fontBoundingBoxAscent); }
    }, W, H, 22 * Math.min(scale, 1.4));
    TL.uploadHead(c);
    TL.setHead(r.left - pad, y0 - pad, r.width + pad * 2, r.height + pad * 2, 1);
    if (!carvedOnce) { carvedOnce = true; if (TL.revealHead && document.documentElement.classList.contains('wait-carve')) TL.revealHead(); }   // if the 1.2 s wait already ran out, the heading is on screen: carve it in place, no saw
    document.documentElement.classList.add('carved');
    document.documentElement.classList.remove('wait-carve');
  };
})();
```

## 7. Chapter scripts

Create these fourteen files in `js/chapters/`, each exactly as written. Each is one `(function () { ... })();` block that reads the clock and the hooks above. "Reduced" means `TL.reduced`.

### first-furrow.js (the hero)

Carves the heading once the fonts are ready (and again after a resize, without the saw-in). Left alone for four seconds on the first two chapters, a small crack creeps out from under the pointer. The slip in the top right corner (wide desktops and tall tablets, and only where it does not touch the heading) plays one invoice through the API: the request, then each line (201 created, sent, viewed, overdue with a reminder, paid) is struck through with a saw line about once a second, the total turns red when paid, it holds, and starts again. The total shows the visitor's own lines from "The cut".

```js
/* Tallyline website: first-furrow. */
(function () {
const TL = window.TL;
let t;
const carve = () => { clearTimeout(t); t = setTimeout(() => TL.carveHeading && TL.carveHeading(), 60); };
if (document.fonts && document.fonts.ready) document.fonts.ready.then(carve); else addEventListener('load', carve);
addEventListener('resize', carve);

// Left alone on the ice for four seconds, a small crack creeps out from under the pointer.
let idle, pos = null;
addEventListener('pointermove', e => {
  pos = { x: e.clientX, y: e.clientY }; clearTimeout(idle);
  if (TL.reduced || TL.coarse) return;
  idle = setTimeout(() => {
    if (!pos || !TL.scratch || TL.current > 1) return;
    let { x, y } = pos, step = 0;
    const creep = () => { const nx = x + 22 + Math.random() * 18, ny = y + (Math.random() - .5) * 26; TL.scratch(x, y, nx, ny); x = nx; y = ny; if (++step < 7) setTimeout(creep, 90); };
    creep();
  }, 4000);
}, { passive: true });

// The slip in the corner plays one invoice through the API: request, created, sent, viewed, overdue, paid. Then it starts again.
const slip = document.getElementById('slip'), steps = slip ? [...slip.querySelectorAll('.slip-log li')] : [], totalEl = slip && slip.querySelector('.slip-total');
function slipFits() {           // never sit on top of the heading: hide the slip if any word of the h1 would touch it
  if (!slip) return;
  document.documentElement.classList.remove('slip-off');
  if (getComputedStyle(slip).display === 'none') return;
  const r = slip.getBoundingClientRect();
  const hit = [...document.querySelectorAll('h1 .w')].some(w => { const b = w.getBoundingClientRect(); return b.right > r.left - 24 && b.left < r.right && b.bottom > r.top - 12 && b.top < r.bottom + 12; });
  document.documentElement.classList.toggle('slip-off', hit);
}
TL.onMeasure(slipFits);
let step = -1, hold = 0, lastTotal = '';
function slipTick() {
  if (TL.reduced) { steps.forEach(li => li.classList.add('on')); slip.classList.add('is-paid'); return; }
  if (document.hidden || TL.current > 0) { setTimeout(slipTick, 600); return; }
  step = step >= steps.length + 1 ? -1 : step + 1;
  steps.forEach((li, i) => li.classList.toggle('on', i <= step));
  slip.classList.toggle('is-paid', step >= steps.length - 1);
  setTimeout(slipTick, step === -1 ? 700 : step >= steps.length - 1 ? 2600 : 950);
}
if (slip) {
  TL.on(() => {                 // the slip shows the visitor's own total once they have sawn their own lines
    const inv = TL.invoice; if (!inv || !totalEl) return;
    const t = inv.total.toFixed(2) + inv.currency; if (t === lastTotal) return; lastTotal = t;
    totalEl.firstElementChild.textContent = 'Total, ' + inv.currency; totalEl.lastElementChild.textContent = inv.total.toFixed(2);
  });
  setTimeout(slipTick, TL.reduced ? 0 : 1900);
}

})();
```

### frozen-word.js

Pinned for 1.6 extra screens. The sentence "Accountants already call paid money liquid. Everything still owed to you is ice." lights word by word as you scroll (each word goes from 17% to full opacity), and a black saw line runs under the last word.

```js
/* Tallyline website: frozen-word. */
(function () {
const TL = window.TL, el = document.getElementById('fw-text');
const text = 'Accountants already call paid money liquid. Everything still owed to you is ice.'.split(' ');
text.forEach((t, i) => { const s = document.createElement('span'); s.className = 'w' + (i === text.length - 1 ? ' last' : ''); s.textContent = t; el.append(s, ' '); });
const words = [...el.querySelectorAll('.w')];
TL.on(() => {
  if (!TL.near('frozen-word') || TL.reduced) return;
  const p = TL.p('frozen-word');
  words.forEach((w, i) => w.classList.toggle('on', p >= .04 + (i / words.length) * .78));
});

})();
```

### the-borehole.js

A late-payment calculator: amount owed, days late and a yearly rate (8 by default) give interest = amount x rate x days / 365, with plain messages and per-field errors. The bored hole beside it grows with the amount (scale .62 when empty, up to 1), and its bottom fills with dark water once there is an amount. Dragging sideways on the hole sets the amount on a logarithmic scale (desktop only).

```js
/* Tallyline website: the-borehole. */
(function () {
const hole = document.getElementById('hole'), out = document.getElementById('b-out'), note = document.getElementById('b-note');
const owed = document.getElementById('b-owed'), days = document.getElementById('b-days'), rate = document.getElementById('b-rate');
const fields = [[owed, 'b-owed-e'], [days, 'b-days-e'], [rate, 'b-rate-e']];
const read = el => { const v = el.value.trim().replace(/,/g, ''); if (v === '') return null; const n = Number(v); return Number.isFinite(n) && n >= 0 ? n : NaN; };
function update() {
  const [a, d, r] = fields.map(([el, e]) => { const v = read(el); document.getElementById(e).textContent = Number.isNaN(v) ? 'Numbers only, and none below zero.' : ''; return v; });
  const dry = !a || Number.isNaN(a);
  hole.dataset.dry = dry ? '1' : '0';
  const s = dry ? .62 : Math.min(1, .66 + Math.log10(a + 1) * .06);
  hole.style.setProperty('--s', s);
  const ok = [a, d, r].every(v => v !== null && !Number.isNaN(v));
  out.textContent = ok ? (Math.round(a * (r / 100) * (d / 365) * 100) / 100).toFixed(2) : '0.00';
  note.textContent = dry ? 'Nothing typed yet, so the hole is dry.' : a >= 1000000 ? 'That is a very expensive hole.' : ok ? 'Interest only. Your client owes the amount as well.' : 'Add the days late to see what it has cost.';
}
fields.forEach(([el]) => el.addEventListener('input', update));
document.getElementById('bore-form').addEventListener('submit', e => e.preventDefault());
// Drag the rim outward to set the amount directly.
let drag = false;
hole.addEventListener('pointerdown', e => { if (window.TL.coarse) return; drag = true; hole.setPointerCapture(e.pointerId); });
hole.addEventListener('pointermove', e => {
  if (!drag) return; const r = hole.getBoundingClientRect(), c = r.left + r.width / 2;
  const t = Math.min(1, Math.abs(e.clientX - c) / (r.width / 2)); owed.value = Math.round(Math.pow(10, t * 6) - 1); update();
});
hole.addEventListener('pointerup', () => { drag = false; });
hole.addEventListener('pointercancel', () => { drag = false; });
update();

})();
```

### wyeths-grid.js

Pinned for 2 extra screens. The underwater ice picture is cut into an 8 x 5 grid (4 x 5 on phones), with the crew's first block already missing. As you scroll, the columns are sawn left to right: each block brightens and parts from its neighbours by a few pixels.

```js
/* Tallyline website: wyeths-grid. */
(function () {
const TL = window.TL, host = document.getElementById('wy-cells');
let cells = [], COLS = 8, ROWS = 5;
function build() {
  COLS = TL.vw < 760 ? 4 : 8; host.innerHTML = ''; cells = [];
  const w = host.clientWidth, h = host.clientHeight; if (!w || !h) return;
  const cw = w / COLS, ch = h / ROWS;
  const IMG = 800 / 1062, bw = Math.max(w, h * IMG), bh = bw / IMG, ox = (bw - w) / 2, oy = bh - h;   // cover the frame, keeping the blocks and losing the surface at the top
  for (let r = 0; r < ROWS; r++) for (let c = 0; c < COLS; c++) {
    if (r === 0 && c === Math.floor(COLS / 3)) continue;                 // the crew's first block is already out
    const d = document.createElement('div'); d.className = 'wy-cell';
    d.style.cssText = `left:${c * cw}px;top:${r * ch}px;width:${cw + 1}px;height:${ch + 1}px;background-size:${bw}px ${bh}px;background-position:${-c * cw - ox}px ${-r * ch - oy}px`;
    d.dataset.c = c; d.dataset.r = r; host.append(d); cells.push(d);
  }
}
TL.onMeasure(build);
TL.on(() => {
  if (!TL.near('wyeths-grid') || !cells.length) return;
  const p = TL.reduced ? 1 : TL.p('wyeths-grid');
  for (const d of cells) {
    const c = +d.dataset.c, r = +d.dataset.r;
    const e = TL.smooth(TL.local(p, .05 + (c / COLS) * .55, .22 + (c / COLS) * .55));        // sawn in order, left to right
    const dir = (c - (COLS - 1) / 2) * 5.5, dirY = (r - 2) * 5.5;      // sawn blocks really part from each other
    d.style.transform = `translate(${dir * e}px, ${dirY * e}px)`;
    d.style.filter = e > .5 ? 'none' : `brightness(${.82 + e * .36})`;
  }
});

})();
```

### the-cut.js

The editable invoice: up to 12 lines of description, hours and rate, a currency select, the live total, the request and response JSON, and a small "block" that shows the lines; a newly added line is sawn in with a red line. Lines and currency are saved in localStorage. It publishes `TL.invoice` (used by the hero slip, the channel and the thaw) and calls `TL.invoiceChanged()`. Below 860px the request and response start closed.

```js
/* Tallyline website: the-cut. */
(function () {
const TL = window.TL, MAX = 12;
const DEFAULT = [['Logo, third round', 6, 90], ['Icon set', 4, 90], ['Files for print', 1.5, 90]];
const tbody = document.getElementById('lines'), reqEl = document.getElementById('request'), resEl = document.getElementById('response');
const blockEl = document.getElementById('block'), totalEl = document.getElementById('total'), addBtn = document.getElementById('add-line'), cur = document.getElementById('currency');
let rows = TL.store.get('lines', DEFAULT.map(r => r.slice()));
if (!Array.isArray(rows) || !rows.length) rows = DEFAULT.map(r => r.slice());
cur.value = TL.store.get('currency', 'USD');

const money = n => (Math.round((n + Number.EPSILON) * 100) / 100).toFixed(2);
const amount = r => Math.round((Number(r[1]) || 0) * (Number(r[2]) || 0) * 100) / 100;
function row(r, i) {
  const tr = document.createElement('tr');
  tr.innerHTML = `<td><input aria-label="Line ${i + 1} description" value=""></td><td><input aria-label="Line ${i + 1} hours" inputmode="decimal" value=""></td><td><input aria-label="Line ${i + 1} rate" inputmode="decimal" value=""></td><td class="amt"></td><td><button class="x" type="button" aria-label="Remove line ${i + 1}">&times;</button></td>`;
  const [d, h, p] = tr.querySelectorAll('input'); d.value = r[0]; h.value = r[1]; p.value = r[2];
  d.addEventListener('input', () => { r[0] = d.value; sync(); });
  h.addEventListener('input', () => { r[1] = h.value; sync(); });
  p.addEventListener('input', () => { r[2] = p.value; sync(); });
  tr.querySelector('.x').addEventListener('click', () => { if (rows.length > 1) { rows.splice(rows.indexOf(r), 1); paint(); } });
  return tr;
}
function paint(fresh) {
  tbody.innerHTML = ''; rows.forEach((r, i) => tbody.append(row(r, i)));
  sync(fresh);
  addBtn.disabled = rows.length >= MAX; addBtn.textContent = rows.length >= MAX ? 'That block is full' : 'Saw another line';
  tbody.querySelectorAll('.x').forEach(x => { x.disabled = rows.length === 1; });
}
function sync(fresh) {
  const lines = rows.map(r => ({ description: r[0].trim() || 'Unnamed line', hours: Number(r[1]) || 0, rate: Number(r[2]) || 0 }));
  const total = rows.reduce((s, r) => s + amount(r), 0);
  [...tbody.children].forEach((tr, i) => { tr.querySelector('.amt').textContent = money(amount(rows[i])); });
  totalEl.textContent = money(total);
  reqEl.textContent = 'POST /v1/invoices\nIdempotency-Key: 0001\n\n' + JSON.stringify({ client: 'client_example', currency: cur.value, due_in_days: 30, lines }, null, 2);
  resEl.textContent = JSON.stringify({ id: 'inv_0001', number: 'INV-0001', status: 'draft', currency: cur.value, total: Number(money(total)) }, null, 2);
  blockEl.innerHTML = '';
  rows.forEach((r, i) => { const d = document.createElement('div'); if (fresh === i) d.className = 'fresh'; const a = document.createElement('span'); a.textContent = r[0].trim() || 'Unnamed line'; const b = document.createElement('span'); b.textContent = money(amount(r)); d.append(a, b); blockEl.append(d); });
  const end = document.createElement('div'); const a = document.createElement('span'); a.textContent = 'Total, ' + cur.value; const b = document.createElement('span'); b.textContent = money(total); end.append(a, b); blockEl.append(end);
  TL.invoice = { lines: rows.map(r => ({ d: r[0].trim() || 'Unnamed line', h: Number(r[1]) || 0, r: Number(r[2]) || 0, a: amount(r) })), total, currency: cur.value };
  TL.store.set('lines', rows); TL.store.set('currency', cur.value);
  if (TL.invoiceChanged) TL.invoiceChanged();
}
addBtn.addEventListener('click', () => { if (rows.length < MAX) { rows.push(['', '', '']); paint(rows.length - 1); tbody.lastElementChild.querySelector('input').focus({ preventScroll: true }); } });
cur.addEventListener('change', () => sync());
if (matchMedia('(max-width: 860px)').matches) document.querySelectorAll('.req')[0].removeAttribute('open'), document.querySelectorAll('.req')[1].removeAttribute('open');
paint();

})();
```

### the-channel.js

Pinned for 1.7 extra screens on desktop. A band of open water is cut across the screen and the visitor's block floats along it from 9% to 87% of the width as you scroll, rocking with scroll speed and leaving a wake. Five flags on the bank (draft, sent, viewed, overdue, paid) light as the block passes; only the nearest shows its sentence and event name, and the block's title shows its current state. On phones, with reduced motion or without WebGL, the chapter is a plain list with all flags lit.

```js
/* Tallyline website: the-channel. */
(function () {
const TL = window.TL, band = document.getElementById('ch-band'), block = document.getElementById('ch-block'), items = [...document.getElementById('ch-marks').children];
const STATES = ['draft', 'sent', 'viewed', 'overdue', 'overdue'];
let lastP = 0, rock = 0, shown = -1;
function fill(idx) {                                       // the block on the water is the block the visitor sawed, showing its current state
  const inv = TL.invoice; if (!inv) return;
  block.textContent = '';
  const h = document.createElement('b'); h.textContent = STATES[idx]; block.append(h);
  inv.lines.slice(0, 3).forEach(l => { const d = document.createElement('div'); const a = document.createElement('span'); a.textContent = l.d; const b = document.createElement('span'); b.textContent = l.a.toFixed(2); d.append(a, b); block.append(d); });
  const d = document.createElement('div'); const a = document.createElement('span'); a.textContent = 'Total, ' + inv.currency; const b = document.createElement('span'); b.textContent = inv.total.toFixed(2); d.append(a, b); block.append(d);
}
TL.on(() => {
  const c = TL.byId['the-channel'];
  if (!c || !c.pin || !TL.near('the-channel', .1)) { TL.setChan(0, 0, 0, 0); if (c && !c.pin) items.forEach(i => i.classList.add('on')); return; }
  const p = TL.p('the-channel'), r = band.getBoundingClientRect();
  const left = TL.vw * .09, right = TL.vw * .87, x = left + (right - left) * p;      // the block really crosses the whole screen, and scroll is the current carrying it
  const idx = Math.min(4, Math.floor(p * 5));
  items.forEach((it, i) => { it.classList.toggle('on', i <= idx); it.classList.toggle('now', i === idx); });
  if (idx !== shown) { shown = idx; fill(idx); }
  const v = (p - lastP) / Math.max(TL.dt, .001); lastP = p;
  rock += (TL.clamp(v * 2, -1, 1) - rock) * Math.min(1, TL.dt * 6);
  block.style.transform = `translate3d(${x}px, 0, 0) rotate(${rock}deg)`;
  TL.setChan(r.top, r.bottom, x - block.offsetWidth * .5, 1);
});

})();
```

### the-ice-house.js

Draws the sawdust ground (drifts and thousands of short strokes) on a canvas, gives every block of the wall its own piece of one ice picture so the wall reads as one sawn sheet, and drops the blocks into place one after another (14px, 40ms apart) when the chapter comes into view. The invoice number counts up each time you come back to the chapter.

```js
/* Tallyline website: the-ice-house. */
(function () {
const TL = window.TL, cv = document.getElementById('ih-dust'), sec = document.getElementById('the-ice-house'), wallEl = document.getElementById('ih-wall'), wall = [...document.querySelectorAll('#ih-wall li')], num = document.getElementById('ih-n');
function dust() {
  const r = sec.getBoundingClientRect(), W = Math.ceil(r.width), H = Math.ceil(r.height); if (!W || !H) return;
  cv.width = W; cv.height = H; const x = cv.getContext('2d'); x.fillStyle = '#b98539'; x.fillRect(0, 0, W, H);
  for (let i = 0; i < 40; i++) {                                       // heaped drifts, so the ground is not an even speckle
    const px = (i * 311.7) % W, py = (i * 197.3) % H, rad = 180 + (i * 73) % 340, g = x.createRadialGradient(px, py, 0, px, py, rad);
    g.addColorStop(0, i % 2 ? 'rgba(226,182,108,.5)' : 'rgba(120,80,30,.32)'); g.addColorStop(1, 'rgba(0,0,0,0)'); x.fillStyle = g; x.fillRect(px - rad, py - rad, rad * 2, rad * 2);
  }
  const brown = ['#a97a35', '#dcb26a', '#8a5f28', '#e6c283', '#6b4a22'], n = Math.min(16000, W * H / 34);
  x.lineCap = 'round';
  for (let i = 0; i < n; i++) { x.strokeStyle = brown[i % 5]; x.globalAlpha = .2 + (i % 5) * .13; x.lineWidth = .7 + (i % 4) * .45; const a = (i * 2.399) % 6.283, l = 7 + (i % 11), px = (i * 137.13) % W, py = (i * 91.77 + i * i * .0007) % H; x.beginPath(); x.moveTo(px, py); x.lineTo(px + Math.cos(a) * l, py + Math.sin(a) * l); x.stroke(); }
  x.globalAlpha = 1;
  const wr = wallEl.getBoundingClientRect(), iw = wr.width, ih = Math.max(wr.height, iw * .75);   // every block shows its own piece of one image, so the wall reads as one sawn sheet
  wall.forEach(li => { const b = li.getBoundingClientRect(); li.style.backgroundSize = `auto, ${iw}px ${ih}px`; li.style.backgroundPosition = `0 0, ${wr.left - b.left}px ${wr.top - b.top}px`; });
}
TL.onMeasure(dust);
wall.forEach(li => { if (!TL.reduced) li.style.setProperty('--drop', '-14px'); });
let seen = false, count = 0;
if (num) num.textContent = 'INV-0001';
new IntersectionObserver(es => es.forEach(e => {
  if (e.isIntersecting && !seen) { seen = true; count++; if (num) num.textContent = 'INV-' + String(count).padStart(4, '0'); wall.forEach((li, i) => setTimeout(() => li.style.setProperty('--drop', '0px'), i * 40)); }
  if (!e.isIntersecting && e.boundingClientRect.top > 0) { seen = false; if (!TL.reduced) wall.forEach(li => li.style.setProperty('--drop', '-14px')); }
}), { threshold: .12 }).observe(sec);

})();
```

### the-tallyman.js

Draws the split tally stick as SVG (vertical on desktop, horizontal below 760px) with notches whose widths follow the medieval Exchequer's rules; hovering a notch says what it stood for. As you scroll, the two halves part. "Send it again" counts sends, adds a red tick on the stick, nudges both halves and adds a line to the answer log ("200 OK, inv_0001 again"): the same key always returns the same invoice. The log keeps the first answer and the last three.

```js
/* Tallyline website: the-tallyman. */
(function () {
const TL = window.TL, host = document.getElementById('ty-stick'), btn = document.getElementById('ty-send'), out = document.getElementById('ty-out');
// Notch widths follow the Dialogue of the Exchequer: a palm for 1,000 pounds, a thumb for 100, a little finger for 20, a swollen barleycorn for 1.
const NOTCHES = [{ w: 44, label: '£1,000: the width of a palm' }, { w: 22, label: '£100: the width of a thumb' }, { w: 22, label: '£100: the width of a thumb' }, { w: 12, label: '£20: the width of a little finger' }, { w: 12, label: '£20: the width of a little finger' }, { w: 5, label: '£1: a swollen barleycorn' }, { w: 5, label: '£1: a swollen barleycorn' }];
let vertical = true, stock, foil;
function draw() {
  vertical = TL.vw >= 760;
  const r = host.getBoundingClientRect(), L = vertical ? r.height : r.width, T = vertical ? r.width : r.height; if (!L) return;
  const cross = Math.min(T, vertical ? 110 : 96), mid = cross / 2;
  const pts = (side) => {     // side -1 is the stock, +1 the foil; notches bite the outer edge of each half
    const edge = side < 0 ? 0 : cross;
    let d = `M ${mid} 0 L ${edge} 0`, y = L * .12;
    for (const n of NOTCHES) { const depth = 6 + n.w * .32; d += ` L ${edge} ${y} L ${edge - side * depth} ${y + n.w / 2} L ${edge} ${y + n.w}`; y += n.w + L * .045; }
    return d + ` L ${edge} ${L} L ${mid} ${L} Z`;
  };
  const svgTransform = vertical ? '' : `matrix(0 1 1 0 0 0)`;
  host.innerHTML = `<svg viewBox="0 0 ${vertical ? cross : L} ${vertical ? L : cross}"><g transform="${svgTransform}">
    <g class="half" id="ty-stock"><path d="${pts(-1)}" fill="#b98a4b" stroke="#3a2710"/><path d="M${mid} 0 V${L}" stroke="#ecd3a5" stroke-width="3"/></g>
    <g class="half" id="ty-foil"><path d="${pts(1)}" fill="#a97a3b" stroke="#3a2710"/><path d="M${mid} 0 V${L}" stroke="#ecd3a5" stroke-width="3"/></g>
  </g></svg><span class="ty-tip" id="ty-tip"></span>`;
  stock = host.querySelector('#ty-stock'); foil = host.querySelector('#ty-foil');
  const lab = (t, x, y) => { const e = document.createElementNS('http://www.w3.org/2000/svg', 'text'); e.setAttribute('x', x); e.setAttribute('y', y); e.setAttribute('font-size', 13); e.setAttribute('fill', '#0a1519'); e.textContent = t; host.querySelector('svg').append(e); };
  if (vertical) { lab('stock', 0, L + 18); lab('foil', cross * .62, L + 18); }
  // Hovering a notch says what it stood for.
  const tip = host.querySelector('#ty-tip'); let y = L * .12;
  NOTCHES.forEach(n => {
    const h = document.createElement('div'); h.style.cssText = vertical ? `position:absolute;left:0;width:${cross}px;top:${y}px;height:${n.w + 6}px` : `position:absolute;top:0;height:${cross}px;left:${y}px;width:${n.w + 6}px`;
    h.addEventListener('pointerenter', () => { tip.textContent = n.label; tip.style.top = (vertical ? y : cross + 4) + 'px'; tip.style.left = vertical ? '' : y + 'px'; tip.classList.add('on'); });
    h.addEventListener('pointerleave', () => tip.classList.remove('on'));
    host.append(h); y += n.w + L * .045;
  });
}
TL.onMeasure(draw);
TL.on(() => {
  if (!stock || !TL.near('the-tallyman')) return;
  const p = TL.reduced ? 1 : TL.p('the-tallyman');
  const gap = (vertical ? 16 : 10) * TL.smooth(TL.local(p, .3, .62)) + (vertical ? 2 : 2);
  stock.setAttribute('transform', vertical ? `translate(${-gap})` : `translate(0 ${-gap})`);
  foil.setAttribute('transform', vertical ? `translate(${gap})` : `translate(0 ${gap})`);
});
let sends = 1;
const log = document.getElementById('ty-log');
btn.addEventListener('click', () => {
  sends++;
  if (log) {                    // the same key comes back as the same invoice, every time
    const li = document.createElement('li'); li.className = 'new same';
    const c = document.createElement('code'); c.textContent = 'POST /v1/invoices';
    const k = document.createElement('span'); k.textContent = 'Idempotency-Key: 0001';
    const b = document.createElement('b'); b.textContent = `200 OK, inv_0001 again (send ${sends})`;
    li.append(c, k, b); log.append(li);
    while (log.children.length > 4) log.children[1].remove();
  }
  btn.textContent = `Sent ${sends} times. Send it again`;
  out.textContent = sends >= 20 ? `Sent ${sends} times. You can stop now, it is still one.` : `Sent ${sends} times. One invoice.`;
  if (!TL.reduced) { const t = document.createElement('i'); t.className = 'tick'; t.style.top = (sends * 9 % host.clientHeight) + 'px'; host.append(t); if (stock && foil) { stock.animate([{ transform: 'translate(-3px)' }, { transform: 'translate(0)' }], { duration: 160, composite: 'add' }); foil.animate([{ transform: 'translate(3px)' }, { transform: 'translate(0)' }], { duration: 160, composite: 'add' }); } }
});

})();
```

### the-voyage.js

The ribbon of frozen lake shrinks from 180 tons to its surviving share (100/180) as you scroll from 30% to 62% of the chapter (vertical on phones). A large readout rides the cut and counts down from "180 tons" to "100 tons", and drips fall from the melted part while it shrinks.

```js
/* Tallyline website: the-voyage. */
(function () {
const TL = window.TL, bar = document.getElementById('vy-bar'), ribbon = document.getElementById('vy-ribbon'), tons = document.getElementById('vy-tons');
const LEFT = 100 / 180;     // the bar ends at exactly its surviving share
TL.on(() => {
  if (!TL.near('the-voyage')) return;
  const p = TL.reduced ? 1 : TL.smooth(TL.local(TL.p('the-voyage'), .3, .62));
  const s = 1 + (LEFT - 1) * p;
  bar.style.transform = TL.vw < 760 ? `scaleY(${s})` : `scaleX(${s})`;
  ribbon.style.setProperty('--s', s.toFixed(4));
  ribbon.style.setProperty('--drip', p > .04 && !TL.reduced ? 'running' : 'paused');
  const t = Math.round(180 - 80 * p) + ' tons'; if (tons.textContent !== t) tons.textContent = t;
});

})();
```

### the-thaw.js

Pinned for 4.5 extra screens. Paints the visitor's invoice (name, lines, total, over the ice-shards picture) into a canvas the shader freezes into a block. The block grows out of the voyage ribbon into the middle of the screen. "Fire the webhook" or scrolling on melts the ice into floes that drift apart into black water; `invoice.paid` rises in large type, the payload appears if you fired it, then "That is the whole product." With reduced motion or without WebGL a plain block stands in.

```js
/* Tallyline website: the-thaw. */
(function () {
const TL = window.TL, sec = document.getElementById('the-thaw');
const cap = document.getElementById('thaw-cap'), ev = document.getElementById('thaw-event'), fire = document.getElementById('thaw-fire');
const load = document.getElementById('thaw-load'), end = document.getElementById('thaw-end'), sr = document.getElementById('thaw-sr'), still = document.getElementById('still-block');

// The visitor's own invoice, drawn into the ice. Red channel is ink, green is the crystal picture frozen behind it.
const cv = document.createElement('canvas'), x = cv.getContext('2d', { willReadFrequently: true });
const pic = new Image(); pic.src = 'img/ice-shards.jpg'; pic.onload = () => paint();
let aspect = 0;
function paint() {
  const inv = TL.invoice; if (!inv) return;
  const phone = TL.vw < 760, W = phone ? 900 : 1400, H = Math.round(W * (aspect || .62)); cv.width = W; cv.height = H;
  x.globalCompositeOperation = 'source-over'; x.fillStyle = '#000'; x.fillRect(0, 0, W, H);
  if (pic.complete && pic.naturalWidth) {
    x.drawImage(pic, 0, 0, W, H);
    const d = x.getImageData(0, 0, W, H), a = d.data;
    for (let i = 0; i < a.length; i += 4) { const l = a[i] * .3 + a[i + 1] * .59 + a[i + 2] * .11; a[i] = 0; a[i + 1] = l; a[i + 2] = 0; a[i + 3] = 255; }
    x.putImageData(d, 0, 0);
  }
  x.globalCompositeOperation = 'lighter'; x.fillStyle = '#f00'; x.strokeStyle = '#f00'; x.textBaseline = 'alphabetic';
  const m = W * .07, right = W - m, big = phone ? 70 : 104, body = phone ? 42 : 36, sm = phone ? 30 : 25;
  x.font = `500 ${big}px "Bodoni Moda", Georgia, serif`; x.textAlign = 'left'; x.fillText('Tallyline', m, m + big * .72);
  x.font = `500 ${sm}px "IBM Plex Mono", monospace`; x.textAlign = 'right'; x.fillText('INV 0001', right, m + big * .4); x.fillText('Bill to: your client', right, m + big * .4 + sm * 1.6);
  const list = inv.lines.slice(0, phone ? 3 : 7); let y = m + big + (phone ? 90 : 70), gap = phone ? 110 : (H - y - m - 150) / Math.max(4, list.length);
  x.lineWidth = 3; x.beginPath(); x.moveTo(m, y - gap * .55); x.lineTo(right, y - gap * .55); x.stroke();
  for (const l of list) {
    x.font = `400 ${body}px "IBM Plex Mono", monospace`; x.textAlign = 'left';
    let t = l.d; while (x.measureText(t).width > W * (phone ? .55 : .62) && t.length > 3) t = t.slice(0, -1); x.fillText(t === l.d ? t : t + '…', m, y);
    x.textAlign = 'right'; x.fillText(l.a.toFixed(2), right, y);
    x.lineWidth = 2; x.beginPath(); x.moveTo(m, y + gap * .38); x.lineTo(right, y + gap * .38); x.stroke();
    y += gap;
  }
  x.font = `500 ${sm + 4}px "IBM Plex Mono", monospace`; x.textAlign = 'left'; x.fillText('Total, ' + inv.currency, m, H - m * .95);
  x.font = `500 ${phone ? 96 : 118}px "Bodoni Moda", Georgia, serif`; x.textAlign = 'right'; x.fillText(inv.total.toFixed(2), right, H - m * .9);
  if (TL.uploadInvoice) TL.uploadInvoice(cv);
  still.innerHTML = '';
  inv.lines.forEach(l => { const d = document.createElement('div'); const a = document.createElement('span'); a.textContent = l.d; const b = document.createElement('span'); b.textContent = l.a.toFixed(2); d.append(a, b); still.append(d); });
  const d = document.createElement('div'); d.textContent = 'Total, ' + inv.currency + ' ' + inv.total.toFixed(2); still.append(d);
  sr.textContent = 'A block of ice holding your invoice: ' + inv.lines.map(l => `${l.d}, ${l.a.toFixed(2)}`).join('; ') + `. Total ${inv.total.toFixed(2)} ${inv.currency}.`;
}
TL.invoiceChanged = () => paint();
if (document.fonts && document.fonts.ready) document.fonts.ready.then(paint);

let fired = false, spring = 0, firedAt = 0, entry = 0, wasPhone = null;
function setRect() {
  const c = TL.byId['the-thaw']; if (!c) return;
  const phone = TL.vw < 760;
  const W = phone ? TL.vw * .88 : Math.min(TL.vw * .76, 1240), H = phone ? Math.min(TL.vh * .7, W * 1.35) : Math.min(TL.vh * .64, W * .62);   // room above for the caption, below for the key
  const a = H / W; if (Math.abs(a - aspect) > .01 || phone !== wasPhone) { aspect = a; wasPhone = phone; paint(); }
  const e = TL.smooth(TL.clamp((TL.y - (c.top - TL.vh * .72)) / (TL.vh * .72)));   // the surviving ribbon of the voyage swells into the block
  entry = e;
  const bar = TL.near('the-voyage', .8) && e > 0 && e < 1 && document.getElementById('vy-bar');
  const b = bar ? bar.getBoundingClientRect() : { left: TL.vw * .1, top: TL.vh * .5, width: TL.vw * .5, height: 8 };
  const cx = (TL.vw - W) / 2, cy = (TL.vh - H) / 2 + TL.vh * (phone ? .02 : .03);
  TL.setInv(b.left + (cx - b.left) * e, b.top + (cy - b.top) * e, b.width + (W - b.width) * e, b.height + (H - b.height) * e, e > .01 && (TL.melt < 1) ? 1 : 0);
}
fire.addEventListener('click', () => { if (fired) return; fired = true; firedAt = performance.now(); fire.textContent = 'Fired'; load.textContent = '{ "type": "invoice.paid", "invoice": "INV-0001", "amount_due": 0 }'; TL.dirty(); if (TL.reduced) spring = 1; });

TL.on(() => {
  const c = TL.byId['the-thaw']; if (!c) return;
  const p = TL.p('the-thaw'), past = TL.y > c.top + c.h - TL.vh * .5, before = TL.y < c.top - TL.vh * .1;
  if (before && fired) { fired = false; spring = 0; fire.textContent = 'Fire the webhook'; load.textContent = ''; }
  if (fired && !TL.reduced) spring = Math.min(1, spring + TL.dt / 1.8);
  const scrub = TL.reduced ? 0 : TL.local(p, .16, .9);
  TL.melt = past ? 1 : Math.max(scrub, TL.reduced ? (fired ? 1 : 0) : spring);
  setRect();
  const m = TL.melt;
  sec.dataset.melted = m >= 1 ? '1' : '0';
  ev.style.opacity = TL.smooth(TL.local(m, .58, .86));
  cap.style.opacity = TL.local(entry, .75, 1) * (1 - TL.local(m, .02, .2));
  fire.style.opacity = 1 - TL.local(m, .3, .5);
  fire.style.visibility = fire.style.opacity <= .01 ? 'hidden' : 'visible';
  load.style.opacity = fired ? TL.smooth(TL.local(m, .75, 1)) : 0;
  end.style.opacity = TL.smooth(TL.local(p, .92, 1));
  if (TL.current === TL.chapters.indexOf(c)) document.body.dataset.surface = m > .55 ? 'water' : 'ice';
  sec.style.setProperty('--ink', m > .55 ? 'var(--snow)' : 'var(--black-water)');
});

})();
```

### ice-cores.js

Each answer is printed on a drilled ice core. With motion allowed, each core is drawn out of the ice from the left as it arrives (alternating a short delay).

```js
/* Tallyline website: ice-cores. */
(function () {
// The answers are printed on the cores. With motion allowed, each core is drawn out of the ice from the left as it comes into view.
const TL = window.TL, cores = [...document.querySelectorAll('.core')];
cores.forEach((c, i) => c.style.setProperty('--i', i % 2));
TL.arrive(cores, 'drill', .9);

})();
```

### whole-lake.js

Pinned for 2.5 extra screens. "You have been standing on an invoice." stands over the lake while the camera rises; then every chapter becomes a line of an invoice laid exactly over its sawn row on the ice (wet rows in snow white), with the sheets each chapter took up (half for chapters skimmed in under a second and a half), the time on the page and a balance due of 0.00. On desktop each row links to its chapter.

```js
/* Tallyline website: whole-lake. */
(function () {
const TL = window.TL, sec = document.getElementById('whole-lake'), tbody = document.getElementById('wl-rows'), timeEl = document.getElementById('wl-time'), sheetsEl = document.getElementById('wl-sheets');
const NAMES = { 'first-furrow': 'The first furrow', 'frozen-word': 'The frozen word', 'the-borehole': 'The borehole', 'wyeths-grid': 'The horse grid', 'the-cut': 'The cut', 'the-channel': 'The channel', 'the-ice-house': 'The ice house', 'the-tallyman': 'The tallyman', 'the-voyage': 'The voyage', 'the-thaw': 'The thaw', 'black-water': 'Black water', 'ice-cores': 'Ice cores', 'whole-lake': 'The whole lake', 'open-water': 'Open water', 'far-bank': 'The far bank' };
let rows = [];
const start = performance.now(), dwell = {};
function build() {
  tbody.innerHTML = ''; rows = [];
  TL.chapters.forEach((c, i) => {
    const tr = document.createElement('tr');
    const wet = c.el.dataset.surface === 'water' || c.id === 'the-thaw';
    if (wet) tr.className = 'wet';
    const label = `${String(i + 1).padStart(2, '0')}  ${NAMES[c.id] || c.id}`, phone = TL.vw < 760;   // phone rows are too short to be honest tap targets, so there they are text
    const a = document.createElement(phone ? 'span' : 'a'); if (!phone) a.href = '#' + c.id; a.textContent = label;
    const td1 = document.createElement('td'); td1.append(a);
    const tds = [td1, document.createElement('td'), document.createElement('td'), document.createElement('td')];
    tds[2].textContent = '0.00'; tds[3].textContent = '0.00'; tds.forEach(t => tr.append(t));
    if (!phone) tr.addEventListener('click', e => { if (e.target.tagName !== 'A') a.click(); });
    tbody.append(tr); rows.push({ tr, c, sheet: tds[1] });
  });
}
TL.onMeasure(build);
TL.on(() => {
  const cur = TL.chapters[TL.current]; if (cur) dwell[cur.id] = (dwell[cur.id] || 0) + TL.dt;
  if (!sec || !TL.near('whole-lake', .5)) return;
  const c = TL.byId['whole-lake']; if (!c) return;
  const flat = !c.pin, p = TL.p('whole-lake');
  const a = flat ? 1 : TL.smooth(TL.local(p, .42, .54)) * (1 - TL.smooth(TL.local(p, .84, .97)));
  const ha = flat ? 1 : 1 - TL.smooth(TL.local(p, .38, .47));   // the line is already there as the section arrives, then the rows take over
  sec.style.setProperty('--a', a.toFixed(3)); sec.style.setProperty('--ha', ha.toFixed(3));
  sec.style.setProperty('--fa', (flat ? 1 : TL.smooth(TL.local(p, .42, .54))).toFixed(3));     // the balance slab stays until the page scrolls it away
  if (flat) return;
  const z = TL.zoom, y = TL.viewY;
  for (const r of rows) {
    const top = TL.vh / 2 + (r.c.wTop - y - TL.vh / 2) * z, h = Math.max(20, r.c.wH * z);
    r.tr.style.transform = `translateY(${top}px)`; r.tr.style.height = h + 'px';
  }
});
function bill() {
  const s = Math.floor((performance.now() - start) / 1000); timeEl.textContent = `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;
  let total = 0;
  for (const r of rows) {                         // a chapter skimmed in under a second and a half is only billed half its sheets
    const full = r.c.h / TL.vh, skim = (dwell[r.c.id] || 0) < 1.5, sheets = skim ? full / 2 : full;
    r.sheet.textContent = sheets.toFixed(1) + (skim ? ' skim' : ''); total += sheets;
  }
  sheetsEl.textContent = total.toFixed(1);
}
setInterval(bill, 1000); TL.onMeasure(bill);

})();
```

### open-water.js

The key request form: checks the email, says plainly that nothing was sent while `keyRequestEndpoint` is empty, and otherwise posts `{ email }` as JSON and raises the flag.

```js
/* Tallyline website: open-water. */
(function () {
const form = document.getElementById('ow-form'), email = document.getElementById('ow-email'), btn = document.getElementById('ow-btn'), msg = document.getElementById('ow-msg'), flag = document.getElementById('ow-flag');
const valid = v => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v.trim());
const say = (t, bad) => { msg.textContent = t; msg.classList.toggle('bad', !!bad); };
email.addEventListener('blur', () => { if (email.value && !valid(email.value)) say('That address will not hold weight. Check the part after the @.', true); else if (msg.classList.contains('bad')) say(''); });
form.addEventListener('submit', async e => {
  e.preventDefault();
  if (!valid(email.value)) { say('That address will not hold weight. Check the part after the @.', true); email.focus(); return; }
  const url = (window.TALLYLINE_CONFIG || {}).keyRequestEndpoint;
  btn.disabled = true; btn.textContent = 'Sawing…'; say('');
  try {
    if (!url) { await new Promise(r => setTimeout(r, 400)); say('This preview is not wired to a server yet, so nothing was sent.'); btn.textContent = 'Ask for a key'; btn.disabled = false; return; }
    const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ email: email.value.trim() }) });
    if (!res.ok) throw new Error(String(res.status));
    say('Cut. Watch your inbox.'); btn.textContent = 'Cut'; flag.style.transform = 'translateY(-12px)';
    if (!window.TL.reduced) document.getElementById('ow-cloth').animate([{ transform: 'skewY(0deg)' }, { transform: 'skewY(5deg)' }, { transform: 'skewY(0deg)' }], { duration: 900, easing: 'ease-in-out' });
  } catch (_) { say('The saw jammed. Nothing was sent. Please try again.', true); btn.textContent = 'Ask for a key'; btn.disabled = false; }
});

})();
```

### far-bank.js

The footer: the colophon line is revealed left to right as you arrive, the page length is written in sheets, and scrolling past the end says "That is the bank." and dips the flag.

```js
/* Tallyline website: far-bank. */
(function () {
const TL = window.TL, line = document.getElementById('fb-line'), count = document.getElementById('fb-count'), bank = document.getElementById('fb-bank'), flag = document.querySelector('.fb-flag');
TL.on(() => { if (TL.near('far-bank')) line.style.setProperty('--r', (TL.reduced ? 100 : Math.max(8, (TL.y + TL.vh >= TL.pageH - 8 ? 1 : TL.smooth(TL.local(TL.p('far-bank'), .05, .3))) * 100)).toFixed(1) + '%'); });
TL.onMeasure(() => { count.textContent = TL.pageH ? `This page ran to ${(TL.pageH / TL.vh).toFixed(1)} sheets.` : ''; });
addEventListener('wheel', e => {
  if (e.deltaY > 0 && TL.y + TL.vh >= TL.pageH - 2) { bank.textContent = 'That is the bank.'; if (flag) { flag.style.transform = 'translateY(4px)'; setTimeout(() => { flag.style.transform = ''; }, 200); } }
}, { passive: true });

})();
```

### Black water (no script)

The black-water chapter ("Liquid.") has no script: it is drawn by the CSS and the shader's water.

## 8. Script order

`js/config.js` loads in the head (already in the markup). At the end of `<body>` load, in this order and each with `defer`: `js/film.js`, `js/shader.js`, `js/stage.js`, `js/chrome.js`, then the chapter files in page order: `first-furrow`, `frozen-word`, `the-borehole`, `wyeths-grid`, `the-cut`, `the-channel`, `the-ice-house`, `the-tallyman`, `the-voyage`, `the-thaw`, `ice-cores`, `whole-lake`, `open-water`, `far-bank` (the tags are already in the markup above).

## 9. Interactions to confirm by hand

Use a real browser with a graphics card and motion allowed. Headless browsers often use a software renderer: the lake then stays a still picture by design (add `?gl=force` to the address to force the shader there for a look).

1. First screen: "Finished work is frozen money." is sawn into the ice line by line, with a bright chip at the blade, then reads as cut into the ice. (If the shader needs more than 1.2 seconds to compile, on a first visit or a slow graphics card, the heading shows as plain type first and is carved in place, without the saw.) On a wide desktop the slip top right plays POST, 201, sent, viewed, overdue, paid. Moving the pointer over the ice scores a groove that heals.
2. "Accountants already call paid money liquid..." lights word by word while pinned, and a line runs under "ice."
3. Type an amount and days late in "Bore a hole in it.": the interest appears and the hole fills with water and grows.
4. The ice grid is sawn column by column while pinned.
5. Edit the invoice lines in "POST your lines.": the total, request, response and the small block follow; "Saw another line" adds one.
6. The block floats down the channel, the flags light one by one and its title changes state.
7. The ice house blocks drop into place; the invoice number goes up when you come back.
8. "Send it again" adds lines to the answer log, all "inv_0001".
9. The voyage ribbon shrinks and the tons readout counts down to 100 tons.
10. Your invoice freezes into a block; "Fire the webhook" thaws it into floes and black water; `invoice.paid` appears.
11. The camera rises over the whole lake and the chapters become invoice lines with sheets and time.
12. Submitting the key form with a bad email shows the error; with a good one it says nothing was sent.
13. Every heading is sawn in with a red line under it the first time it arrives; the nav underlines the part you are on; keys `j` and `k` jump between chapters.

## 10. Verify, then show the result

Serve the folder (section 1) and open it. Check desktop near 1440 x 900, a tablet width near 768, and phone widths near 390 and 320: no horizontal overflow, no missing files, no console errors, no request to another domain. Check the interactions in section 9 with motion allowed (with reduced motion the pinned chapters become plain sections and the effects stay still: that is intended).

Finish by telling the person the local address, what you built and tested, the tool and model you are, and anything missing or different. Do not call the result pixel-identical to the demo at https://sitepeel.dev/website-prompts/tallyline/preview/.

More website prompts