# Media Pipeline

## Source policy

- Keep masters under `source-assets/`; this directory is excluded from Git, Docker, and direct web serving.
- Put generated/optimized deliverables under the controlled `public/` layout below; production will later map these keys to R2.
- AI-created material goes under `source-assets/ai-generated/` with prompt, date, references, approval state, conceptual/real status, and usage note.
- AI scenes must not falsely depict the real Norden factory, employees, production line, certificates, customers, or countries.

## Current folder contract

```text
source-assets/
  product-renders/  story/  brand/  catalog/  videos/originals/
  ai-generated/  notes/  legacy-site/  legacy-web-public/

public/
  brand/  catalog/  products/  uploads/admin/
  media/gallery/images/  media/gallery/videos/
  media/story/catalog/  media/maps/
```

The retired roots `norden-images/`, `norden-video/`, and `norden_gorseller/` must not return. Run `npm run media:audit-layout` after every path or media migration.

## Current high-value masters

- `source-assets/story/9 Kademe PNG.png`: 3508x3508, approximately 55 MB.
- `source-assets/story/Kapak Render PNG.png`: 2408x3408, approximately 36 MB.
- `source-assets/story/Ic Kapak Render PNG.png`: 2480x3508, approximately 42 MB.

These are source masters, not web-ready assets.

## Web derivatives

- Transparent products: AVIF/WebP at 640, 960, 1440, and when necessary 1920 px.
- Backgrounds: AVIF first, WebP fallback; target under 250-400 KB per desktop scene where possible.
- Hero videos: MP4 H.264 plus WebM when useful; muted, poster image, short loop.
- Mobile-specific crops and posters are mandatory.

## Loading

- Only the active hero video loads.
- Below-fold scenes use lazy loading.
- Heavy scrollytelling modules load dynamically.
- Do not ship all seven series media and all gallery videos on the first route.

## Release and R2 rule

- `public/` currently contains about 70.63 MiB of web-ready media; `source-assets/` contains about 4.23 GiB of masters and legacy material.
- Only web-ready public derivatives are uploaded to the public R2 bucket. Masters and legacy files never become anonymous public objects.
- New content replaces neither an existing immutable key nor its cached bytes; publish a new hash/versioned key, update the DB, verify, then retire the old object through a recoverable manifest.
- Before migration run `npm run media:migrate-paths`, `npm run media:audit-layout`, and the release acceptance suite.

## AI asset gate

Define exact use, aspect ratio, real/conceptual status, Norden materials, prohibited errors, desktop/mobile crops, and factual validation owner before generation.
