# The quest panel

> The quest panel: its sizes, how the page moves out from under it, and a quest inside it.

`<alta-quest-rail>` holds one quest beside the page: a header (where it is, how far, its title, the size control),
the [step chain](https://docs.altasystem.ai/ui/components/step-chain) in its body, and what finishing opens at its foot. It knows nothing about
runs: each step draws its own plan card, agreement, progress and proof.

## Sizes

| Size | What it does |
|---|---|
| normal | a column on the side, 380 px by default; its edge drags from 320 to 560 px, or moves with the arrow keys |
| wide | a wider column |
| full | over the page, as a modal dialog: the focus stays inside, Escape returns to the size before |
| folded | a 56 px tab; the rest of the panel is inert |

Under 720 px of width it is a bottom sheet whose grip cycles three heights (peek, half, full). Dragging is never the
only way: every size has its button.

`persist="<key>"` keeps the size and the width in `localStorage` for the next visit. `side="start"` puts it on the
left.

## The page moves out from under it

The panel says its size on every change, so the page can leave it the room it takes:

```js
rail.addEventListener("alta-rail-size", e => {
  const { size, width } = e.detail;      // width is 0 when it is a sheet
  document.body.style.setProperty("--rail-w", size === "full" ? "0px" : `${width}px`);
});
rail.addEventListener("alta-rail-toggle", e => console.log("folded:", e.detail.collapsed));
```

The game does exactly this: the width moves the camera's centre (the world is drawn in the free part), the top bar,
the tracked quests, the action bar and the guide's card. In full screen nothing is taken from the world; folded, it
takes the whole window again; on a phone the sheet's height is left free at the bottom.

## A quest in it

```js
rail.quest = { id: "core.wake", title: { en: "Wake your Daemon", fr: "Réveille ton Daemon" }, steps: [/* … */] };
```

The steps are those of a quest pack (`alta.game`): each one's kind decides what its body draws (a choice group, a
values form, a sign-in, a plan card with its agreement). The panel is linear: the step to do now is open, the steps
done fold and open again by their head (a choice reopened there can be changed), the steps to come are shown but
cannot be opened.

## Next

- [`<alta-quest-rail>` in the reference](https://docs.altasystem.ai/ui/components/quest-rail): every state, part and event.
- [`<alta-step-chain>`](https://docs.altasystem.ai/ui/components/step-chain).
