# nitaimaarek UI — complete reference Shared UI framework for every `*.nitaimaarek.com` site: frosted-glass components and a cursor-reactive canvas background. Assets: `/ui.css`, `/ui.js`, `/ui-bg.js` — all on `https://framework.nitaimaarek.com`. No build step, no dependencies, no web fonts. Rendered version of this file: `/`. ## Install ```html
``` `ui-bg.js` is fetched automatically the first time a background is requested; add `` yourself to avoid that second round trip. Put `ui.js` in `` without `defer` to avoid a theme flash. It is optional: every component degrades to working HTML without it. ## Rules 1. Bare HTML is already styled — add the `` and change nothing else. 2. Use `.ui-*` classes only for widgets plain elements don't cover. 3. Never write per-site CSS or a second palette; fix `ui.css` instead. 4. Restyle via tokens on ``, e.g. `style="--ui-hue:30"`. 5. Behaviour attaches through `data-ui-*` attributes, never through classes. ## Tokens Set on `:root` / ``. Everything else derives from them. | Token | Default | Drives | |---|---|---| | `--ui-hue` | 265 | Accent: links, focus, checked controls, background particles | | `--ui-sat` | 70% | Accent saturation | | `--ui-tint` | 240 | Neutral hue — surfaces, borders, text (240 cool ink, 40 warm) | | `--ui-tint-sat` | 6% | Grey lean; `0%` = pure neutral | | `--ui-radius` | 14px | **Every** corner in the framework. `-xs` ×.35, `-sm` ×.65, `-lg` ×1.35 derive from it, so `--ui-radius:0` squares the whole UI and a large value rounds all of it | | `--ui-density` | 1 | Multiplies the spacing scale `--ui-1`…`--ui-8` (4…64px) | | `--ui-fs` / `--ui-lh` | 15px / 1.6 | Root type size, line height | | `--ui-width` / `--ui-measure` | 1120px / 72ch | Content column; prose line length | | `--ui-font` / `--ui-mono` | system stacks | Typefaces | | `--ui-display` | `var(--ui-font)` | Face for h1–h4 and `.ui-display`; set to `var(--ui-mono)` for mono headings | | `--ui-solid` / `--ui-solid-ink` | ink / page | Filled surfaces — primary button, solid badge | | `--ui-blur` | 20px | Frosted-glass strength on panels; `0` makes them flat | | `--ui-lift` | -2px | How far buttons and cards rise on hover | | `--ui-glass` / `--ui-glass-2` | derived | Panel fills, translucent so the background reads through | | `--ui-glass-line` / `--ui-glass-hi` | derived | Hairline border and inset top highlight | | `--ui-bg` `--ui-bg-alt` `--ui-surface` `--ui-surface-2` | derived | Backgrounds, back to front | | `--ui-line` / `--ui-line-soft` | derived | Borders: visible / hairline | | `--ui-text` / `--ui-muted` / `--ui-faint` | derived | Text emphasis levels | | `--ui-ok` `--ui-warn` `--ui-bad` `--ui-info` | — | Status colours (+ `-wash` backgrounds) | | `--ui-fast` `--ui-mid` `--ui-slow` | 150/240/420ms | Motion (off under `prefers-reduced-motion`) | | `--ui-shadow-1..3` / `--ui-ring` | — | Elevation, focus ring | ```html ``` Dark is the default palette; light comes from `prefers-color-scheme` or `data-theme="light"`. `ui.js` persists theme and hue in a cookie scoped to `.nitaimaarek.com`, so the choice follows the user across all subdomains. ## Layer 1 — classless base Headings use `--ui-display` (the sans face) at heavy weights with tight tracking; `h5`/`h6` render as small uppercase mono eyebrows. Styled with no markup changes: `h1`–`h6`, `p`, `a`, `strong`, `em`, `small`, `mark`, `abbr`, `ul`, `ol`, `dl`, `hr`, `blockquote`, `code`, `pre`, `kbd`, `img`, `figure`, `table`/`thead`/ `tbody`/`th`/`td`/`caption`, `form`, `fieldset`, `legend`, `label`, `input` (text/search/email/url/password/number/tel/date/time/color/file/checkbox/radio/ range), `textarea`, `select`, `option`, `button`, `progress`, `details`, `summary`, `dialog`, scrollbars, `::selection`, `:focus-visible`. Body children are centred at `--ui-width`; add `class="ui-wide"` to `` to remove that cap. Gotcha: because direct children of `` get `margin-inline: auto`, a direct child you give a *narrower* `max-width` will centre itself instead of lining up with the headings. Add `margin-inline: 0` to it, or nest it inside a wrapper. ## Layer 2 — components ### Glass `.ui-glass` applies the frosted-panel recipe (translucent fill, hairline border, `backdrop-filter`) to any element. `.ui-card`, `.ui-menu`, `.ui-modal__box` and `.ui-toast` already use it. Browsers without `backdrop-filter` fall back to solid surfaces automatically. ### Display type `.ui-display` is the oversized hero face (`clamp(3rem, 1rem + 9vw, 8.5rem)`, weight 900, `-.06em` tracking). `.ui-dim` greys part of it. ```html