# Build a course catalogue with the Primer theme

You are building one page in an existing project: the course catalogue of an online school, with a search field and a level filter that together change a grid of nine course cards, a count of results given in words, and an empty state. Follow this brief closely. `DESIGN.md` decides the tokens: colors, type, spacing steps and corners. This brief decides the layout, its widths included, and which token goes where. If this brief names a color, a type size, a spacing step or a corner that `DESIGN.md` does not have, `DESIGN.md` wins.

## Before you start

1. **Check the theme is installed.** The project should have `DESIGN.md` in its root and the Primer variables in its global CSS. If not, run `npx shadcn@latest add https://strictthemes.com/r/primer.json` and save https://strictthemes.com/themes/primer/DESIGN.md as `DESIGN.md` in the project root. In a project without shadcn, use https://strictthemes.com/themes/primer/tailwind.css instead. If the global CSS still imports a font the theme does not use (a new shadcn project imports Geist), remove that import, and uninstall its package if nothing else uses it. Keep every font import the theme's install added, also one for a style no page uses yet.
2. **Read `DESIGN.md` from start to finish.** It is the source of truth for every visual decision.
3. **Look at the project before writing code.** Use its framework, router and file layout. For controls (buttons, inputs, tabs, menus, dialogs, accordions, data tables) use the components in `components/ui`, and add a missing one with `npx shadcn@latest add <name>` rather than writing your own, unless this brief names a plain element. Layout is plain elements with theme classes: sections, panels, figures and lists need no component.
4. **Teach `cn()` the theme's type classes.** shadcn's class merger does not know `text-display` or `text-h1`. It takes them for colors, so `cn("text-label text-muted-foreground")` silently drops one of the two, and a type class passed to a stock component does not replace its size. In a new shadcn project, `lib/utils.ts` only passes `cn` on from the `cn` package. Unless the file already holds the lines below, change it to:

   ```ts
   import { createCn } from "cn/config"

   // The theme's type classes are font sizes, not colors.
   export const cn = createCn({
     extend: {
       classGroups: {
         "font-size": [{ text: ["display", "h1", "h2", "body", "label"] }],
       },
     },
   })
   ```

   Then make every file in `components/ui` use it: where one has `import { cn } from "cn"`, change that line to import `cn` from the project's utils file (`@/lib/utils` in a default setup). Do the same for each component you add later. If the project uses `tailwind-merge` instead of the `cn` package, its components already import from the utils file: pass the same object to `extendTailwindMerge` and keep `clsx`.
5. **Write real content.** If the user gave you details about their product, use them. Otherwise use the sample product in this brief and write the rest of the copy yourself: specific and plain, the way the samples read. Invent the company and people names; do not use real ones. Never use lorem ipsum. A link with no destination yet points to `#`. Set the page's `<title>` and meta description.

## The theme in short

- **Fonts:** Lexend for headings, Plus Jakarta Sans for body text, Fira Code for labels and code.
- **Type scale** (size/weight; each class also sets line height and tracking): `text-display` 56px/700, `text-h1` 36px/700, `text-h2` 22px/600, `text-body` 16px/400, `text-label` 13px/500.
- **Font per size:** a type class does not set the font family. Headings (`<h1>` to `<h6>`) get the heading font on their own; on any other element add the font class: `font-heading` with `text-display`, `text-h1`, `text-h2`; `font-mono` with `text-label`.
- **Spacing scale**, with the Tailwind step in brackets: 4px (`1`), 8px (`2`), 12px (`3`), 20px (`5`), 32px (`8`), 80px (`20`).
- **Corners:** `rounded-sm` 6px, `rounded-md` 10px, `rounded-xl` 16px (the `lg` corner in `DESIGN.md`). `rounded-lg` is 10px as well: it is shadcn's name for the base corner, the one its stock buttons and inputs use.
- **Colors (light mode):** primary #095C78, on-primary #FFFFFF, secondary #FFD166, on-secondary #073B4C, tertiary #06D6A0, on-tertiary #073B4C, neutral #3E6270, background #FFFBF0, surface #FFFFFF, foreground #073B4C, border #E4DCC6, error #B3123F, azure #118AB2, sun #FFD166, berry #EF476F.

### How Primer pages are laid out

