# Landing Page Builder

## Objective

Assemble a marketing page from ready-made sections and publish it at its own URL.

A section-based editor for public pages, with a separate draft tree, a publish step, and a live address.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Ship a fixed set of sections the marketing team actually uses: hero, feature row, logo strip, testimonial, pricing, call to action, footer. Each gets configurable content and a couple of layout options. A general-purpose layout engine is a far larger product and should not be attempted here.
2. Keep the draft tree and the published tree as separate records. Editing must never change what a visitor sees until publish is pressed.
3. Reuse the app's existing Draft and Publish States and Scheduled Publishing rather than inventing a second publishing model that only pages understand.
4. Emit per-page title, description, canonical address, and social preview tags through the app's existing SEO Setup, with defaults derived from the page's own first heading and image.
5. Do not let a section reference an asset by raw address. Pull images from the app's media storage so the system knows which assets a published page depends on.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- An editor that writes straight to the live page will publish somebody's half-finished paragraph. Hold every change in the draft tree and promote it only on an explicit publish.
- A chosen slug can collide with an existing page or with an application route such as sign-in or admin. Check both when the slug is saved and refuse with a clear reason rather than shadowing a real route.
- A page shared without title, description, and preview image renders as a bare link in chat and search results. Generate defaults from the content and let the author override them.
- Published pages must be cached to survive traffic, and republishing must clear that cache immediately. An author who still sees the old page after publishing will publish again and again.
- An asset deleted from the media library leaves a section pointing at nothing. Render the section without the image rather than a broken frame, and warn the author at deletion time rather than afterwards.
- Changing the slug of a page that has already been shared breaks every existing link. Keep the old path redirecting to the new one.
- Anything at a public address gets indexed and shared. Unpublished and scheduled pages must return not found to a direct visit, not merely be hidden from the page list.
- Sections must reserve their image dimensions so the published page does not jump while photos load, and alt text should be required before publish is allowed.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] Authors build a page from the shipped sections and publish it at its own address without a deploy.
- [ ] Draft edits are invisible to visitors until publish.
- [ ] Slug collisions and reserved application routes are refused when the slug is saved.
- [ ] Every published page emits title, description, canonical, and social preview tags.
- [ ] Republishing invalidates the cached page immediately.
- [ ] A renamed slug keeps the old path redirecting to the new one.
- [ ] A section whose asset was deleted renders without breaking the page.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
