# Agentic Design System by Madhav Nair: instructions for AI agents

## Read first
Bots working on this repo: read DESIGN-RULES.md in the repo root (also in the zip) before any site work.
> A small, headless design system (CSS variables + W3C design tokens + semantic HTML recipes). Free to use. No framework, no build step.

## Files (load the CSS in this order)
1. https://madhavnair.in/css/base.css: base colour, type, shadow and motion tokens per mode (+ Inter @font-face)
2. https://madhavnair.in/css/tokens.css: spacing, radii, type scale and semantic tokens
3. https://madhavnair.in/css/themes.css: themes as token overrides (html[data-theme], html[data-mode])
4. https://madhavnair.in/css/components.css: component recipes (prefix c-)
- https://madhavnair.in/design/tokens.json: the same tokens in W3C Design Tokens (DTCG) format
- https://madhavnair.in/design/components.json: component specs: anatomy, variants, tokens used, accessibility rules, exact HTML
- https://madhavnair.in/DESIGN.md: the design language for humans
- https://madhavnair.in/design/madhav-design-system.zip: all of the above, plus Inter, licences and a sample index.html that works offline

## Rules (must)
1. Use tokens only. No raw hex/rgb colours or radii in component CSS. Radii: --r-sm, --r, --r-lg, --r-pill.
2. Set html[data-mode="light"|"dark"] before first paint; themes change tokens, never components.
3. One accent (--accent). Use it for the current item, the primary chip and small tags. Never for body text or large fills.
4. Dark mode primary button = dark pill (--pill) + accent chip (c-btn + c-btn__chip).
5. Sticky bars are solid (--chrome) and sit at top: var(--hh). Never translucent.
6. Media sits in c-plate or c-card--media and is clipped. Real images with width, height and alt.
7. No fixed min-heights on stacked cards. Spacing from the --s-1…--s-9 scale.
8. Geist Pixel (--pixel) for tiny labels only.
9. Copy: candid, specific, British English. No invented metrics, quotes or claims.

## Don't
Glow, gradient text, HUD looks, heavy gradients, neon overload, nested double frames, hover-only content, autoplaying motion.

## Test checklist (must pass before shipping)
- No horizontal scroll at 320, 360, 390, 412, 768, 1024, 1280, 1440, 1920px.
- Text ≥ 4.5:1, text on accent ≥ 4.5:1, focus ring ≥ 3:1, in light and dark.
- Tap targets ≥ 44px on touch; everything reachable by keyboard with visible focus.
- prefers-reduced-motion: no running animations. 200% zoom: reflows.
- One h1, title, description, canonical, OG image, alt text on every image.
- Sticky elements don't overlap each other or hide content.

## Components
### card (.c-card)
Anatomy: c-pill (optional), heading, body, c-card__foot (optional, pinned to bottom)
Variants: c-card--lead: the one current thing; 3px accent edge, c-card--media: no padding, media clipped, body in c-card__body, c-card--quiet: sunken, no shadow
Tokens: --bg-raised, --bg-sunken, --r-lg, --s-5, --shadow-1, --border, --accent
A11y: One heading per card. If the whole card is a link, use only one <a>. No fixed min-height.
HTML: <article class="c-card"><span class="c-pill"><span class="c-pill__dot"></span>Now</span><h3>Card title</h3><p>Short supporting text.</p><a class="c-card__foot" href="#">Read more</a></article>

### button (.c-btn)
Anatomy: c-btn__chip (icon on accent), label
Variants: (base): ink pill (light), dark pill (dark) with accent chip, c-btn--accent: accent fill, c-btn--ghost: outline only, c-btn--back: small ghost pill with a left chevron for the back link: label = parent index (Notes, Work, Playground), aria-label "Back to ...", plain link to the parent, first item in the article column, not sticky, --fg text at --t-sm, lime only on hover or focus
Tokens: --fg, --bg-page, --pill, --accent, --on-accent, --r, --r-sm
A11y: At least 44×44px. Visible :focus-visible ring ≥3:1. Text on accent ≥4.5:1.
HTML: <a class="c-btn" href="#"><span class="c-btn__chip" aria-hidden="true">→</span>Primary</a>
HTML (back): <a class="c-btn c-btn--ghost c-btn--back" href="/notes.html" aria-label="Back to Notes"><svg viewBox="0 0 12 12" aria-hidden="true" focusable="false"><path d="M7.5 3 4.5 6l3 3" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>Notes</a>

### pill (.c-pill)
Anatomy: c-pill__dot (optional), text
Variants: none
Tokens: --bg-sunken, --fg-2, --accent, --r-sm, --t-xs
A11y: Not interactive. The dot is decorative.
HTML: <span class="c-pill"><span class="c-pill__dot"></span>Label</span>

### chip (.c-chip)
Anatomy: text
Variants: [aria-pressed=true]: selected
Tokens: --fg, --bg-page, --fg-2, --r-pill, --border-strong
A11y: State via aria-pressed. 44px tap height on touch.
HTML: <button class="c-chip" aria-pressed="true">Selected</button> <button class="c-chip" aria-pressed="false">Filter</button>

