# design.md — msar.me design system

> Source of truth for the look and feel of any app built in the msar.me style.
> Taken from https://msar.me/ on 2026-11-06. Follow it exactly. When a value is missing here, use the nearest token. Do not make up a new colour.

---

## 1. Character

A calm, editorial engineer's notebook: a white content column on a dotted grey background, a serif for headlines, a geometric sans for everything else, and **one teal accent used sparingly**.

**Rules**

1. Neutrals carry about 95% of the UI. Use `accent` (teal) only for: the active nav item, hover states, a highlighted phrase in a headline, and link underlines.
2. **Borders, not shadows.** Separate surfaces with a 1px `line` border or ring. Keep shadows at 2–5% black.
3. The primary button is **ink-flipped** (`inverse`): near-black in light mode, near-white in dark mode. Primary buttons are never teal.
4. Body copy is `fg-muted`. Only headings and titles use full `fg`.
5. Light and dark themes are both first class. Switch with `data-theme="dark"` (or a `.dark` class) on `<html>`.
6. Avoid: gradients, emoji in UI, coloured left-border cards, heavy drop shadows, purple or blue AI-style palettes.

---

## 2. Colour tokens

| Token | Light | Dark | Use |
|---|---|---|---|
| `bg` | `#f8fafc` | `#07080b` | Page background (with dot grid) |
| `surface` | `#ffffff` | `#0e1114` | Content column, cards, inputs, nav pill |
| `subtle` | `#f2f4f7` | `#191c20` | Secondary button fill, placeholders, quiet hover |
| `line` | `#e2e6e9` | `#25292f` | All borders, rings and dividers |
| `fg` | `#141920` | `#f1f4f6` | Headings, titles, nav items |
| `fg-muted` | `#4d535c` | `#b3b8be` | Body text |
| `fg-subtle` | `#6e737b` | `#8b9097` | Dates, meta, placeholders, captions |
| `accent` | `#00776e` | `#34d4bf` | Brand teal: active, hover, highlights |
| `accent-strong` | `#005f5a` | `#66e9d4` | Pressed or hover state of accent |
| `accent-soft` | `#ccfbf1` | `#04363199` | Tinted background behind accent content |
| `accent-fg` | `#f3fcfa` | `#021816` | Text on a solid accent fill |
| `ring` | `#009589` | `#00baa6` | Focus outline |
| `inverse` | `#141920` | `#f1f4f6` | Primary button fill |
| `inverse-fg` | `#f8fafc` | `#0e1114` | Text on inverse |
| `info` / `info-soft` | `#0069a2` / `#dff2fe` | `#00bbfe` / `#052f4a80` | Information |
| `warn` / `warn-soft` | `#b45307` / `#fef3c6` | `#fcbb00` / `#46190180` | Warning |
| `danger` / `danger-soft` | `#bf000f` / `#ffe2e2` | `#f87171` / `#46080980` | Error, destructive |
| `noise-dot` | `#00000026` | `#ffffff26` | Dots of the background grid |

Contrast: every text token passes 4.5:1 on `bg` and `surface` in both themes. `ring` passes 3:1.

---

## 3. Typography

Fonts (Google Fonts, variable):

```html
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,100..900&family=Sora:wght@100..800&family=JetBrains+Mono:wght@100..800&display=swap" rel="stylesheet">
```

| Family | Stack | Used for |
|---|---|---|
| `display` | `Fraunces, Georgia, "Times New Roman", serif` | H1, H2 |
| `sans` | `Sora, ui-sans-serif, system-ui, sans-serif` | Body, UI, card titles |
| `mono` | `"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace` | Code |

| Style | Family | Size / line height | Weight | Notes |
|---|---|---|---|---|
| `display-xl` | display | 48 / 56px | 600 | Hero H1 on desktop (≥640px) |
| `display-lg` | display | 36 / 40px | 600 | Hero H1 on mobile, page titles |
| `heading` | display | 30 / 36px | 600 | Section H2 |
| `title` | sans | 16 / 28px | 600 | letter-spacing −0.4px; card and list titles |
| `body` | sans | 16 / 28px | 400 | Prose, in `fg-muted` |
| `body-ui` | sans | 16 / 24px | 400 | Default UI text |
| `small` | sans | 14 / 24px | 400 | Descriptions, dates |
| `label` | sans | 14 / 24px | 500 | Nav items, secondary buttons, links |
| `button` | sans | 14 / 24px | 600 | Primary button label |
| `code` | mono | 14 / 20px | 400 | Inline and block code |