- **Page:** cream paper with white cards on it. The outermost element is a `<div>` with `flex min-h-svh flex-col bg-background text-body text-foreground`, holding the `<header>`, a `<main>` (`flex-1`) and the `<footer>`.
- **Container:** the header's row, the content of `<main>` and the footer's row each sit in a centered container `<div>`: `mx-auto w-full max-w-[1240px] px-5`, so the content is at most 1200px wide, as `DESIGN.md` gives the grid, with 20px at the page's edge at every width. This width is the one arbitrary value allowed.
- **Sample organisation:** "Rowlark", an invented online school that teaches practical data skills in three topics: spreadsheets, SQL and charts. It has nine courses, 102 lessons in all, and three teachers: Samir Okonjo (spreadsheets), Odile Brandt (SQL) and Lena Farrow (charts). The learner is Tessa Marlow. Prices are in US dollars. The same courses, lessons, lengths and prices appear on every page; this brief gives the ones it needs.
- **Today:** the sample's today is Sunday, 14 March 2027, a fixed date in code, never the device's clock.
- **Dates and lengths:** a date is written day first with the month in full, `14 March 2027`, and the year only where this brief shows it. A date that stands on its own (a small figure, a row of a list) is a `<time>` with a `dateTime` (`2027-03-14`); inside a sentence it is plain text. A length is hours and minutes with a space before each unit, `3 h 10 min`, and minutes alone under an hour, `16 min`. A count carries its noun: `12 lessons`.
- **Addresses:** the pages live at `/catalogue`, `/course`, `/lesson`, `/progress` and `/plans`. The school's name in the header links to `/catalogue`. A link whose destination this brief does not name points to `#`.
- **Grid:** columns stand 32px apart and cards 20px, as `DESIGN.md` gives them. Where this brief puts parts side by side, their wrapper is `grid grid-cols-1 gap-8 lg:grid-cols-12`, a single column below `lg`, and each item gets the `lg:col-span-*` this brief gives it. A row of cards of the same kind is `grid grid-cols-1 gap-5` with the columns this brief names. Items in one row stretch to the same height unless this brief says otherwise.
- **Vertical rhythm:** written as gaps on stacks, never as top margins and never as `space-y-*`. Every element that holds more than one thing in a column is `flex flex-col` with one of these gaps: `gap-1` between a name and the small figure under it; `gap-2` between a heading and a small figure above or under it, between a field's label, the field, its helper text and its error, and between the items of a list of short lines; `gap-3` between a heading and its paragraph and between paragraphs; `gap-5` between the parts inside a card, between a section's heading and its content, and between cards; `gap-8` between the groups of a page and between columns; `gap-20` between sections, the 80px of `DESIGN.md`. A row of things side by side is `flex flex-wrap items-center` with `gap-3`, or `gap-2` for things that belong together (an icon and its word). The scale has no 16px and no 24px step: where a habit asks for one, use `gap-3` or `gap-5`. Where this brief gives no gap, use the one that fits.
- **Main:** the container inside `<main>` is `flex flex-col` with `pt-8 pb-20` and the gap this brief names: `gap-20` on a page made of sections (Catalogue, Course, Plans), `gap-8` on a page that is one piece of work (Lesson, Progress).
- **Header:** the first thing on the page is a `<header>` with `border-b border-border`, running the full width. Its container is also the row, `flex flex-wrap items-center gap-x-8 gap-y-1 py-3`: the school's name, "Rowlark", a link in `inline-flex h-10 items-center font-heading text-h2 text-foreground`; then the `<nav>`, the page's only one named "Main" (`aria-label`), with `w-full md:w-auto`. It holds a `<ul>` with `flex gap-5` of three links, in this order: "Courses" to `/catalogue`, "My progress" to `/progress`, "Plans" to `/plans`. Each link is `inline-flex h-10 items-center font-sans text-body font-semibold text-foreground underline-offset-8`: the current page's link has `aria-current="page"` and `underline decoration-2`; the others have `hover:underline`. Below `md` the nav takes a line of its own under the name; the three links fit on it at 375px, so there is no "Menu" button and the header has no state. This brief says which link is current.
- **Footer:** a `<footer>` with `border-t border-border`, running the full width. Its container is also the row, `flex flex-wrap items-center justify-between gap-3 py-8`: the school's name in `font-heading text-h2`, as a `<p>`, and a small figure: `Rowlark · Practical data skills, one short lesson at a time · 2027`.
- **Breadcrumb:** where this brief asks for one, it is a `<nav>` with the `aria-label` "Breadcrumb" holding an `<ol>` with `flex flex-wrap items-center gap-2`, in `font-mono text-label`: each step but the last a link in `text-muted-foreground underline underline-offset-4 hover:text-foreground`, a `/` in `text-muted-foreground` with `aria-hidden="true"` between steps, and the last step in `text-foreground` with `aria-current="page"`, not a link. Because the breadcrumb then says `page`, the header's "Courses" link has `aria-current="true"` in place of `page`, with the same look.
- **Headings:** Lexend, sentence case, no full stop, at the weight its type class sets: do not add a weight class to a heading. The `<h1>` is `text-h1`; it is `text-display` only where this brief says so, and then only from `md` up (`text-h1 md:text-display`). An `<h2>` is `text-h2`. An `<h3>` is `text-h2` too, unless this brief gives it another size. A small heading inside a card that this brief calls a name is `font-sans text-body font-semibold`: body text at weight 600, not the heading font. Headings get the heading font on their own; any other element in `text-display`, `text-h1` or `text-h2` adds `font-heading`.
- **Sections:** where this brief calls something a section, it is a `<section>` with `aria-labelledby` pointing at its heading, `flex flex-col gap-5`, with the heading (or a heading row) first and the content after it. Without a visible heading it gets an `aria-label`, and where it then holds one element it has no stack classes. Where a card is the section, the card carries `<section>`, and its own `gap-5` is the section's. A heading row is `flex flex-wrap items-end justify-between gap-3`: the heading on the left, and on the right what belongs to the whole section, a small figure or a control. The header, the footer and a page's opening are not sections.
- **Labels:** Fira Code sets what is counted, measured or typed: levels, lengths, counts, scores, percentages, dates, code, and also field labels, table headers, breadcrumbs, badge text and captions. A label is `font-mono text-label`, in sentence case, never `uppercase`, a short fragment. Buttons and nav links are not labels: they are in the body font.
- **Small figures:** a length, a count, a date, a percentage or a short note that this brief calls a small figure is `font-mono text-label tabular-nums text-muted-foreground`. The classes go on the element that holds the whole figure. Parts of one figure are joined with ` · `. A `text-foreground` in this brief replaces the muted color: write the two through `cn`, so that one replaces the other. A small figure with an icon is `inline-flex items-center gap-2` with the icon first.
- **Key figures:** the one number a card is about (a count, a price) is `font-heading text-display tabular-nums`, with its unit beside it as a small figure, in a row with `flex flex-wrap items-baseline gap-2`. Where this brief asks for a smaller one, it is `font-heading text-h1 tabular-nums`.
- **Text color:** headings, body text, names, key figures and the figures of a chart are `text-foreground`. Labels, small figures and helper text are `text-muted-foreground`, and only on the page or a card, never on a fill. Paragraphs are never muted.
- **Writing:** address the reader as "you", in short, plain sentences, the way a patient teacher talks. No exclamation marks.
- **Measure:** a paragraph of body text is at most `max-w-2xl` wide.
- **Links:** a text link is the text color, underlined: `text-foreground underline underline-offset-4 hover:decoration-2`, and it inherits its size. A link that is a card's or a row's title has no underline until hover: `text-foreground underline-offset-4 hover:underline`. The class lists in these notes and in this brief leave out the focus outline: add the outline classes from the rules to every link and to every native control you write.
- **Buttons:** the shadcn `Button` with `className="h-10 px-5 font-sans text-body font-semibold"`: the body font at weight 600, in sentence case, two to four words. The stock `Button` ships a smaller size and `font-medium`; these classes replace both, and its stock corner (`rounded-lg`, 10px) stays. The default variant is for the one main action of a view, deep blue with white text, yellow with ink text in dark mode: no view shows two. Every other button is `variant="secondary"`, yellow with ink text, a lighter blue with white text in dark mode. `variant="outline"` is only for the buttons of a button group that are not chosen. No `ghost`, `link` or `destructive` buttons. In `components/ui/button.tsx`, once: in the `secondary` variant, replace `hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]` with `hover:bg-secondary/80` (the stock hover cannot be told from the resting color); on a page with a button group, in the `outline` variant, replace `bg-background` with `bg-card` and take out `dark:bg-input/30`, so the button is the card's white on the cream page, its hover classes unchanged. A button that sends a form needs `type="submit"`: this `Button` is `type="button"` unless told otherwise. No button on these pages is ever disabled, so none gets `focusableWhenDisabled`, and `button.tsx` needs no `data-disabled:` classes. A call to action that goes to another page is an `<a>` with the same classes: write `cn(buttonVariants({ variant }), "h-10 px-5 font-sans text-body font-semibold")`, because `buttonVariants` alone does not merge classes. An icon in a button is `size-4` with `aria-hidden="true"`, and sits where this brief puts it.
- **Button groups:** a set of buttons where one is chosen (a level, a week) is a `<div>` with `role="group"`, `flex flex-wrap gap-2` and an `aria-label`. The chosen button has `aria-pressed="true"` and `variant="secondary"`; the rest have `aria-pressed="false"` and `variant="outline"`. Not `Tabs`: there are no tab panels. Pressing one moves no focus.
- **Inputs:** the shadcn `Input` with `className="h-10 px-3 text-body md:text-body"`, its stock corner. In `components/ui/input.tsx`, replace the class `bg-transparent` and the class `dark:bg-input/30` with `bg-card`, so a field is white on the cream page in light mode and the card's color in dark mode; `file:bg-transparent` and the `disabled:` fills stay. A field is a `flex flex-col gap-2`: a visible `<label>` with `block`, a label in `text-muted-foreground`, tied to the field with `htmlFor`; then the field; then any helper text, a small figure that the field names in `aria-describedby`.
- **Errors:** an error is one line under what it is about: `flex items-start gap-2 font-mono text-label text-destructive`, holding the `CircleAlert` icon (`size-4 shrink-0`, `aria-hidden="true"`) and one sentence that says what to do. A field gets `aria-invalid` and names the line's `id` in its `aria-describedby`; the `<fieldset>` of a group of radio buttons names the line in its `aria-describedby` and gets no `aria-invalid`, which is not for a group. A form is checked in code on submit, with `noValidate` on the `<form>`. The error line is removed when its control changes. The error color is for this line only: a wrong answer to a question is not an error and is told in words in the text color.
- **Confirmations:** a message that appears or changes after an action goes into an element with `role="status"` that is on the page from the start: one that arrives with its text is often not announced. Where it starts empty it is never hidden, has no classes that draw or take space, and is never an item of a `gap-*` stack or row: it shares a plain `<div>` with the element above it, and the message inside it, rendered only while there is one, carries the look and the space, such as `mt-5`. A status element that always holds text (a count of results) may be an item of a stack like any other.
- **Cards:** a card is a plain element with `rounded-xl border border-border bg-card p-5` (16px corners, 20px padding, a 1px border, no shadow), and `flex flex-col gap-5` inside unless this brief says otherwise. Not the shadcn `Card`, which ships its own padding and a ring. Never put a card inside a card, and never a bordered box inside a card: divide a card's parts with 1px rules, `border-t border-border` with `pt-5`.
- **Rows with rules:** a list whose rows are divided by rules (lessons, a legend, recent activity) is a `<ul>` or an `<ol>` with `flex flex-col` and no gap. Each row has `py-3 first:pt-0 last:pb-0`, and every row after the first `border-t border-border`.
- **Badges:** the shadcn `Badge` (`npx shadcn@latest add badge`) with `className="h-auto rounded-sm border-transparent bg-tertiary px-2 py-1 font-mono text-label text-tertiary-foreground"`: green with ink text in both modes, one or two words, no icon. The corner must be in this `className`, or the stock pill wins. There is one kind of badge. Green is a fill only: never write `text-tertiary`.
- **Chart colors:** four fills, the same in both modes, used in this order: `bg-azure`, `bg-tertiary` (green), `bg-sun` (yellow), `bg-berry`. A chart with one series is azure; a chart with more takes them in this order. Never `bg-secondary`, `bg-primary` or a `chart-*` class in a chart: `bg-secondary` and `bg-primary` change with the mode, and the yellow of a chart is always `bg-sun`. Each topic keeps one color on every page: Spreadsheets azure, SQL green, Charts berry. Sun is for the time spent on practice files, which belongs to no topic. No text is ever set on azure, sun or berry, and no chart color is a text color. Sun is a pale fill on a white card, so, as with every chart color, it is never the only way to read something: the word or the figure is always beside it.
- **Topic marks and legend dots:** a topic is shown as `inline-flex items-center gap-2`: a dot, `size-2 shrink-0 rounded-full` with the topic's fill and `aria-hidden="true"`, then the topic's name, a label in `text-muted-foreground` unless this brief gives another style. The same dot is the dot of a chart's legend.
- **Progress bars:** a row, `flex items-center gap-3`: a track, `h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-border`, holding a fill, `h-full rounded-full bg-tertiary`, whose width is a percentage in an inline `style`; then the percentage, `25%`, as a small figure in `text-foreground` with `w-10 shrink-0 text-right`. At 0% there is no fill. The track has `aria-hidden="true"`, which hides the fill too; the percentage beside it and the count this brief puts near it (`3 of 12 lessons done`) say the same in words. Percentages are whole numbers.
- **Charts:** drawn with plain elements, flat: a bar is a `<div>` with one fill, square corners and no border, whose height or width is a percentage in an inline `style`, worked out in code from the data. Every bar has its figure written beside or above it in `font-mono text-label tabular-nums text-foreground`. Grid lines are 1px `border-border`; axis values are small figures. A chart's drawing has `aria-hidden="true"` and the text alternative this brief names.
- **Avatars:** a circle with a person's initials: `flex size-10 shrink-0 items-center justify-center rounded-full bg-secondary font-mono text-label text-secondary-foreground`, with `aria-hidden="true"`, beside the written name. Where this brief asks for a larger one it is `size-12`, never more.
- **Lesson rows:** a lesson in a list has its number, its title and its length. The title is `text-body` and the length a small figure; the number is a small figure in a column of its own or leads the title, as this brief says. Where a lesson has a state (done, next, locked), the state is an icon and a word, never a color.
- **Accordions:** the shadcn `Accordion` (`npx shadcn@latest add accordion`), inside a card that has `px-5 py-0` in place of the card's padding and no stack classes, so each trigger's own padding is the card's. The stock `Accordion` is off the type scale. In `components/ui/accordion.tsx`: on the trigger, replace `items-start` with `items-center`, its stock vertical padding with `py-3`, and its small text size and `font-medium` with `font-sans text-body font-semibold`, and add `min-h-10 gap-3`; on the content, replace the small text size with `text-body`; on the content's inner element, replace the stock bottom padding with `pb-5` (`pt-0` stays) and delete the class that starts with `[&_p:not(:last-child)]`, which gives paragraphs a bottom margin off the scale. The items keep the stock 1px rule between them. Each trigger sits in an `<h3>` that the component renders, so an accordion always follows an `<h2>`. Give each `AccordionItem` a `value`.
- **Icons:** from `lucide-react`, with `size-4` (`size-5` where this brief says so) and the stroke they ship with, 2px with round caps: do not set `strokeWidth`. An icon beside a word has `aria-hidden="true"`. Beside a line of body text in an `items-start` row, the icon gets `mt-1` to sit on the first line. Only where named. Never an emoji.
- **Corners:** `rounded-sm` (6px) for badges and the stacked bar of a chart; `rounded-lg` (10px, what buttons and inputs ship with) for buttons, inputs and a code block; `rounded-xl` (16px) for cards; `rounded-full` only for avatars, progress bars, legend dots and the stock `Switch`, none of them over 48px. A chart's bars have square corners.
- **Surfaces:** flat. No shadows, blur or gradients in the code you write.
- **Motion:** in the code you write, the only transition is color: `transition-colors duration-150` on a link whose color changes on hover. A progress bar does not animate, and nothing moves on scroll. Stock components keep the motion they ship with.

