# МЕСТО — Design System

> Source of truth for the visual language of МЕСТО products — the site mp-llc.ru and the internal CRM.
> Reverse-engineered from the live site (`app/`, `components/`, `tailwind.config.ts`, `app/globals.css`) on 2026-05-08.
> **Synced 2026-09-26** with the decisions made in the МЕСТО CRM during UX rounds R1–R9 (contrast fixes, semantic colours, focus, touch, elevation, layers). See [§10](#10-changelog--sync-with-the-crm).

For brand identity, voice and logo usage rules see [`brandbook.md`](./brandbook.md).
For raw assets see [`logos/`](./logos/) and [`tokens/`](./tokens/).

---

## 1. Foundations

### 1.1 Brand color (primary navy)

| Token | Value | Where it lives | Use |
|---|---|---|---|
| **Brand Navy** | `#071246` · `hsl(229 82% 15%)` | `--primary` in `globals.css`, `app/icon.svg`, `<meta theme-color>`, viewport | Logo glyph, all UI primary surfaces, buttons, links, favicon, mobile chrome, OG |

The brand uses a single source of truth. CSS resolves through `hsl(var(--primary))`, design exports through `#071246`.

### 1.2 Full palette (HSL tokens)

Tokens come from `app/globals.css` (`:root`) and resolve through Tailwind's `hsl(var(--token))` pattern. Hex values are computed for design-tool use. Contrast is measured against `--background` unless stated.

| Role | Token | HSL | Hex (approx.) | Notes |
|---|---|---|---|---|
| Background | `--background` | `228 33% 99%` | `#FCFCFD` | App bg, near-white cool |
| Foreground | `--foreground` | `226 33% 18%` | `#1F263D` | Body text |
| Card | `--card` | `0 0% 100%` | `#FFFFFF` | Card / header surface |
| Card fg | `--card-foreground` | `226 33% 18%` | `#1F263D` | Text on cards |
| Popover | `--popover` | `0 0% 100%` | `#FFFFFF` | Popover surface |
| **Primary** | `--primary` | `229 82% 15%` | `#071246` | CTA, brand mark |
| Primary fg | `--primary-foreground` | `0 0% 100%` | `#FFFFFF` | Text on primary |
| Secondary | `--secondary` | `227 32% 88%` | `#D7DBEA` | Subtle chip / surface |
| Secondary fg | `--secondary-foreground` | `226 33% 18%` | `#1F263D` | |
| Muted | `--muted` | `225 31% 95%` | `#EEF0F6` | Inactive bg, hover surface |
| Muted fg | `--muted-foreground` | `228 30% 48%` | `#56649F` | Secondary copy · **5.5:1** (was `53%` → 4.1:1) |
| Accent | `--accent` | `225 33% 93%` | `#E7EAF3` | Hover / focus surface |
| Accent fg | `--accent-foreground` | `229 82% 15%` | `#071246` | Active nav text |
| Border | `--border` | `227 30% 91%` | `#E1E4EF` | Hairlines, card outlines, dividers |
| Input | `--input` | `227 22% 61%` | `#868FB1` | **Form-control border · 3.1:1** (WCAG 1.4.11) — split from `--border` |
| Ring (focus) | `--ring` | `229 82% 15%` | `#071246` | Focus ring |
| Ring offset | `--ring-offset` | `228 33% 99%` | `#FCFCFD` | Gap between control and ring |
| Skeleton | `--skeleton` | `227 32% 88%` | `#D7DBEA` | Loading placeholders · 1.35:1 (visible without animation) |
| Overlay | `--overlay` | `226 33% 18%` | `#1F263D` | Modal scrim, used as `bg-overlay/40` |
| Media | `--media` | `240 6% 6%` | `#0E0E10` | **Photo viewer (lightbox) only** — neutral near-black so interior photos keep their colours; text/icons on it use `--media-foreground` (white) and `.focus-ring-on-media`. Never a UI surface |

**Why `--input` ≠ `--border`.** A field has a transparent/white background, so its outline is the *only* cue that it is a control and must hold 3:1. Hairlines between sections carry no such requirement. Outline buttons stay on `--border` so they do not read as inputs.

**Functional / semantic colours** — states, never decoration:

| Role | Token | HSL | Hex | Use only for |
|---|---|---|---|---|
| Destructive | `--destructive` | `0 72% 45%` | `#C52020` | Fill under white text (delete button, error badge) · 5.8:1 with white |
| Destructive fg | `--destructive-foreground` | `0 0% 100%` | `#FFFFFF` | Text on destructive |
| Destructive text | `--destructive-text` | `0 68% 46%` | `#C52626` | Error messages as text · 5.6:1 |
| Destructive accent | `--destructive-accent` | `0 82% 65%` | `#EF5D5D` | Brand red (≈ `#EE5959` in the brandbook) — **borders and icons only**, never under text |
| Warning | `--warning` | `48 100% 96%` | `#FFFBEB` | Surface of a transitional state (≈ amber-50) |
| Warning border | `--warning-border` | `46 97% 65%` | `#FCD44F` | Its border (≈ amber-300) |
| Warning fg | `--warning-foreground` | `22 78% 26%` | `#76350F` | Its text · 8.9:1 (≈ amber-900) |
| Warning accent | `--warning-accent` | `32 95% 44%` | `#DB7706` | Warning icons only (≈ amber-600) |
| Success | `--success` | `142 76% 36%` | `#16A249` | **Icons and dots only** — 3.3:1 to white, not enough for text |

Rules: a "success" *message* is built on navy/neutrals (`border-primary/30 bg-secondary/60 text-foreground`) with a `text-success` icon; a raw palette class (`text-green-600`, `text-amber-600`, `bg-black/80`) or a hex value in markup is a bug. Amber is the only warm hue in the system.

**Charts / data viz** (5-step navy ramp):

| Token | HSL | Hex | Use |
|---|---|---|---|
| `--chart-1` | `229 82% 15%` | `#071246` | Primary series |
| `--chart-2` | `228 82% 28%` | `#0D2482` | Secondary series |
| `--chart-3` | `228 83% 66%` | `#607DF0` | Tertiary |
| `--chart-4` | `228 82% 78%` | `#99ABF5` | Highlight |
| `--chart-5` | `226 32% 71%` | `#9DA8CD` | Neutral series |

**Selection color:** `bg: hsl(var(--primary))` = `#071246`, `fg: #FFFFFF`.

**Dark mode:** none. The brand is light-only. Tailwind is configured with `darkMode: ['selector', "[data-theme='__never__']"]`, so a stray `dark:` class can never switch on for users with a dark OS.

### 1.3 Typography

**Two-typeface system** — **Inter Bold (700)** is used **only for the logo** (mark + wordmark) — in SVGs and, as live text, in the wordmark (`font-brand`, loaded via `next/font` in weight 700 only) on both the site and the CRM. **Fira Sans** handles everything else: headlines, body, UI, eyebrows, code. Loaded via `next/font/google` (subsets `latin` + `cyrillic`) and exposed as CSS var `--font-fira`. Mapped to `font-sans` only. Tailwind's default `font-mono` falls through to the system mono stack (`ui-monospace, SFMono-Regular, Menlo, …`) — used for code blocks in admin and chart tooltips.

| Property | Value |
|---|---|
| Family | `Fira Sans`, `system-ui`, `sans-serif` |
| Subsets | `latin`, `cyrillic` |
| Weights loaded | 400, 500, 600, 700 |
| Italic | not loaded — do not use italic |
| Variable name | `var(--font-fira)` |

**Type scale** (Tailwind, observed in production):

| Role | Class | Size | Weight | Where |
|---|---|---|---|---|
| Display H1 | `text-4xl md:text-5xl lg:text-6xl` | 36 / 48 / 60 px | 600 (semibold) | Site hero |
| H2 | `text-2xl md:text-3xl lg:text-4xl` | 24 / 30 / 36 px | 600 | Site section heads |
| App page title | `text-2xl leading-tight` | 24 px | 600 | Dense UI (CRM, admin) — compressed on purpose |
| Section title | `text-lg leading-snug` | 18 px | 600 | Section inside a page, `<h2>` by default |
| H3 / Card title | `text-lg` (site) · `text-base` (app) | 18 / 16 px | 600 | Card titles — a real heading, not a `<div>` |
| Body | `text-base` | 16 px | 400 | Paragraphs |
| Body small | `text-sm` | 14 px | 400 | Secondary copy, nav |
| Micro | `text-xs` | 12 px | 600 + uppercase | Eyebrows, footers |
| Overline | `text-2xs uppercase tracking-wider` | 11 px | 600 | Meta labels, table heads, eyebrows in dense UI |
| Brand wordmark | `font-brand text-base font-bold tracking-brand uppercase` | 16 px · Inter 700 · +0.15em | Header, footer, CRM sidebar/login (`Wordmark`) |

- `text-2xs` (`0.6875rem / 1rem`) replaces every ad-hoc `text-[11px]` / `text-[10px]`. Arbitrary font sizes are not allowed.
- `tracking-brand` (`0.15em`) replaces `tracking-[0.15em]`. Tracking + caps is reserved for the wordmark and overlines.
- Heading levels never skip (H1 → H2 → H3); card and dialog titles are real headings.
- Line-height: defaults to Tailwind `leading-relaxed` (1.625) on body, `leading-tight` (1.25) on display.

### 1.4 Spacing & layout

- Container: `<Container>` (`components/ui/container.tsx`) = `mx-auto w-full px-6` + `max-w-7xl` (default, 1280 px) · `narrow` (`max-w-5xl`) · `prose` (`max-w-3xl`). Don't copy the class string.
- Header offset: `--header-h` (5rem) → `pt-header`; `html { scroll-padding-top: var(--header-h) }` keeps focused/anchored elements out from under the fixed header (WCAG 2.4.11).
- Vertical rhythm for sections: `py-20 lg:py-28` (80 / 112 px).
- Grid: 12-column logical, but expressed as `md:grid-cols-2`, `lg:grid-cols-3`, `lg:grid-cols-4`.
- Card padding: `p-6` (24 px).
- Header padding: `px-6 py-4` (24 / 16).
- Forms: canonical width `max-w-xl`; a multi-column form may go full width.

### 1.5 Radii

Set via `--radius: 0.375rem` (6 px). The scale is **locked** in `theme.borderRadius` (not `extend`) — only these classes exist:

| Tailwind | Value | Use |
|---|---|---|
| `rounded-lg` | `var(--radius)` = 6 px | **Controls:** buttons (default/lg/icon), button-like CTA links, inputs, textareas, selects; dialogs; CRM cards |
| `rounded-md` | radius − 2 = 4 px | Small buttons (`sm`), nav items, tab triggers, site content cards and images, popovers/menus |
| `rounded-sm` | radius − 4 = 2 px | Checkbox, small chips |
| `rounded-full` | pill | Badges, slider dots |

Same on the site and in the CRM (decided 2026-09-26: the site moved its controls from 4 px to 6 px).

Bare `rounded`, `rounded-xl/2xl/3xl` no longer compile (2026-10-17: 34 bare `rounded` were migrated to the identical `rounded-md`).

### 1.6 Elevation / shadow

Two brand levels, no stock `shadow-sm/md/lg/xl`:

```css
shadow-mesto:    0 2px 6px 0 rgba(0, 0, 0, 0.08);
shadow-mesto-lg: 0 8px 24px -4px rgba(7, 18, 70, 0.14), 0 2px 6px 0 rgba(7, 18, 70, 0.08);
```

| Level | Where |
|---|---|
| none (border only) | **Static cards and panels** — a permanent shadow on a static section is noise |
| `hover:shadow-mesto` | A card that is clickable as a whole — the shadow is the promise of a click |
| `shadow-mesto` | Fixed header, primary CTA buttons on photo/navy |
| `shadow-mesto-lg` | Floating surfaces: popover, dropdown, select, tooltip, dialog, sheet, toast |

Changed 2026-09 (was: every card `shadow-mesto`, hover lift to `shadow-lg`).

### 1.7 Motion

- Durations (tokens, no raw `duration-NNN`): `duration-fast` 150 ms (micro), `duration-base` 200 ms (hover, shadow), `duration-slow` 300 ms (mobile menu, image zoom on card hover), `duration-hero` 1000 ms (hero crossfade only).
- JS-driven motion (autoplay slider, marquee) is not covered by the CSS rule — check `useReducedMotion()` (`hooks/use-reduced-motion.ts`): no autoplay under reduced motion, and every auto-moving element has a visible pause control (WCAG 2.2.2).
- Easings: default Tailwind (ease in-out).
- Patterns: opacity crossfade for hero images, height transitions for mobile menu, `translate-x-0.5` on link arrow hover, `active:translate-y-px` on buttons.
- **`prefers-reduced-motion: reduce`** — a global rule in `globals.css` cuts every animation/transition to 0.01 ms and disables smooth scroll. Anything that relies on motion to be understood (e.g. a pulsing skeleton) must also be visible when static — hence `--skeleton`.
- No spring physics, no parallax, no scroll-driven animation. Quiet motion language.

### 1.8 Layers (z-index)

One scale instead of ad-hoc `z-10` / `z-50`:

| Token | Value | Use |
|---|---|---|
| `z-sticky` | 10 | Sticky bars inside content |
| `z-dropdown` | 20 | In-flow menus |
| `z-header` | 30 | Site fixed header, admin mobile top bar |
| `z-overlay` | 40 | Modal scrim + dialog/sheet content |
| `z-popover` | 45 | Portaled select/menu/tooltip — above a modal it opens from |
| `z-toast` | 50 | Toasts, update banners |
| `z-skip` | 60 | Skip link |

Local stacking inside a `relative` block (text over a hero image) may use `z-10`.

---

## 2. Component recipes

The site uses shadcn/ui primitives (Radix + cva) plus a few custom sections. `cn()` (`lib/utils.ts`) is `twMerge` extended with the brand scales (`shadow-mesto*`, `z-*`, `tracking-brand`, `duration-fast/base`) — otherwise conflicting classes are resolved by CSS order, not argument order.

### 2.1 Button

```tsx
<Button>Обсудить проект</Button>
// a link that looks like a button — never copy the class string:
<Button asChild><Link href="/contacts">Обсудить проект</Link></Button>
// on a navy surface (hero, CTA band):
<Button asChild size="xl" variant="onPrimary"><Link href="/portfolio">Смотреть портфолио</Link></Button>
```

Variants from `components/ui/button.tsx`: `default`, `destructive`, `outline`, `secondary`, `ghost`, `link`, `onPrimary`, `outlineOnPrimary` (the last two carry `focus-ring-on-primary`). Sizes: `sm` (36 px), `default` (40 px), `lg` (44 px), `xl` (48 px, hero/CTA), `icon` (40 px), `icon-sm` (32 px, row actions). **Every size grows to ≥ 44 px under `pointer: coarse`** — no per-page `h-11` overrides.

- `default` hover = `opacity-90`; `destructive` hover = `brightness-90` (fading the fill drops white-text contrast).
- `outline` uses the hairline `border-border`, not `border-input`.
- Pressed: `active:translate-y-px`. Invalid: `aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/40`.

### 2.2 Card (content)

```tsx
// static
<div className="rounded-md border border-border bg-card p-6" />
// clickable as a whole
<Link className="focus-ring group block rounded-md border border-border bg-card transition-shadow duration-base hover:shadow-mesto" />
```

Always pair with `border-border` — never borderless. Make the whole card the link, not only its title.

### 2.3 Step / index card

Numbered card pattern (used in `approach-section`, `focus-section`):

```tsx
<span className="inline-flex h-9 w-9 items-center justify-center rounded-md bg-primary text-sm font-semibold text-primary-foreground">
  01
</span>
```

### 2.4 Header

`fixed top-0` · `z-header` · `bg-card/95` · `backdrop-blur-sm` · `shadow-mesto` · `border-b`. Wordmark left, nav right, primary CTA on far right. Mobile menu toggle is `touch-target` (44 px under a coarse pointer).

### 2.5 CTA section

Full-bleed `bg-primary` band with `text-primary-foreground`, contrasting `bg-primary-foreground text-primary` button. Interactive elements on the band use `focus-ring-on-primary`. Used as page closer.

### 2.6 Hero

Full-screen `Image fill object-cover` with `bg-primary/65` overlay, headline in `text-primary-foreground`, slider dots bottom-right. Links and dots use `focus-ring-on-primary`.

### 2.7 Form field

```tsx
<Field label="Имя" required error={errors.name} hint="Как к вам обращаться">
  <Input name="name" autoComplete="name" />
</Field>
```

`Field` (`components/ui/field.tsx`) wires `id`, `htmlFor`, `aria-describedby` (hint + error) and `aria-invalid` into its single child; `required` adds the `*` marker (pair it with a "* — обязательное поле" legend). `overline` renders the label as `.text-eyebrow` (public forms).

Input recipe: `focus-ring h-10 [@media(pointer:coarse)]:h-11 rounded-lg border border-input bg-background px-3 text-base [@media(pointer:fine)]:text-sm aria-invalid:…`. Text size is gated on the pointer, not the width: an iPad (≥ 768 px, touch) also zooms on < 16 px fields.

- Validate on submit with `noValidate` + inline errors; focus the first invalid field; show a server error summary next to the submit button, not 3000 px above it.
- Never show raw driver/HTTP messages — map to Russian copy (`lib/admin-action.ts` on the server).

- Label above the control; placeholder never replaces a label.
- `text-base` on mobile — iOS zooms the page when a < 16 px field gets focus.
- Use the right type: `type="date"`, `type="email"`, `type="url"`, `inputMode="decimal"` for sums. On iOS, date/time inputs are left-aligned by a base rule in `globals.css`.
- `aria-invalid` works in Tailwind 3 only because `theme.extend.aria.invalid` is configured.

### 2.8 Alert (message strip)

```tsx
<Alert tone="danger">Не удалось сохранить. Попробуйте ещё раз.</Alert>
```

Tones `danger` · `warning` · `success` · `neutral` — each carries an icon (meaning is never colour-only, WCAG 1.4.1). `danger` gets `role="alert"` automatically, others get no role. Tone vocabulary matches Badge (`destructive` · `warning` · `default` · `outline`).

### 2.9 Badge

`rounded-full px-2.5 py-0.5 text-xs font-semibold`. Variants `default`, `secondary`, `destructive`, `outline`, `warning`. Only a badge that *is* a link gets a hover state.

### 2.10 Skeleton & empty state

- Skeleton: `<Skeleton>` (`animate-pulse rounded-md bg-skeleton`), shaped like the content it replaces, `aria-hidden`, plus one sr-only `role="status"` line ("Загрузка проектов").
- Empty state: `<EmptyState icon title description action>` — one plain line plus the next action. An empty *filter* result offers "Показать все".
- Error state: `<ErrorState title description onRetry actions>` — Russian copy, retry, a way out; focuses its heading. Route-level: `app/error.tsx`, `app/global-error.tsx`, `app/admin/error.tsx`.

### 2.11 Component catalogue (added 2026-10-17)

| Component | File | Use / rules |
|---|---|---|
| `IconButton` | `ui/icon-button.tsx` | Icon-only actions. `label` is **required** (→ `aria-label` + tooltip); `pressed` → `aria-pressed` for toggles. 32/40 px, 44 px on touch. Never a raw `<button><Icon/></button>`. |
| `ConfirmProvider` / `useConfirm` | `ui/confirm-dialog.tsx` | Replaces `window.confirm`. Title names the object, description states the consequence; Cancel is focused; focus returns to the trigger. |
| `Field` | `ui/field.tsx` | Label + control + hint + error (§2.7). |
| `PageHeader` | `ui/page-header.tsx` | Admin page header: back link, h1, description, actions slot. One per page. |
| `Container` | `ui/container.tsx` | Page width + gutter (§1.4). |
| `EmptyState` / `ErrorState` / `Skeleton` | `ui/*.tsx` | §2.10. |
| `Wordmark` | `ui/wordmark.tsx` | «МЕСТО» in Inter 700 — site, admin, login. |
| `ExternalLink` | `ui/external-link.tsx` | New-tab links: arrow icon + sr-only "(откроется в новой вкладке)" + `rel="noopener noreferrer"`. |
| `Toaster` | `ui/sonner.tsx` | The only toast system (sonner, polite live region), mounted once in the admin layout. |
| `useAdminAction` | `hooks/use-admin-action.ts` | Runs a server action in a transition: toast on success/error, redirect to login with return path on an expired session. Update local state only on success. |
| `adminAction` | `lib/admin-action.ts` | Server side of the same contract: session check, never throws, `{ ok, code, error }` with Russian copy. |
| `.text-eyebrow` | `globals.css` | Overline (`text-xs font-semibold uppercase tracking-widest text-muted-foreground`). For a section title, put it on a real `<h2>`. |
| `.touch-target` / `.touch-target-y` | `globals.css` | 44 px square / 44 px height under `pointer: coarse` for small controls, text links and chips. |
| Lightbox | `portfolio/project-gallery.tsx` | Full-screen on `bg-media`: title + «Фото N из M» (live), close, ←/→ at the edges, swipe, thumbnail strip with `aria-current`; focus returns to the last photo shown. Not on navy — it tinted the photos (2026-10-30). |
| `.prose-mesto` | `globals.css` | Long-form CMS text: visible links, scrollable tables, `overflow-wrap: anywhere`. |

Deleted as dead duplicates: `ui/toast.tsx`, `ui/toaster.tsx`, `ui/use-toast.ts`, `hooks/use-toast.ts`, `ui/use-mobile.tsx`, `components/theme-provider.tsx`, `styles/globals.css`.

---

## 3. Iconography

- Library: **Lucide React** (`lucide-react`).
- Sizing: 16 / 18 / 20 px — match adjacent text size (`size-4` in buttons).
- Stroke: `1.5` (set explicitly on inline SVGs in the codebase).
- Color: inherit `currentColor`. Never hard-code icon fills. Decorative icons get `aria-hidden`.
- No text glyphs (`+`, `✓`, `↑↓`) or emoji as UI icons. A destructive action is icon + text, never colour alone.

Inline SVG conventions (from `site-header`, `focus-section`):

```html
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
  <path d="…" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
```

---

## 4. Accessibility & semantics

- `lang="ru"` set on `<html>`. All copy is Russian-first, with `ru-RU` alternate — including `aria-label`s.
- **Contrast:** text on `bg-primary` ≈ 14:1 (AAA). `--muted-foreground` on background 5.5:1 (AA for all sizes). White on `--destructive` 5.8:1. `--input` border 3.1:1. Don't put muted text on tinted surfaces and don't fade it further (`text-muted-foreground/80` fails at 11 px).
- **Focus — exactly two named recipes** in `globals.css`, no hand-written sets:
  - `.focus-ring` — `ring-2 ring-ring ring-offset-2` with an offset gap coloured `--ring-offset`. Without the gap a navy ring on a navy button is 1:1.
  - `.focus-ring-on-primary` — on navy surfaces: white ring, navy gap.
  - `outline-none` without a replacement is forbidden. Default `ringColor` is `--ring` (otherwise TW3 falls back to blue-500).
- **Hit area:** controls 40 px (`h-10`), small buttons 36 px (`h-9`) with a mouse; **every Button/IconButton/Input is ≥ 44 px under `pointer: coarse`**. `.touch-target` / `.touch-target-y` do the same for custom controls and text links. Nothing interactive is below 24 × 24 px (WCAG 2.5.8).
- **Skip link** "Перейти к содержимому" (`SkipLink`, `z-skip`) → `<main id="main">` on the site and in the admin.
- **Landmarks:** the admin sidebar is an `<aside>` *next to* `<main>`, never inside it.
- **Hover only with a real pointer:** `future.hoverOnlyWhenSupported` wraps every `hover:` in `@media (hover: hover)` — on phones hover used to "stick" after a tap.
- Mobile menu: static `aria-label="Меню"` + `aria-expanded`/`aria-controls`; the closed panel is `inert`; Escape closes and returns focus; closes on navigation.
- Navigation: active item has `aria-current="page"` (prefix match), not colour only.
- Hero slider: 8 px dots inside 24 px buttons, `aria-label="Слайд N из M"`, `aria-current`, pause/play control; no autoplay under reduced motion.
- Status changes (filter result count, form success, toasts) are announced through a live region.
- Long user text with `whitespace-pre-wrap` also gets `overflow-wrap: anywhere` (globally), so a pasted URL can't cause horizontal page scroll.

---

## 5. Image system

- Formats served: `image/avif`, `image/webp` (Next.js `images.formats`).
- Hero crossfade ratio: 16:9-ish, fills viewport `min-h-[600px] lg:min-h-[700px]`.
- Portfolio grid: aspect 4:3, `rounded-md` corners, no border.
- Always provide `alt` — the schema treats empty alt as decorative only.

---

## 6. SEO & meta surfaces

- Title template: `%s — МЕСТО`. Default: `МЕСТО — Pop-Up, выставки, инсталляции и витрины`.
- OG image: 1200 × 630, generated on the fly in `app/opengraph-image.tsx`. See [`logos/og-template.svg`](./logos/og-template.svg) for the editable source.
- Theme color (mobile chrome): `#071246`.
- JSON-LD: `Organization` + `WebSite` injected in root layout.

---

## 7. Tokens — drop-in files

| File | Use |
|---|---|
| [`tokens/colors.json`](./tokens/colors.json) | Style Dictionary / Figma Tokens compatible |
| [`tokens/typography.json`](./tokens/typography.json) | Type scale |
| [`tokens/tokens.css`](./tokens/tokens.css) | CSS custom properties + focus/touch recipes — drop into `globals.css` |

---

## 8. Do / Don't

### Do
- Lead with **navy `#071246`** as the only saturated brand color.
- Stack content on near-white (`#FCFCFD`) cards over the navy.
- Use `tracking-brand uppercase` only for the wordmark and overlines — nowhere else.
- Keep motion under 300 ms outside of hero crossfade; respect reduced motion.
- Reuse the navy ramp (`chart-1…5`) for all data viz instead of inventing new accent colors.
- Use `.focus-ring` / `.focus-ring-on-primary` on every interactive element.
- Keep cards flat; give a shadow only to what is clickable (on hover) or floating.

### Don't
- Don't introduce a third brand color or accent (no orange/green/red CTAs — red, amber and green are *state* colours only: errors, transitions, success icons).
- Don't set text in `--success` or `--destructive-accent`; don't put text on a `#EE5959` fill.
- Don't use raw palette classes (`text-green-600`, `bg-black/80`) or hex in markup — use tokens.
- Don't use stock shadows (`shadow-sm/md/lg/xl`), arbitrary font sizes (`text-[11px]`) or arbitrary z-index.
- Don't use italics — Fira Sans italic is not loaded.
- Don't apply `shadow-mesto` to text; it's a surface shadow.
- Don't render the wordmark below 12 px (cyrillic is illegible). Use the monogram instead.
- Don't gradient the navy. The brand is flat.

---

## 9. Production status — applied

- ✅ **Primary color unified** — `--primary` (and dependent `--ring`, `--accent-foreground`, `--chart-1`, `--sidebar-*`) set to `229 82% 15%` (= `#071246`) in `app/globals.css`. `::selection` switched to `hsl(var(--primary))`.
- ✅ **Logo source files added** — canonical SVGs in [`logos/`](./logos/): mark and wordmark in light / reverse / outlined variants. **Mark and wordmark are never combined into a lockup** — pick one or the other.
- ✅ **Font aliases cleaned up** — `font-serif` and `font-mono` removed from `tailwind.config.ts`. `font-mono` now resolves to the system mono stack (correct for code blocks in admin and chart tooltips). `font-serif` is unused.
- ✅ **PNG fallbacks generated** — favicon at `16/32/64/128/192/256/512/1024`, multi-resolution `favicon.ico`, OG `1200×630` (+ `2400×1260` retina), wordmark raster at `480w/960w/1920w`. See [`logos/png/`](./logos/png/) and the [`make-pngs.sh`](./logos/png/make-pngs.sh) regen script. Production app icons (`public/icon-192.png`, `public/icon-512.png`, `app/favicon.ico`) regenerated from canonical sources.
- ✅ **CRM decisions ported (2026-09-26)** — tokens, Tailwind extensions, `.focus-ring*`, `.touch-target`, reduced motion, flat cards, `shadow-mesto-lg` on floating UI, `bg-overlay/40` scrims, `Alert` with tones, `warning` badge, extended `cn()`. See §10.

---

## 10. Changelog — sync with the CRM

The CRM (`mesto-crm`) took this system in 2026-08 and hardened it over nine UX review rounds. What came back to the site on **2026-09-26**:

| Area | Before | Now | Why |
|---|---|---|---|
| `--muted-foreground` | `228 32% 53%` | `228 30% 48%` | 4.1:1 → 5.5:1, AA for small meta text |
| `--destructive` | `0 82% 65%` | `0 72% 45%` (+ `-accent`, `-text`) | White on red was 3.4:1 |
| `--input` | `= --border` (1.2:1) | `227 22% 61%` | Field outline must be 3:1 |
| New tokens | — | `--warning*`, `--success`, `--skeleton`, `--overlay`, `--ring-offset` | Semantic states, visible loading, brand-tinted scrim, visible focus |
| Focus | per-component sets, none on public links | `.focus-ring`, `.focus-ring-on-primary` | One recipe; navy ring on navy was invisible |
| Hover on touch | sticky | `hoverOnlyWhenSupported` | iOS hover stuck after tap |
| Cards | always `shadow-mesto`, hover `shadow-lg` | flat; `hover:shadow-mesto` if clickable | Static shadow is noise |
| Floating UI | stock `shadow-md/lg` | `shadow-mesto-lg` | One elevation language |
| Scale gaps | `text-[11px]`, `tracking-[0.15em]`, `z-50` | `text-2xs`, `tracking-brand`, `z-*` scale | Named steps instead of magic numbers |
| Modal scrim | `bg-black/80` | `bg-overlay/40` | Black is foreign to a blue palette |

| Control radius (site) | `rounded-md` 4 px | `rounded-lg` 6 px, as in the CRM | One control shape across products |
| Wordmark in the CRM | Fira Sans 600 | Inter 700 (`font-brand`), as on the site | The logo looks the same everywhere |

**Decided 2026-09-26:** wordmark — Inter Bold everywhere (the CRM now loads Inter 700); control radius — 6 px everywhere; hero slider dots stay 8 px (visual choice, accepted below the 24 px target).

**Still open:** *table header as overline* — specified here, not implemented in the CRM.

### 2026-10-17 — UI/UX audit (site + admin)

Full audit (public routes, admin, auth, PWA) and a system pass. Highlights:

| Area | Before | Now | Why |
|---|---|---|---|
| Radius scale | extendable, 34 bare `rounded` | locked `none/sm/md/lg/full` | One scale; drift can't compile |
| Touch targets | 32–40 px buttons, 18–22 px admin arrows | Button/IconButton/Input ≥ 44 px on coarse pointers | WCAG 2.5.8 + one-handed use |
| Toasts | 2 systems, none mounted | sonner only, `useAdminAction` | Uniform feedback, no silent failures |
| Confirmations | `window.confirm` | `useConfirm` (AlertDialog) | Names object + consequence |
| Errors | raw Postgres/HTTP text, no boundaries | `adminAction` codes + Russian copy, `error.tsx` everywhere | No dead white screens, no leaked schema |
| Tokens added | — | `--header-h`, `--success-foreground`, `--brand-telegram`, `duration-slow/hero`, `z-popover`, `color-scheme: light` | Gaps found in the audit |
| Docs | hex values drifted from HSL | recomputed from HSL | Swatches showed colours the site doesn't use |

**CRM sync pending:** port `IconButton` touch sizes, locked radius scale, `z-popover`, `--success-foreground`, `useConfirm` to `mesto-crm`.
