# Implementation Plan

## Validation Checklist

- [x] All specification file paths are correct and exist
- [x] Context priming section is complete
- [x] All implementation phases are defined
- [x] Each phase follows TDD: Prime → Test → Implement → Validate
- [x] Dependencies between phases are clear (no circular dependencies)
- [x] Parallel work is properly tagged with `[parallel: true]`
- [x] Activity hints provided for specialist selection `[activity: type]`
- [x] Every phase references relevant SDD sections
- [x] Every test references PRD acceptance criteria
- [x] Integration & E2E tests defined in final phase
- [x] Project commands match actual project setup
- [x] A developer could follow this plan independently

---

## Specification Compliance Guidelines

### How to Ensure Specification Adherence

1. **Before Each Phase**: Complete the Pre-Implementation Specification Gate
2. **During Implementation**: Reference specific SDD sections in each task
3. **After Each Task**: Run Specification Compliance checks
4. **Phase Completion**: Verify all specification requirements are met

### Deviation Protocol

If implementation cannot follow specification exactly:
1. Document the deviation and reason
2. Get approval before proceeding
3. Update SDD if the deviation is an improvement
4. Never deviate without documentation

## Metadata Reference

- `[parallel: true]` - Tasks that can run concurrently
- `[component: component-name]` - For multi-component features
- `[ref: document/section; lines: 1, 2-3]` - Links to specifications, patterns, or interfaces and (if applicable) line(s)
- `[activity: type]` - Activity hint for specialist agent selection

---

## Context Priming

*GATE: You MUST fully read all files mentioned in this section before starting any implementation.*

**Specification**:

- `docs/specs/029-homepage-redesign-feature-showcase/product-requirements.md` - PRD with 12 features, acceptance criteria, success metrics
- `docs/specs/029-homepage-redesign-feature-showcase/solution-design.md` - SDD with architecture, interfaces, component map

**Key Design Decisions (ADRs from SDD)**:

- **ADR-1**: Modular template partials (~15 files) - Break monolithic 1073-line home.html into section partials
- **ADR-2**: PostHog for analytics - JavaScript SDK for event tracking, heatmaps, session recording
- **ADR-3**: TaskEngine cached stats - Daily job aggregates stats to `homepage_stats` cache table
- **ADR-4**: New custom demo form system - In-house form to replace FormSite dependency
- **ADR-5**: Single form for Homepage and Team+ page - Same modal with `team_plus_interest` flag

**Implementation Context**:

Commands to run:
```bash
# Development
cd userfrosting && composer install
php -S localhost:8080 -t public_html/

# CSS Build
php userfrosting/conductor build-css           # Development
php userfrosting/conductor build-css --minify  # Production

# Testing
./test.sh                        # All tests
./test.sh --testsuite unit       # Unit tests
./test.sh --stan                 # With PHPStan

# Database Migrations
php userfrosting/conductor run

# TaskEngine
php userfrosting/bin/task job:dispatch homepage-stats  # Manual dispatch
php userfrosting/bin/task worker:start                 # Start worker
```

Patterns to follow:
- BEM CSS naming: `modern-[block]__[element]--[modifier]`
- TaskEngine BaseJob pattern: `userfrosting/src/BuyerKiosk/TaskEngine/Jobs/StoreMetricsAggregatorJob.php`
- Demo API pattern: `userfrosting/routes/demo/api.php` (lines 229-286)
- Repository pattern: `userfrosting/src/BuyerKiosk/Demo/Repositories/LeadRepository.php`

Interfaces to implement:
- SDD Interface: HomepageStatsService `[ref: SDD/Interface Specifications; lines: 692-717]`
- SDD Interface: Demo Form API `[ref: SDD/Interface Specifications; lines: 647-689]`
- SDD Interface: PostHog Events `[ref: SDD/Interface Specifications; lines: 785-820]`

---

## Implementation Phases

### Phase Dependencies Overview

```
Phase 1 (Foundation) ──────┬──────────────────────────────────────────────────────────┐
                           │                                                          │
                           ▼                                                          ▼
Phase 2 (Homepage + Demo Form) ─────┬──────────────────────► Phase 5 (PostHog) ◄─────┤
                                    │                                                 │
Phase 3 (Team+) ◄───────────────────┤                                                 │
                                    │                                                 │
Phase 4 (Demo Form API) ◄───────────┘                                                 │
                                                                                      │
                           ┌──────────────────────────────────────────────────────────┘
                           ▼
Phase 6 (Integration & E2E) ─► DONE
```

### Risks & Mitigations

| Risk | Impact | Mitigation |
|------|--------|------------|
| Copy/asset delays | Medium | Use placeholder content, prioritize hero and key sections |
| GA/PostHog conflict | Low | Keep both during 30-day transition, validate both fire |
| Demo form regression | High | Enhance existing `/api/demo/contact` endpoint, not replace |
| Large image files | Medium | Require WebP + srcset before merge, validate with Lighthouse |
| PostHog adblock | Low | Graceful degradation - site works without analytics |

---

