# Surfaces

Every neutral background and foreground composes `oklch(shade × var(--q-surface-tone))`. Surfaces are named by **role**, not faux-depth, and the ladder runs in real ~0.05 lightness steps — going **lighter in both themes** (not inverted in dark) — so adjacent surfaces separate on tone alone, no border needed. An app warms its whole context with one knob: `--q-surface-tone: var(--q-tinted)`. Shadows are reserved for layers that actually float (menus, popovers, toasts); everything inline stays flat.

## Surface roles

- Inset `--q-surface-inset` Wells, inputs — recessed below the field
- Base `--q-surface-base` Body, sidebar — the chrome
- Panel `--q-surface-panel` The main content field
- Card `--q-surface-card` Grouped content lifted above the panel
- Float `--q-surface-float` Menus, popovers, toasts — card fill + shadow

## Interactive states

- Hover `--q-state-hover` Wash over a neutral surface on hover
- Active `--q-state-active` Pressed / active wash

## Placement conventions

Surfaces are **absolute** roles — nothing auto-elevates, so *you* pick the rung. The one rule that prevents the invisible-panel bug: a surface must sit a rung apart from whatever is directly behind it. Follow the map, keep nesting shallow.

- `--q-surface-base` App chrome — body, sidebar, topbar `--q-surface-base`
- `--q-surface-panel` Content field — the main sheet `--q-surface-panel`
- `--q-surface-card` Card / raised group on the field `--q-surface-card`
- `--q-surface-base` Control-bearing well — filter rails, control groups `--q-surface-base`
- `--q-surface-inset` Quiet display well — code, readouts (no nested controls) `--q-surface-inset`
- `--q-surface-inset` Input / select / textarea `--q-surface-inset`
- `--q-surface-float` Menu / popover / toast / tooltip (+ elevation) `--q-surface-float`

1. A surface differs from the one directly behind it by at least one rung — check the parent before you pick.
2. Never inset-on-inset (or any same-rung nesting). A well that holds controls is base, so its inset controls still read.
3. Shadows only on float; everything inline stays flat.
4. The ladder is shallow (~4 rungs; in light, card sits near white) — keep nesting to ~2 elevations.

## Foreground on surfaces

Text strong `--q-text-strong` Emphasis — strong, titles

Text `--q-text` Primary — body, headings

Text muted `--q-text-muted` Secondary — labels, captions

Text subtle `--q-text-subtle` Tertiary — placeholders, hints

- `--q-border` Hairlines
- `--q-border-strong` Emphasis, focused inputs
- `--q-divider` Dense-data hairlines (tables, trees)

## Radius ramp

A mechanical ramp feeds four semantic roles. The brand leans soft — the **pill** is the signature, so the ramp runs generous: big surfaces echo the pill language instead of fighting it.

- `--q-radius-xs` 0.25rem
- `--q-radius-sm` 0.375rem
- `--q-radius-md` 0.5rem
- `--q-radius-lg` 0.75rem
- `--q-radius-xl` 1rem
- `--q-radius-2xl` 1.25rem
- `--q-radius-full` 999px

- Control `--q-radius-control` Inputs, selects, textareas
- Panel `--q-radius-panel` Cards, menus, dropdowns, popovers
- Container `--q-radius-container` main, modals, big sheets
- Pill `--q-radius-pill` Badges, buttons, nav, CTA

## Borderless: recessed wells

Going borderless, grouped content separates with a recessed **well** — a flat inset colour step, no hairline and no shadow — rather than a dividing line. Hairlines survive only for dense data (tables, trees) where the steps would be noisy.

## The tone knob

The dashboard and docs use the crisp `--q-base` neutral; the marketing site sets `--q-surface-tone: var(--q-tinted)` to warm every surface and foreground at once — the brand hue carried into the neutrals.

## Examples

```svelte
<script lang="ts">

  const text = [
    {
      token: '--q-text-strong',
      label: 'Text strong',
      role: 'Emphasis — strong, titles',
    },
    { token: '--q-text', label: 'Text', role: 'Primary — body, headings' },
    {
      token: '--q-text-muted',
      label: 'Text muted',
      role: 'Secondary — labels, captions',
    },
    {
      token: '--q-text-subtle',
      label: 'Text subtle',
      role: 'Tertiary — placeholders, hints',
    },
  ];
</script>
```

### Example 1: Hairlines against wells

The same three rows, grouped by a line and by a recessed tone step.

```svelte
<div class="compare">
  <div class="compare-col">
    <span class="knob-tag">before — hairlines</span>
    <div class="bordered-group">
      <div class="bordered-row">Overview</div>
      <div class="bordered-row">Metrics</div>
      <div class="bordered-row">Logs</div>
    </div>
  </div>
  <div class="compare-col">
    <span class="knob-tag">after — recessed wells</span>
    <div class="inset-group">
      <div class="inset-well">Overview</div>
      <div class="inset-well">Metrics</div>
      <div class="inset-well">Logs</div>
    </div>
  </div>
</div>
```

### Example 2: One tone knob, two neutrals

The tinted panel sets only the surface tone; its surfaces and inks warm together.

```svelte
<div class="knob">
  <div class="knob-panel">
    <span class="knob-tag">base</span>
    <div class="mini-card">
      <strong style:color="var(--q-text)">Aa</strong>
      <span style:color="var(--q-text-muted)">muted</span>
    </div>
  </div>
  <div class="knob-panel" style="--q-surface-tone: var(--q-tinted)">
    <span class="knob-tag">tinted</span>
    <div class="mini-card">
      <strong style:color="var(--q-text)">Aa</strong>
      <span style:color="var(--q-text-muted)">muted</span>
    </div>
  </div>
</div>
```

---

From the Qualia design guide: https://q-core-3b2732.gitlab.io/tokens/surfaces. Every page as markdown: https://q-core-3b2732.gitlab.io/llms.txt