Hero pattern: the lead phrase is coloured `accent` and the rest is `fg`, e.g. "**Forward Deployed Engineer.** I work inside the problem until it ships."

---

## 4. Spacing, corners, shadows

**Spacing** (4px base, matches Tailwind): `1`=4 · `2`=8 · `3`=12 · `4`=16 · `6`=24 · `10`=40 · `12`=48 · `20`=80 · `32`=128px.

- Buttons and nav items: 8px × 12px padding. Inputs: 7px × 12px.
- Cards: 24px padding. Card stacks: 40px gap.
- Sections: 80px apart. Space above the footer: 128px.
- Layout: a centred `surface` column (max-width about 1280px, 1px `line` ring) on the dotted `bg`. Prose max-width is 42rem.

**Corners:** `radius-sm` 4px (list items) · `radius-md` 6px (buttons, inputs) · `radius-xl` 12px (mobile photo tiles) · `radius-2xl` 16px (cards, photos) · `radius-full` 9999px (nav pill, avatar, icon buttons).

**Shadows**

| Token | Value | Use |
|---|---|---|
| `shadow-card` | `0 1px 3px 0 rgba(0,0,0,.02), 0 1px 2px -1px rgba(0,0,0,.02)` | Cards at rest |
| `shadow-input` | `0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -2px rgba(0,0,0,.05)` | Inputs |
| `shadow-float` | `0 10px 15px -3px rgba(0,0,0,.05), 0 4px 6px -4px rgba(0,0,0,.05)` | Nav pill, avatar, icon buttons |
| `shadow-photo` | light `0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1)` · dark same at `.4` | Photo tiles |

**Motion**

- Page enter: 0.42s `cubic-bezier(.22,1,.36,1)`. Page exit: 0.16s `cubic-bezier(.4,0,1,1)`.
- Button press: `scale(.97)` over 150ms. Colour changes: 150ms.
- Honour `prefers-reduced-motion`.

**Focus:** `outline: 2px solid var(--ring); outline-offset: 2px` on every interactive element.

**Icons:** line icons with a 1.5px stroke, `currentColor`, 16–24px. Default `fg-subtle`, hover `accent`.

---

## 5. Drop-in CSS (tokens + components)