### tab-switch (.c-tabswitch)
Anatomy: button[role=tab] x2 to 4
Variants: [aria-selected=true]: selected
Tokens: --bg-sunken, --line, --fg, --fg-2, --accent, --r, --r-sm, --t-sm
A11y: State via aria-selected. Selected = no fill and no pill: --fg text and a 2px --accent indicator inset 12px from the tab sides and 5px from its bottom, rounded ends, never touching the container border or corner. Unselected = --fg-2. One intact container border. 44px tap height on touch. Arrow keys move between tabs.
HTML: <div class="c-tabswitch" role="tablist" aria-label="Choose your tool"><button type="button" role="tab" aria-selected="true">Claude / GPT</button><button type="button" role="tab" aria-selected="false" tabindex="-1">Grok Bot</button></div>

### team-card (.c-teamcard)
Anatomy: span.c-teamcard__av (img or video, 56px) + div.c-teamcard__body > p.c-teamcard__n (name + span.c-teamcard__pill role) + p.c-teamcard__d (one-liner)
Variants: ul.c-teamcards: grid, 2-up, 1-up at 640px and below, cards top-align (align-items: start) so avatars and names stay level across a row; .c-teamcard--wide: full-width row (grid-column: 1 / -1), same card style, photo avatar object-fit: cover
Tokens: --fg, --fg-2, --line, --accent, --r, --r-pill, --t-md, --t-sm, --s-2, --s-4, --s-5, --s-6
A11y: List of people. Avatar is decorative (aria-hidden, alt empty) because the name is in text. 56px avatar from 112px sources. Optional video loop in the avatar slot: transparent PNG poster first, alpha WebM only, never an opaque MP4; posters only under reduced motion; one loop at a time. Focusable cards (tabindex=0) only when they carry a hover or focus loop.
HTML: <ul class="c-teamcards" aria-label="Team"><li class="c-teamcard"><span class="c-teamcard__av" aria-hidden="true"><img src="/images/about/madhav-avatar.svg" alt="" width="56" height="56"></span><div class="c-teamcard__body"><p class="c-teamcard__n">Name <span class="c-teamcard__pill">Role</span></p><p class="c-teamcard__d">One line on what they do.</p></div></li><li class="c-teamcard"><span class="c-teamcard__av" aria-hidden="true"><img src="/images/about/crew/bot-rum-112-poster-alpha.png" alt="" width="56" height="56"></span><div class="c-teamcard__body"><p class="c-teamcard__n">Rum <span class="c-teamcard__pill">Junior Developer</span></p><p class="c-teamcard__d">Stages every change so it gets seen first.</p></div></li></ul>

### tag (.c-tag)
Anatomy: text
Variants: c-tag--pixel: Geist Pixel label; sparingly
Tokens: --accent, --on-accent, --r-sm, --t-xs, --pixel
A11y: Text on accent ≥4.5:1. Never the only signal of state.
HTML: <span class="c-tag">New</span> <span class="c-tag c-tag--pixel">BETA</span>

### section (.c-section)
Anatomy: c-section__head, content
Variants: c-section--tight: smaller block padding
Tokens: --s-8, --s-6, --s-5
A11y: Has a heading or aria-label.
HTML: <section class="c-section c-section--tight"><div class="c-section__head"><h2>Section title</h2></div><p>Section content.</p></section>

### sticky-bar (.c-sticky)
Anatomy: controls
Variants: none
Tokens: --chrome, --line, --hh, --s-2
A11y: Solid, never translucent. top = header height (--hh). Anchors need scroll-margin-top.
HTML: <div class="c-sticky" style="position:static"><div style="display:flex;gap:8px;padding-inline:12px"><button class="c-chip" aria-pressed="true">All</button><button class="c-chip" aria-pressed="false">Notes</button></div></div>

### plate (.c-plate)
Anatomy: img with width/height + alt, figcaption (optional)
Variants: none
Tokens: --bg-raised, --r-lg, --shadow-1, --border
A11y: Meaningful alt. Lazy-load below the fold.
HTML: <figure class="c-plate"><div class="ds-ph" role="img" aria-label="Placeholder image">16:9 image</div><figcaption>Caption</figcaption></figure>


### flow (.c-flow)
Anatomy: li.c-flow__step (c-flow__t title, c-flow__d detail, ul.c-flow__br Yes/No branches, c-flow__who avatar line), optional c-flow-pair wrapper for two flows
Variants: c-flow__step--human: the one human step; number becomes a lime pill, c-flow-pair: two flows side by side, stacked under 720px, c-flow--rules: numbered rules list; no rail, no lime, no human step
Tokens: --s-3, --s-5, --t-xs, --t-sm, --t-md, --line-2, --lime, --on-lime, --r-pill
A11y: Ordered list with aria-label. Branches are text, not shapes. Avatar img alt empty when the name is in text.
HTML: <ol class="c-flow" aria-label="Example flow"><li class="c-flow__step"><p class="c-flow__t">Request arrives</p><p class="c-flow__d">One plain message.</p></li><li class="c-flow__step c-flow__step--human"><p class="c-flow__t">Human approves?</p><ul class="c-flow__br"><li><b>Yes</b><span>Next step.</span></li><li><b>No</b><span>Stop and ask.</span></li></ul></li><li class="c-flow__step"><p class="c-flow__t">Ship and check</p></li></ol>

