Skip to content
📦 ARCHIVED SNAPSHOT (v1.0) You are viewing historical business logic and documentation for Webpage (planovi.app) v1.0 (frozen on 2026-11-23, commit 69f9463). Switch to Latest →

3. Marketing Landing Page, Shared Layout & UI System

Repository: Webpage (planovi-webpage) • Rule Prefix: BR-MKT • Documented Rules: 11 • Open [TEAM_WHY_NEEDED] Questions: 2

1. Business Purpose & Actors

  • Problem solved: Presents the PLANOVI product value proposition to prospective energy cooperatives, property managers, and real estate developers; provides interactive ROI/savings exploration, pricing visibility, brand identity consistency (Zone 1), global navigation, theme toggling, and cookie notice disclosure.
  • Actors: Prospective B2B buyers, mobile/desktop visitors, brand maintainers syncing assets from planovi-docs.

2. All Features & End-to-End Flows

  • Flow A — Landing Page SSR Assembly (index.php:43-600):
    • Renders <html lang="<?= $current_lang ?>" data-theme="dark">, SEO meta/canonical/hreflang tags, Open Graph & Twitter Cards (og-image.png), Schema.org @graph JSON-LD (Organization, SoftwareApplication with AggregateOffer PLN/3, FAQPage with 3 Q&As), components/head-icons.php, components/navbar.php, <main id="main-content"> containing 11 vertical sections (Hero, Audience, How It Works, Features Bento Grid, Profitability Simulator, Pricing, Waitlist, Partners, Testimonials, FAQ, Blog 3-card preview, Contact), and components/footer.php (which includes cookie-banner.php).
  • Flow B — Dark/Light Theme Toggle & Canvas Particle Engine (js/script.js:3-129):
    • Trigger: Page DOMContentLoaded or click on #theme-toggle.
    • Processing: Reads localStorage.getItem('theme'); toggles document.documentElement[data-theme] between 'dark' and 'light', persists to localStorage, swaps icon ph-moon ↔ ph-sun, and re-initializes #bg-canvas particle animation (density min((w*h)/25000, 80), mouse repulsion radius 150px, particle linking when dx^2 + dy^2 < 18000, green palette adapted per theme). Also re-initializes on window.resize.
  • Flow C — Interactive UI Widgets (js/script.js:131-228):
    • 3D Card Tilt: Mousemove on .bento-item, .audience-card, .timeline-item, .testimonial-card, .dashboard-mockup applies perspective(1000px) rotateX(±5deg) rotateY(±5deg), resetting to 0deg on mouseleave.
    • Features Bento Accordion: Clicking .bento-item (excluding .switch and input descendants) collapses all other bento cards and toggles .expanded to reveal .expandable-ui demo widgets (static interactive checkboxes/bars; no backend state).
    • Profitability Simulator (#optSlider → #optValue): Input event on range slider (min=0, max=100, value=70) computes Math.floor(85 * Math.pow(val / 100, 0.7)) and updates #optValue (initial static HTML is 66%).
    • FAQ Accordion: Single-open toggle on .faq-item click (.active class expands .faq-answer up to max-height: 200px).
    • Mobile Navigation Overlay: #burger-menu-btn adds .active to #custom-menu (role="dialog", aria-modal="true") and sets document.body.style.overflow = 'hidden'. Clicking #close-menu-btn or any .menu-link closes it and restores body scroll.
  • Flow D — Cookie Consent Banner (cookie-banner.php:1-56):
    • Trigger: DOMContentLoaded checks !localStorage.getItem('planovi_cookies_accepted') or footer button invokes window.openCookieBanner().
    • State Change: Clicking #acceptCookiesBtn sets localStorage.planovi_cookies_accepted = 'true', removes .show, sets display: none after 400ms.
  • Flow E — Vector Brand Logo & Sync Pipeline (components/brand-logo.php, scripts/sync-brand.sh):
    • brand-logo.php reads assets/brand/planovi-logo-currentcolor.svg via @file_get_contents and string-replaces <svg with <svg class="brand-logo-svg" aria-hidden="true" focusable="false" .
    • sync-brand.sh shallow-clones PA-IDEAS/planovi-docs via gh repo clone into mktemp -d, overwrites ./BRANDING_GUIDE.md and ${1:-assets/brand}/, and cleans up temp dir on EXIT.

3. Hard Business Rules, Validations, Calculations & Edge Cases

  • BR-MKT-01 (Profitability Simulator Formula): $\text{savings%} = \lfloor 85 \times (\text{slider} / 100)^{0.7} \rfloor$ for $\text{slider} \in [0, 100]$, yielding 0% at 0, 66% at default 70, and 85% at 100 (index.php:332,342, js/script.js:180-184).
  • BR-MKT-02 (Pricing CTA Visibility Gate): Pricing action buttons (pricing_basic, pricing_pro, pricing_ent) render ONLY when site_config('features.show_pricing_buttons') is truthy (index.php:366,385,403). Price figures themselves are currently placeholder "..." in both lang/pl.json:95-101 and lang/en.json:95-101.
  • BR-MKT-03 (Canvas Particle Cap): Particle count is strictly capped at Math.min((canvas.height * canvas.width) / 25000, 80) (js/script.js:53).
  • BR-MKT-04 (Zone 1 Brand & WCAG AAA Button Contrast Rule): Solid primary buttons (.btn-primary), checked switches, .skip-link, and .popular-badge use #32CA42 (--brand-solid) background with dark #09090B (--brand-contrast) foreground text (9.4:1 contrast). Light mode green text uses #22A830 (--brand) (css/style.css:17-57, BRANDING_GUIDE.md:85-88).
  • BR-MKT-05 (Anchor Prefixing on Non-Home Pages): components/navbar.php:5-6 and components/footer.php:5-6 set $anchor_prefix = ($is_home_page === true) ? '' : '/' so section links (#features, #pricing, etc.) navigate back to /#section from subpages.
  • BR-MKT-06 (Cache-Busting Timestamp Overhead): index.php:142,597-598, status.php:114,250, documentation.php:35,86, docs.php:35,86, and login/index.php:19,45-46 append ?v=<?= time() ?> to CSS/JS URLs on every render, disabling browser/CDN caching for those assets.
  • BR-MKT-07 (Mobile Login Link Omission Bug): At max-width: 768px, .nav-login-desktop is hidden (css/style.css:328), and .menu-mobile-login has CSS rules (css/style.css:280,329), but components/navbar.php:51-63 renders NO login link inside #custom-menu. Mobile users cannot access the Login CTA from navigation.
  • BR-MKT-08 (Cookie Banner Compliance Limitation): cookie-banner.php provides only an "Accept/Got it" button (no reject/granularity controls), stores acceptance in localStorage (planovi_cookies_accepted), and does not gate loading of Google Fonts, unpkg.com, or Cloudflare Turnstile.
  • BR-MKT-09 (Homepage Blog Card Limit): Homepage #blog renders at most 3 latest published posts for $current_lang (index.php:510).
  • BR-MKT-10 (Static Placeholder Marketing Content): Hero PV stat (+94.2%, index.php:173), Bento toggle states/resolutions (Uchwała 4/2026, 5/2026, index.php:249-319), Partners strip (Google, AWS, Stripe, Azure, Meta, index.php:425-429), and Testimonials (Jan Kowalski / John Doe, Anna Nowak / Anna Smith, lang/*.json:61-66) are hardcoded placeholders.
  • BR-MKT-11 (Asset Duplication): Root assets/ duplicates 8 files that also exist in assets/brand/ (favicon.svg, favicon-32x32.png, apple-touch-icon.png, logo-black.png, logo-white.png, og-image.png, plus logo-dark.svg/logo-light.svg), and docs/public/brand/ maintains a third copy of all 18 brand-kit files.

4. State Machines & Data Lifecycle

  • Theme State: dark (SSR default <html data-theme="dark">) ↔ light (persisted in localStorage.theme; applied post-parse in DOMContentLoaded, causing a brief dark flash on reload in light mode).
  • Cookie Banner State: unaccepted (absent in localStorage) → shown (display: block, .show) → accepted (localStorage.planovi_cookies_accepted = 'true', hidden) ↔ re-openable via window.openCookieBanner().

5. Technical Contract (Inputs → Processing → Side Effects)

  • Inputs: $current_lang, site_config(), site_url(), get_blog_posts($current_lang, 3), localStorage (theme, planovi_cookies_accepted).
  • Side Effects: Loads external CDN scripts/styles (Google Fonts, unpkg.com/@phosphor-icons/web, challenges.cloudflare.com/turnstile/v0/api.js); mutates localStorage; runs requestAnimationFrame loop on #bg-canvas.

6. Cross-Repository Dependencies

Caller → CalleeProtocol & AuthExact Endpoint / Contract
scripts/sync-brand.sh → PA-IDEAS/planovi-docsGitHub CLI (gh auth)gh repo clone PA-IDEAS/planovi-docs → copies brand-kit/BRANDING_GUIDE.md & brand-kit/assets/
planovi-backend / planovi-microservices → planovi-webpagePublic HTTPS GET (unauthenticated)Email templates reference https://planovi.app/assets/logo-white.png / logo-black.png (and dev-webpage.planovi.app on dev) per BRANDING_GUIDE.md:336-339

7. Why It Works This Way (Decisions, Trade-offs & Workarounds)

  • Public email logo hosting on planovi-webpage: Per BRANDING_GUIDE.md:336-339, docs.planovi.app sits behind an Nginx IP whitelist so Gmail/Outlook image proxies cannot fetch logos from docs; therefore marketing webroot hosts public PNG logos for ecosystem emails.
  • Zero-dependency Vanilla CSS/JS + SVG inline logo: Eliminates build steps for the PHP marketing site; components/brand-logo.php inlines currentColor SVG so light/dark theme switches logo fill immediately via CSS --logo-color.
  • Scroll reveal JS removed: Comment in js/script.js:172 notes "Scroll Reveal (Removed for stability, using pure CSS animation)".
  • [TEAM_WHY_NEEDED: Should ?v=<?= time() ?> cache-busting on CSS/JS be replaced with filemtime() so browsers and Cloudflare can cache static assets?]
  • [TEAM_WHY_NEEDED: When will placeholder Partners (Google/AWS/Stripe/Azure/Meta), Testimonials (Jan Kowalski/Anna Nowak), and Pricing ("...") be replaced with real production copy?]

8. Debugging, Logs & Common Failure Modes

Symptom / Error MessageRoot Cause in CodeHow to VerifyFix
Blank space where logo should appearMissing assets/brand/planovi-logo-currentcolor.svg (suppressed by @file_get_contents in components/brand-logo.php:7)ls -l assets/brand/planovi-logo-currentcolor.svgRun ./scripts/sync-brand.sh assets/brand
themeToggle throws TypeError: Cannot read properties of null on a custom pagejs/script.js:5 calls themeToggle.querySelector('i') without null-checking themeToggle (and canvas.getContext('2d') on line 37)Open browser DevTools ConsoleAlways include components/navbar.php or add null guards in js/script.js
Mobile visitors cannot find Login button.nav-login-desktop hidden <= 768px and omitted from #custom-menu (components/navbar.php:51-63)Inspect viewport <= 768pxAdd <li class="menu-mobile-login"><a href="<?= site_url('panel_login') ?>" ...> inside #custom-menu