## The page

Where this section and the layout notes above differ, this section wins.

Sample content, if the user gave none: "Rowlark", an online school for practical data skills. Its nine courses, in this order (title, topic, level, lessons, length, teacher, one sentence):

1. "Spreadsheets from scratch", Spreadsheets, Beginner, 10 lessons, 2 h 30 min, Samir Okonjo. "Cells, formulas and tidy tables, for people who have never opened a spreadsheet."
2. "SQL from zero", SQL, Beginner, 12 lessons, 3 h 10 min, Odile Brandt. "Ask a database your first questions with SELECT, WHERE and ORDER BY."
3. "Your first charts", Charts, Beginner, 8 lessons, 1 h 50 min, Lena Farrow. "Turn a small table into a bar chart and a line chart that people can read."
4. "Cleaning messy data", Spreadsheets, Beginner, 9 lessons, 2 h 15 min, Samir Okonjo. "Fix dates, doubles and stray spaces before they spoil your sums."
5. "Pivot tables in practice", Spreadsheets, Intermediate, 11 lessons, 3 h 5 min, Samir Okonjo. "Sum up ten thousand rows in a minute, and know what the summary hides."
6. "Joins and grouping in SQL", SQL, Intermediate, 14 lessons, 4 h 5 min, Odile Brandt. "Bring two tables together, then count, sum and average by group."
7. "Charts that tell the truth", Charts, Intermediate, 10 lessons, 2 h 40 min, Lena Farrow. "Axes, scales and colors that show the numbers as they are."
8. "Window functions step by step", SQL, Advanced, 13 lessons, 3 h 50 min, Odile Brandt. "Running totals, ranks and moving averages without leaving SQL."
9. "Dashboards people read", Charts, Advanced, 15 lessons, 4 h 30 min, Lena Farrow. "Plan, lay out and test one page of charts for a team that is short of time."