```css
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,100..900&family=Sora:wght@100..800&family=JetBrains+Mono:wght@100..800&display=swap");

:root, [data-theme="light"] {
  --bg:#f8fafc; --surface:#ffffff; --subtle:#f2f4f7; --line:#e2e6e9;
  --fg:#141920; --fg-muted:#4d535c; --fg-subtle:#6e737b;
  --accent:#00776e; --accent-strong:#005f5a; --accent-soft:#ccfbf1; --accent-fg:#f3fcfa;
  --ring:#009589; --inverse:#141920; --inverse-fg:#f8fafc;
  --info:#0069a2; --info-soft:#dff2fe; --warn:#b45307; --warn-soft:#fef3c6;
  --danger:#bf000f; --danger-soft:#ffe2e2; --noise-dot:#00000026;
  --shadow-photo:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);
}
[data-theme="dark"], .dark {
  --bg:#07080b; --surface:#0e1114; --subtle:#191c20; --line:#25292f;
  --fg:#f1f4f6; --fg-muted:#b3b8be; --fg-subtle:#8b9097;
  --accent:#34d4bf; --accent-strong:#66e9d4; --accent-soft:#04363199; --accent-fg:#021816;
  --ring:#00baa6; --inverse:#f1f4f6; --inverse-fg:#0e1114;
  --info:#00bbfe; --info-soft:#052f4a80; --warn:#fcbb00; --warn-soft:#46190180;
  --danger:#f87171; --danger-soft:#46080980; --noise-dot:#ffffff26;
  --shadow-photo:0 20px 25px -5px rgba(0,0,0,.4),0 8px 10px -6px rgba(0,0,0,.4);
}
:root {
  --font-display:Fraunces,Georgia,"Times New Roman",serif;
  --font-sans:Sora,ui-sans-serif,system-ui,sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --radius-sm:4px; --radius-md:6px; --radius-xl:12px; --radius-2xl:16px; --radius-full:9999px;
  --shadow-card:0 1px 3px 0 rgba(0,0,0,.02),0 1px 2px -1px rgba(0,0,0,.02);
  --shadow-input:0 4px 6px -1px rgba(0,0,0,.05),0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-float:0 10px 15px -3px rgba(0,0,0,.05),0 4px 6px -4px rgba(0,0,0,.05);
  --ease-out:cubic-bezier(.22,1,.36,1); --ease-in:cubic-bezier(.4,0,1,1);
}

/* Page */
.ms-page{background-color:var(--bg);background-image:radial-gradient(circle at 1px 1px,var(--noise-dot) 1px,transparent 0);background-size:24px 24px;color:var(--fg-muted);font:400 16px/24px var(--font-sans);-webkit-font-smoothing:antialiased}
.ms-display{font-family:var(--font-display);font-weight:600;color:var(--fg)}
.ms-display em{font-style:normal;color:var(--accent)}

/* Button */
.ms-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px;border:0;border-radius:var(--radius-md);font:500 14px/24px var(--font-sans);text-decoration:none;cursor:pointer;transition:transform .15s,background-color .15s,color .15s}
.ms-btn:active{transform:scale(.97)}
.ms-btn:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
.ms-btn:disabled{opacity:.75;cursor:not-allowed;transform:none}
.ms-btn--primary{background:var(--inverse);color:var(--inverse-fg);font-weight:600}
.ms-btn--primary:hover{opacity:.9}
.ms-btn--secondary{background:var(--subtle);color:var(--fg);box-shadow:inset 0 0 0 1px var(--line)}
.ms-btn--secondary:hover{background:var(--surface)}
.ms-btn--icon{width:40px;height:40px;padding:0;border-radius:var(--radius-full);background:var(--surface);color:var(--fg-subtle);box-shadow:0 0 0 1px var(--line),var(--shadow-float)}
.ms-btn--icon:hover{color:var(--accent)}

/* Link */
.ms-link{color:var(--fg);font-weight:500;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 40%,transparent);text-underline-offset:4px;transition:text-decoration-color .15s}
.ms-link:hover{text-decoration-color:var(--accent)}

/* Nav pill */
.ms-nav{display:inline-flex;list-style:none;margin:0;padding:0 12px;border-radius:var(--radius-full);background:color-mix(in srgb,var(--surface) 90%,transparent);box-shadow:0 0 0 1px var(--line),var(--shadow-float);backdrop-filter:blur(8px)}
.ms-nav a{display:block;padding:8px 12px;font:500 14px/24px var(--font-sans);color:var(--fg);text-decoration:none;transition:color .15s}
.ms-nav a:hover,.ms-nav a[aria-current="page"]{color:var(--accent)}

/* Card */
.ms-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-2xl);padding:24px;box-shadow:var(--shadow-card);color:var(--fg-muted)}
.ms-card__title{display:flex;align-items:center;gap:12px;margin:0 0 16px;font:600 14px/24px var(--font-sans);color:var(--fg)}

/* Article list item */
.ms-article{display:flex;flex-direction:column;align-items:flex-start;padding:8px;border-radius:var(--radius-sm)}
.ms-article time{order:-1;margin-bottom:12px;padding-left:14px;border-left:2px solid var(--line);font-size:14px;line-height:24px;color:var(--fg-subtle)}
.ms-article h3{margin:0;font:600 16px/28px var(--font-sans);letter-spacing:-.4px;color:var(--fg);transition:color .15s}
.ms-article:hover h3{color:var(--accent)}
.ms-article p{margin:8px 0 0;font-size:14px;line-height:24px}

/* Input */
.ms-input{min-width:0;appearance:none;padding:7px 12px;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface);color:var(--fg);font:400 14px/24px var(--font-sans);box-shadow:var(--shadow-input)}
.ms-input::placeholder{color:var(--fg-subtle)}
.ms-input:focus{outline:2px solid var(--ring);border-color:transparent}
.ms-input[aria-invalid="true"]{border-color:var(--danger)}

code{font:400 14px/20px var(--font-mono)}
```

