# States

Interactive states shift one step on the 12-step color scale instead of using opacity hacks. Layering uses six named `z-index` tokens from `base` (`0`) to `toast` (`50`).

## Interactive state rules

| State | Step / rule |
| --- | --- |
| Solid (default → hover → pressed) | step 9 → 10 → 11 |
| Subtle (default → hover → pressed) | step 3 → 4 → 5 |
| Selected | 2px border or step-shifted fill |
| Disabled | step 3 background, step 8 text (no opacity) |
| Focus ring | 2px width, 2px offset, var(--ring) (:focus-visible) |

Keep disabled controls at step 3 background and step 8 text with full `1` opacity. Render focus rings on `:focus-visible` only so pointer clicks stay clean while keyboard focus remains unmistakable.

## Z-index layering

| Layer | Tailwind | CSS var | Value | Use |
| --- | --- | --- | --- | --- |
| base | z-base | --z-base | 0 | Default document flow |
| sticky | z-sticky | --z-sticky | 10 | Sticky headers, top bars, sidebars |
| dropdown | z-dropdown | --z-dropdown | 20 | Menus, select popups, comboboxes |
| overlay | z-overlay | --z-overlay | 30 | Backdrop dimmers and grid overlays |
| modal | z-modal | --z-modal | 40 | Dialogs, sheets, alert modals |
| toast | z-toast | --z-toast | 50 | Transient status notifications |

Default Tailwind numeric `z-*` classes are blocked in `theme.css` so every overlay and popup uses a named layer token.

## Usage

Apply state and layering tokens in Tailwind CSS or CSS:

```tsx
<div className="relative z-dropdown rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-lg">
  <button
    type="button"
    className="w-full rounded-sm px-3 py-2 text-left text-body transition-colors duration-100 ease-standard hover:bg-muted"
  >
    Menu action
  </button>
</div>
```

```css
.interactive-control:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.modal-layer {
  z-index: var(--z-modal);
}
```

## Do and don't

- **Do: Shift scale steps and use named z-index layers** — Use step 9→10→11 for solid fills, step 3→4→5 for subtle fills, step 3/8 for disabled, and z-base through z-toast for stacking.
- **Don't: Use opacity for disabled states or arbitrary z-index numbers** — Do not apply opacity-50 to disabled controls or write z-50 and z-[999] because numeric z-index utilities are disabled.

## Accessibility

- Global `:focus-visible` styling renders a `2px` solid `--ring` outline with a `2px` offset so keyboard navigation works on every interactive element.
- Disabled controls use step 3 background and step 8 text without opacity reduction, keeping state styling predictable across themes.

## Rationale

Step-shifting states preserve calibrated surface separation in both dark and light modes, and six named `z-index` tiers prevent stacking-context wars.