That is four courses for beginners, three intermediate and two advanced: 102 lessons in all.

The container inside `<main>` uses `gap-20` between sections. This page uses the stock `button`, `input` and `badge`; add any the project lacks with `npx shadcn@latest add button input badge`. It has a button group, so make both changes to `components/ui/button.tsx` that the Buttons note gives.

Build these parts in order.

### 1. Header

The header from the layout notes, with Courses as the current page.

### 2. Opening

A `<div>` with `flex flex-col gap-8`, not a section. First a `flex flex-col gap-3`: the `<h1>` in `text-h1 md:text-display` with `md:max-w-3xl`, "Data skills you will use on Monday", and one paragraph: "Nine courses in spreadsheets, SQL and charts. Every lesson is short, ends with one question, and starts where the last one stopped."

Then four figures, a `<ul>` with `grid grid-cols-2 gap-5 md:max-w-2xl md:grid-cols-4`: two rows of two below `md`, one row of four from `md` up. Each `<li>` is `flex flex-col gap-1 border-l-2 pl-3`, with a rule in a chart color on its left, in the order of the Chart colors note: `border-azure`, `border-tertiary`, `border-sun`, `border-berry`. It holds the smaller key figure of the layout notes and, under it, a small figure:

- `9`, then `courses`
- `102`, then `lessons`
- `3`, then `topics`
- `3`, then `teachers`

