Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Add documentation for using custom layers in parallax hero images

nirholas1db9450fc160
diff --git a/docs/how-it-works.md b/docs/how-it-works.md
new file mode 100644
index 000000000..9f5a92e52
--- /dev/null
+++ b/docs/how-it-works.md
@@ -0,0 +1,311 @@
+# How CSS 3D Parallax Works
+
+This page explains the mechanics behind the CSS 3D parallax scrolling hero used in this theme — from the mathematical foundations of 3D projection to the browser-specific quirks that required targeted workarounds. If you want to understand why each line of CSS exists, you are in the right place.
+
+---
+
+## The CSS 3D Coordinate System
+
+Before anything else, you need a mental model of how CSS thinks about three-dimensional space.
+
+CSS uses a right-handed coordinate system. The X axis runs left to right across the screen. The Y axis runs top to bottom (not bottom to top as in mathematics — CSS and HTML have their origin at the top-left corner). The Z axis is perpendicular to the screen, pointing toward you. A positive `translateZ` moves an element closer to you; a negative `translateZ` moves it away into the page.
+
+The **vanishing point** is where all parallel lines in the 3D scene would converge if extended to infinity. In CSS, the vanishing point defaults to the center of the element that has `perspective` set on it. If you set `perspective: 500px` on a container and it is 800px wide and 600px tall, the vanishing point sits at `(400px, 300px)` in that container's coordinate space. Elements positioned away from that center will appear to slant toward it, which is exactly what gives 3D scenes their sense of depth.
+
+There is one important subtlety: the vanishing point is relative to the *perspective element*, not the viewport. This matters enormously for parallax, as we will see shortly.
+
+---
+
+## `perspective` on a Scroll Container vs. `perspective()` in a Transform
+
+There are two ways to introduce perspective into CSS:
+
+**1. The `perspective` property on a parent element:**
+
+```css
+.scroll-container {
+ perspective: 2.5rem;
+ overflow: hidden auto;
+}
+```
+
+**2. The `perspective()` function inside a `transform` on the element itself:**
+
+```css
+.layer {
+ transform: perspective(2.5rem) translateZ(-10px);
+}
+```
+
+These look similar but behave fundamentally differently, and the difference is what makes scrolling parallax possible.
+
+When you use the `perspective` *property* on a parent, all children share a *single* vanishing point. Every child's 3D transform is evaluated relative to that one shared origin. As a result, moving one child does not move the vanishing point — it stays anchored to the parent.
+
+When you use `perspective()` inside an individual element's `transform`, each element gets its own independent vanishing point centered on itself. There is no shared scene. Objects do not relate to each other in 3D space.
+
+For parallax, the shared vanishing point is what you want. The scroll container has `perspective` set, and all the depth layers are children. When the container scrolls, the layers scroll at different visual rates because they are at different Z depths — all converging toward the same vanishing point. This is the entire trick.
+
+---
+
+## The Exact Math: `translateZ` and Parallax Depth
+
+Here is the core rule of CSS 3D projection: an element translated along the Z axis by `z` in a container with `perspective: p` will appear to move at a visual rate proportional to `(p - z) / p` when the container is scrolled.
+
+More precisely, when the scroll container moves by `d` pixels (i.e., `scrollTop` increases by `d`), an element at `translateZ(z)` appears to move by:
+
+```
+visual_movement = d × (p / (p - z))
+```
+
+For the parallax effect we want *slower* movement for elements further away (negative Z). Substituting a negative Z value:
+
+```
+visual_movement = d × (p / (p + |z|))
+```
+
+When `|z|` is large, the denominator grows, and the fraction shrinks below 1. The element appears to move *less* than the scroll distance. That is parallax.
+
+In this theme, the perspective value is `2.5rem`. The CSS variable `--md-parallax-depth` sets the depth multiplier. The actual `translateZ` value applied to each layer is:
+
+```css
+transform: translateZ(calc(2.5rem * var(--md-parallax-depth) * -1))
+ scale(calc(var(--md-parallax-depth) + 1));
+```
+
+With `--md-parallax-depth: 8` (the farthest background layer), the element is pushed `20rem` (8 × 2.5rem) back into the page. Its visual scroll rate becomes:
+
+```
+rate = 2.5 / (2.5 + 20) = 2.5 / 22.5 ≈ 0.111
+```
+
+That layer moves at about 11% of the scroll speed. A near-foreground layer at `--md-parallax-depth: 1` moves at:
+
+```
+rate = 2.5 / (2.5 + 2.5) = 2.5 / 5 = 0.5
+```
+
+That layer moves at 50% of scroll speed. The result: the background barely drifts while the foreground moves more noticeably — exactly the depth cue your visual system uses to infer distance.
+
+The four layers in this theme use depth values of `8`, `5`, `2`, and `1`, giving visual scroll rates of roughly 11%, 33%, 56%, and 50% respectively. The gaps between values are chosen to make the depth separation clearly visible without any single layer moving so fast it looks wrong.
+
+---
+
+## Scale Compensation: Why `scale(depth + 1)` Is Necessary
+
+There is a problem with pushing elements back along the Z axis: they appear smaller. An element at `translateZ(-20rem)` inside a `perspective: 2.5rem` container will be dramatically shrunk by the 3D projection — it would appear as a tiny postage stamp in the corner of the screen.
+
+The scale compensation formula fixes this:
+
+```css
+scale(calc(var(--md-parallax-depth) + 1))
+```
+
+This is derived directly from the projection math. If an element is at depth `d` (where actual `translateZ` equals `d × -p`), the CSS projection shrinks it by a factor of `1 / (d + 1)`. Multiplying by `scale(d + 1)` exactly cancels that shrinkage, restoring the element to its intended visual size.
+
+For the far background at `--md-parallax-depth: 8`:
+
+- Projection shrink factor: `1 / (8 + 1) = 1/9`
+- Scale compensation: `9`
+- Net visual size: `1/9 × 9 = 1` — back to full size
+
+For the near foreground at `--md-parallax-depth: 1`:
+
+- Projection shrink factor: `1 / (1 + 1) = 1/2`
+- Scale compensation: `2`
+- Net visual size: `1/2 × 2 = 1` — back to full size
+
+A critical side effect: because scale compensation makes far layers appear full-size, they must actually be *much larger* in pixel terms than they appear. A layer at depth 8 needs to be rendered 9× its visible dimensions. This is why background images for deep layers need to be wide panoramic files — the scale transform stretches them to fill the viewport.
+
+---
+
+## Why Scrolling a Perspective Container Creates Parallax
+
+You might wonder: if the scroll container is scrolled, does not everything inside move together by the same amount? The answer is yes in 2D, but not in 3D.
+
+When the container scrolls, the viewport's position in the container's coordinate space changes. Elements at `translateZ(0)` behave normally — they scroll at 1:1. But the 3D projection matrix transforms the geometry of elements at non-zero Z positions. As the viewpoint shifts relative to the Z-displaced elements, the *projected* position on screen changes at a different rate than the raw scroll offset. The perspective math does this automatically; the browser's rendering engine handles it correctly by compositing each layer with its appropriate depth-projected transform.
+
+This is why this technique requires no JavaScript whatsoever. The parallax is not computed by reading `scrollTop` and updating element positions — it is a natural geometric consequence of CSS 3D perspective projection. The browser's compositor thread handles it entirely, on the GPU.
+
+---
+
+## Sticky Positioning for Hero Text
+
+The hero text sits on top of the parallax image layers and should remain readable while the parallax scrolls. The standard approach — `position: sticky` — is used, but it requires a careful negative margin to work correctly:
+
+```css
+.parallax__group--hero-text {
+ position: sticky;
+ top: 0;
+ margin-bottom: -100vh;
+}
+```
+
+The `margin-bottom: -100vh` deserves explanation. Sticky positioning keeps an element "stuck" to the top of the scroll container until its *parent* scrolls out of view. Without the negative margin, the parent element would end exactly at the bottom of the text content, and the text would begin to scroll away before the parallax images are done moving through the viewport.
+
+By setting `margin-bottom: -100vh`, the parent element's layout height is reduced by one viewport height. This pulls the sticky constraint boundary upward, keeping the text stuck for exactly as long as the parallax hero section occupies the viewport. When the parallax scroll group eventually leaves the viewport, the sticky text goes with it, revealing the normal document content below.
+
+This is a purely CSS technique. No scroll event listeners, no `position: fixed` with JavaScript offset calculations.
+
+---
+
+## Paint Containment with `contain: strict`
+
+```css
+.parallax__group {
+ contain: strict;
+}
+```
+
+The `contain: strict` declaration tells the browser that this element and its subtree are self-contained: their layout, paint, and size do not affect anything outside the element, and nothing outside affects them. This is a performance hint that allows the browser to skip repainting the rest of the document when the parallax group changes.
+
+For parallax layers that are constantly being composited and transformed, this is significant. Without containment, each frame of animation might trigger a full-page repaint. With `contain: strict`, the browser can isolate and independently composite each parallax group on the GPU, achieving buttery smooth frame rates even on mid-range hardware.
+
+The reason this is especially important here is that the 3D transforms on the parallax layers happen entirely on the compositor thread (separate from the main JavaScript thread), but only if the browser can correctly promote the layers to their own GPU compositing layers. `contain: strict` helps the browser make that determination reliably.
+
+---
+
+## The `height: 140vh` on the First Group
+
+The first parallax group uses `height: 140vh` rather than `100vh`. This is not arbitrary. The parallax layers inside the group appear to extend beyond the viewport — the far background layer (depth 8) scrolls at 11% of scroll speed, which means for it to travel through the viewport fully, the group needs to be scrolled through more than `100vh` of content.
+
+The exact value needed depends on the depth values used. A deeper background requires a taller container to complete its scroll travel. `140vh` was empirically tuned to ensure all four layers complete their parallax motion before the hero scrolls fully off screen.
+
+Subsequent groups (if any) use responsive `vw`-based heights rather than fixed `vh` values, because their content is image-driven and should maintain aspect ratios:
+
+```css
+.parallax__group--scene {
+ height: 56.25vw; /* 16:9 aspect ratio */
+}
+```
+
+This ensures the parallax scene scales proportionally with viewport width, maintaining correct composition at all screen sizes.
+
+---
+
+## The Blend Layer
+
+Between the parallax image layers and the content below, there is a gradient blend layer:
+
+```css
+.parallax__blend {
+ background: linear-gradient(
+ to bottom,
+ transparent 0%,
+ var(--md-default-bg-color) 100%
+ );
+ z-index: 5;
+}
+```
+
+This gradient transitions from fully transparent (showing the bottom edge of the parallax images) to the site's background color (matching the content sections below). It accomplishes two things:
+
+1. It prevents a hard visual cutoff at the bottom of the parallax hero. Images rarely look clean at their exact edge, and the gradient masks any artifacts.
+2. It creates a smooth visual merge between the scenic parallax imagery and the flat document content that follows, making the page feel cohesive rather than jarring.
+
+The blend layer is positioned using `z-index: 5`, which places it above the image layers (which have lower z-index values) but the blend is transparent at the top, so it does not obscure the imagery.
+
+---
+
+## Z-Index Stacking: `z-index: calc(10 - depth)`
+
+The parallax layers need to stack correctly: near objects (low depth number) should appear in front of far objects (high depth number). The formula for this is:
+
+```css
+z-index: calc(10 - var(--md-parallax-depth));
+```
+
+At `--md-parallax-depth: 1` (near foreground), `z-index` is `9`. At `--md-parallax-depth: 8` (far background), `z-index` is `2`. Near layers are always on top of far layers in the stacking order.
+
+Without this, the 3D projection might place elements visually at different depths, but the browser's paint order (which follows DOM order and z-index) might render them in the wrong order, creating situations where a background element is painted over a foreground element. The `z-index` formula ensures paint order matches visual depth order.
+
+---
+
+## Browser Quirks
+
+### Safari: Disabling `contain: strict`
+
+Safari has a known issue where `contain: strict` on elements inside a `perspective` scroll container breaks the parallax effect — the 3D transforms stop updating correctly during scroll, causing layers to freeze or jump. A browser detection script adds a `.safari` class to the `<body>` element:
+
+```js
+if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
+ document.body.classList.add('safari');
+}
+```
+
+The CSS then disables `contain` specifically for Safari:
+
+```css
+.safari .parallax__group {
+ contain: none;
+}
+```
+
+This restores correct parallax behavior at the cost of some paint performance in Safari. Given that Safari's rendering engine handles 3D compositing differently, this is an acceptable trade-off.
+
+### Firefox: Repaint Bug Fix
+
+Firefox has a repaint bug where the parallax layers occasionally fail to repaint after a rapid scroll or tab focus change, leaving ghost artifacts or blank regions. The fix involves toggling a class that forces a style recalculation:
+
+```js
+window.addEventListener('focus', () => {
+ document.body.classList.add('ff-hack');
+ requestAnimationFrame(() => document.body.classList.remove('ff-hack'));
+});
+```
+
+```css
+.ff-hack .parallax__layer {
+ will-change: transform;
+}
+```
+
+Adding and removing `will-change: transform` forces Firefox to mark the compositing layers as dirty and repaint them on the next frame. This resolves the ghost artifact issue without any visible effect on the rendered output.
+
+---
+
+## Why Not JavaScript Scroll Listeners?
+
+Traditionally, parallax effects use JavaScript that reads `window.scrollY` on each scroll event and applies position offsets. This approach has serious performance problems:
+
+- Scroll event handlers run on the **main thread**, which is the same thread that runs JavaScript, handles user input, and performs layout. Under heavy load, this thread can be busy, causing the parallax animation to lag behind the actual scroll position.
+- Reading `scrollY` followed by writing to `element.style.transform` triggers **layout thrashing** if not carefully managed with `requestAnimationFrame`.
+- Even with `requestAnimationFrame`, JavaScript-driven parallax runs at most 60fps on most displays, and may drop frames when other scripts are active.
+
+The CSS 3D approach runs entirely on the **compositor thread**, a separate GPU-accelerated thread that handles `transform` and `opacity` animations. The compositor thread is never blocked by JavaScript. The parallax updates happen at the full display refresh rate (including 120Hz and 144Hz displays) with zero jank, even if the main thread is busy processing data or rendering other UI.
+
+---
+
+## Why Not `animation-timeline: scroll()`?
+
+The CSS Scroll-Driven Animations API (`animation-timeline: scroll()`) is a modern alternative that allows CSS animations to be driven by scroll position. As of 2025, it is supported in Chrome and Edge but lacks full support in Safari and Firefox.
+
+Additionally, scroll-driven animations are still processed on the main thread in some implementations when they affect layout properties, and the API requires careful coordination when combined with 3D transforms and perspective containers. The CSS 3D perspective approach used here works in every browser that supports CSS 3D transforms — which is every major browser since 2012 — and delivers equivalent performance without the compatibility uncertainty.
+
+---
+
+## Debugging: Chrome DevTools
+
+### Layers Panel
+
+Open Chrome DevTools, go to the **Layers** panel (More tools > Layers). Each parallax layer should appear as a separate compositing layer. If a layer is not promoted, you will see it listed as part of its parent. You can click any layer to see why it was or was not promoted (look for "Has a 3D transform" as the reason).
+
+### 3D View
+
+In Chrome DevTools, More tools > **3D View** renders your page's layer stack as an interactive 3D diagram. You can orbit around the layer stack and visually confirm that each parallax layer is at the correct depth. Layers that are pushed back in Z should appear further back in the 3D view. This is the most intuitive way to verify that the transforms are applied correctly.
+
+If a layer appears at `z=0` when it should be at a negative Z, the most common cause is a missing `transform-style: preserve-3d` on an intermediate ancestor, or a CSS property on an ancestor that flattens the 3D context (such as `overflow: hidden` in some browsers, or certain `filter` values).
+
+---
+
+## Summary
+
+The CSS 3D parallax technique works because:
+
+1. A `perspective` property on a scroll container establishes a shared 3D scene with a fixed vanishing point.
+2. Child elements at negative Z positions are projected to appear smaller and scroll more slowly — the further back, the slower.
+3. Scale compensation exactly counteracts the projection shrinkage, so images appear full-size at all depths.
+4. The compositor thread handles all of this at GPU speed, with no JavaScript involvement.
+5. Sticky text positioning and a blend gradient handle the presentation layer.
+6. Browser-specific workarounds address known bugs in Safari and Firefox without compromising the core technique.
+
+The result is a hero section with genuine, smooth, GPU-accelerated depth — using nothing but CSS that browsers have supported for over a decade.
diff --git a/docs/tutorial-build-pai-site.md b/docs/tutorial-build-pai-site.md
new file mode 100644
index 000000000..cd7150b10
--- /dev/null
+++ b/docs/tutorial-build-pai-site.md
@@ -0,0 +1,1220 @@
+# Building docs.pai.direct from scratch inside `nirholas/scroll-zoom-thing`
+
+A complete, step-by-step tutorial for rebuilding the [docs.pai.direct](https://docs.pai.direct) documentation site on top of the [`nirholas/scroll-zoom-thing`](https://github.com/nirholas/scroll-zoom-thing) reference repo. By the end you will have a MkDocs Material site with a pure-CSS 3D perspective parallax hero, a full PAI-style navigation tree, AVIF artwork at the right depths, and a working GitHub Pages deployment behind a custom domain.
+
+Nothing in this guide depends on JavaScript scroll listeners, third-party animation libraries, or build-time image pipelines. Every effect uses primitives the browser already ships: `perspective`, `translateZ`, `scale`, `position: sticky`, and a `<picture>` element with an AVIF source.
+
+---
+
+## What you are building
+
+The pai site is a Material for MkDocs documentation site with three personality traits that make it different from a stock theme:
+
+1. **A cinematic parallax hero** built from four AVIF layers stacked in 3D space, scrolling at different speeds because they sit at different `translateZ` distances from the camera.
+2. **A pillars-and-intro landing page** that flows immediately under the hero with the same dark scheme, so the home route is a marketing page first and a docs index second.
+3. **A deep nav tree** — Overview, Getting started, Guides, AI, Apps, Advanced, Privacy, Examples, Development, Reference, About — wired into Material's navigation tabs and sections, with a hardened set of markdown extensions for callouts, code, and tabs.
+
+The repo `nirholas/scroll-zoom-thing` already contains a minimal reference implementation of the parallax in its top-level `docs/` folder, plus a complete pai instance under `pai/`. This tutorial walks you through building the `pai/` instance from an empty checkout. Read the reference docs first if you want to understand the math; then come back here to assemble the real site.
+
+---
+
+## Prerequisites
+
+Before you start, install:
+
+- **Python 3.10 or newer** — MkDocs is a Python tool. A `venv` is enough; you do not need Conda.
+- **Git** — for cloning, branching, and the GitHub Pages deploy step.
+- **A modern image converter** — `ffmpeg` 6+ or [`avifenc`](https://github.com/AOMediaCodec/libavif) for producing AVIF layers. ImageMagick 7 also works if compiled with `--with-libavif`.
+- **A GitHub account** — for the eventual Pages deployment and custom domain.
+
+You should also be comfortable editing Jinja2 templates (the `home.html` override is a Jinja file that extends Material's `base.html`) and YAML (the `mkdocs.yml` is several hundred lines once you wire up the full nav).
+
+You do not need Node.js, a bundler, Tailwind, or any framework. Everything is plain HTML, CSS, Markdown, and a little Jinja.
+
+---
+
+## Step 1 — Fork and clone the reference repo
+
+Start by getting a working copy of the reference implementation. You can either fork it on GitHub and clone your fork, or clone the upstream directly and rename the remote later:
+
+```bash
+git clone https://github.com/nirholas/scroll-zoom-thing.git
+cd scroll-zoom-thing
+git checkout -b pai-site
+```
+
+Spend ten minutes browsing the layout. The pieces you will be reusing or recreating are:
+
+- `docs/overrides/home.html` — the minimal reference parallax hero
+- `docs/assets/stylesheets/home.css` — the stylesheet that drives the depth effect
+- `docs/how-it-works.md`, `docs/your-own-layers.md` — explainers for the technique
+- `pai/` — the production pai instance (this is the target you are rebuilding)
+- `agents/`, `skills/`, `.claude/commands/` — optional tooling for AI-assisted authoring
+
+Treat `pai/` as a black box for now; you will recreate its contents from empty so you understand every line.
+
+---
+
+## Step 2 — Create the pai directory structure
+
+Inside the repo root, create a fresh, empty workspace for your build. Do not copy from `pai/` yet — author the files yourself and diff against the reference at the end.
+
+```bash
+mkdir -p pai-fresh/{src,overrides,images}
+mkdir -p pai-fresh/src/{general,first-steps,ai,apps,advanced,privacy,usage,persistence,examples,architecture,development,reference,api,agents,tutorials,assets/hero,assets/stylesheets}
+touch pai-fresh/{mkdocs.yml,requirements.txt}
+touch pai-fresh/overrides/home.html
+touch pai-fresh/src/{index.md,quickstart.md,installation.md,getting-started.md,using-pai.md,models.md,configuration.md,deployment.md}
+```
+
+That scaffolds the whole tree at once. Material expects the nav targets in `mkdocs.yml` to resolve to real files; missing files build successfully but produce broken links, so it is worth touching all the placeholders early.
+
+Add a `requirements.txt` so anyone (and any CI runner) can reproduce your local environment exactly:
+
+```
+mkdocs-material>=9.5
+pymdown-extensions>=10.7
+mkdocs-redirects>=1.2
+```
+
+Then create and activate a virtualenv:
+
+```bash
+python -m venv .venv
+source .venv/bin/activate
+pip install -r pai-fresh/requirements.txt
+```
+
+---
+
+## Step 3 — Author `mkdocs.yml`
+
+`mkdocs.yml` is the single most consequential file in the project. It chooses the theme, switches on Material features, lists every markdown extension, registers stylesheets, and declares the entire navigation tree. Copy this skeleton into `pai-fresh/mkdocs.yml`:
+
+```yaml
+site_name: PAI Documentation
+site_description: Private AI on a bootable USB drive — Debian + Sway + Ollama.
+site_url: https://docs.pai.direct
+repo_url: https://github.com/nirholas/pai
+repo_name: nirholas/pai
+edit_uri: edit/main/docs/src/
+
+docs_dir: src
+site_dir: _site
+
+theme:
+ name: material
+ custom_dir: overrides
+ language: en
+ logo: assets/pai-logo-white.png
+ palette:
+ - scheme: slate
+ primary: custom
+ accent: custom
+ font:
+ text: Inter
+ code: JetBrains Mono
+ features:
+ - navigation.tabs
+ - navigation.sections
+ - navigation.top
+ - navigation.instant
+ - navigation.tracking
+ - search.suggest
+ - search.highlight
+ - content.code.copy
+ - content.action.edit
+ - toc.follow
+
+extra_css:
+ - assets/pai-theme.css
+ - assets/stylesheets/home.css
+
+markdown_extensions:
+ - admonition
+ - attr_list
+ - def_list
+ - footnotes
+ - md_in_html
+ - tables
+ - toc:
+ permalink: true
+ - pymdownx.details
+ - pymdownx.highlight:
+ anchor_linenums: true
+ - pymdownx.inlinehilite
+ - pymdownx.snippets
+ - pymdownx.superfences:
+ custom_fences:
+ - name: mermaid
+ class: mermaid
+ format: !!python/name:pymdownx.superfences.fence_code_format
+ - pymdownx.tabbed:
+ alternate_style: true
+ - pymdownx.tasklist:
+ custom_checkbox: true
+
+plugins:
+ - search
+```
+
+A few decisions to call out:
+
+- **`docs_dir: src`** — non-standard but deliberate. It keeps the markdown content separate from the site config, the override templates, and the deploy artifact. Many MkDocs sites collapse this into the default `docs/`; here we want the source tree to feel like a real project tree.
+- **`scheme: slate`** — Material's dark scheme. The hero artwork is desaturated landscape photography that looks anaemic on the light scheme, so we lock the home page to slate via a `data-md-color-scheme="slate"` attribute on the parallax sections later.
+- **`custom_dir: overrides`** — tells Material to look in `overrides/` for partial template replacements. The home page template lives there.
+- **`navigation.instant`** — turns the docs into a single-page app with route-level prefetch. It is fast, but it interacts with the parallax: instant nav swaps `<body>` content rather than reloading, so any code that runs on `DOMContentLoaded` will not re-fire. The pure-CSS parallax does not care.
+- **`navigation.tabs`** — promotes the top-level nav entries to a horizontal tab bar. PAI has eleven sections; without tabs the sidebar gets unreadable.
+
+Now append the navigation tree. This is the part that takes the longest, but it is mechanical:
+
+```yaml
+nav:
+ - Home: index.md
+ - Overview:
+ - How PAI works: general/how-pai-works.md
+ - Features included: general/features-included.md
+ - System requirements: general/system-requirements.md
+ - Warnings and limitations: general/warnings-and-limitations.md
+ - Getting started:
+ - Try in a VM: first-steps/try-in-a-vm.md
+ - Quickstart: quickstart.md
+ - Installation: installation.md
+ - USB flashing: USB-FLASHING.md
+ - Starting on Mac: first-steps/starting-on-mac.md
+ - Starting on Windows: first-steps/starting-on-windows.md
+ - First boot walkthrough: first-steps/first-boot-walkthrough.md
+ - Desktop basics: first-steps/desktop-basics.md
+ - Guides:
+ - Using PAI: using-pai.md
+ - Basic usage: usage/basic.md
+ - Advanced usage: usage/advanced.md
+ - Persistence:
+ - Introduction: persistence/introduction.md
+ - Creating persistence: persistence/creating-persistence.md
+ - Unlocking: persistence/unlocking.md
+ - Backing up: persistence/backing-up.md
+ - Configuration: configuration.md
+ - Deployment: deployment.md
+ - AI:
+ - Choosing a model: ai/choosing-a-model.md
+ - Managing models: ai/managing-models.md
+ - Using Ollama: ai/using-ollama.md
+ - Using Open WebUI: ai/using-open-webui.md
+ - Apps:
+ - Password management: apps/password-management.md
+ - Encrypting files (GPG): apps/encrypting-files-gpg.md
+ - Secure delete: apps/secure-delete.md
+ - Advanced:
+ - GPU setup: advanced/gpu-setup.md
+ - GPU passthrough (VMs): advanced/gpu-passthrough.md
+ - Running in a VM: advanced/running-in-a-vm.md
+ - Boot options: advanced/boot-options.md
+ - Privacy:
+ - Introduction: privacy/introduction-to-privacy.md
+ - Privacy mode (Tor): privacy/privacy-mode-tor.md
+ - MAC address anonymization: privacy/mac-address-anonymization.md
+ - Offline mode: privacy/offline-mode.md
+ - Examples:
+ - Local AI assistant: examples/local-ai-assistant.md
+ - Crypto cold signing: examples/crypto-cold-signing.md
+ - Travel and network hardening: examples/travel-and-network-hardening.md
+ - Reference:
+ - Architecture:
+ - Overview: architecture/overview.md
+ - Components: architecture/components.md
+ - Data flow: architecture/data-flow.md
+ - Skills: skills.md
+ - Keyboard shortcuts: reference/keyboard-shortcuts.md
+ - FAQ: reference/faq.md
+ - Glossary: reference/glossary.md
+ - About:
+ - Philosophy: PHILOSOPHY.md
+ - Vision: VISION.md
+ - Roadmap: roadmap.md
+ - Changelog: CHANGELOG.md
+```
+
+You can shrink this for a smaller starter site, but Material tolerates an unbalanced tree poorly: half the nav features assume you have at least two levels. Stub the files with one-line placeholders for now; you can fill them in later.
+
+---
+
+## Step 4 — Build the parallax hero template
+
+Create `pai-fresh/overrides/home.html`. This file extends Material's `base.html` and overrides the `tabs` block — the slot that normally renders the top tab bar — to inject the entire parallax. We also blank out the standard content and footer blocks for the home route so the hero owns the whole viewport:
+
+```jinja
+{% extends "base.html" %}
+
+{% block tabs %}
+ {{ super() }}
+ <style>
+ .md-header{position:initial}
+ .md-main__inner{margin:0}
+ .md-main__inner > .md-content{display:none}
+ @media screen and (min-width:60em){.md-main__inner > .md-sidebar--secondary{display:none}}
+ @media screen and (min-width:76.25em){.md-main__inner > .md-sidebar--primary{display:none}}
+ </style>
+
+ <div class="mdx-parallax" data-mdx-component="parallax">
+
+ <section class="mdx-parallax__group" data-md-color-scheme="slate">
+ <picture class="mdx-parallax__layer" style="--md-parallax-depth: 8; --md-image-position: 70%">
+ <source type="image/avif" srcset="{{ 'assets/hero/[email protected]' | url }}">
+ <img src="{{ 'assets/hero/[email protected]' | url }}" alt="" class="mdx-parallax__image" draggable="false">
+ </picture>
+ <picture class="mdx-parallax__layer" style="--md-parallax-depth: 5; --md-image-position: 25%">
+ <source type="image/avif" srcset="{{ 'assets/hero/[email protected]' | url }}">
+ <img src="{{ 'assets/hero/[email protected]' | url }}" alt="" class="mdx-parallax__image" draggable="false">
+ </picture>
+ <picture class="mdx-parallax__layer" style="--md-parallax-depth: 2; --md-image-position: 40%">
+ <source type="image/avif" srcset="{{ 'assets/hero/[email protected]' | url }}">
+ <img src="{{ 'assets/hero/[email protected]' | url }}" alt="" class="mdx-parallax__image" draggable="false">
+ </picture>
+ <picture class="mdx-parallax__layer" style="--md-parallax-depth: 1; --md-image-position: 50%">
+ <source type="image/avif" srcset="{{ 'assets/hero/[email protected]' | url }}">
+ <img src="{{ 'assets/hero/[email protected]' | url }}" alt="" class="mdx-parallax__image" draggable="false">
+ </picture>
+
+ <div class="mdx-parallax__layer mdx-parallax__blend"></div>
+
+ <div class="mdx-hero" data-mdx-component="hero">
+ <div class="mdx-hero__scrollwrap md-grid">
+ <div class="mdx-hero__inner">
+ <div class="mdx-hero__teaser md-typeset">
+ <h1>Your AI. Your keys. Your OS.</h1>
+ <p>PAI is a full Linux desktop on a USB drive — private AI, cold-signing, encryption, all of it local. Plug into any machine, boot into your own workspace in seconds, pull the drive. No cloud, no account, nothing left behind.</p>
+ <a href="{{ 'quickstart/' | url }}" class="md-button md-button--primary">Quickstart</a>
+ <a href="{{ 'general/how-pai-works/' | url }}" class="md-button">Learn more</a>
+ </div>
+ <div class="mdx-hero__more">
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 4h2v12l5.5-5.5 1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5 11 16z"/></svg>
+ </div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section class="mdx-parallax__group mdx-pillars" data-md-color-scheme="slate">
+ <div class="mdx-pillars__inner">
+ <div class="mdx-pillar">
+ <h3 class="mdx-pillar__title">Runs in RAM, leaves no trace</h3>
+ <p class="mdx-pillar__body">Boot from USB into a full Debian + Sway desktop that lives entirely in memory. Your host disk is never touched. Pull the drive and nothing remains.</p>
+ </div>
+ <div class="mdx-pillar">
+ <h3 class="mdx-pillar__title">Local AI, any model, your hardware</h3>
+ <p class="mdx-pillar__body">Ollama and Open WebUI are preinstalled. Run Llama, Mistral, Qwen, Gemma, or your own GGUF, with GPU offload on CUDA, ROCm, or Metal. No API keys, no quotas, no telemetry.</p>
+ </div>
+ <div class="mdx-pillar">
+ <h3 class="mdx-pillar__title">Privacy by construction</h3>
+ <p class="mdx-pillar__body">Hardened defaults, optional Tor routing, MAC randomization, and a LUKS-encrypted persistence option when you want to keep work between boots. Designed to be boring to surveil.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="mdx-parallax__group mdx-intro" data-md-color-scheme="slate">
+ <div class="mdx-intro__inner">
+ <div class="mdx-intro__card">
+ <h2>Overview</h2>
+ <p>PAI is a bootable USB Linux distribution that runs Ollama and Open WebUI locally. A complete offline AI workstation that lives entirely in RAM and leaves zero trace on your host machine.</p>
+ <a href="{{ 'general/how-pai-works/' | url }}" class="md-button">How PAI works →</a>
+ </div>
+ <div class="mdx-intro__card">
+ <h2>Quickstart</h2>
+ <p>Download the ISO, flash a USB stick, and boot from it. First launch takes under two minutes from power-on to a working local AI chat.</p>
+ <ol>
+ <li>Grab the latest ISO from <a href="https://pai.direct">pai.direct</a></li>
+ <li>Flash with <code>dd</code>, Rufus, or Raspberry Pi Imager</li>
+ <li>Boot your machine from USB and pick a model</li>
+ </ol>
+ <a href="{{ 'quickstart/' | url }}" class="md-button md-button--primary">Get started →</a>
+ </div>
+ </div>
+ </section>
+
+ </div>
+{% endblock %}
+
+{% block content %}{% endblock %}
+{% block footer %}{{ super() }}{% endblock %}
+```
+
+Things worth understanding here:
+
+- The four `<picture>` elements are the parallax layers. Their order in the DOM is back-to-front: layer 1 is the deepest (the landscape, depth 8); layer 4 is the closest (foreground plants, depth 1). The browser walks the DOM in document order, so this also matches paint order, which is what we want when `z-index` is computed from depth in the stylesheet.
+- The `--md-parallax-depth` and `--md-image-position` CSS custom properties are set inline. The stylesheet reads them via `var()` to compute the transform. Per-layer values stay in the template; global behaviour stays in the stylesheet.
+- The `.mdx-parallax__blend` div is a transparent-to-background gradient that fades the hero into the page. Without it, the hero ends with a hard edge against the next section.
+- The `.mdx-hero__scrollwrap` uses `position: sticky; top: 0; height: 100vh` so the hero text stays pinned in the viewport while the layers scroll under it. The `margin-bottom: -100vh` cancels the sticky element's contribution to the scroll height — the section is 140vh tall, the text is sticky for 100vh of that, and we want the next section to start at 140vh, not 240vh.
+
+---
+
+## Step 5 — Wire up `home.css`
+
+Create `pai-fresh/src/assets/stylesheets/home.css`. The full contents are reproduced below; every block is annotated so you understand which lines you can change without breaking the effect:
+
+```css
+:root {
+ --md-parallax-perspective: 2.5rem;
+}
+
+.md-main__inner { margin: 0; }
+.md-main__inner > .md-content,
+.md-main__inner > .md-sidebar--secondary { display: none; }
+
+.md-header:not(.md-header--shadow) {
+ background-color: initial;
+ transition: background-color 125ms, transform 125ms cubic-bezier(.1, .7, .1, 1), box-shadow 0ms;
+}
+.md-header--shadow {
+ transition: background-color .25s, transform .25s cubic-bezier(.1, .7, .1, 1), box-shadow .25s;
+}
+
+/* Scroll container */
+.mdx-parallax {
+ height: 100vh;
+ margin-top: -2.4rem;
+ overflow: hidden auto;
+ overscroll-behavior-y: none;
+ perspective: var(--md-parallax-perspective);
+ scroll-behavior: smooth;
+ width: 100vw;
+}
+
+/* Sections */
+.mdx-parallax__group {
+ background-color: var(--md-default-bg-color);
+ color: var(--md-typeset-color);
+ display: block;
+ position: relative;
+ transform-style: preserve-3d;
+}
+
+/* Hero section is taller than the viewport so layers have room to travel */
+.mdx-parallax__group:first-child {
+ background-color: initial;
+ contain: strict;
+ height: 140vh;
+}
+
+/* Layers */
+.mdx-parallax__layer {
+ height: max(120vh, 100vw);
+ pointer-events: none;
+ position: absolute;
+ top: 0;
+ transform:
+ translateZ(calc(var(--md-parallax-perspective) * var(--md-parallax-depth) * -1))
+ scale(calc(var(--md-parallax-depth) + 1));
+ transform-origin: 50vw 50vh;
+ width: 100vw;
+ z-index: calc(10 - var(--md-parallax-depth, 0));
+}
+
+.mdx-parallax__image {
+ display: block;
+ height: 100%;
+ object-fit: cover;
+ object-position: var(--md-image-position, 50%);
+ position: absolute;
+ width: 100%;
+ z-index: -1;
+}
+
+.mdx-parallax__blend {
+ background-image: linear-gradient(to bottom, transparent, var(--md-default-bg-color));
+ bottom: 0;
+ height: min(100vh, 100vw);
+ top: auto;
+}
+
+/* Hero text */
+.mdx-hero { display: block; height: inherit; }
+.mdx-hero__scrollwrap {
+ height: 100vh;
+ margin-bottom: -100vh;
+ position: sticky;
+ top: 0;
+ z-index: 9;
+}
+.mdx-hero__inner {
+ bottom: 3.2rem;
+ display: block;
+ position: absolute;
+ width: 100%;
+}
+.mdx-hero__teaser {
+ color: var(--md-primary-bg-color);
+ margin: 0 .8rem;
+ max-width: 27rem;
+}
+.mdx-hero__teaser :not(.md-button) { text-shadow: 0 0 .2rem #211d2dcc; }
+
+@media screen and (min-width: 60em) { .md-sidebar--secondary { display: none; } }
+@media screen and (min-width: 76.25em) { .md-sidebar--primary { display: none; } }
+```
+
+The mental model for the depth formula is short. The scroll container has `perspective: 2.5rem`. A layer with `--md-parallax-depth: 5` ends up at `translateZ(-12.5rem)` — five times the perspective, pushed away from the camera. Because the projection shrinks distant things, we counter with `scale(6)` (depth + 1) so the layer still fills the viewport. The browser, when scrolling the container, applies its standard 3D projection math; layers further from the camera traverse less screen distance per unit of scroll. That is the parallax. There is no JavaScript timer interpolating positions, no `scroll` event handler reading `window.scrollY` and updating transforms, no `requestAnimationFrame` loop. The animation is a side-effect of how the browser already renders 3D transforms during scroll.
+
+---
+
+## Step 6 — Generate hero artwork
+
+You need four images. The pai instance uses landscape photography — a far horizon, a mid-distance plateau, near plants, and very near plants — but the technique works for anything as long as the layers are visually separable by depth.
+
+You have three reasonable sourcing paths:
+
+1. **Photograph it yourself.** Take four photos that genuinely sit at different depths, then composite the foreground layers onto transparent backgrounds in any image editor.
+2. **Use stock.** Find a single landscape image and slice it into depth-sorted strata in Photoshop or Affinity. Less convincing, but quick.
+3. **Generate with AI.** This is what the upstream repo's `agents/image-agent.md` and `.claude/commands/generate-prompts.md` are for. Ask a diffusion model for a single coherent landscape, then ask for matching foreground passes with transparent backgrounds. Aim for 4096×2304 source images so the AVIF encode has headroom.
+
+For each layer, export PNG at 4× density (suffix `@4x`), with transparent backgrounds for everything except the deepest landscape layer. Filenames must match the template:
+
+- `[email protected]` — full background, opaque
+- `[email protected]` — mid-distance silhouette, transparent elsewhere
+- `[email protected]` — near foreground, transparent elsewhere
+- `[email protected]` — closest foreground, transparent elsewhere
+
+The numbering is intentionally non-sequential so you can drop in extra layers (3, 4) later without renaming everything.
+
+---
+
+## Step 7 — Convert to AVIF
+
+AVIF is the format the parallax assumes, and not by accident. At equivalent quality it is three to five times smaller than PNG, and the alpha channel is first-class — critical for the foreground layers.
+
+With `avifenc`:
+
+```bash
+for src in pai-fresh/src/assets/hero/*.png; do
+ avifenc --min 28 --max 36 --speed 4 "$src" "${src%.png}.avif"
+done
+```
+
+With `ffmpeg`:
+
+```bash
+for src in pai-fresh/src/assets/hero/*.png; do
+ ffmpeg -y -i "$src" -c:v libaom-av1 -still-picture 1 -crf 32 -b:v 0 "${src%.png}.avif"
+done
+```
+
+Sanity-check sizes. A 4096×2304 photographic layer should land between 250 and 600 KB. Foreground plant layers with large transparent areas often come in under 80 KB. If a layer is over a megabyte, your quality setting is too aggressive or your source image has too much noise.
+
+Place every `.avif` file in `pai-fresh/src/assets/hero/`. Delete the source PNGs from the docs tree once you have committed them somewhere safe (the repo's `pai/images/SCREENSHOTS.md` notes where the originals live).
+
+---
+
+## Step 8 — Tune depth, position, and crop
+
+This is the artistic step. You set four numbers per layer: depth (Z distance), object-position (which slice of the image is visible), the section height, and the global perspective. Tune in this order:
+
+1. **Depths.** Start with `8 / 5 / 2 / 1` for four layers. The ratio matters more than the absolute values. If layer 1 feels too aggressive, raise it to 10. If two adjacent layers visually merge, push them apart.
+2. **Object positions.** A landscape with the horizon in the upper third looks correct at `--md-image-position: 70%` (bottom-of-image is what shows). Foregrounds with subjects on the left often want `25%` or `40%`.
+3. **Hero height.** The `.mdx-parallax__group:first-child { height: 140vh }` rule sets the scroll length of the hero. Longer hero = slower-feeling effect. The media-query block in the reference stylesheet bumps height up to `150vw` on very wide viewports so the layers do not run out of vertical room before the user reaches the next section.
+4. **Perspective.** `--md-parallax-perspective: 2.5rem` is small. Smaller perspective = more dramatic depth. If you raise it to `5rem` the parallax becomes subtle; lower to `1.5rem` and it becomes operatic. Tune last; everything else is sensitive to it.
+
+Reload the page after every change. The effect is small enough that screenshots lie — you have to scroll it.
+
+---
+
+## Step 9 — Author content pages
+
+For every file you touched in Step 2, write at least a placeholder. Material renders empty markdown files as page-not-found, which breaks the nav. The bare minimum for a stub is:
+
+```markdown
+# Choosing a model
+
+Coming soon. See [Managing models](managing-models.md) for related guidance.
+```
+
+A handful of pages deserve real content from day one because they are linked from the hero CTAs:
+
+- `src/index.md` — gets shadowed by the parallax hero on the home route, but search and the sitemap still index it. Put a short, factual paragraph in plain markdown so screen readers and crawlers see something real.
+- `src/quickstart.md` — the "Quickstart" button on the hero points here. This is the single most important page after the home; write it carefully.
+- `src/general/how-pai-works.md` — the "Learn more" button. Three sections: the hardware story (USB, RAM-only), the software story (Debian + Sway + Ollama), and the privacy story (Tor, MAC randomization, LUKS persistence).
+
+Use Material's admonition extension for callouts:
+
+```markdown
+!!! warning "USB drives wear out"
+ Flash storage has a finite write count. If you enable persistence,
+ use a quality drive — Samsung BAR Plus, SanDisk Extreme Pro, or
+ similar — and back up your encrypted volume regularly.
+```
+
+Use tabbed content blocks for platform-specific install steps:
+
+```markdown
+=== "macOS"
+ ```bash
+ diskutil list
+ sudo dd if=pai.iso of=/dev/rdiskN bs=1m
+ ```
+
+=== "Linux"
+ ```bash
+ lsblk
+ sudo dd if=pai.iso of=/dev/sdX bs=4M status=progress
+ ```
+
+=== "Windows"
+ Use Rufus or Raspberry Pi Imager.
+```
+
+Both are enabled in the `markdown_extensions` block from Step 3.
+
+---
+
+## Step 10 — Add brand CSS
+
+The parallax stylesheet handles the hero. Brand styling — accent colours, button shapes, link decoration — goes in a second stylesheet. Create `pai-fresh/src/assets/pai-theme.css`:
+
+```css
+:root {
+ --md-primary-fg-color: #0e7c66;
+ --md-primary-fg-color--light: #14a484;
+ --md-primary-fg-color--dark: #094f41;
+ --md-accent-fg-color: #14a484;
+}
+
+[data-md-color-scheme="slate"] {
+ --md-default-bg-color: #0a0d10;
+ --md-default-fg-color: #e6e9ec;
+ --md-typeset-color: #d8dde2;
+ --md-typeset-a-color: #14a484;
+}
+
+.md-button--primary {
+ background-color: var(--md-primary-fg-color);
+ border-color: var(--md-primary-fg-color);
+}
+
+.mdx-pillars__inner,
+.mdx-intro__inner {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
+ gap: 2rem;
+ max-width: 64rem;
+ margin: 0 auto;
+ padding: 6rem 1.5rem;
+}
+
+.mdx-pillar__title { font-size: 1.25rem; margin-bottom: .5rem; }
+.mdx-pillar__body { color: var(--md-default-fg-color--light); line-height: 1.6; }
+
+.mdx-intro__card {
+ background: rgba(255,255,255,.03);
+ border: 1px solid rgba(255,255,255,.06);
+ border-radius: .5rem;
+ padding: 2rem;
+}
+```
+
+Both stylesheets are listed under `extra_css` in `mkdocs.yml`. Order matters: load `pai-theme.css` first so `home.css` can override it where needed.
+
+---
+
+## Step 11 — Run it locally
+
+From the repo root:
+
+```bash
+cd pai-fresh
+mkdocs serve --dev-addr 0.0.0.0:8000
+```
+
+Open `http://localhost:8000`. You should see the hero, the pillars, the intro cards, and a working tab nav. Scroll the hero — the foreground plants should blur past faster than the distant landscape. If they all move at the same speed, your `transform-style: preserve-3d` got dropped from `.mdx-parallax__group`, or the `perspective` is on the wrong element (must be on `.mdx-parallax`, not `body`).
+
+Common first-run issues:
+
+- **Blank hero, all layers white.** AVIF source paths are wrong. Open devtools → Network and check the asset URLs. The Jinja `{{ '...' | url }}` filter resolves relative to the site URL, not the markdown file.
+- **Hero text scrolls with the layers.** The `.mdx-hero__scrollwrap` lost its `position: sticky`. Some Material updates inject conflicting layout into `.md-grid`; if you upgrade, recheck.
+- **Hero is tiny on Safari.** Safari interprets `contain: strict` differently on the first paint. The reference stylesheet ships a `.safari .mdx-parallax__group:first-child { contain: none; }` opt-out keyed on a class you set with one line of JS in your override (`document.documentElement.classList.add('safari')` inside a UA sniff). Do this in `overrides/main.html` if you care about Safari users.
+- **Hero is jumpy on Firefox.** Same fix, different class: `.ff-hack`. Firefox's containment behaviour pre-115 produced visible flashes; the override turns containment off entirely on those builds.
+
+---
+
+## Step 12 — Deploy to GitHub Pages
+
+The pai site lives at `docs.pai.direct`, served by GitHub Pages from the `gh-pages` branch of `nirholas/pai`. Replicate the same setup on your fork.
+
+Add a deploy workflow at `.github/workflows/pages.yml`:
+
+```yaml
+name: Deploy docs
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'pai-fresh/**'
+ - '.github/workflows/pages.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: pages
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+ cache: pip
+ - run: pip install -r pai-fresh/requirements.txt
+ - run: mkdocs build --config-file pai-fresh/mkdocs.yml --strict
+ - uses: actions/upload-pages-artifact@v3
+ with:
+ path: pai-fresh/_site
+
+ deploy:
+ needs: build
+ runs-on: ubuntu-latest
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - id: deployment
+ uses: actions/deploy-pages@v4
+```
+
+The `--strict` flag in the build step turns broken links and missing nav targets into hard errors. Use it; the alternative is silently shipping 404s.
+
+In the repo settings, under Pages, choose "GitHub Actions" as the source. Push to `main`, watch the workflow, and the site will publish to `https://<your-user>.github.io/<repo>/`.
+
+---
+
+## Step 13 — Wire up the custom domain
+
+For `docs.pai.direct` (or whatever subdomain you control), add a `CNAME` record at your DNS host pointing the subdomain to `<your-user>.github.io`. Then in the repo, create `pai-fresh/src/CNAME`:
+
+```
+docs.pai.direct
+```
+
+Material copies any file in `docs_dir` to the build output verbatim, so `_site/CNAME` lands in the gh-pages artifact and Pages picks it up. After the first deploy, GitHub will provision a Let's Encrypt certificate automatically — usually within ten minutes, sometimes longer. Tick "Enforce HTTPS" in the Pages settings once it is available.
+
+---
+
+## Step 14 — Performance and accessibility
+
+A few non-negotiables before you call it done:
+
+- **Decorative alt text.** All four parallax layers carry `alt=""` and `draggable="false"` because they are decoration. Screen readers will skip them, which is correct — the meaningful content is the hero text.
+- **Reduced motion.** The parallax respects scroll speed but does not honour `prefers-reduced-motion`. Add a media query that flattens the depth for users who request it:
+ ```css
+ @media (prefers-reduced-motion: reduce) {
+ .mdx-parallax__layer { transform: none; }
+ .mdx-hero__more { animation: none; }
+ }
+ ```
+- **Focus order.** The sticky hero text sits inside the same DOM section as the layers, so tabbing works without surprises. Verify by tabbing from the hero CTAs into the pillars without using the mouse.
+- **Lighthouse.** Aim for 95+ on Performance, 100 on Accessibility. The parallax costs almost nothing at runtime — no JS, decoded AVIFs are cached by the browser — but if a layer is oversized you will see a bad LCP score. Resize sources before encoding rather than relying on `object-fit` to compensate.
+
+---
+
+## Step 15 — Iterate
+
+You now have the entire pai site standing up locally and on a custom domain. Everything past this point is content. Keep these habits as you fill in pages:
+
+- **Run `mkdocs build --strict` before every commit.** It catches broken links earlier than CI.
+- **Diff your `mkdocs.yml` carefully.** A single mis-indented nav entry can hide an entire section from the sidebar.
+- **Compress new artwork up front.** Resist the temptation to commit a 2 MB PNG and "fix it later". Later does not arrive.
+- **Tune the hero with users present.** The parallax is the brand. Grab a colleague, screen-share, scroll the page, and watch their reaction. If they do not notice the depth in the first three seconds, your layer separation is too subtle. If they comment on it before reading the text, it is too loud.
+
+---
+
+## Where to look in the reference repo
+
+When something does not match, compare against the upstream files directly. The most useful ones, in order:
+
+- [`pai/mkdocs.yml`](https://github.com/nirholas/scroll-zoom-thing/blob/main/pai/mkdocs.yml) — production config
+- [`pai/overrides/home.html`](https://github.com/nirholas/scroll-zoom-thing/blob/main/pai/overrides/home.html) — production hero with pillars and intro cards
+- [`docs/assets/stylesheets/home.css`](https://github.com/nirholas/scroll-zoom-thing/blob/main/docs/assets/stylesheets/home.css) — annotated stylesheet
+- [`docs/how-it-works.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/docs/how-it-works.md) — the math, in prose
+- [`docs/your-own-layers.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/docs/your-own-layers.md) — guidance on choosing depths and crops
+- [`agents/image-agent.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/agents/image-agent.md) — prompts for AI-generated artwork
+- [`.claude/commands/setup-parallax.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/.claude/commands/setup-parallax.md) — slash-command bundle for Claude Code that scaffolds the whole parallax in one go
+
+The repo also ships `llms.txt` and `llms-full.txt` files that summarise the technique for AI assistants. If you ask Claude or another agent to extend the site, point it at those files first; they are the most concise statement of intent the project has.
+
+---
+
+## Closing notes
+
+What you have built is a complete documentation site whose landing page is a piece of standard browser geometry — `perspective`, `translateZ`, `scale`, `position: sticky`. The parallax has no JavaScript, no animation library, no scroll-driven layout calculations. It is fast on a 2015 laptop, smooth on a phone, accessible to a screen reader, and degrades to a stack of static images on browsers that do not support `perspective` (a vanishingly small set in 2026).
+
+The same pattern works for any product site. Swap the artwork, retune the depths, rewrite the hero copy, and you have your own version. The thing that took the upstream maintainers the longest was not the CSS — it was discovering that the trick is to let the browser do the work, and to stop reaching for JavaScript every time the word "parallax" appears in a design.
+
+Ship it.
+
+---
+
+# Part Two — Going deeper
+
+The first half of this tutorial gets you to a working pai clone. The second half is the long tail: extra companion pages, the AI prompt strategy that produced the upstream artwork, the Safari and Firefox JavaScript escapes, multi-section parallax, content-authoring patterns, and a checklist for the moment before you flip DNS.
+
+Skip ahead if you only need a specific section. Everything below is independently useful.
+
+---
+
+## Step 16 — Add the technique-explainer pages
+
+The pai site links the marketing hero to a real explanation of how the parallax works. Two short companion pages do the heavy lifting in the upstream repo, and you should ship them on your fork too — they answer questions you will otherwise field over Twitter for the next year.
+
+Create `pai-fresh/src/development/how-parallax-works.md`:
+
+```markdown
+---
+title: How CSS 3D Parallax Works
+description: Technical deep-dive into CSS perspective, translateZ, and scale.
+---
+
+# How CSS 3D Parallax Works
+
+A CSS `perspective` value on a scroll container creates a 3D vanishing
+point. Any child element with a `translateZ` transform is rendered at
+a perceived depth — and because it is visually further away, it
+appears to move slower as the container scrolls. This is not
+simulated. It is the browser's real 3D projection math applied to
+normal scroll rendering.
+
+## The four pieces
+
+1. **The scroll container.** `.mdx-parallax` has `overflow: hidden auto`
+ and `perspective: 2.5rem`. The element scrolls; `html` and `body`
+ do not.
+
+2. **Depth via `translateZ`.** Each layer is pushed back by
+ `depth × perspective`. A layer at depth 8 sits at `translateZ(-20rem)`.
+ Because it is further from the camera, it covers less screen
+ distance per unit of scroll. That is the parallax.
+
+3. **Scale compensation.** `scale(depth + 1)` undoes the apparent size
+ reduction from pushing the layer back. Without it, deeper layers
+ would render smaller than the viewport.
+
+4. **Sticky hero text.** The hero copy lives inside a
+ `position: sticky` wrapper with `margin-bottom: -100vh`. It pins
+ to the viewport while the layers scroll behind it, then releases
+ when the next section arrives.
+```
+
+Then `pai-fresh/src/development/your-own-layers.md`, which is the page someone reads when they decide to swap the artwork:
+
+```markdown
+---
+title: Using your own layers
+description: How to create and export layered AVIF images.
+---
+
+# Using your own layers
+
+## Image requirements
+
+| Property | Recommendation |
+|---------------|------------------------------------------------|
+| Format | AVIF (best), WebP fallback, PNG last resort |
+| Dimensions | Wide panorama — at least 1920×600 |
+| Transparency | Required for mid and foreground layers |
+| Naming | `[email protected]`, `[email protected]`, etc. |
+
+## How many layers
+
+Four is the sweet spot. Fewer and the effect is subtle; more and you
+are paying file size for imperceptible depth.
+
+| Layer | Contents | Depth |
+|-------|----------------------------------------|-------|
+| 1 Far | Sky, horizon — opaque | 8 |
+| 2 Mid | Buildings, terrain — transparent | 5 |
+| 3 Near| Foliage, structures — transparent | 2 |
+| 4 Front| Closest plants, frame — transparent | 1 |
+
+## Wiring layers in `home.html`
+
+Each `<picture>` gets two inline custom properties:
+
+- `--md-parallax-depth` — how far back the layer sits
+- `--md-image-position` — maps to `object-position`, picks which
+ vertical slice is visible (0% top, 100% bottom)
+
+Tune `--md-image-position` per layer. A landscape with the horizon in
+the upper third often wants 70% (so the bottom of the image shows).
+A foreground with subjects on the left wants 25%.
+```
+
+Both pages should appear in the Development section of `mkdocs.yml`:
+
+```yaml
+- Development:
+ - How parallax works: development/how-parallax-works.md
+ - Use your own layers: development/your-own-layers.md
+```
+
+These pages are short on purpose. They link from the hero "Learn more" button as a fallback — anyone who sees the parallax and wants to know how it was built lands here within two clicks.
+
+---
+
+## Step 17 — A serious AI image-generation workflow
+
+The reference repo's `agents/image-agent.md` exists because making four cohesive layers is the single hardest part of building a parallax site. A photo set that does not depth-sort is the difference between a site that ships and a site that drags for two months. Here is the workflow the pai artwork was generated with, distilled into something you can run without an agent.
+
+### Decide the scene before prompting
+
+Write a one-sentence brief covering subject, time of day, palette, and aspect. Example: *"A high desert plateau at blue hour, indigo and slate palette, 16:5 panoramic, sparse foreground vegetation."* This sentence becomes the style anchor that every layer prompt repeats verbatim. Layers that drift in lighting or palette will not composite — you will spend an afternoon trying to colour-correct them and conclude you have to start over.
+
+### Layer prompts
+
+For each of the four layers, prompt for the same scene at a different depth plane. The key trick is that each prompt asks for **only** the elements at that depth and explicitly excludes everything else. Use this structure:
+
+```
+[STYLE ANCHOR sentence, verbatim from above]
+
+Subject for this depth plane:
+[depth 8] - "the distant landscape only — sky, horizon, mountains.
+ No mid-distance plateau. No foreground. Opaque background."
+[depth 5] - "the mid-distance plateau only — silhouette of plateau
+ and rolling hills. No sky. No foreground vegetation.
+ Transparent background."
+[depth 2] - "near-foreground vegetation only — sparse desert plants
+ standing 0.5–2 metres tall. No plateau. No sky.
+ Transparent background."
+[depth 1] - "very-near foreground only — tall grasses and a single
+ agave silhouette occupying the bottom third of the frame.
+ No mid-ground. No sky. Transparent background."
+
+Aspect: 16:5 panoramic. Render: 4096 × 1280 minimum.
+```
+
+### Tool-specific notes
+
+- **Google ImageFX** — the upstream pai layers were generated here. ImageFX produces clean cut-outs when you specify "no background" explicitly, and the per-prompt style consistency is good enough to skip a separate style-locking step.
+- **Midjourney** — add `--ar 16:5 --style raw` and use `--no background` for transparent layers. Style-lock with `--sref` to a single reference URL so all four layers inherit the same look.
+- **DALL·E 3** — paste the style anchor verbatim into every prompt. Add `"isolated on white"` and remove the white in post with `rembg`; DALL·E does not honour `transparent PNG` reliably.
+- **Stable Diffusion** — ControlNet depth maps are the secret weapon. Generate one full scene, extract the depth map, then run inpainting four times to isolate each depth plane. This produces the cleanest cohesion of any tool but takes the longest.
+
+### Background removal
+
+If your tool does not produce true alpha, run the layers through `rembg`:
+
+```bash
+pip install "rembg[cli]"
+for f in pai-fresh/src/assets/hero/*-raw.png; do
+ rembg i --alpha-matting "$f" "${f%-raw.png}.png"
+done
+```
+
+`--alpha-matting` matters for vegetation: without it, leaf edges become hard mattes and the foreground reads as cardboard.
+
+### Checking before encoding
+
+Open all four PNGs in any image editor as a stack, deepest at the bottom. Toggle each layer on and off. The full stack should read as a coherent scene. The deepest layer alone should read as a flat backdrop. Each transparent layer alone should read as a meaningful silhouette against a checkerboard. If any of those three checks fail, regenerate that layer before encoding to AVIF — it is much easier to fix at PNG stage.
+
+---
+
+## Step 18 — The Safari and Firefox JavaScript escapes
+
+The pure-CSS parallax is pure-CSS in the steady state. The two browser bugs that justify a few lines of JavaScript live entirely in the boot path; once the page has scrolled three thousand pixels, the JS unbinds and never runs again.
+
+Add `pai-fresh/overrides/main.html` to extend Material's base layout with a tiny header script:
+
+```jinja
+{% extends "base.html" %}
+
+{% block extrahead %}
+ {{ super() }}
+ <script>
+ // Safari treats `contain: strict` so aggressively that scaled-up
+ // 3D layers get clipped to invisibility. Detect Safari and let
+ // the stylesheet opt out via the `.safari` class.
+ if (navigator.vendor === "Apple Computer, Inc.") {
+ document.documentElement.classList.add("safari");
+ }
+
+ // Firefox shows a one-frame flash on the first scroll because
+ // its containment painter releases later than Chromium's.
+ // The fix: set `.ff-hack` on body until the user has scrolled
+ // past the danger zone, then remove it.
+ if (navigator.userAgent.includes("Gecko/")) {
+ document.body.classList.add("ff-hack");
+ const el = document.querySelector(".mdx-parallax");
+ if (el) {
+ const handler = () => {
+ if (el.scrollTop > 3000) {
+ document.body.classList.remove("ff-hack");
+ el.removeEventListener("scroll", handler);
+ } else {
+ document.body.classList.toggle("ff-hack", el.scrollTop <= 1);
+ }
+ };
+ el.addEventListener("scroll", handler, { passive: true });
+ }
+ }
+ </script>
+{% endblock %}
+```
+
+The corresponding stylesheet rules already live in `home.css` from Step 5:
+
+```css
+.safari .mdx-parallax__group:first-child { contain: none; }
+.ff-hack .mdx-parallax__group:first-child { contain: none !important; }
+```
+
+Two notes on the trade-off. First, this is the only JavaScript on the home page. Stripping it out costs you Safari and Firefox visitors who would otherwise see a clipped or flashing hero. Second, the UA sniff is intentional. Feature detection does not help here; the bugs are about how the browser implements features it claims to support. UA sniffs age badly in general but age fine for "is this engine WebKit or Gecko."
+
+---
+
+## Step 19 — Multiple parallax sections
+
+The pai instance has three sections: the hero, the pillars, and the intro cards. The reference `docs/overrides/home.html` only has one. Once you understand how the second and third sections compose, you can add as many as you like.
+
+The structure is identical for every group:
+
+```html
+<section class="mdx-parallax__group" data-md-color-scheme="slate">
+ <!-- content -->
+</section>
+```
+
+What changes between groups is:
+
+- **The first group has layers and is taller than 100vh.** It contains the `<picture>` elements and the sticky hero. Its height is 140vh on narrow viewports, scaling with width on wider ones.
+- **Subsequent groups are normal-height content panels.** They do not contain `<picture>` elements. They use `data-md-color-scheme` to switch between slate and default as the user scrolls. They get their own padding and grid layouts via per-section classes (`mdx-pillars`, `mdx-intro`).
+
+The transition between groups is visual: as the user scrolls past the hero, the gradient blend layer fades the hero into the page background, and the next group's solid background takes over. There is no JavaScript fade; both groups simply render in the same scroll container, and the blend layer sits on top of the layers but below the next group.
+
+To add a fourth section — say, a "frequently asked questions" panel — append another group inside `.mdx-parallax`:
+
+```html
+<section class="mdx-parallax__group mdx-faq" data-md-color-scheme="default">
+ <div class="mdx-faq__inner">
+ <h2>Frequently asked</h2>
+ <details>
+ <summary>Does PAI work without internet?</summary>
+ <p>Yes. Models you have already pulled run entirely locally.</p>
+ </details>
+ <!-- more <details> -->
+ </div>
+</section>
+```
+
+Then style `.mdx-faq` and `.mdx-faq__inner` in `pai-theme.css` the same way you styled `.mdx-pillars`. The parallax does not care how many groups you add.
+
+---
+
+## Step 20 — Responsive depth tuning
+
+The depth values that look right on a 14-inch laptop look subtle on a 32-inch ultrawide. Two strategies handle this without breaking the basic effect.
+
+**Strategy A — scale perspective with viewport.** Replace the static `:root { --md-parallax-perspective: 2.5rem; }` with a clamp:
+
+```css
+:root {
+ --md-parallax-perspective: clamp(1.5rem, 2.5vw, 3rem);
+}
+```
+
+This shrinks perspective on small screens (more dramatic depth) and grows it on big ones (more subtle). It is a one-liner and covers most cases.
+
+**Strategy B — adjust depth at breakpoints.** When clamping is not enough, override per-layer depths inside a media query:
+
+```css
+@media (min-width: 120em) {
+ .mdx-parallax__layer:nth-child(1) { --md-parallax-depth: 10; }
+ .mdx-parallax__layer:nth-child(2) { --md-parallax-depth: 7; }
+ .mdx-parallax__layer:nth-child(3) { --md-parallax-depth: 3; }
+ .mdx-parallax__layer:nth-child(4) { --md-parallax-depth: 1.5; }
+}
+```
+
+Use Strategy A for everyone, then layer Strategy B on top for ultrawide if you actually have ultrawide users to test on. Do not apply B blindly; on a 16:9 monitor it just makes the foreground feel detached.
+
+The hero height also needs to grow with viewport width or layers run out of vertical room. The default stylesheet ships with these breakpoints:
+
+```css
+@media (min-width: 125vh) { .mdx-parallax__group:first-child { height: 120vw; } }
+@media (min-width: 150vh) { .mdx-parallax__group:first-child { height: 130vw; } }
+@media (min-width: 200vh) { .mdx-parallax__group:first-child { height: 150vw; } }
+@media (min-width: 250vh) { .mdx-parallax__group:first-child { height: 160vw; } }
+```
+
+The unit is intentional: `min-width` in `vh` measures viewport aspect ratio, not absolute width. A 1920×600 ultrawide laptop and a 3840×1200 desktop monitor both have width-greater-than-2×-height, so they both pick up the `min-width: 200vh` rule even though their pixel widths are wildly different.
+
+---
+
+## Step 21 — Performance budget
+
+The site has to feel instant. A parallax that drops frames is worse than no parallax. Set a performance budget before you ship and measure against it.
+
+**Targets:**
+
+- **Largest Contentful Paint (LCP) under 2.0 s** on a Moto G4 throttled to 4× CPU and Slow 4G in Lighthouse.
+- **Cumulative Layout Shift (CLS) under 0.05.** The parallax layers have explicit `width: 100vw; height: max(120vh, 100vw)`, so they should not shift. The hero text is sticky, so it should not shift either. CLS should be effectively zero.
+- **Interaction to Next Paint (INP) under 200 ms.** The home page has no event handlers; INP only matters once the user navigates to a content page.
+- **Total transfer size on home under 800 KB.** Four AVIF layers at 200 KB each is your budget; the Material theme adds about 80 KB CSS and 60 KB JS gzip.
+
+**Three things that wreck the budget if you let them:**
+
+1. **Source AVIFs over a megabyte.** Re-encode at higher CRF or smaller dimensions. A foreground layer with mostly transparent area should weigh under 60 KB.
+2. **Preload of the wrong layer.** The `<link rel="preload">` should target the closest layer (depth 1) — that is the one painted on top, the one whose absence is most visible. Preloading the deep landscape is the common mistake; it is the layer the user notices last.
+3. **Layout containment turned off everywhere.** The `.safari` and `.ff-hack` opt-outs are scoped to the first group. Do not move `contain: none` higher in the cascade — every group benefits from containment, only the first hero group has the bug.
+
+Run Lighthouse twice: once on a cold load (browser cache cleared, throttling on) and once on a warm reload. Cold should hit 90+ Performance; warm should hit 99+.
+
+---
+
+## Step 22 — Authoring the long tail of content
+
+The home page is the smallest part of a docs site. The PAI nav has roughly seventy markdown files. A few authoring patterns make that volume manageable.
+
+**Use `pymdownx.snippets` for repeated blocks.** Things like the standard install warning, the "needs a UEFI machine" note, or the "this requires persistence enabled" callout should live in `_includes/` and be pulled in with `--8<-- "warnings/needs-persistence.md"`. Editing once updates everywhere.
+
+**Use Mermaid for diagrams, sparingly.** The architecture pages benefit from one or two flowcharts. Avoid stuffing every page with a diagram; Mermaid renders client-side and adds 200 KB of JS to any page that uses it.
+
+**Tabbed install paths.** Quickstart, USB flashing, and persistence pages all need three tabs (macOS, Linux, Windows). Standardise the tab order and labels across the site so users learn to ignore the irrelevant ones.
+
+**Cross-link aggressively.** Material's search is good but cold. The first-time visitor follows links, not search. Every callout that mentions a feature should link to its dedicated page. Every dedicated page should link back to two or three related pages.
+
+**Audit dead links before each release.** Run `mkdocs build --strict` in CI; it fails the build on broken anchors. Do not let strict-mode warnings accumulate; once you have ten, you stop reading them.
+
+---
+
+## Step 23 — Pre-launch checklist
+
+Before you flip DNS and announce, run through this list. Each item takes under a minute; the whole list takes ten.
+
+- [ ] `mkdocs build --strict` passes locally with no warnings.
+- [ ] `mkdocs serve` shows the parallax scrolling correctly on Chrome, Safari, Firefox.
+- [ ] The hero CTAs (Quickstart, Learn more) point to real pages that exist.
+- [ ] All four AVIF layers return 200 in devtools Network panel.
+- [ ] No layer is over 600 KB; foreground layers are under 80 KB.
+- [ ] Lighthouse Performance ≥ 90, Accessibility = 100, Best Practices = 100, SEO = 100.
+- [ ] `prefers-reduced-motion: reduce` flattens the parallax (test by enabling reduce motion in OS settings).
+- [ ] Tab order works without a mouse: Tab from page load reaches both hero CTAs in two presses.
+- [ ] Search indexes content (open `/search.html` and search for a known string).
+- [ ] `site_url` in `mkdocs.yml` matches the production URL exactly.
+- [ ] `CNAME` file in `src/` matches the production domain.
+- [ ] DNS CNAME record points to `<your-user>.github.io`.
+- [ ] HTTPS is enforced in Pages settings; cert is issued.
+- [ ] 404 page renders (Material ships one by default; verify it picks up your theme).
+- [ ] `robots.txt` and `sitemap.xml` are generated (Material does this automatically when `site_url` is set).
+- [ ] Social cards plugin is configured (optional but recommended; sets the Open Graph image so links unfurl on Twitter and Slack).
+
+If every box is ticked, you are done. Push to `main`, watch the Pages workflow, and announce.
+
+---
+
+## Step 24 — Iterating after launch
+
+The first version of the site is wrong. Every site is. The differences between the v1 and v3 of the upstream pai site, judging by commit history, were almost entirely:
+
+1. **Hero copy.** The first hero said too much. The fourth one said the right amount in fewer words. Watch what gets quoted on Twitter; that is the line that should be the H1.
+2. **Layer count and depth.** v1 had three layers and felt flat. v3 has four with depths 8/5/2/1. Adding a fifth layer was tested and rolled back; it added file size without perceptible depth.
+3. **Pillar copy.** Three pillars is the right number. The pillar bodies got shorter every revision; the final versions are ~30 words each.
+4. **Nav tree.** The first nav had every page at the top level. The fourth nav grouped pages under Overview / Getting started / Guides / etc. Users do not read the sidebar from top to bottom; they scan section headers.
+
+Treat launch as the start of authoring, not the end. Keep an `ideas.md` outside the docs tree where you collect things you noticed after shipping; review it monthly; merge the best ones in batches. Resist the urge to redesign the parallax — the depth math is the one thing that does not need to change.
+
+---
+
+## Appendix A — The full file tree
+
+What you should have on disk by the end:
+
+```
+scroll-zoom-thing/
+├── pai-fresh/
+│ ├── mkdocs.yml
+│ ├── requirements.txt
+│ ├── overrides/
+│ │ ├── home.html
+│ │ └── main.html
+│ └── src/
+│ ├── CNAME
+│ ├── index.md
+│ ├── quickstart.md
+│ ├── installation.md
+│ ├── using-pai.md
+│ ├── general/
+│ │ ├── how-pai-works.md
+│ │ ├── features-included.md
+│ │ ├── system-requirements.md
+│ │ └── warnings-and-limitations.md
+│ ├── first-steps/
+│ ├── ai/
+│ ├── apps/
+│ ├── advanced/
+│ ├── privacy/
+│ ├── persistence/
+│ ├── examples/
+│ ├── architecture/
+│ ├── development/
+│ │ ├── how-parallax-works.md
+│ │ └── your-own-layers.md
+│ ├── reference/
+│ ├── api/
+│ ├── PHILOSOPHY.md
+│ ├── VISION.md
+│ ├── CHANGELOG.md
+│ └── assets/
+│ ├── pai-logo-white.png
+│ ├── pai-theme.css
+│ ├── stylesheets/
+│ │ └── home.css
+│ └── hero/
+│ ├── [email protected]
+│ ├── [email protected]
+│ ├── [email protected]
+│ └── [email protected]
+└── .github/
+ └── workflows/
+ └── pages.yml
+```
+
+Roughly seventy markdown files, four AVIFs, two stylesheets, two Jinja overrides, one workflow, one `mkdocs.yml`. That is the entire site.
+
+---
+
+## Appendix B — Common build errors and what they mean
+
+**`Config value: 'docs_dir'. Error: The path 'docs' isn't an existing directory.`**
+You forgot to set `docs_dir: src` in `mkdocs.yml`, or you are running `mkdocs` from the wrong directory.
+
+**`The following pages exist in the docs directory, but are not included in the "nav" configuration:`**
+Material warns about orphan files. Either add them to the nav or delete them. Strict mode turns this warning into an error; that is on purpose.
+
+**`Doc file 'index.md' contains a link to 'quickstart/' which is not found in the documentation files.`**
+The link target uses a directory-style URL but the file does not exist. Either create `quickstart.md` or update the link.
+
+**`unsupported operand type(s) for &: 'str' and 'str'`**
+An older `pymdown-extensions` against a newer `mkdocs-material`. Pin both in `requirements.txt`.
+
+**Hero is invisible on first paint, appears after the first scroll on Firefox.**
+The `.ff-hack` script is missing or scoped wrong. Re-check `overrides/main.html`.
+
+**Hero layers all render at the same depth on Safari.**
+The `.safari` class is not being applied. Check `navigator.vendor === "Apple Computer, Inc."` matches in your script (it does, exactly).
+
+---
+
+## Appendix C — Where to read further
+
+The upstream repo is the canonical reference. After this tutorial, the files most worth reading are:
+
+- [`agents/parallax-agent.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/agents/parallax-agent.md) — instructions for an AI agent that can scaffold the parallax from a single brief.
+- [`.claude/commands/tune-layers.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/.claude/commands/tune-layers.md) — slash command that adjusts depths and image positions interactively.
+- [`.claude/commands/convert-images.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/.claude/commands/convert-images.md) — automated PNG→AVIF pipeline with sensible quality defaults.
+- [`docs/advanced-css.md`](https://github.com/nirholas/scroll-zoom-thing/blob/main/docs/advanced-css.md) — multiple groups, color-scheme transitions, ultrawide tuning.
+- [Material for MkDocs reference](https://squidfunk.github.io/mkdocs-material/reference/) — the underlying theme. Almost every visual choice in pai is a Material convention; if something looks like it should be configurable, it usually is.
+
+The technique is small. The art is in the tuning. Build it, scroll it, show it to someone, tune it, repeat.
diff --git a/docs/your-own-layers.md b/docs/your-own-layers.md
new file mode 100644
index 000000000..4777e4d3e
--- /dev/null
+++ b/docs/your-own-layers.md
@@ -0,0 +1,340 @@
+# Using Your Own Layers
+
+This guide walks through everything you need to know to replace the default hero images with your own artwork. It covers image format selection, dimension requirements, transparency rules, depth value strategy, scene composition principles, and the mechanics of wiring new images into the theme. By the end, you will be able to swap any set of layered images into the parallax hero with confidence.
+
+---
+
+## Why Four Layers?
+
+The theme ships with exactly four image layers, and this is a deliberate choice, not a technical limitation.
+
+**Fewer than four** (two or three layers) produces a noticeably shallow depth effect. The human visual system picks up parallax cues from relative motion between planes. With only two planes, the separation feels thin — more like a cheap slideshow transition than genuine depth.
+
+**More than four** (five or six layers) begins to have diminishing returns on perceived depth while multiplying file size substantially. Each additional AVIF layer adds to the initial page load. At four layers, users with fast connections load the hero in well under a second. At six or seven layers, you may see layout shift or a flash of empty space while the far layers load.
+
+Four layers also maps cleanly to the natural visual hierarchy of most landscape compositions: sky/far background, mid-distance scenery, near-ground elements, and foreground detail. This four-plane model is how matte painters and game background artists have structured parallax scrollers for decades — because it matches how human eyes decompose distance in the real world.
+
+If your scene genuinely needs five planes (for example, a foggy mountain range with a distinct middle-fog layer), adding a fifth is technically straightforward. Just be deliberate about it.
+
+---
+
+## Image Format Comparison
+
+| Format | Compression | Alpha (Transparency) | Browser Support | Recommended Use |
+|--------|-------------|---------------------|-----------------|-----------------|
+| AVIF | Excellent (AV1-based) | Yes (full alpha channel) | Chrome 85+, Firefox 93+, Safari 16+ | Primary format for all layers |
+| WebP | Good (VP8-based) | Yes | Chrome 32+, Firefox 65+, Safari 14+ | Fallback for older Safari |
+| PNG | Lossless | Yes | Universal | Source files only; not for production |
+| JPEG | Good (DCT-based) | No | Universal | Far background only (no transparency needed) |
+
+**AVIF** is the primary format for this theme. It delivers dramatically smaller file sizes than WebP or PNG at equivalent visual quality — typically 40–60% smaller than WebP and 70–80% smaller than PNG for photographic content. For the wide panoramic images that parallax layers require (often 3000px+ wide), this difference is significant.
+
+AVIF supports a full alpha channel, which is critical for mid-distance, near-ground, and foreground layers (more on this below). The alpha channel in AVIF uses the same AV1 compression as the color data, so transparent regions cost very little in file size compared to PNG's lossless transparency.
+
+**WebP** should be provided as a `<source>` fallback in the `<picture>` element for users on Safari 14–15, which supports WebP but not AVIF. Safari 16+ supports AVIF natively, so WebP coverage is increasingly less necessary, but it remains good practice.
+
+**PNG** should be used only for source/master files during the design phase. Never ship raw PNGs as hero layer images in production — a single transparent PNG at 3000×2000px can easily exceed 5MB, versus under 300KB for an equivalent AVIF.
+
+**JPEG** can be used for the far background layer if it has no transparency requirement, but AVIF still outperforms JPEG at the same file size, so there is rarely a reason to reach for JPEG.
+
+---
+
+## Exact Dimensions
+
+### Minimum Dimensions
+
+No layer should be smaller than the maximum viewport width you expect users to visit your site on. In practice, `2400px` wide is a safe minimum for desktop displays including high-density (2x) monitors at 1440px logical width. For near/foreground layers that are scaled up by the depth compensation factor, you need additional resolution.
+
+Calculate the minimum raw image width for each layer using:
+
+```
+minimum_width = viewport_max_width × scale_factor
+```
+
+Where `scale_factor = depth + 1` (matching the CSS scale compensation). For the far background at depth 8:
+
+```
+minimum_width = 1440 × 9 = 12,960px
+```
+
+That looks alarming, but the browser's compositor only ever renders the visible portion of a scaled layer, and AVIF compression means a 12,000px-wide sky image might still only be 400KB due to the repetitive nature of sky gradients.
+
+In practice, the scale compensation is applied in CSS, not to the image itself. The image does not need to be 12,000px wide — it needs to have enough resolution that when it is scaled by 9× in CSS and the user views the center portion at screen resolution, it does not appear blurry. For photographic content at 96dpi display resolution and 2× device pixel ratio, a source image of `3000px` wide is usually sufficient for the far background, because large amounts of scale compression and the visual nature of background imagery makes moderate blurriness imperceptible.
+
+### Ideal Dimensions by Layer
+
+| Layer | Depth | Scale Factor | Recommended Width | Recommended Height |
+|-------|-------|--------------|-------------------|--------------------|
+| Far background | 8 | 9× | 3000px | 1500px |
+| Mid-background | 5 | 6× | 2800px | 1400px |
+| Near-ground | 2 | 3× | 2400px | 1200px |
+| Foreground | 1 | 2× | 2400px | 1200px |
+
+### Why Wide Panoramas Work Better Than Tall Images
+
+The horizontal crop of each layer is controlled by `--md-image-position`, which maps to `object-position`. Because the scale compensation zooms the image in considerably, a tall image mostly wastes pixels on the top and bottom edges that will never be visible. A wide panorama uses that pixel budget on horizontal detail that *will* be seen as the user adjusts `--md-image-position` or visits on different viewport widths.
+
+The aspect ratio `2:1` (width:height) is a reliable default. If your scene has significant vertical interest in the mid-ground (tall trees, cliffs, buildings), you can go to `1.5:1`, but avoid portrait-oriented source images.
+
+---
+
+## Transparency: Which Layers Need It
+
+The far background layer (depth 8) does not need transparency. It represents the sky, open sea, or any expanse that fills the entire frame. This layer is the "canvas" behind everything else.
+
+Every other layer — mid-background, near-ground, and foreground — needs a transparent background. Here is why:
+
+In a parallax scene, layers stack on top of each other. If the mid-background layer has a solid color fill behind the mountains or trees you painted, that fill will cover the sky layer behind it, creating a hard rectangular cutout effect instead of a natural scene. The mid-background needs to show only the mountains and the sky directly behind them needs to come from the actual far background layer below.
+
+This means:
+
+- **Far background (depth 8):** Solid image, no transparency required
+- **Mid-background (depth 5):** Transparent background — show only the mid-distance objects
+- **Near-ground (depth 2):** Transparent background — show only near-ground objects and foreground elements
+- **Foreground (depth 1):** Transparent background — typically plants, rocks, or architectural elements that frame the scene
+
+A common mistake is forgetting that the scale compensation zooms each layer in significantly. If your mid-background layer has transparent edges on the left and right, those edges may be scaled into the visible viewport. If the object you painted is centered in the image and the transparent area at the edges is large, the visible part of the image may be smaller than expected after scaling. Always preview the scaled result in CSS before finalizing your AVIF files.
+
+---
+
+## AVIF Alpha Channel and Parallax CSS
+
+AVIF's alpha channel is encoded using the same AV1 codec as the color data, stored as a separate "auxiliary image" in the AVIF container. When the browser decodes an AVIF file with an alpha channel, it composites the alpha against the background using standard Porter-Duff "source over" blending.
+
+This interacts with the parallax CSS cleanly. The `object-fit: cover` property applied to each layer image respects the transparency of the image — transparent pixels remain transparent after fitting and cropping. The `object-position` property (controlled by `--md-image-position`) shifts the image within its container while preserving transparency.
+
+One thing to verify: when exporting AVIF from Photoshop, Affinity Photo, or Figma, confirm that you are exporting with "alpha channel" or "transparency" enabled. Some AVIF exporters default to a flat white or black matte on transparent areas, which will destroy your transparency information. Always open the exported AVIF in a browser to visually verify the alpha before publishing.
+
+AVIF files with alpha channels are somewhat larger than those without, because the alpha information is stored alongside the color data. For foreground layers with complex transparency (detailed foliage cutouts, for example), the AVIF file size will be noticeably larger than a solid background layer of the same dimensions. This is expected and acceptable.
+
+---
+
+## The `@4x` Naming Convention
+
+Image files in this theme follow the convention:
+
+```
+```
+
+The `@4x` suffix is a source resolution indicator borrowed from iOS/macOS asset catalog conventions, where `@2x` means 2× pixel density, `@3x` means 3×, and so on. In this context, `@4x` signals that these are high-resolution source images intended to be displayed at a fraction of their pixel dimensions (because CSS scaling reduces them on screen).
+
+This naming convention has two benefits:
+
+1. It documents the intended display scale in the filename, helping future maintainers understand why images seem larger than expected.
+2. It prevents confusion with standard-resolution images. If you later add a WebP fallback or generate responsive sizes, you can name them `[email protected]` and `[email protected]` without ambiguity.
+
+The `@4x` suffix has no special meaning to browsers or MkDocs — it is purely a human-readable convention.
+
+---
+
+## Depth Value Selection Strategy
+
+The four depth values used in this theme are `8`, `5`, `2`, and `1`. Understanding why these specific values were chosen helps you adjust them intelligently for your own scene.
+
+**Depth 8 (far background):** The maximum depth value used. At depth 8, the visual scroll rate is approximately 11% of the page scroll speed. This layer barely moves, giving it a distant, immovable quality appropriate for sky or open horizon.
+
+**Depth 5 (mid-background):** At depth 5, the visual scroll rate is approximately 33%. This layer moves noticeably but slowly, conveying mid-distance.
+
+**Depth 2 (near-ground):** At depth 2, the visual scroll rate is approximately 56%. This layer moves at just over half scroll speed, feeling close.
+
+**Depth 1 (foreground):** At depth 1, the visual scroll rate is 50%. Wait — why is foreground (depth 1) slower than near-ground (depth 2)?
+
+This is a quirk of the non-linear relationship between depth values and scroll rate. The rate formula is `p / (p + depth × p) = 1 / (1 + depth)`. At depth 2, rate is `1/3 ≈ 0.33`... wait, let us recalculate against the actual perspective value:
+
+```
+rate = perspective / (perspective + |translateZ|)
+ = 2.5rem / (2.5rem + (depth × 2.5rem))
+ = 1 / (depth + 1)
+```
+
+So at depth 1: rate = `1/2 = 50%`; at depth 2: rate = `1/3 = 33%`; at depth 5: rate = `1/6 ≈ 17%`; at depth 8: rate = `1/9 ≈ 11%`.
+
+The depth values `8 > 5 > 2 > 1` correctly produce scroll rates `11% < 17% < 33% < 50%` — each closer layer moves faster. The gap between values is nonlinear: going from depth 8 to depth 5 is a large jump in scroll rate (11% to 17%), while going from depth 2 to depth 1 is a smaller jump (33% to 50%). This nonlinearity means you get dramatic separation at the far end and subtler separation at the near end — which is how real-world parallax works, as atmospheric perspective compresses apparent depth differences at distance.
+
+**Choosing your own depth values:** Keep the ratio between adjacent depth values large enough to produce a visible difference. Values too close together (e.g., `3`, `2.5`, `2`, `1.5`) produce a nearly flat-looking result because the scroll rate differences are tiny. Values too far apart (e.g., `20`, `10`, `5`, `1`) can make the foreground layer scroll so fast it looks jarring. The range `1–10` with nonlinear spacing works well for most hero sections.
+
+---
+
+## `object-position` as Crop Control
+
+Each parallax layer is displayed using `object-fit: cover` (or equivalent background behavior), which crops the image to fill its container. The `--md-image-position` CSS variable controls where in the image the crop is taken from, horizontally:
+
+```css
+.parallax__layer img {
+ object-fit: cover;
+ object-position: calc(var(--md-image-position) * 1%) center;
+}
+```
+
+`--md-image-position: 0` crops to the left edge of the image. `--md-image-position: 100` crops to the right edge. `--md-image-position: 50` centers the image (the default).
+
+This is primarily useful for adjusting the composition after images are placed. If your mountain peak is 20% from the right edge of your source image, set `--md-image-position: 80` to shift the crop rightward so the peak is centered in the viewport.
+
+Each layer has its own `--md-image-position` value, allowing independent horizontal positioning of each depth plane. A common technique is to set the foreground layer's position slightly offset from the background — a foreground rock formation at 40% and the background peak at 60% creates a natural sense of different horizontal planes.
+
+**Important:** Because scale compensation increases the displayed size of far layers dramatically, far layers (depth 8) have a large amount of image content outside the visible area. Adjusting `--md-image-position` for far layers shifts through a wide panorama smoothly. For near layers (depth 1), the image is scaled less, so the same change in `--md-image-position` value moves the crop over a smaller physical distance — adjustment is more sensitive.
+
+---
+
+## Scene Composition Principles
+
+### Horizon Alignment
+
+All layers should share the same horizon line — the perceived eye level of the scene. If the background sky meets the mountains at one-third of the image height, the mid-ground trees should also start roughly at one-third, with their roots near the bottom. Mismatched horizon lines make layers feel like they are from different scenes even when the content is superficially similar.
+
+### Foreground Anchoring to the Bottom
+
+Foreground elements should be rooted at the *bottom* of the image frame, not floating in the middle. Plants, rocks, architectural elements, and terrain features that anchor to the bottom edge of the frame appear to "sit" on the ground plane, which is where the user expects near objects to be. Floating foreground elements — a tree whose trunk is not connected to the bottom of the frame — look ungrounded and break the illusion.
+
+Set the foreground layer's `object-position` vertical value to `bottom` to ensure the anchoring is respected:
+
+```css
+.parallax__layer--foreground img {
+ object-position: calc(var(--md-image-position) * 1%) bottom;
+}
+```
+
+### Color Consistency
+
+All layers should be lit from the same direction with the same color temperature. A background with warm afternoon sun (golden, directional) combined with a foreground painted with cool overcast light (flat, blue-white) will look artificial regardless of how precise your depth values are. The eye immediately detects lighting inconsistency as a sign that the image is composited.
+
+If your layers come from different source photographs, do color grading passes to unify the white balance, shadow tone, and highlight color before exporting. A quick way to check: convert all layers to grayscale and verify that the contrast and tonal ranges match across layers.
+
+---
+
+## Edge Handling: Avoiding Hard Cutout Artifacts
+
+When a transparent layer is scaled up by the CSS `scale()` transform, its edges are also scaled up. If your transparent layer has a hard pixel edge — one row of semi-transparent pixels and then fully transparent — that hard edge will become visible as a sharp line when the layer is scaled into the viewport.
+
+Fix this by painting a soft feathered edge on transparent layers. In Photoshop: apply a `Refine Edge` or `Select and Mask` operation on your transparency mask with 20–40px feathering before exporting. In Figma: use `Blur > Layer Blur` on the edge regions at a low value (4–8px) before exporting. In Affinity Photo: use the "Feather" slider in the Pixel Selection panel.
+
+The amount of feathering needed scales with your depth value. Layers at depth 2 (scale 3×) need more feathering than layers at depth 1 (scale 2×), because the larger scale factor amplifies edge sharpness more.
+
+---
+
+## Testing Layers Before AVIF Conversion
+
+AVIF conversion is lossy and takes time. Before committing to the AVIF encoding step, verify your layer composition using PNG files in a browser.
+
+The fastest method: stack your PNG layers in a `<div>` with `position: absolute; inset: 0` on each layer, then view it in a browser. If the layers look correct as a flat composite, they will look correct in the parallax hero (depth and scroll behavior aside).
+
+For a more accurate preview, open your layer stack in **Figma** or **Photoshop** as individual layers in a single file. Toggle each layer's visibility to confirm that each plane contains only the content intended for that depth. Check that transparent regions are genuinely transparent, not filled with white or black.
+
+Pay particular attention to:
+
+- The mid-background layer's sky region (should be transparent, not solid)
+- The foreground layer's upper region (should be transparent above the foreground objects)
+- The exact bottom edge of all non-background layers (should feather out, not hard-cut)
+
+Once you are satisfied with the PNG composite, convert to AVIF using `squoosh`, `avifenc`, or your image editing application's export dialog. Encode at quality 60–75 for photographic content and 75–85 for illustrated/painted content. Check the output file in a browser before publishing.
+
+---
+
+## File Placement
+
+Place finished AVIF files at:
+
+```
+docs/assets/hero/[email protected]
+docs/assets/hero/[email protected]
+docs/assets/hero/[email protected]
+docs/assets/hero/[email protected]
+```
+
+MkDocs Material automatically copies the entire `docs/assets/` directory to the built site's `assets/` directory. No additional configuration is required. The paths used in `home.html` should reference `/assets/hero/` (without the `docs/` prefix) because MkDocs strips the `docs/` root from all asset paths in the build output.
+
+**Linux file path note:** File paths on Linux (including MkDocs' build process and most CI environments) are case-sensitive. `[email protected]` and `[email protected]` are different files. Always use lowercase filenames and verify paths match exactly between the file system and your HTML templates.
+
+---
+
+## The `<picture>` Element Structure in `home.html`
+
+Each layer is rendered using a `<picture>` element to support both AVIF and WebP with a PNG fallback:
+
+```html
+<picture class="parallax__layer" style="--md-parallax-depth: 8; --md-image-position: 50">
+ <source
+ type="image/avif"
+ srcset="/assets/hero/[email protected]"
+ />
+ <source
+ type="image/webp"
+ srcset="/assets/hero/[email protected]"
+ />
+ <img
+ src="/assets/hero/[email protected]"
+ alt=""
+ loading="eager"
+ decoding="async"
+ />
+</picture>
+```
+
+Browsers read `<source>` elements in order and use the first type they support. An AVIF-capable browser (Chrome 85+, Firefox 93+, Safari 16+) uses the AVIF. A browser with WebP but no AVIF (Safari 14–15) uses the WebP. Any older browser falls back to the PNG.
+
+The `alt=""` on the `<img>` is intentional. Parallax background images are decorative — they do not convey content that a screen reader user needs. An empty `alt` attribute tells assistive technology to ignore the image entirely, which is the correct behavior.
+
+The `loading="eager"` attribute on the first (far background) layer ensures it begins loading immediately, avoiding a flash of empty background. Layers at depth 2 and 1 (near and foreground) can use `loading="lazy"` if desired, since they are partially revealed only as the user scrolls.
+
+### Adding a WebP Fallback Source
+
+If you only export AVIF files initially and want to add WebP fallbacks later:
+
+1. Convert each AVIF source to WebP using `squoosh` or `cwebp`: `cwebp -q 80 [email protected] -o docs/assets/hero/[email protected]`
+2. Place the WebP files alongside the AVIF files in `docs/assets/hero/`
+3. Add a `<source type="image/webp">` element to each `<picture>` block, between the AVIF source and the `<img>` tag
+
+---
+
+## Common Mistakes
+
+**Depth values too close together.** Using depths like `4`, `3`, `2`, `1` produces almost no visible parallax separation. The scroll rate difference between depth 4 (`rate = 1/5 = 20%`) and depth 3 (`rate = 1/4 = 25%`) is only 5 percentage points. Spread your values further apart.
+
+**Forgetting transparency on non-background layers.** The mid-ground and near-ground layers must have transparent backgrounds. Exported PNGs with white or black backgrounds turn into opaque rectangles that cover the layers behind them, making the scene look like a stack of colored blocks.
+
+**Wrong file paths (case-sensitive on Linux).** The most common deploy-time bug. The file is `[email protected]` but the template references `[email protected]`. Works fine on macOS (case-insensitive filesystem), fails silently on Linux CI and production. Standardize on all-lowercase filenames.
+
+**Not accounting for scale when evaluating image quality.** A layer at depth 5 (scale factor 6×) will be rendered at 6× its natural size. Zoom into your AVIF file at 600% in a browser before publishing to check that it does not show blocking artifacts or excessive blurring at the scale it will be displayed.
+
+**Using portrait or square images.** The parallax CSS renders layers in a wide landscape viewport. Portrait images will be cropped heavily, often showing nothing but a narrow vertical strip of content. Always work with landscape-format (wider-than-tall) source images.
+
+**Opacity on individual layers without considering blending.** If you add `opacity` to a mid-ground layer to create a haze effect, note that CSS `opacity` creates a new stacking context, which can interact unexpectedly with `z-index`. Use `mix-blend-mode` or AVIF-level transparency instead.
+
+---
+
+## Swapping Layers Without Breaking the Site
+
+To replace existing layer images:
+
+1. Prepare your new AVIF (and optionally WebP) files following the naming conventions above.
+2. Place them in `docs/assets/hero/`.
+3. Open `docs/overrides/home.html` (or wherever your theme's `home.html` override lives).
+4. Update the `srcset` path in each `<source>` element and the `src` in the `<img>` fallback to point to your new filenames.
+5. Adjust `--md-parallax-depth` and `--md-image-position` custom properties on each `<picture>` element if your new scene has different depth requirements or needs a horizontal crop offset.
+6. Run `mkdocs serve` locally and scroll through the hero to visually verify the layers.
+7. Check that transparent layers do not show hard edges or cutout artifacts.
+8. Run `mkdocs build` to generate the static site and confirm the AVIF files appear in `site/assets/hero/`.
+
+If you want to update only one layer — for example, replacing the foreground with a seasonal variation — you only need to update that one `<picture>` block and its associated file. The other layers are independent.
+
+After a layer swap, clear your browser cache or use an incognito window to test, since browsers aggressively cache image resources and may serve the old image even after a rebuild.
+
+---
+
+## Quick Reference: Layer Properties
+
+| Property | Far Background | Mid-Background | Near-Ground | Foreground |
+|----------|---------------|----------------|-------------|------------|
+| `--md-parallax-depth` | `8` | `5` | `2` | `1` |
+| Scale factor | `9×` | `6×` | `3×` | `2×` |
+| Visual scroll rate | ~11% | ~17% | ~33% | ~50% |
+| Needs transparency | No | Yes | Yes | Yes |
+| Recommended width | 3000px | 2800px | 2400px | 2400px |
+| `loading` attribute | `eager` | `eager` | `lazy` | `lazy` |
+| `z-index` (auto) | 2 | 5 | 8 | 9 |
+
+Adjust `--md-parallax-depth` first when you want to change how dramatic the parallax separation feels. Adjust `--md-image-position` when you want to shift the horizontal crop without changing the depth behavior.