- [x] **T1 Phase 1: Foundation (Database, TaskEngine Job, Stats Service)** ✅ COMPLETED 2026-01-14

    > **Deliverables**: `homepage_stats` table, `HomepageStatsJob`, `HomepageStatsService`
    > **Dependency**: None (starting point)
    > **Enables**: Phase 2 (stats rendering), Phase 5 (stats tracking)

    - [ ] T1.1 Prime Context
        - [ ] T1.1.1 Read SDD data storage interface `[ref: SDD/Interface Specifications; lines: 575-603]`
        - [ ] T1.1.2 Read SDD aggregation queries `[ref: SDD/Interface Specifications; lines: 605-645]`
        - [ ] T1.1.3 Read existing StoreMetricsAggregatorJob pattern `[ref: userfrosting/src/BuyerKiosk/TaskEngine/Jobs/StoreMetricsAggregatorJob.php]`
        - [ ] T1.1.4 Read PRD stats requirements `[ref: PRD/Feature 4; lines: 146-161]`

    - [ ] T1.2 Write Tests
        - [ ] T1.2.1 Unit test: HomepageStatsService.getStats() returns all 6 stats `[ref: PRD/Feature 4; lines: 149-156]` `[activity: backend-test]`
        - [ ] T1.2.2 Unit test: HomepageStatsService.getStat($key) returns single stat `[activity: backend-test]`
        - [ ] T1.2.3 Unit test: HomepageStatsService.isStale() returns true when >48hrs old `[ref: PRD/Feature 4; line: 157]` `[activity: backend-test]`
        - [ ] T1.2.4 Unit test: HomepageStatsService fallback when cache empty `[ref: PRD edge case; line: 282]` `[activity: backend-test]`
        - [ ] T1.2.5 Unit test: HomepageStatsJob aggregates from all active stores `[activity: backend-test]`
        - [ ] T1.2.6 Unit test: HomepageStatsJob formats display values correctly (e.g., "$847M+") `[activity: backend-test]`

    - [ ] T1.3 Implement Database Migration
        - [ ] T1.3.1 Create migration JSON: `20260114_001_homepage_stats_table.json` `[ref: SDD/Interface Specifications; lines: 575-603]` `[activity: backend-database]`
        - [ ] T1.3.2 Add columns: id, statKey, statValue, displayValue, updatedAt `[activity: backend-database]`
        - [ ] T1.3.3 Add UNIQUE index on statKey `[activity: backend-database]`
        - [ ] T1.3.4 Seed initial fallback values (stores_served=127+, years=10+, etc.) `[activity: backend-database]`

    - [ ] T1.4 Implement HomepageStatsService
        - [ ] T1.4.1 Create `userfrosting/src/BuyerKiosk/Core/Services/HomepageStatsService.php` `[ref: SDD/Interface Specifications; lines: 692-717]` `[activity: backend-service]`
        - [ ] T1.4.2 Implement getStats(): array - returns all stats from cache `[activity: backend-service]`
        - [ ] T1.4.3 Implement getStat(string $key): ?array - returns single stat `[activity: backend-service]`
        - [ ] T1.4.4 Implement isStale(): bool - checks MAX(updatedAt) vs 48hr threshold `[activity: backend-service]`
        - [ ] T1.4.5 Implement fallback logic: hardcoded values if table empty/missing `[activity: backend-service]`
        - [ ] T1.4.6 Add warning logging when stale, error logging when empty `[activity: backend-service]`

    - [ ] T1.5 Implement HomepageStatsJob
        - [ ] T1.5.1 Create `userfrosting/src/BuyerKiosk/TaskEngine/Jobs/HomepageStatsJob.php` `[ref: SDD/Interface Specifications; lines: 605-645]` `[activity: backend-job]`
        - [ ] T1.5.2 Extend BaseJob, implement getName(), getDisplayName(), getQueue()='low', getScope()='global' `[activity: backend-job]`
        - [ ] T1.5.3 Implement handle(): aggregate stores_served, franchise_brands from central DB `[activity: backend-job]`
        - [ ] T1.5.4 Implement handle(): loop all store DBs to sum buyTotal from buyQueue `[activity: backend-job]`
        - [ ] T1.5.5 Implement handle(): sum buyCount from stores table `[activity: backend-job]`
        - [ ] T1.5.6 Implement handle(): format display values ($XXM+, XX+, etc.) `[activity: backend-job]`
        - [ ] T1.5.7 Implement handle(): REPLACE INTO homepage_stats cache `[activity: backend-job]`

    - [ ] T1.6 Register Job
        - [ ] T1.6.1 Create migration JSON: `20260114_002_homepage_stats_job.json` `[activity: backend-database]`
        - [ ] T1.6.2 Insert into task_job_definitions with schedule: '0 2 * * *' `[activity: backend-database]`

    - [ ] T1.7 Validate Phase 1
        - [ ] T1.7.1 Run migration: `php userfrosting/conductor run` `[activity: run-command]`
        - [ ] T1.7.2 Run unit tests: `./test.sh --testsuite unit` `[activity: run-tests]`
        - [ ] T1.7.3 Run PHPStan: `./test.sh --stan` `[activity: lint-code]`
        - [ ] T1.7.4 Manually dispatch job: `php userfrosting/bin/task job:dispatch homepage-stats` `[activity: run-command]`
        - [ ] T1.7.5 Verify stats populated in homepage_stats table `[activity: business-acceptance]`

---