The rules only decorate: here a color does not stand for a topic.

### 3. All courses

A section with the `<h2>` "All courses". Its content, in the section's `gap-5`, is the controls, the count, and the grid or the empty state.

**The controls.** A `<div>` with `flex flex-col gap-5 md:flex-row md:items-end md:justify-between`:

- The search field, in a wrapper with `w-full md:max-w-sm`: a field from the layout notes with the label "Search courses", an `Input` with `type="search"` and `autoComplete="off"`, and the helper text `By title, topic or teacher`. No placeholder and no search button: the grid follows as you type.
- The level filter, a `flex flex-col gap-2`: a `<p>` with an `id`, styled as a field's label, "Level"; then a button group from the layout notes, named by that `<p>` with `aria-labelledby` (in place of the `aria-label`), with four buttons: "All levels", chosen at the start, "Beginner", "Intermediate" and "Advanced".

**The count.** A `<p>` with `role="status"`, a small figure in `text-foreground`. It always holds a sentence, so it is an item of the section's stack:

- `Showing all 9 courses` while all nine are shown;
- `Showing 3 of 9 courses` while fewer are shown (`Showing 1 of 9 courses`);
- `No courses match` while none is.

**The grid.** A `<ul>` with `grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3`, in the order of the sample list. Each `<li>` is a card from the layout notes, with `h-full`, holding, top to bottom in its `gap-5`:

