Part of [Architecture](https://docs.mapcairn.com/architecture.md), which is built from [ARCHITECTURE.md](https://github.com/MapCairn/mapcairn/blob/main/ARCHITECTURE.md) in the repository, where it is edited.

The routes of the reference site.

`packages/web/src/routes.ts` is the host's route table. The pages are:

- `/`, the product page (`routes/product.tsx`, `src/product/`). It is server-rendered and static, and it sits outside the app layout (below), so it builds no services: no adapter, no layer definition, no engine and no engine styles are loaded there and no tile is requested. Its picture of the playground is committed WebP captures, one view at two sizes (`product/captures`, taken by `scripts/captureProduct.ts`, `docs/guides/product-captures.md`), served from this site, so no tile is requested for it either. Its loader returns the latest release, read from `CHANGELOG.md` at build time by `product/releaseFacts.server.ts`, so the page asks no service for it and the changelog stays on the server. Its own markup requests nothing from another site; in production the host adds its cookieless page-view counter, as on every page. Its words live once, in `product/productContent.ts`, and three outputs are rendered from them: the page itself, its Markdown twin at `/index.md` and the second half of `/llms-full.txt`. The embedding example is the README's three files (`product/embedExampleFiles.ts` and the files in `product/embed/`), held as text because nothing under `packages/` may import the umbrella package: a test keeps each file equal to the README's block and to `sites/docs/docs/guides/embed-a-map.md`, and `packages/core/src/lint/readme.test.ts` type-checks the README's `main.tsx` as an app outside the repository would. The page shows an excerpt of `main.tsx`, cut from that file by `excerptOf`, so it shows code that compiles. It draws a map only when a project that installs `@mapcairn/sdk`, `react`, `react-dom` and `maplibre-gl` runs it; nothing on the page runs it. Its artwork takes every position from `product/surveyGeometry.ts`, pure functions of a few constants, which a unit test and a browser test check. The page is English only by decision, so its route's `handle` (`PageLanguageHandle`) sets `<html lang="en-GB">` in the server render. The root marks that fixed language so the pre-paint theme script does not replace it with a stored playground language.
- `/map`, the playground (`routes/map.tsx`): the map, mounted after hydration as before. Its server render carries a short description of the playground for readers that do not run the app.
- `/privacy`, the privacy policy.

The root route renders only the matched page. The services, the one announcer and tooltips belong to a pathless layout route, `routes/app.tsx`, around `/map`, `/privacy` and the development-only `/design` and `/design/two-maps`: it calls `createServices()` once per app instance and keeps `<html lang>` and the tab title in step with the interface's language. A full page that is not the map (the product page and the privacy page) carries `data-document-scroll` on its container, and then the document scrolls rather than the map's fixed frame (`global.css.ts`), so the keyboard scrolls it from the first key press. The map package marks its style modules as its only side effects (`"sideEffects"` in its manifest), so a page that uses one or two of its components loads only their styles and code.

Each page exports its own `meta` through `buildPageMeta` (title, description, Open Graph and Twitter tags, a preview image the project draws itself) and its own JSON-LD from `structuredData.ts`: `SoftwareSourceCode` and the page's questions as an `FAQPage` on `/`, a `WebApplication` and a breadcrumb trail on `/map`, a `WebPage` and a trail on `/privacy`, and the `WebSite` on each. The resource routes `robots.txt`, `sitemap.xml`, `llms.txt`, `llms-full.txt` and `index.md` are built once from the same sources (`product/llmsText.ts`, `product/productMarkdown.ts`).

The playground moved from `/` to `/map`. A shared link keeps the map's state in the fragment, which the server never receives, so the move cannot be a server redirect. Instead the product page's first element is an inline script (`app/mapLinkRedirect.ts`), allowed by its own SHA-256 hash in the Content Security Policy beside the theme script's: when the fragment holds a `key=value` pair, it replaces the address with `/map`, keeping the query and the fragment, before the page paints. `UrlState` reads and writes the fragment on whatever path the map is on, so the playground's own links carry `/map`.