- [ ] **T2 Phase 2: Homepage Template Redesign + Demo Form UI**

    > **Deliverables**: Modular partials (~15 files), updated home.html, demo-form.html partial, CSS updates
    > **Dependency**: Phase 1 (stats service must exist for stats section)
    > **Enables**: Phase 3 (shares demo-form partial), Phase 4 (API for form), Phase 5 (tracking attributes)
    > **Done When**: Homepage renders all sections, demo form modal opens, all breakpoints work, Lighthouse LCP < 2.5s

    - [ ] T2.1 Prime Context
        - [ ] T2.1.1 Read SDD directory map `[ref: SDD/Building Block View; lines: 496-569]`
        - [ ] T2.1.2 Read SDD PRD Feature 1 mapping (Hero) `[ref: SDD/PRD Requirements Mapping; lines: 273-284]`
        - [ ] T2.1.3 Read SDD PRD Feature 2 mapping (Features) `[ref: SDD/PRD Requirements Mapping; lines: 286-296]`
        - [ ] T2.1.4 Read existing home.html structure `[ref: userfrosting/templates/common/home.html]`
        - [ ] T2.1.5 Read existing modern-home.css patterns `[ref: public_html/css/front/modern-home.css]`

    - [ ] T2.2 Implement Navigation Partial `[component: nav]`
        - [ ] T2.2.1 Create `userfrosting/templates/common/partials/homepage/nav.html` `[ref: SDD/PRD Mapping; lines: 368-374]` `[activity: frontend-template]`
        - [ ] T2.2.2 Include nav items: Features (#features), Team+ (/team-plus), Pricing (#pricing), Contact (#contact), Login `[ref: PRD/Feature 10; lines: 222-227]` `[activity: frontend-template]`
        - [ ] T2.2.3 Add mobile hamburger toggle with aria-expanded `[activity: frontend-template]`
        - [ ] T2.2.4 Add Team+ link to /team-plus route `[activity: frontend-template]`
        - [ ] T2.2.5 Ensure #contact anchor target exists (footer or contact section) `[activity: frontend-template]`

    - [ ] T2.3 Implement Hero Partial `[component: hero]`
        - [ ] T2.3.1 Create `userfrosting/templates/common/partials/homepage/hero.html` `[ref: SDD/PRD Mapping; lines: 273-284]` `[activity: frontend-template]`
        - [ ] T2.3.2 Add headline (max 10 words) and subhead (max 25 words) Twig variables `[ref: PRD/Feature 1; lines: 117-118]` `[activity: frontend-template]`
        - [ ] T2.3.3 Add primary CTA "Schedule Demo" button with `data-demo-trigger` `[ref: PRD/Feature 1; line: 119]` `[activity: frontend-template]`
        - [ ] T2.3.4 Add secondary CTA (Watch Video / Learn More) `[ref: PRD/Feature 1; line: 120]` `[activity: frontend-template]`
        - [ ] T2.3.5 Add franchise logo loop (min 3 logos) `[ref: PRD/Feature 1; line: 121]` `[activity: frontend-template]`
        - [ ] T2.3.6 Add `data-posthog-section="hero"` attribute `[activity: frontend-template]`

    - [ ] T2.4 Implement Feature Section Partials `[component: features]` `[parallel: true]`
        - [ ] T2.4.1 Create `partials/homepage/features/kiosk.html` with consistent structure `[ref: SDD/PRD Mapping; lines: 286-296]` `[activity: frontend-template]`
        - [ ] T2.4.2 Create `partials/homepage/features/signage.html` `[activity: frontend-template]`
        - [ ] T2.4.3 Create `partials/homepage/features/daybook.html` `[activity: frontend-template]`
        - [ ] T2.4.4 Create `partials/homepage/features/backstock.html` `[activity: frontend-template]`
        - [ ] T2.4.5 Create `partials/homepage/features/floor-plan.html` `[activity: frontend-template]`
        - [ ] T2.4.6 Create `partials/homepage/features/customer-chat.html` `[activity: frontend-template]`
        - [ ] T2.4.7 Create `partials/homepage/features/reporting.html` `[activity: frontend-template]`
        - [ ] T2.4.8 Create `partials/homepage/features/events.html` `[activity: frontend-template]`
        - [ ] T2.4.9 Create `partials/homepage/features/comeback-cash.html` `[activity: frontend-template]`
        - [ ] T2.4.10 Create `partials/homepage/features/quickbooks.html` `[activity: frontend-template]`
        - [ ] T2.4.11 Create `partials/homepage/features/fivestars.html` `[activity: frontend-template]`
        - [ ] T2.4.12 Each partial: h3 (max 6 words), p (max 50 words), 3-4 li bullets, img with loading="lazy" `[ref: PRD/Feature 2; lines: 129-131]` `[activity: frontend-template]`
        - [ ] T2.4.13 Each partial: add `data-posthog-section="[name]"` attribute `[ref: PRD/Feature 2; line: 130]` `[activity: frontend-template]`

    - [ ] T2.5 Implement Team+ Section Partial `[component: team-plus-section]`
        - [ ] T2.5.1 Create `partials/homepage/team-plus-section.html` `[ref: SDD/PRD Mapping; lines: 298-307]` `[activity: frontend-template]`
        - [ ] T2.5.2 Add visually distinct background (var(--primary-50)) `[ref: PRD/Feature 3; line: 139]` `[activity: frontend-template]`
        - [ ] T2.5.3 Add price "$30/month per store" with font-size >= 1.25rem `[ref: PRD/Feature 3; line: 140]` `[activity: frontend-template]`
        - [ ] T2.5.4 Add "Premium Add-On" badge `[ref: PRD/Feature 3; line: 141]` `[activity: frontend-template]`
        - [ ] T2.5.5 Add 5 feature bullets: Scheduling, AI Scheduling, Staff Chat, Team App, Live App `[ref: PRD/Feature 3; line: 142]` `[activity: frontend-template]`
        - [ ] T2.5.6 Add "Learn More" CTA linking to /team-plus `[ref: PRD/Feature 3; line: 143]` `[activity: frontend-template]`
        - [ ] T2.5.7 Add scheduling calendar screenshot `[ref: PRD/Feature 3; line: 145]` `[activity: frontend-template]`

    - [ ] T2.6 Implement Stats Section Partial `[component: stats]`
        - [ ] T2.6.1 Create `partials/homepage/stats.html` `[ref: SDD/PRD Mapping; lines: 309-325]` `[activity: frontend-template]`
        - [ ] T2.6.2 Add CSS Grid: 2x3 mobile, 6x1 desktop `[ref: PRD/Feature 4; line: 149]` `[activity: frontend-template]`
        - [ ] T2.6.3 Display 6 stats from Twig `{{ stats }}` variable `[ref: PRD/Feature 4; lines: 150-156]` `[activity: frontend-template]`
        - [ ] T2.6.4 Add `data-stat-value` attributes for count-up animation `[ref: PRD/Feature 4; line: 160]` `[activity: frontend-template]`
        - [ ] T2.6.5 Add franchise logo grid (PIAS, PC, CM, OUAC, SE, SW) `[ref: PRD/Feature 4; line: 158]` `[activity: frontend-template]`
        - [ ] T2.6.6 Add `data-posthog-section="stats"` attribute `[ref: PRD/Feature 4; line: 161]` `[activity: frontend-template]`

    - [ ] T2.7 Implement Testimonials Partial `[component: testimonials]`
        - [ ] T2.7.1 Create `partials/homepage/testimonials.html` `[ref: SDD/Building Block View; line: 532]` `[activity: frontend-template]`
        - [ ] T2.7.2 Add 2-3 testimonials: quote, name, store name, store type `[ref: PRD/Feature 4; line: 159]` `[activity: frontend-template]`

    - [ ] T2.8 Implement Pricing Section Partial `[component: pricing]`
        - [ ] T2.8.1 Create `partials/homepage/pricing.html` `[ref: SDD/PRD Mapping; lines: 327-336]` `[activity: frontend-template]`
        - [ ] T2.8.2 Add 3 tiers: Phone Check-In, Apparel Brands, Sports & Gear `[ref: PRD/Feature 5; line: 167]` `[activity: frontend-template]`
        - [ ] T2.8.3 Add Team+ addon: "$30/month per store" marked as optional `[ref: PRD/Feature 5; line: 168]` `[activity: frontend-template]`
        - [ ] T2.8.4 Each tier: price, 3-5 bullet features, CTA `[ref: PRD/Feature 5; line: 169]` `[activity: frontend-template]`
        - [ ] T2.8.5 Add "Contact for custom pricing" for enterprise `[ref: PRD/Feature 5; line: 170]` `[activity: frontend-template]`
        - [ ] T2.8.6 Add `data-posthog-section="pricing"` attribute `[ref: PRD/Feature 5; line: 171]` `[activity: frontend-template]`

    - [ ] T2.9 Implement Footer Partial `[component: footer]`
        - [ ] T2.9.1 Create `partials/homepage/footer.html` `[ref: SDD/Building Block View; line: 534]` `[activity: frontend-template]`
        - [ ] T2.9.2 Add "Schedule Demo" CTA `[ref: PRD/Feature 6; line: 176]` `[activity: frontend-template]`
        - [ ] T2.9.3 Add contact info, social links, legal links `[activity: frontend-template]`
        - [ ] T2.9.4 Add `id="contact"` for navigation anchor `[activity: frontend-template]`

    - [ ] T2.9A Implement Mid-Page CTA Section `[component: mid-cta]`
        - [ ] T2.9A.1 Create CTA section between features and stats `[ref: PRD/Feature 6; line: 176]` `[activity: frontend-template]`
        - [ ] T2.9A.2 Add "Schedule Demo" button consistent with hero CTA `[activity: frontend-template]`
        - [ ] T2.9A.3 Add `data-demo-trigger` attribute for modal trigger `[activity: frontend-template]`

    - [ ] T2.10 Implement Video Section (Should Have) `[component: video]`
        - [ ] T2.10.1 Create video section in hero or dedicated section `[ref: PRD/Feature 8; lines: 209-213]` `[activity: frontend-template]`
        - [ ] T2.10.2 Add poster image, lazy-load video on click `[ref: SDD/Performance Strategy; line: 1059]` `[activity: frontend-template]`
        - [ ] T2.10.3 Add onerror handler to show poster, hide play button on failure `[ref: PRD edge case; line: 285]` `[activity: frontend-template]`

    - [ ] T2.11 Implement Mobile App Showcase (Should Have) `[component: mobile-showcase]`
        - [ ] T2.11.1 Create mobile app showcase section with device mockups `[ref: PRD/Feature 9; lines: 216-220]` `[activity: frontend-template]`
        - [ ] T2.11.2 Add Team app and Live app screenshots `[ref: PRD/Feature 9; line: 217]` `[activity: frontend-template]`
        - [ ] T2.11.3 NO app store badges (apps not published) `[ref: PRD/Feature 9; line: 220]` `[activity: frontend-template]`

    - [ ] T2.12 Implement Demo Form Partial (UI Only) `[component: demo-form]`
        - [ ] T2.12.1 Create `partials/homepage/demo-form.html` modal `[ref: SDD/Building Block View; line: 533]` `[activity: frontend-template]`
        - [ ] T2.12.2 Add required fields: name, email, phone, store_name, store_type `[ref: PRD/Feature 6; line: 178]` `[activity: frontend-template]`
        - [ ] T2.12.3 Add store_type dropdown: Resale/Consignment, Sporting Goods, Phone Check-In, Other `[ref: PRD/Feature 6; line: 179]` `[activity: frontend-template]`
        - [ ] T2.12.4 Add hidden team_plus_interest field (set via JS from Team+ page) `[ref: SDD/PRD Mapping; line: 362]` `[activity: frontend-template]`
        - [ ] T2.12.5 Add CSRF token field `[activity: frontend-template]`
        - [ ] T2.12.6 Add form `action="/api/demo/contact"` for non-JS fallback `[ref: SDD/PRD edge case; line: 284]` `[activity: frontend-template]`
        - [ ] T2.12.7 Add form `method="POST"` for non-JS fallback `[activity: frontend-template]`

    - [ ] T2.13 Update Main home.html Template
        - [ ] T2.13.1 Refactor home.html to include all partials `[ref: SDD/Building Block View; lines: 467-476]` `[activity: frontend-template]`
        - [ ] T2.13.2 Update pageHome() controller to pass stats from HomepageStatsService `[activity: backend-controller]`
        - [ ] T2.13.3 Ensure all breakpoints work: 375px, 768px, 1024px, 1440px `[ref: PRD/Feature 1; line: 122]` `[activity: frontend-css]`
        - [ ] T2.13.4 Keep existing GA tracking script (UA-80211901-1) during transition `[ref: SDD/Implementation Boundaries; line: 126]` `[activity: frontend-template]`

    - [ ] T2.14 Implement SEO Meta Tags
        - [ ] T2.14.1 Add meta title and description `[ref: SDD/Quality Requirements; line: 1146]` `[activity: frontend-template]`
        - [ ] T2.14.2 Add Open Graph tags (og:title, og:description, og:image) `[ref: SDD/Quality Requirements; line: 1146]` `[activity: frontend-template]`
        - [ ] T2.14.3 Add Twitter Card tags `[activity: frontend-template]`
        - [ ] T2.14.4 Verify semantic HTML structure (nav, main, section, footer) `[ref: SDD/Accessibility Implementation; line: 1068]` `[activity: frontend-template]`

    - [ ] T2.15 Implement Image Optimization
        - [ ] T2.15.1 Convert hero image to WebP with JPEG fallback `[ref: SDD/Performance Strategy; line: 1055]` `[activity: asset-optimization]`
        - [ ] T2.15.2 Add srcset for responsive images `[ref: SDD/Performance Strategy; line: 1055]` `[activity: asset-optimization]`
        - [ ] T2.15.3 Ensure feature screenshots are optimized (< 100KB each) `[activity: asset-optimization]`
        - [ ] T2.15.4 Add width/height attributes to prevent CLS `[ref: SDD/Constraints; line: 44]` `[activity: frontend-template]`

    - [ ] T2.16 Update CSS
        - [ ] T2.16.1 Update modern-home.css for new partial styles `[activity: frontend-css]`
        - [ ] T2.16.2 Add responsive grid for stats (2x3 mobile, 6x1 desktop) `[activity: frontend-css]`
        - [ ] T2.16.3 Add Team+ section highlight styles `[activity: frontend-css]`
        - [ ] T2.16.4 Add skeleton loaders for slow connection states `[ref: PRD edge case; line: 283]` `[activity: frontend-css]`
        - [ ] T2.16.5 Add `@media (prefers-reduced-motion: reduce)` for animations `[ref: SDD/Performance Strategy; line: 1061]` `[activity: frontend-css]`
        - [ ] T2.16.6 Build CSS: `php userfrosting/conductor build-css --minify` `[activity: run-command]`

    - [ ] T2.17 Write Frontend Smoke Tests
        - [ ] T2.17.1 Test: Homepage renders without errors `[activity: frontend-test]`
        - [ ] T2.17.2 Test: All 11 feature sections have data-posthog-section attributes `[activity: frontend-test]`
        - [ ] T2.17.3 Test: Demo form modal opens on CTA click `[activity: frontend-test]`
        - [ ] T2.17.4 Test: Nav anchor links (#features, #pricing, #contact) target existing elements `[activity: frontend-test]`
        - [ ] T2.17.5 Test: Stats section displays 6 stat values `[activity: frontend-test]`

    - [ ] T2.18 Validate Phase 2
        - [ ] T2.18.1 Visual review at all breakpoints (375, 768, 1024, 1440px) `[activity: visual-review]`
        - [ ] T2.18.2 Verify all 11 feature sections render `[ref: PRD/Feature 2; line: 128]` `[activity: business-acceptance]`
        - [ ] T2.18.3 Verify stats display from HomepageStatsService `[activity: business-acceptance]`
        - [ ] T2.18.4 Run Lighthouse audit: LCP < 2.5s target `[ref: PRD/Feature 1; line: 124]` `[activity: performance-audit]`
        - [ ] T2.18.5 Run axe-core accessibility scan `[ref: SDD/Quality Requirements; line: 1140]` `[activity: accessibility-audit]`
        - [ ] T2.18.6 Verify GA tracking still fires (UA-80211901-1) `[ref: SDD/Implementation Boundaries; line: 126]` `[activity: business-acceptance]`
        - [ ] T2.18.7 Verify demo form modal opens from all 3 CTA locations (hero, mid-page, footer) `[ref: PRD/Feature 6; line: 176]` `[activity: business-acceptance]`

---

- [ ] **T3 Phase 3: Team+ Landing Page**

    > **Deliverables**: /team-plus route, team-plus.html template, partials
    > **Dependency**: Phase 2 (shares nav, footer, demo-form partials created in T2.12)
    > **Enables**: Phase 4 (API for demo form), Phase 5 (page tracking)
    > **Done When**: /team-plus renders, comparison table displays, demo form opens with team_plus_interest flag

    - [ ] T3.1 Prime Context
        - [ ] T3.1.1 Read SDD PRD Feature 7 mapping `[ref: SDD/PRD Requirements Mapping; lines: 352-366]`
        - [ ] T3.1.2 Read SDD comparison table specification `[ref: SDD/Interface Specifications; lines: 720-783]`
        - [ ] T3.1.3 Read PRD Team+ landing page requirements `[ref: PRD/Feature 7; lines: 187-204]`

    - [ ] T3.2 Write Tests
        - [ ] T3.2.1 Integration test: GET /team-plus returns 200 `[activity: backend-test]`
        - [ ] T3.2.2 Integration test: /team-plus renders team-plus.html template `[activity: backend-test]`
        - [ ] T3.2.3 Integration test: Page contains comparison table `[ref: PRD/Feature 7; line: 200]` `[activity: backend-test]`

    - [ ] T3.3 Implement Route and Controller
        - [ ] T3.3.1 Add GET /team-plus route in `userfrosting/routes/index.php` `[ref: SDD/PRD Mapping; line: 356]` `[activity: backend-route]`
        - [ ] T3.3.2 Add pageTeamPlus() method in AccountController `[ref: SDD/Building Block View; line: 539]` `[activity: backend-controller]`

    - [ ] T3.4 Implement Team+ Partials `[component: team-plus-page]`
        - [ ] T3.4.1 Create `partials/team-plus/hero.html` with headline (max 8 words) `[ref: PRD/Feature 7; line: 193]` `[activity: frontend-template]`
        - [ ] T3.4.2 Create `partials/team-plus/features/scheduling.html` with calendar screenshot `[ref: PRD/Feature 7; line: 195]` `[activity: frontend-template]`
        - [ ] T3.4.3 Create `partials/team-plus/features/ai-scheduling.html` with "saves 2-4 hours/week" `[ref: PRD/Feature 7; line: 196]` `[activity: frontend-template]`
        - [ ] T3.4.4 Create `partials/team-plus/features/staff-chat.html` with channels screenshot `[ref: PRD/Feature 7; line: 197]` `[activity: frontend-template]`
        - [ ] T3.4.5 Create `partials/team-plus/features/team-app.html` with device mockup (3 screens) `[ref: PRD/Feature 7; line: 198]` `[activity: frontend-template]`
        - [ ] T3.4.6 Create `partials/team-plus/features/live-app.html` with device mockup (3 screens) `[ref: PRD/Feature 7; line: 199]` `[activity: frontend-template]`
        - [ ] T3.4.7 Create `partials/team-plus/comparison-table.html` with 10 feature rows `[ref: SDD/Interface Specifications; lines: 720-783]` `[activity: frontend-template]`
        - [ ] T3.4.8 Create `partials/team-plus/pricing.html` with "$30/month per store" breakdown `[ref: PRD/Feature 7; line: 200]` `[activity: frontend-template]`

    - [ ] T3.5 Implement Main team-plus.html Template
        - [ ] T3.5.1 Create `userfrosting/templates/common/team-plus.html` `[ref: SDD/Building Block View; line: 501]` `[activity: frontend-template]`
        - [ ] T3.5.2 Include shared partials: nav, footer, demo-form `[ref: SDD/Building Block View; lines: 477-491]` `[activity: frontend-template]`
        - [ ] T3.5.3 Add `data-page="team-plus"` attribute for PostHog source tracking `[activity: frontend-template]`
        - [ ] T3.5.4 Add mobile screenshots only (no app store badges) `[ref: PRD/Feature 7; line: 202]` `[activity: frontend-template]`

    - [ ] T3.6 Implement CSS for Team+ Page
        - [ ] T3.6.1 Add comparison table styles (Team+ column highlighted) `[ref: SDD/Interface Specifications; lines: 778-783]` `[activity: frontend-css]`
        - [ ] T3.6.2 Add responsive table (horizontal scroll on mobile) `[activity: frontend-css]`
        - [ ] T3.6.3 Build CSS: `php userfrosting/conductor build-css --minify` `[activity: run-command]`

    - [ ] T3.7 Write Frontend Smoke Tests
        - [ ] T3.7.1 Test: GET /team-plus returns 200 `[activity: frontend-test]`
        - [ ] T3.7.2 Test: Page contains 5 feature sections `[activity: frontend-test]`
        - [ ] T3.7.3 Test: Comparison table renders with 10 feature rows `[activity: frontend-test]`
        - [ ] T3.7.4 Test: Demo form sets team_plus_interest=true `[activity: frontend-test]`

    - [ ] T3.8 Validate Phase 3
        - [ ] T3.8.1 Visual review at all breakpoints `[activity: visual-review]`
        - [ ] T3.8.2 Verify 5 feature sections with screenshots `[ref: PRD/Feature 7; line: 194]` `[activity: business-acceptance]`
        - [ ] T3.8.3 Verify comparison table with 10 rows `[ref: PRD/Feature 7; line: 200]` `[activity: business-acceptance]`
        - [ ] T3.8.4 Run Lighthouse: LCP < 2.5s `[ref: PRD/Feature 7; line: 204]` `[activity: performance-audit]`
        - [ ] T3.8.5 Run axe-core accessibility scan `[activity: accessibility-audit]`
        - [ ] T3.8.6 Verify demo form modal opens with team_plus_interest flag set `[activity: business-acceptance]`

---

- [ ] **T4 Phase 4: Demo Form API & JavaScript**

    > **Deliverables**: Enhanced /api/demo/contact endpoint, demo_leads migration, form JavaScript
    > **Dependency**: Phase 2 (demo-form.html partial created in T2.12), Phase 3 (Team+ page uses form)
    > **Enables**: Phase 5 (form tracking events)
    > **Done When**: Form submits successfully, leads created with new fields, validation works, non-JS fallback works

    - [ ] T4.1 Prime Context
        - [ ] T4.1.1 Read SDD Demo Form API interface `[ref: SDD/Interface Specifications; lines: 647-689]`
        - [ ] T4.1.2 Read SDD PRD Feature 6 mapping `[ref: SDD/PRD Requirements Mapping; lines: 338-350]`
        - [ ] T4.1.3 Read PRD demo form requirements `[ref: PRD/Feature 6; lines: 173-183]`
        - [ ] T4.1.4 Read existing demo API pattern `[ref: userfrosting/routes/demo/api.php; lines: 229-286]`

    - [ ] T4.2 Write Tests
        - [ ] T4.2.1 Unit test: Form validation - valid email format `[ref: PRD/Feature 6; line: 180]` `[activity: backend-test]`
        - [ ] T4.2.2 Unit test: Form validation - phone 10+ digits `[ref: PRD/Feature 6; line: 180]` `[activity: backend-test]`
        - [ ] T4.2.3 Unit test: Form validation - store_type enum values `[ref: SDD/Interface Specifications; line: 666]` `[activity: backend-test]`
        - [ ] T4.2.4 Unit test: Form validation - all required fields non-empty `[ref: PRD/Feature 6; line: 180]` `[activity: backend-test]`
        - [ ] T4.2.5 Integration test: POST /api/demo/contact creates lead with new fields `[activity: backend-test]`
        - [ ] T4.2.6 Integration test: POST with team_plus_interest=true sets flag `[activity: backend-test]`
        - [ ] T4.2.7 Integration test: Validation error returns 400 with field errors `[ref: SDD/Interface Specifications; lines: 678-681]` `[activity: backend-test]`
        - [ ] T4.2.8 Integration test: Non-JS POST submission creates lead and redirects `[activity: backend-test]`

    - [ ] T4.3 Implement Database Migration
        - [ ] T4.3.1 Create migration to add columns to demo_leads table `[activity: backend-database]`
        - [ ] T4.3.2 Add column: store_name VARCHAR(255) `[ref: SDD/Interface Specifications; line: 688]` `[activity: backend-database]`
        - [ ] T4.3.3 Add column: store_type VARCHAR(50) `[ref: SDD/Interface Specifications; line: 688]` `[activity: backend-database]`
        - [ ] T4.3.4 Add column: team_plus_interest TINYINT(1) DEFAULT 0 `[ref: SDD/Interface Specifications; line: 689]` `[activity: backend-database]`

    - [ ] T4.4 Enhance Demo Form API (Existing Endpoint)
        - [ ] T4.4.1 Enhance existing POST /api/demo/contact to accept new homepage fields `[ref: userfrosting/routes/demo/api.php; lines: 229-286]` `[activity: backend-api]`
        - [ ] T4.4.2 Add name, store_name, store_type, team_plus_interest field handling `[activity: backend-api]`
        - [ ] T4.4.3 Implement field validation: email (filter_var), phone (regex), store_type (in_array) `[ref: SDD/Interface Specifications; lines: 667-669]` `[activity: backend-api]`
        - [ ] T4.4.4 Implement validation error response: {success: false, error, fields} `[ref: SDD/Interface Specifications; lines: 678-681]` `[activity: backend-api]`
        - [ ] T4.4.5 Add DemoRateLimiter integration `[ref: SDD/Security Considerations; line: 1046]` `[activity: backend-api]`

    - [ ] T4.5 Implement Non-JS Fallback Handler
        - [ ] T4.5.1 Add server-side form POST handling (Content-Type: application/x-www-form-urlencoded) `[ref: PRD edge case; line: 284]` `[activity: backend-api]`
        - [ ] T4.5.2 Implement success redirect to /?demo=success `[activity: backend-api]`
        - [ ] T4.5.3 Implement error redirect to /?demo=error with flash message `[activity: backend-api]`
        - [ ] T4.5.4 Add noscript success/error message display in template `[activity: frontend-template]`

    - [ ] T4.6 Implement Demo Form JavaScript
        - [ ] T4.6.1 Add form validation (client-side) before submit `[ref: PRD/Feature 6; line: 183]` `[activity: frontend-js]`
        - [ ] T4.6.2 Add fetch POST to /api/demo/contact `[ref: PRD/Feature 6; line: 181]` `[activity: frontend-js]`
        - [ ] T4.6.3 Add inline error display per field on validation failure `[ref: PRD/Feature 6; line: 183]` `[activity: frontend-js]`
        - [ ] T4.6.4 Add focus on first error field `[ref: PRD edge case; line: 281]` `[activity: frontend-js]`
        - [ ] T4.6.5 Add success message display, form NOT reset on error `[ref: PRD edge case; line: 280]` `[activity: frontend-js]`
        - [ ] T4.6.6 Add team_plus_interest=true when opened from Team+ page `[ref: SDD/PRD Mapping; line: 362]` `[activity: frontend-js]`

    - [ ] T4.7 Validate Phase 4
        - [ ] T4.7.1 Run migration: `php userfrosting/conductor run` `[activity: run-command]`
        - [ ] T4.7.2 Run unit and integration tests: `./test.sh` `[activity: run-tests]`
        - [ ] T4.7.3 Manual test: Submit form on homepage (verify lead created) `[activity: manual-test]`
        - [ ] T4.7.4 Manual test: Submit form on Team+ page (verify team_plus_interest=1) `[activity: manual-test]`
        - [ ] T4.7.5 Manual test: Validation errors display inline `[activity: manual-test]`
        - [ ] T4.7.6 Manual test: Form works with JavaScript disabled (verify redirect to /?demo=success) `[ref: PRD edge case; line: 284]` `[activity: manual-test]`
        - [ ] T4.7.7 Verify existing demo flow still works (regression test) `[activity: business-acceptance]`

---

- [ ] **T5 Phase 5: PostHog Analytics Integration**

    > **Deliverables**: PostHog SDK integration, homepage.js, all tracking events
    > **Dependency**: Phase 2 (section attributes), Phase 3 (page attributes), Phase 4 (form events)
    > **Enables**: Phase 6 (event verification)
    > **Done When**: All PRD events fire correctly, PostHog debugger shows events, GA still works alongside

    - [ ] T5.1 Prime Context
        - [ ] T5.1.1 Read SDD PostHog interface specification `[ref: SDD/Interface Specifications; lines: 785-820]`
        - [ ] T5.1.2 Read PRD tracking requirements table `[ref: PRD/Tracking Requirements; lines: 312-327]`
        - [ ] T5.1.3 Read PostHog JS SDK documentation `[ref: https://posthog.com/docs/libraries/js]`

    - [ ] T5.2 Implement PostHog SDK Setup
        - [ ] T5.2.1 Add PostHog CDN script to template head `[ref: SDD/Interface Specifications; line: 791]` `[activity: frontend-template]`
        - [ ] T5.2.2 Configure: api_host, api_key (from env), autocapture=true, capture_pageview=true `[ref: SDD/Interface Specifications; lines: 795-800]` `[activity: frontend-js]`
        - [ ] T5.2.3 Add environment variable: POSTHOG_API_KEY `[ref: SDD/Deployment View; line: 961]` `[activity: backend-config]`
        - [ ] T5.2.4 Add environment variable: POSTHOG_HOST `[ref: SDD/Deployment View; line: 962]` `[activity: backend-config]`
        - [ ] T5.2.5 Pass PostHog config to template via controller `[activity: backend-controller]`

    - [ ] T5.3 Implement homepage.js
        - [ ] T5.3.1 Create `public_html/js/front/homepage.js` `[ref: SDD/Building Block View; line: 563]` `[activity: frontend-js]`
        - [ ] T5.3.2 Implement IntersectionObserver for section_viewed events `[ref: PRD/Feature 2; line: 131]` `[activity: frontend-js]`
        - [ ] T5.3.3 Track time_visible for each section `[ref: SDD/Interface Specifications; line: 803]` `[activity: frontend-js]`

    - [ ] T5.4 Implement Custom Events `[parallel: true]`
        - [ ] T5.4.1 Implement hero_cta_clicked: {cta_type, position} `[ref: PRD/Feature 1; line: 123]` `[activity: frontend-js]`
        - [ ] T5.4.2 Implement team_plus_cta_clicked: {source} `[ref: PRD/Feature 3; line: 144]` `[activity: frontend-js]`
        - [ ] T5.4.3 Implement pricing_section_viewed `[ref: PRD/Feature 5; line: 171]` `[activity: frontend-js]`
        - [ ] T5.4.4 Implement pricing_cta_clicked: {tier} `[ref: PRD/Feature 5; line: 172]` `[activity: frontend-js]`
        - [ ] T5.4.5 Implement demo_form_opened: {source, page} `[ref: PRD/Feature 6; line: 182]` `[activity: frontend-js]`
        - [ ] T5.4.6 Implement demo_form_submitted: {store_type, source, team_plus_interest} `[ref: PRD/Feature 6; line: 182]` `[activity: frontend-js]`
        - [ ] T5.4.7 Implement demo_form_error: {field, error_type} `[ref: SDD/Interface Specifications; line: 810]` `[activity: frontend-js]`
        - [ ] T5.4.8 Implement team_plus_page_view: {source} `[ref: PRD/Feature 7; line: 203]` `[activity: frontend-js]`
        - [ ] T5.4.9 Implement team_plus_demo_requested `[ref: PRD/Feature 7; line: 203]` `[activity: frontend-js]`
        - [ ] T5.4.10 Implement video_played: {video_name, watch_percent} `[ref: SDD/Interface Specifications; line: 813]` `[activity: frontend-js]`
        - [ ] T5.4.11 Implement stats_section_viewed `[ref: PRD/Feature 4; line: 161]` `[activity: frontend-js]`

    - [ ] T5.5 Implement Count-Up Animation
        - [ ] T5.5.1 Implement stats count-up on IntersectionObserver visibility `[ref: PRD/Feature 4; line: 160]` `[activity: frontend-js]`
        - [ ] T5.5.2 Respect prefers-reduced-motion (skip animation if set) `[ref: SDD/Performance Strategy; line: 1061]` `[activity: frontend-js]`

    - [ ] T5.6 Write Analytics Smoke Tests
        - [ ] T5.6.1 Test: PostHog SDK initializes without errors `[activity: frontend-test]`
        - [ ] T5.6.2 Test: section_viewed events fire on scroll `[activity: frontend-test]`
        - [ ] T5.6.3 Test: hero_cta_clicked fires with correct properties `[activity: frontend-test]`
        - [ ] T5.6.4 Test: demo_form_submitted fires with store_type `[activity: frontend-test]`

    - [ ] T5.7 Validate Phase 5
        - [ ] T5.7.1 Verify PostHog SDK loads without blocking page `[ref: SDD/Error Handling; line: 938]` `[activity: performance-audit]`
        - [ ] T5.7.2 Verify all 11 PRD events fire using PostHog debugger `[ref: SDD/Quality Requirements; line: 1144]` `[activity: business-acceptance]`
        - [ ] T5.7.3 Verify site works with PostHog blocked (adblock scenario) `[ref: SDD/Implementation Gotchas; line: 1173]` `[activity: manual-test]`
        - [ ] T5.7.4 Test count-up animation with prefers-reduced-motion `[activity: accessibility-audit]`
        - [ ] T5.7.5 Verify GA tracking still fires alongside PostHog `[ref: SDD/Implementation Boundaries; line: 126]` `[activity: business-acceptance]`

---

- [ ] **T6 Phase 6: Integration & End-to-End Validation**

    > **Deliverables**: All integration tests passing, E2E user flows verified, deployment ready
    > **Dependency**: Phases 1-5 complete
    > **Enables**: Production deployment

    - [ ] T6.1 Unit Test Coverage
        - [ ] T6.1.1 Verify HomepageStatsService unit tests pass `[activity: run-tests]`
        - [ ] T6.1.2 Verify HomepageStatsJob unit tests pass `[activity: run-tests]`
        - [ ] T6.1.3 Verify Demo Form API unit tests pass `[activity: run-tests]`
        - [ ] T6.1.4 Run full test suite: `./test.sh` `[activity: run-tests]`

    - [ ] T6.2 Integration Tests
        - [ ] T6.2.1 Test homepage renders with stats from cache `[activity: integration-test]`
        - [ ] T6.2.2 Test homepage renders with stale cache (fallback values) `[ref: SDD/Test Specifications; lines: 1208-1214]` `[activity: integration-test]`
        - [ ] T6.2.3 Test homepage renders with empty cache (hardcoded fallback) `[ref: SDD/Test Specifications; lines: 1216-1222]` `[activity: integration-test]`
        - [ ] T6.2.4 Test Team+ page renders with all sections `[activity: integration-test]`
        - [ ] T6.2.5 Test demo form submission creates lead `[ref: SDD/Test Specifications; lines: 1197-1205]` `[activity: integration-test]`

    - [ ] T6.3 End-to-End User Flows
        - [ ] T6.3.1 E2E: Homepage happy path - load, scroll all sections, click demo CTA `[ref: SDD/Test Specifications; lines: 1184-1193]` `[activity: e2e-test]`
        - [ ] T6.3.2 E2E: Demo form submission - fill form, submit, see success `[ref: SDD/Test Specifications; lines: 1197-1205]` `[activity: e2e-test]`
        - [ ] T6.3.3 E2E: Team+ page journey - nav click, scroll, click demo CTA `[ref: SDD/Test Specifications; lines: 1224-1232]` `[activity: e2e-test]`
        - [ ] T6.3.4 E2E: Mobile responsive - all breakpoints display correctly `[ref: SDD/Test Specifications; lines: 1234-1244]` `[activity: e2e-test]`
        - [ ] T6.3.5 E2E: Navigation content - all nav items present and functional `[ref: SDD/Test Specifications; lines: 1256-1266]` `[activity: e2e-test]`
        - [ ] T6.3.6 E2E: Video playback - poster, play, error handling `[ref: SDD/Test Specifications; lines: 1268-1280]` `[activity: e2e-test]`
        - [ ] T6.3.7 E2E: Team+ demo request - form sets team_plus_interest=1 `[ref: SDD/Test Specifications; lines: 1282-1290]` `[activity: e2e-test]`

    - [ ] T6.4 Performance Validation
        - [ ] T6.4.1 Lighthouse audit: LCP < 2.5s `[ref: SDD/Quality Requirements; line: 1137]` `[activity: performance-audit]`
        - [ ] T6.4.2 Lighthouse audit: CLS < 0.1 `[ref: SDD/Quality Requirements; line: 1138]` `[activity: performance-audit]`
        - [ ] T6.4.3 Lighthouse audit: FID < 100ms `[ref: SDD/Quality Requirements; line: 1139]` `[activity: performance-audit]`
        - [ ] T6.4.4 Verify images lazy-load (except hero) `[ref: SDD/Performance Strategy; line: 1054]` `[activity: performance-audit]`
        - [ ] T6.4.5 Test on simulated slow 3G connection `[ref: PRD edge case; line: 283]` `[activity: performance-audit]`

    - [ ] T6.5 Accessibility Validation
        - [ ] T6.5.1 Run axe-core automated scan: 0 critical/serious issues `[ref: SDD/Quality Requirements; line: 1140]` `[activity: accessibility-audit]`
        - [ ] T6.5.2 Keyboard navigation: all interactive elements focusable `[ref: SDD/Quality Requirements; line: 1141]` `[activity: accessibility-audit]`
        - [ ] T6.5.3 Color contrast: all text meets 4.5:1 ratio `[ref: SDD/Accessibility Implementation; line: 1071]` `[activity: accessibility-audit]`
        - [ ] T6.5.4 Screen reader: ARIA labels on icons, alt text on images `[ref: SDD/Accessibility Implementation; line: 1070]` `[activity: accessibility-audit]`

    - [ ] T6.6 Browser Compatibility
        - [ ] T6.6.1 Test Chrome (latest 2 versions) `[ref: SDD/Quality Requirements; line: 1142]` `[activity: browser-test]`
        - [ ] T6.6.2 Test Safari (latest 2 versions) `[activity: browser-test]`
        - [ ] T6.6.3 Test Firefox (latest 2 versions) `[activity: browser-test]`
        - [ ] T6.6.4 Test Edge (latest 2 versions) `[activity: browser-test]`

    - [ ] T6.7 Security Validation
        - [ ] T6.7.1 Verify CSRF protection on demo form `[ref: SDD/Security Considerations; line: 1043]` `[activity: security-audit]`
        - [ ] T6.7.2 Verify input validation (no XSS via form fields) `[ref: SDD/Security Considerations; line: 1044]` `[activity: security-audit]`
        - [ ] T6.7.3 Verify no PII in PostHog events `[ref: SDD/Security Considerations; line: 1047]` `[activity: security-audit]`

    - [ ] T6.8 SEO Validation
        - [ ] T6.8.1 Verify meta title and description present `[ref: SDD/Quality Requirements; line: 1146]` `[activity: seo-audit]`
        - [ ] T6.8.2 Verify Open Graph tags present `[ref: SDD/Quality Requirements; line: 1146]` `[activity: seo-audit]`
        - [ ] T6.8.3 Verify semantic HTML structure (nav, main, section, footer) `[ref: SDD/Accessibility Implementation; line: 1068]` `[activity: seo-audit]`
        - [ ] T6.8.4 Run Lighthouse SEO audit `[activity: seo-audit]`

    - [ ] T6.9 Deployment Preparation
        - [ ] T6.9.1 Run full test suite: `./test.sh --stan` `[activity: run-tests]`
        - [ ] T6.9.2 Build production CSS: `php userfrosting/conductor build-css --minify` `[activity: run-command]`
        - [ ] T6.9.3 Verify all migrations apply cleanly `[activity: run-command]`
        - [ ] T6.9.4 Dispatch initial stats job: `php userfrosting/bin/task job:dispatch homepage-stats` `[activity: run-command]`
        - [ ] T6.9.5 Verify PostHog project configured (API key set) `[activity: business-acceptance]`
        - [ ] T6.9.6 Document rollback strategy `[ref: SDD/Rollback Strategy; lines: 997-1004]` `[activity: documentation]`

    - [ ] T6.10 Final PRD Compliance Check
        - [ ] T6.10.1 Verify Feature 1: Hero section meets all acceptance criteria `[ref: PRD/Feature 1; lines: 113-124]` `[activity: business-acceptance]`
        - [ ] T6.10.2 Verify Feature 2: 11 feature sections present `[ref: PRD/Feature 2; lines: 125-133]` `[activity: business-acceptance]`
        - [ ] T6.10.3 Verify Feature 3: Team+ section with price, badge, 5 bullets, CTA `[ref: PRD/Feature 3; lines: 135-145]` `[activity: business-acceptance]`
        - [ ] T6.10.4 Verify Feature 4: 6 dynamic stats, logos, testimonials `[ref: PRD/Feature 4; lines: 146-161]` `[activity: business-acceptance]`
        - [ ] T6.10.5 Verify Feature 5: 3 pricing tiers + Team+ addon `[ref: PRD/Feature 5; lines: 163-172]` `[activity: business-acceptance]`
        - [ ] T6.10.6 Verify Feature 6: Demo form with all required fields `[ref: PRD/Feature 6; lines: 173-183]` `[activity: business-acceptance]`
        - [ ] T6.10.7 Verify Feature 7: Team+ landing page with 5 sections, comparison table `[ref: PRD/Feature 7; lines: 187-204]` `[activity: business-acceptance]`
        - [ ] T6.10.8 Verify Feature 8: Video demo present `[ref: PRD/Feature 8; lines: 209-213]` `[activity: business-acceptance]`
        - [ ] T6.10.9 Verify Feature 9: Mobile app showcase with screenshots `[ref: PRD/Feature 9; lines: 216-220]` `[activity: business-acceptance]`
        - [ ] T6.10.10 Verify Feature 10: Navigation with Features, Team+, Pricing, Contact, Login `[ref: PRD/Feature 10; lines: 222-227]` `[activity: business-acceptance]`

    - [ ] T6.11 Implementation Complete
        - [ ] T6.11.1 All PRD Must Have features implemented ✓
        - [ ] T6.11.2 All PRD Should Have features implemented ✓
        - [ ] T6.11.3 All SDD architecture decisions followed ✓
        - [ ] T6.11.4 Ready for production deployment via `./deploy.sh`

---

## Summary

| Phase | Description | Tasks | Dependencies |
|-------|-------------|-------|--------------|
| T1 | Foundation (DB, Job, Service) | 25 | None |
| T2 | Homepage Template + Demo Form UI + SEO | 62 | T1 |
| T3 | Team+ Landing Page | 25 | T2 |
| T4 | Demo Form API & JavaScript | 31 | T2, T3 |
| T5 | PostHog Analytics Integration | 25 | T2, T3, T4 |
| T6 | Integration & E2E Validation | 42 | T1-T5 |
| **Total** | | **~210 tasks** | |

---

## Codex Review (2026-01-14)

**Blockers Resolved:**
1. ✅ Route mismatch: Changed from `/api/homepage/demo-request` to existing `/api/demo/contact`
2. ✅ Sequencing conflict: Moved demo-form UI partial to Phase 2 (T2.12)
3. ✅ GA retention: Added task to keep GA during PostHog transition (T2.13.4)

**Important Fixes Applied:**
4. ✅ Added POSTHOG_HOST env var task (T5.2.4)
5. ✅ Added mid-page CTA section (T2.9A) and #contact anchor (T2.9.4)
6. ✅ Added non-JS form fallback handling (T4.5)
7. ✅ Added frontend smoke tests to Phases 2, 3, 5 (T2.17, T3.7, T5.6)
8. ✅ Added SEO meta/OG implementation tasks (T2.14)
9. ✅ Added image optimization tasks with WebP/srcset (T2.15)
10. ✅ Added risks & mitigations section

**Enhancements Applied:**
- Added "Done When" criteria to each phase
- Added regression test for existing demo flow (T4.7.7)
- Added GA validation alongside PostHog (T5.7.5)

---

## Phase 1 Review Summary

**Completion Date**: 2026-01-14
**Reviewed By**: Codex (via MCP)

### Codex Review Findings

| Issue | Severity | Action | Status |
|-------|----------|--------|--------|
| Partial cache doesn't merge with fallback values | 🔴 Critical | Merged fallback stats as base, DB values overlay | ✅ Fixed |
| saveStats() not atomic, staleness detection unreliable | 🟡 Important | Wrapped in transaction, added rollback | ✅ Fixed |
| formatDollarValue returns "$0M+" for sub-million | 🟡 Important | Added $K+ and raw dollar handling | ✅ Fixed |
| Testing gaps: partial cache, sub-million formatting | 🟡 Important | Added 3 new test methods | ✅ Fixed |
| Stat key "years" vs "years_in_business" | 🟢 Clarification | SDD uses `years_in_business` consistently | ❌ Rejected (no issue) |
| buyQueue as data source question | 🟢 Info | Per SDD line 629-630, buyQueue is correct | ❌ Rejected (no issue) |

### Changes Made Based on Review

1. **HomepageStatsService.php:85-93** - Modified `getStats()` to start with fallback stats and merge DB values over them. This ensures all 6 stats always returned even if some DB rows are missing.

2. **HomepageStatsJob.php:289-360** - Wrapped all stat saves in a transaction with `beginTransaction()`, `commit()`, and `rollBack()` for atomic updates.

3. **HomepageStatsJob.php:388-414** - Added sub-million and small value handling to `formatDollarValue()`:
   - $500K → "$500K+"
   - $500 → "$500+"
   - $0 → "$0+"

4. **HomepageStatsServiceTest.php:181-200** - Added test `test_getStats_always_returns_all_six_stats()` to verify complete coverage.

5. **HomepageStatsJobTest.php:91-121** - Added tests for sub-million and small value formatting.

### Rejected Suggestions (with rationale)

1. **Stat key clarification**: The SDD explicitly uses `years_in_business` (lines 598, 643). The shorthand "years=10+" in the review prompt was informal - no code change needed.

2. **buyQueue data source**: SDD line 629-630 specifies buyQueue as the correct source for dollar value aggregation. buyQueue contains all buys including processed ones.

### Items Deferred to Future Phases

None - all critical and important issues were addressed in this review cycle.

### Validation Results

- ✅ PHPStan passes (no errors)
- ✅ Unit tests pass (28 tests, 96 assertions)
- ✅ All Phase 1 deliverables implemented per SDD

---

*PLAN Status: ✅ PHASE 1 COMPLETE*
*Created: 2026-01-14*
*Phase 1 Review: 2026-01-14 - All critical/important issues resolved*
*Ready for: Phase 2 (Homepage Template Redesign + Demo Form UI)*