1. A row, `flex flex-wrap items-center justify-between gap-2`: the topic mark from the layout notes (the dot in the topic's color, then `Spreadsheets`, `SQL` or `Charts`), and the level as a badge: "Beginner", "Intermediate" or "Advanced". Every level has the same green badge: the word tells them apart.
2. A `flex flex-col gap-2`: the title as an `<h3>` in `text-h2`, holding a title link from the Links note (`/course` for "Charts that tell the truth", `#` for the others); then the course's sentence in `text-body`; then a small figure with the teacher, `With Odile Brandt`.
3. The card's foot, with `mt-auto`, so the feet of a row stand on one line: a `<div>` with `flex flex-wrap items-center gap-x-5 gap-y-1 border-t border-border pt-3`, holding two small figures in `text-foreground`, each with its icon: `BookOpen` and `12 lessons`, then `Clock` and `3 h 10 min`.

Nothing else is in a card: no button, no price, no picture. This page has no default button: nothing on it is the one main action.

**The empty state.** While no course matches, the grid is not rendered and a card takes its place, with `items-start` beside its stack classes: a name (the small heading of the Headings note, as a `<p>`), "No courses match your search"; one sentence in `text-body`, "Try a shorter word, or another level."; and a `secondary` button, "Clear search and level".

### 4. How a lesson works

A section with the `<h2>` "How a lesson works", then a `<ul>` with `grid grid-cols-1 gap-8 md:grid-cols-3`. Each `<li>` is a `flex flex-col gap-2`, not a card: an icon with `size-5` in `text-foreground`, an `<h3>` in `text-h2`, and one or two sentences in `text-body`.

- `BookOpen`, "Read for a quarter of an hour": "A lesson takes 12 to 19 minutes. It explains one idea and shows it once."
- `ListChecks`, "Answer one question": "Each lesson ends with a question with four answers. You are told in words whether you were right, and why."
- `Bookmark`, "Pick up where you stopped": "Rowlark keeps your place, your lessons done and your days in a row."

Under the list, in the section's `gap-5`, one line in `text-body`: "The first module of every course is free." followed by a text link, "See the plans", to `/plans`.

### 5. Footer

The footer from the layout notes.

### Behavior

- Keep the search text and the level in component state; the cards, the count and the empty state all read from them.
- A course matches the search when the text typed, trimmed and compared without regard to case, is found in its title, its topic or its teacher's name. An empty search matches every course. So `sql` shows three courses, two by their title and "Window functions step by step" by its topic, and `lena` shows Lena Farrow's three.
- A course matches the level when "All levels" is chosen or its level is the chosen one. A card is shown when it matches both: `sql` with "Advanced" leaves one course, and `pivot` with "Beginner" leaves none.
- The count follows at once, on every keystroke and every press of a level. The chosen level's button has `aria-pressed="true"`, the others `aria-pressed="false"`; pressing one moves no focus.
- "Clear search and level" empties the search field, chooses "All levels" and moves focus to the search field, since the button itself is gone with the empty state.
- The title links and the nav links need no behavior beyond their `href`.

## Rules

- **Colors:** only the theme's colors, through the semantic classes (`bg-background`, `text-foreground`, `bg-card`, `bg-primary`, `text-primary-foreground`, `text-muted-foreground`, `border-border` and so on). No hex, rgb or named colors in components, and no Tailwind palette classes such as `bg-blue-500` or `text-gray-600`.
- **Spacing:** padding, margin and gap use only the scale's steps (`1`, `2`, `3`, `5`, `8`, `20`) plus 0, 1px and 2px. No arbitrary values such as `p-[18px]`, and no other steps such as `p-6` or `gap-10`. `auto` margins are fine. Widths and heights such as `w-64` or `size-4` are sizes, not spacing. This applies to the code you write: a stock component keeps the spacing inside it, unless this brief changes it.
- **Type:** every piece of text you write gets its size from one of `text-display`, `text-h1`, `text-h2`, `text-body`, `text-label`, set on the element or on a parent it inherits from. Put `text-body` on the outermost element of the page you write. No other sizes. A stock shadcn component keeps the size it ships with, unless `DESIGN.md` or this brief gives that component its own style. A type class does not replace a weight class: where a stock component ships `font-medium` and the text should be regular, add `font-normal`.
- **Fonts:** only the theme's fonts, through `font-sans`, `font-heading` and `font-mono`. Do not add a font.
- **Corners:** only the `rounded-*` classes, which the theme already sets. No arbitrary radius, and `rounded-full` only where `DESIGN.md` or this brief names a full round, such as an avatar or a status dot. The theme allows a full round on a box up to 56px across; Strict Check reports a larger one, and a pill counts by its height.
- **Contrast:** all text meets WCAG AA against its background.
- **Stock components:** a component from `components/ui`, and an `<a>` styled with `buttonVariants`, keeps the hover, pressed and disabled colors and the motion it ships with, unless this brief changes them. They are the theme's colors under other names.
- **Counts:** a number with a noun reads right at one: "1 set", not "1 sets". Where this brief gives the words for only one of the two, write the other the same way.
- **Sizes from data:** a height or a width that comes from data (a chart bar, a meter) is set with an inline `style`. That is the one use for an inline style.
- **Focus:** every link and control shows a 2px outline on keyboard focus: `focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`. Keep `focus-visible:outline-solid` in it: in Tailwind 4 an `outline-none` on the same element, which stock components carry, otherwise hides the outline. An element that only gets focus from code (a heading or a message with `tabIndex={-1}`) gets the same outline written with `focus:` in place of `focus-visible:` (`focus:outline-solid focus:outline-2 focus:outline-offset-2 focus:outline-ring`): after a mouse click, a browser does not match `:focus-visible` on an element that code focuses. A link, a button or a field that code focuses keeps the `focus-visible:` classes it has: after a mouse click it shows no outline, which is how a browser treats every control, and is right. A stock component that ships its own focus ring (`Button`, `buttonVariants`, `Input`, `Textarea`, `Checkbox`, `Switch`, `AccordionTrigger`, the close button of a `Sheet`) must lose that ring. Do it once, in the component's file in `components/ui`, which is yours to change: replace its `focus-visible:ring-*` classes with the outline classes, and in a field replace its `aria-invalid:ring-*` classes, the `dark:` ones included, with `aria-invalid:ring-0`, or a field with an error shows a tinted ring. `Button` has two more sets. Its base classes also carry `aria-invalid:ring-*` classes: replace them with `aria-invalid:ring-0`, as in a field. Its `destructive` variant carries `focus-visible:ring-*` classes of its own, the `dark:` one included: delete them and put nothing in their place, because the base classes already give every variant the outline. Wherever this rule says replace, change the classes in the file and do not add `ring-0` beside them: an added class only wins where it comes later and passes through `cn`. The stock `focus-visible:border-ring` can stay. These ring changes go only into the files of components that this page uses and that can take focus on it: a `Badge` that is not a link keeps its ring classes. The `cn` import from the setup steps is another matter and goes into every file. A box that scrolls sideways (a code block, a wide table) gets `tabIndex={0}`, `role="region"`, an `aria-label` and the same outline, also at widths where it happens to fit. Where a focusable box touches the edges of a parent that has `overflow-hidden`, draw its outline inside it: `focus-visible:-outline-offset-2` in place of `focus-visible:outline-offset-2`.
- **Not allowed:** purple or multi-color gradients; emoji used as icons or bullets; glows and colored shadows.
- **Avoid:** a card inside a card.
- **Dark mode:** the page must work with the `dark` class on `<html>`. Because every color comes from a semantic class, this needs no extra code; do not write `dark:` color overrides. A new shadcn project follows the system's mode and switches on the `d` key: leave that as it is, and add no mode switch of your own. If the page has a native `<select>` or a date or time field, tell the browser the mode, or its list and its picker stay light in dark mode: in the global CSS, give `:root` `color-scheme: light` and `.dark` `color-scheme: dark`.

From the theme's own do's and don'ts:

- Do write the figure beside every bar and every progress bar: color alone says nothing.
- Do keep one main action in view: the next lesson, the next question.
- Do tell a learner where they are: lesson 4 of 12, 35 minutes left.
- Don't set text on azure, sun or berry, and don't use any chart color for text.
- Don't use more than the four chart colors, and don't use gradients or glows.
- Don't put a card inside a card.
- Don't introduce a color, size or radius that is not a token above.

## Check before you finish

Go through this list against the code you wrote, and fix anything that fails.

- [ ] The search field and the level filter work together on the nine cards, and the level filter is a button group with `aria-pressed`, not tabs.
- [ ] The count of results is a sentence in words in a `role=status` element that is on the page from the start, and it follows every keystroke and every press.
- [ ] Every card gives its topic in words beside the dot, its level in a green badge, its number of lessons and its length, and no text is set on azure, sun or berry.
- [ ] A search with no result shows a sentence and a Clear search and level button, and pressing it brings back all nine cards and moves focus to the search field.
- [ ] The grid is three cards wide from `lg` up, two from `md` and one below, and the page does not scroll sideways at 375px.
- [ ] No color is written as a hex, rgb or Tailwind palette value in the page's code.
- [ ] Every padding, margin and gap in the code you wrote is a step of the spacing scale.
- [ ] Every text element you wrote gets its size from a type-scale class, its own or an inherited one. Visually hidden text is exempt.
- [ ] No file in `components/ui` imports `cn` from `"cn"` directly.
- [ ] Text contrast meets WCAG AA in light and dark mode.
- [ ] The page has one `<h1>`, headings are in order, and every image has alt text.
- [ ] Every interactive element can be reached with the keyboard and shows the focus outline from the rules.
- [ ] At 375px wide the page does not scroll sideways. Wide tables and code blocks scroll inside their own box.
- [ ] The project builds without errors or warnings.

Then tell the user which checks pass, which you could not verify, and anything in this brief you did not do and why.
