# PAPI — the Go Around reload animation

*Designer, 12 Nov 2026. Replaces "Rollout" (PR #8), which MT rejected: "the design is good and quality is good, but it doesn't mean anything."*

## Why PAPI

Every pilot reads a PAPI on every approach without thinking: four lights beside the runway, **two white and two red means you're on the glide slope**. That is exactly what a reload should say.

- **Loading:** the four lamps sweep white → red → white, one lamp at a time, as if the aircraft is flying down through the approach slope and back up. The inner (right) lamp turns red first, like a real left-side PAPI. 240ms per step, a short pink cross-fade on the site ease `cubic-bezier(.32,.72,0,1)`, so it reads as a calm cadence, not a spinner.
- **Done:** the lamps walk, one lamp per 170ms, from wherever they are onto the verdict, and the lens unit's hairline ring cross-fades to the status colour:

| Status | Lamps | A pilot reads | Ring |
|---|---|---|---|
| `go` | 2 white + 2 red | on slope: fresh data, good to go | `#22C55E` |
| `cau` | 3 white + 1 red | slightly high: cached data, usable | `#FF8A00` |
| `nogo` | 4 red | too low: update failed | `#F80F3B` |

- **At rest** the unit shows 2 white + 2 red with no ring, so the refresh button itself already says "on slope".
- **Icon size** (inside a 44px refresh button, about 30×10px): the same unit. After the verdict it holds for 1s, then the ring fades and the lamps walk back to 2 + 2.
- **Panel size:** about 128×36px.
- The lens unit is always dark (like the real light box), tinted per theme, so the white lamps read on Pearl and Champagne too.
- No text anywhere, no logo. The status for screen readers is a visually hidden live region ("Refreshing", "Updated", "Showing cached data", "Update failed, tap to retry").
- **Motion budget:** only `opacity` (lamps, ring) and `transform` (ring settle scale .97 → 1). No layout, no blur, `contain:paint`, `will-change` only while loading.
- **Reduced motion:** no sweep; the lamps and ring jump straight to the verdict.

## Alternative: ILS

`ga-reload-ils.js` / `ga-reload-ils.css` (`GAReloadILS`, same API). A course-deviation indicator: while loading, the localiser and glideslope needles hunt out of phase like an aircraft intercepting. On `done()` they fly in to a centred cross ("established", green ring). `cau` leaves the glideslope one dot off (amber). `nogo` parks both needles at full scale and drops the red warning flag (red ring). The same rules apply: transform and opacity only, no text, reduced motion, four themes.

PAPI is the primary because it is readable at 24–40px (four dots) and its verdict needs no explanation. The ILS cross gets busy below about 30px.

## API (same as Rollout's `ga-reload.js`)

```html
<link rel="stylesheet" href="ga-reload.css">
<script src="ga-reload.js"></script>
<span id="ld"></span>
<script>
const ld = GAReload.mount(document.getElementById('ld'), {
  theme: 'midnight',   // 'midnight' | 'amethyst' | 'pearl' | 'champagne'
  size: 'page'         // 'page' (~128px) or 'icon' (inside a refresh button)
});
ld.start();
fetch('/api/metar')
  .then(r => ld.done({status: r.headers.get('x-cache') === 'HIT' ? 'cau' : 'go'}))
  .catch(() => ld.done({status: 'nogo'}));
// ld.reset()            -> back to rest instantly
// ld.reset({fade:true}) -> ring fades, lamps walk back to 2 + 2
// ld.setTheme('pearl')  -> switch theme without remounting
</script>
```

For the ILS alternative, swap in `ga-reload-ils.css` and `ga-reload-ils.js` and use `GAReloadILS.mount(...)`.

## Files

| File | What |
|---|---|
| `ga-reload.js`, `ga-reload.css` | PAPI (primary) |
| `ga-reload-ils.js`, `ga-reload-ils.css` | ILS (alternative) |
| `demo.html` | `?design=papi\|ils&layout=single\|grid\|verdicts&size=page\|icon&theme=…`. Loops live; `&render=1` exposes `seek(t)` for frame-exact recording |
| `render.py` | Re-renders everything in `out/` (Playwright frames at 2×, libx264 crf 14 preset slow, yuv420p, 30fps) |
| `out/papi-4themes.mp4`, `out/ils-4themes.mp4` | 2×2 grid (Midnight, Amethyst / Pearl, Champagne), 2162×3842, 4s seamless loop, no labels, 1px hairline separation only |
| `out/papi-<theme>.mp4`, `out/ils-<theme>.mp4` | One clean clip per theme, 1080×1920, 4s loop |
| `out/*-icon-4themes.mp4` | Icon size inside the refresh button, 2×2 grid (shown at 3.2× zoom so it can be judged) |
| `out/*-verdicts-midnight.mp4`, `out/*-verdicts-pearl.mp4` | GO / CAUTION / NO-GO side by side |
| `out/*.png` | Stills at 3.0s (verdict showing) |

The panel clips show the component at 1.5× zoom (crisp, re-laid-out rather than scaled) so it reads in a video. Loop: `start()` at 0s, `done()` at 2.2s (1.9s for icon), `reset({fade:true})` at 3.3s, back to rest by 4s.

Map the live site attributes to a theme:

```js
function reloadTheme(root) {
  const t = root.getAttribute('data-theme'), pal = root.getAttribute('data-pal');
  if (t === 'night' && pal === 'purple') return 'amethyst';
  if (t === 'night') return 'midnight';
  if (t === 'day' && pal === 'beige') return 'champagne';
  return 'pearl';
}
```

## NEXT SESSION — from Designer

This is a design component only. It is **not** on the site. Do not merge, wire or deploy it until MT says yes.

When MT says yes, **Go Around**:

1. Replace the propeller / current refresh effect (`wm-refresh-fx.js` and the refresh icon) with `ga-reload.css` + `ga-reload.js` at `size:'icon'` in the refresh button. Use `size:'page'` for full-panel loading states.
2. On a refresh tap or data fetch call `start()`. When data lands call `done({status})`: `'go'` for fresh data, `'cau'` when served from cache or stale, `'nogo'` when the fetch fails. Keep the existing retry on tap.
3. Drive the theme from `html[data-theme][data-pal]` with the map above, and call `setTheme()` when the user switches theme.
4. Reduced motion is built in. Don't add any text label next to it.
5. Landing v4 (`components/landing-v4/`, locked) has a `<!-- RELOAD CLIP SLOT -->` in the phone's reload step. Once MT approves PAPI, the only change allowed there is dropping `out/papi-pearl.mp4` / `out/papi-midnight.mp4` (or a phone-sized re-render) into that slot.
6. PR #8 (Rollout) is superseded by this one and can be closed when MT agrees.

— Designer
