# Testimonials Section

## Objective

Collect real customer quotes with attribution and show them on your public pages.

A store of customer quotes with name, role, photo, and rating, plus a section that renders them on public pages.

## 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. Record consent as a field on the testimonial, along with when and how it was given, and refuse to publish a quote that does not have it.
2. Route submitted testimonials through the app's existing moderation queue rather than publishing them on arrival. Reuse the existing text moderation and image moderation checks if the app has them.
3. Reuse the app's existing avatar and image upload path for the photo and logo, including its size and type limits and its stored variants. Do not add a second upload endpoint with different rules.
4. Design the card to look right with no photo and no company logo. The photo is the optional part, not the layout.
5. Do not build a general-purpose slider. If the quotes fit, render them as a static grid, and only add rotation when there are genuinely more testimonials than the page can show.

## 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

- A quote published without recorded consent from the named person is a legal problem, not a content problem. Publication must be blocked until consent is present and attributable.
- A missing avatar or company logo leaves a ragged row. Fall back to a consistent placeholder at the same reserved dimensions so the layout does not shift or gap.
- Very long quotes must truncate at a sensible length with an expand control that reveals the rest in place, not a modal and not a link to another page.
- If the section rotates, it must pause on hover, on keyboard focus, and when reduced motion is requested, and every quote must be reachable without waiting for the rotation.
- A withdrawn testimonial has to disappear everywhere. Removing the record must invalidate any cached page, static build, or feed that included it, and that must be verified rather than assumed.
- Star ratings need an accessible text equivalent, because a row of icons tells a screen reader nothing.
- Photos supplied by customers arrive at wildly different crops. Normalise them to one shape server-side rather than squashing them with CSS.
- A public submission form invites spam. Rate limit it, and never render unmoderated content, including in a preview visible to anyone but the author.

## 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

- [ ] A testimonial cannot be published without a recorded consent entry.
- [ ] Submitted testimonials land in the existing moderation queue before they are visible.
- [ ] Cards render correctly with a photo, without a photo, and with a very long quote.
- [ ] Rotation pauses on hover, on focus, and under reduced-motion preferences.
- [ ] Removing a testimonial clears it from every public page and cached rendering.
- [ ] Ratings expose a text equivalent to assistive technology.
- [ ] Photos are uploaded through the app's existing image pipeline and limits.
- [ ] 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.
