# Image ratios

Media containers use five locked aspect ratios (`1:1 · 4:3 · 16:9 · 4:5 · 9:16`). Default Tailwind aspect utilities outside this set are blocked in `theme.css`.

## Aspect ratio scale

| Ratio | Tailwind | CSS var | CSS value | Use |
| --- | --- | --- | --- | --- |
| 1:1 | aspect-square | --aspect-square | 1 / 1 | Avatars, product tiles, square thumbnails |
| 4:3 | aspect-4/3 | --aspect-4-3 | 4 / 3 | Editorial cards, documentation diagrams |
| 16:9 | aspect-video | --aspect-video | 16 / 9 | Widescreen video, hero media, demos |
| 4:5 | aspect-4/5 | --aspect-4-5 | 4 / 5 | Portrait photography, vertical cards |
| 9:16 | aspect-9/16 | --aspect-9-16 | 9 / 16 | Mobile-first vertical media, stories |

Choose the ratio that matches the subject orientation so containers reserve space before images finish loading.

## Usage

Apply aspect-ratio utilities in Tailwind CSS or custom properties in CSS:

```tsx
<figure className="w-full max-w-sm overflow-hidden rounded-md border border-border bg-card">
  <img
    src="/diagram.png"
    alt="System architecture diagram"
    className="aspect-video w-full object-cover"
  />
</figure>
```

```css
.card-media {
  aspect-ratio: var(--aspect-4-3);
  width: 100%;
  object-fit: cover;
}
```

## Do and don't

- **Do: Lock media frames to the five allowed ratios** — Apply aspect-square, aspect-4/3, aspect-video, aspect-4/5, or aspect-9/16 with object-cover so layout height is known before paint.
- **Don't: Use arbitrary or unapproved aspect ratios** — Do not use aspect-auto, aspect-3/2, or aspect-21/9 because off-scale ratios cause inconsistent card heights and fail theme compilation.

## Accessibility

- Explicit `aspect-ratio` containers prevent Cumulative Layout Shift (CLS) as images load, keeping reading positions and focus targets stable.
- Always provide descriptive `alt` text on informative images or `alt=""` on purely structural frames.

## Rationale

Five standardized ratios cover square avatars, editorial cards, widescreen video, portrait cards, and vertical mobile media without ad-hoc cropping.