---

## 6. Tailwind (v4) mapping

Load the CSS variables from section 5, then:

```css
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *, [data-theme=dark], [data-theme=dark] *));
@theme inline {
  --color-bg: var(--bg); --color-surface: var(--surface); --color-subtle: var(--subtle); --color-line: var(--line);
  --color-fg: var(--fg); --color-fg-muted: var(--fg-muted); --color-fg-subtle: var(--fg-subtle);
  --color-accent: var(--accent); --color-accent-strong: var(--accent-strong); --color-accent-soft: var(--accent-soft); --color-accent-fg: var(--accent-fg);
  --color-ring: var(--ring); --color-inverse: var(--inverse); --color-inverse-fg: var(--inverse-fg);
  --color-info: var(--info); --color-warn: var(--warn); --color-danger: var(--danger);
  --font-display: var(--font-display); --font-sans: var(--font-sans); --font-mono: var(--font-mono);
}
```

Tailwind v3: map the same names in `theme.extend.colors` as `'var(--bg)'` and so on, and set `darkMode: 'class'`.

Typical class recipes (as used on msar.me):

| Element | Classes |
|---|---|
| Hero H1 | `font-display text-4xl sm:text-5xl font-semibold text-fg` |
| Section H2 | `font-display text-3xl font-semibold text-fg` |
| Card title | `text-base font-semibold tracking-tight text-fg group-hover:text-accent` |
| Body | `text-base leading-7 text-fg-muted` |
| Meta | `text-sm text-fg-subtle` |
| Primary button | `inline-flex items-center gap-2 rounded-md bg-inverse px-3 py-2 text-sm font-semibold text-inverse-fg active:scale-[0.97]` |
| Secondary button | `inline-flex items-center gap-2 rounded-md bg-subtle px-3 py-2 text-sm font-medium text-fg ring-1 ring-inset ring-line` |
| Card | `rounded-2xl border border-line bg-surface p-6 shadow-sm shadow-black/2` |
| Nav pill | `rounded-full bg-surface/90 px-3 text-sm font-medium text-fg shadow-lg shadow-black/5 ring-1 ring-line backdrop-blur` |
| Input | `rounded-md border border-line bg-surface px-3 py-[7px] text-sm shadow-md shadow-black/5 placeholder:text-fg-subtle` |
| Link | `font-medium text-fg underline decoration-accent/40 underline-offset-4 hover:decoration-accent` |

---

## 7. Components: usage rules

- **Button:** one `primary` per view. Everything else is `secondary`. Icon-only buttons are 40px round and need an `aria-label`. Add a trailing "→" when the button navigates.
- **Nav pill:** floating, centred, 4–6 links, current page marked with `aria-current="page"`. Below 768px, replace it with a single "Menu" pill.
- **Card:** use it for grouped sidebar or grid content. Never nest cards. End with a button if there is an action.
- **Article item:** the date (with a 2px `line` tick) sits above the title. The excerpt is clamped to about 160 characters. The whole item is the link, and the title turns `accent` on hover.
- **Input:** always give it a label or `aria-label`. When invalid, use `aria-invalid="true"` and put a 14px `danger` message below the field.
- **Callouts:** `*-soft` background, `*` text and icon, `radius-md`, 12–16px padding. No left border stripe.

---

## 8. Content and voice

- First person, direct, plain. Short declarative sentences.
- Sentence case for headings and buttons ("Latest articles", "Work with me").
- Calls to action are verbs: "See how I can help →", "Join", "Read article".
- Dates are written "Oct 14, 2026". Ranges use an em dash: "Nov 2022—Present".
- No emoji in UI.

---

## 9. Brand mark

There is no wordmark. The site's mark is the illustrated avatar in a round frame with a 1px `line` ring and `shadow-float`. Where the avatar isn't available, write **msar.me** in `display` type at weight 600.
