// landing.jsx — MyHomeAware landing page, two variants (daylight / signal)
// Shared layout, theme-driven. Hero composition differs between variants.

// ──────────────────────────────────────────────────────────
// Theme tokens
// ──────────────────────────────────────────────────────────
function getTheme(variant, accent) {
  const isDark = variant === 'signal';
  return isDark ? {
    isDark: true,
    bg: '#0a0c11',
    bgAlt: '#10131b',
    surface: '#161a24',
    surfaceHi: '#1d2230',
    text: '#eef0f5',
    textDim: 'rgba(238,240,245,.62)',
    textMute: 'rgba(238,240,245,.42)',
    border: 'rgba(255,255,255,.08)',
    borderStrong: 'rgba(255,255,255,.14)',
    accent: accent || '#a78bff',
    accentInk: '#0a0c11',
    chip: 'rgba(255,255,255,.06)'
  } : {
    isDark: false,
    bg: '#f8f6f1',
    bgAlt: '#efece4',
    surface: '#ffffff',
    surfaceHi: '#ffffff',
    text: '#15151a',
    textDim: 'rgba(21,21,26,.65)',
    textMute: 'rgba(21,21,26,.45)',
    border: 'rgba(21,21,26,.08)',
    borderStrong: 'rgba(21,21,26,.14)',
    accent: accent || '#5b46d4',
    accentInk: '#ffffff',
    chip: 'rgba(21,21,26,.05)'
  };
}

// ──────────────────────────────────────────────────────────
// Laptop frame (minimal)
// ──────────────────────────────────────────────────────────
function Laptop({ children, width = 880, dark = true }) {
  const h = Math.round(width * 0.62);
  return (
    <div style={{ width, display: 'flex', flexDirection: 'column', filter: 'drop-shadow(0 30px 60px rgba(0,0,0,.22))' }}>
      <div style={{ background: dark ? '#1d1f24' : '#dcdbd6', borderRadius: '14px 14px 4px 4px', padding: 8, paddingBottom: 6 }}>
        <div style={{ background: '#000', borderRadius: 6, overflow: 'hidden', height: h, position: 'relative' }}>
          <div style={{ position: 'absolute', top: 6, left: '50%', transform: 'translateX(-50%)', width: 60, height: 6, borderRadius: 999, background: dark ? '#0a0a0d' : '#a8a7a2', zIndex: 2 }} />
          <div style={{ position: 'absolute', inset: 0 }}>{children}</div>
        </div>
      </div>
      <div style={{ height: 12, background: dark ? '#1d1f24' : '#dcdbd6', borderRadius: '0 0 20px 20px', position: 'relative', marginLeft: -16, marginRight: -16, paddingLeft: 16, paddingRight: 16 }}>
        <div style={{ width: 80, height: 4, background: 'rgba(0,0,0,.25)', borderRadius: '0 0 6px 6px', margin: '0 auto' }} />
      </div>
    </div>);

}

// Phone frame (minimal, no notch detail since these are decorative mocks)
function Phone({ children, width = 260 }) {
  const h = Math.round(width * 2.05);
  return (
    <div style={{ width, height: h, borderRadius: 36, background: '#0a0a0d', padding: 7, boxShadow: '0 24px 50px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.04) inset', position: 'relative' }}>
      <div style={{ borderRadius: 30, overflow: 'hidden', height: '100%', position: 'relative', background: '#000' }}>
        <div style={{ position: 'absolute', top: 8, left: '50%', transform: 'translateX(-50%)', width: 80, height: 22, background: '#0a0a0d', borderRadius: 999, zIndex: 5 }} />
        <div style={{ position: 'absolute', inset: 0, paddingTop: 38 }}>{children}</div>
      </div>
    </div>);

}

// ──────────────────────────────────────────────────────────
// Reusable building blocks
// ──────────────────────────────────────────────────────────
function Pill({ t, children, tone = 'accent' }) {
  const bg = tone === 'accent' ? `color-mix(in oklch, ${t.accent} 18%, transparent)` : t.chip;
  const fg = tone === 'accent' ? t.accent : t.textDim;
  return (
    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '5px 11px', borderRadius: 999, background: bg, color: fg, fontSize: 12, fontWeight: 600, letterSpacing: '.02em' }}>
      <span style={{ width: 6, height: 6, borderRadius: 999, background: t.accent }} />
      {children}
    </span>);

}

function Btn({ t, children, primary = false, sm = false, href, onClick }) {
  const Tag = href ? 'a' : 'button';
  const linkProps = href ? { href, target: '_blank', rel: 'noopener noreferrer' } : {};
  return (
    <Tag {...linkProps} onClick={onClick} style={{
      appearance: 'none', border: 'none', cursor: 'pointer', textDecoration: 'none',
      display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
      height: sm ? 38 : 48, padding: sm ? '0 18px' : '0 22px',
      borderRadius: sm ? 10 : 12,
      background: primary ? t.accent : 'transparent',
      color: primary ? t.accentInk : t.text,
      fontWeight: 600, fontSize: sm ? 13 : 14, letterSpacing: '-0.005em',
      boxShadow: primary ? 'none' : `inset 0 0 0 1px ${t.borderStrong}`,
      fontFamily: 'inherit'
    }}>{children}</Tag>);

}

function Nav({ t }) {
  return (
    <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '22px 56px' }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
        <Logo t={t} />
        <span style={{ fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 19, letterSpacing: '-0.02em', color: t.text }}>MyHomeAware</span>
      </div>
      <div style={{ display: 'flex', gap: 32, color: t.textDim, fontSize: 14, fontWeight: 500 }}>
        <a href="#product" style={{ cursor: 'pointer' }}>Product</a>
        <a href="#use-cases" style={{ cursor: 'pointer' }}>Use Cases</a>
        <a href="#partners" style={{ cursor: 'pointer' }}>Partners</a>
      </div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
        <a href="https://myhomeaware.app" target="_blank" rel="noopener noreferrer" style={{ color: t.textDim, fontSize: 14, fontWeight: 500, cursor: 'pointer' }}>Sign in</a>
        <Btn t={t} primary sm href="https://myhomeaware.app">Open app  ↗</Btn>
      </div>
    </div>);

}

function Logo({ t, size = 28 }) {
  // Abstract house-with-radar mark
  return (
    <svg width={size} height={size} viewBox="0 0 32 32" fill="none">
      <path d="M6 14 L16 6 L26 14 V26 H6 Z" stroke={t.accent} strokeWidth="2" strokeLinejoin="round" />
      <circle cx="16" cy="18" r="2.4" fill={t.accent} />
      <circle cx="16" cy="18" r="5.5" stroke={t.accent} strokeOpacity=".5" strokeWidth="1" />
      <circle cx="16" cy="18" r="8.5" stroke={t.accent} strokeOpacity=".25" strokeWidth="1" />
    </svg>);

}

// ──────────────────────────────────────────────────────────
// HERO — Daylight variant
// ──────────────────────────────────────────────────────────
function HeroDaylight({ t, headline, sub }) {
  return (
    <section style={{ padding: '40px 56px 80px', position: 'relative' }}>
      <div style={{ display: 'grid', gridTemplateColumns: '1.05fr 1fr', gap: 48, alignItems: 'center' }}>
        <div>
          <Pill t={t}>NEW · COMMUNITY INSIGHTS</Pill>
          <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 76, lineHeight: 0.98, letterSpacing: '-0.035em', margin: '20px 0 22px', fontWeight: 600, color: t.text, textWrap: 'balance' }}>
            {headline}
          </h1>
          <p style={{ fontSize: 19, lineHeight: 1.45, color: t.textDim, maxWidth: 520, margin: 0, textWrap: 'pretty' }}>
            {sub}
          </p>
          <div style={{ display: 'flex', gap: 12, marginTop: 32 }}>
            <Btn t={t} primary href="https://myhomeaware.app">Open the app ↗</Btn>
          </div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginTop: 36, color: t.textMute, fontSize: 13 }}>
            <span style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 30, height: 30, borderRadius: '50%', background: `color-mix(in oklch, ${t.accent} 18%, transparent)`, color: t.accent }}>
              {Ico.leaf(t.accent)}
            </span>
            <span>Trusted by <b style={{ color: t.text, fontWeight: 600 }}>families, agents, and service providers</b> across the country.</span>
          </div>
        </div>

        <div style={{ position: 'relative', height: 560, display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
          <div style={{ position: 'relative', zIndex: 1 }}>
            <Laptop width={620} dark={false}>
              <div style={{ width: '100%', height: '100%', background: '#0a0c11', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <img src="assets/app-map.png" style={{ width: '100%', height: 'auto', maxHeight: '100%', display: 'block' }} alt="MyHomeAware map view" />
              </div>
            </Laptop>
          </div>
          <div style={{ position: 'absolute', right: 380, bottom: 30, zIndex: 2 }}>
            <Phone width={190}>
              <PhoneReport dark={false} bare />
            </Phone>
          </div>
        </div>
      </div>
    </section>);

}

// ──────────────────────────────────────────────────────────
// HERO — Signal variant (full-bleed dark, map ambient bg)
// ──────────────────────────────────────────────────────────
function HeroSignal({ t, headline, sub }) {
  return (
    <section style={{ padding: '40px 56px 0', position: 'relative' }}>
      {/* ambient map background */}
      <div style={{ position: 'absolute', inset: 0, overflow: 'hidden', zIndex: 0 }}>
        <div style={{ position: 'absolute', top: -120, right: -180, width: 1100, height: 1100, opacity: 0.55,
          background: `radial-gradient(circle at center, ${t.accent}33, transparent 60%)` }} />
        <div style={{ position: 'absolute', top: 0, right: 0, width: 900, height: 900, opacity: 0.18, maskImage: 'radial-gradient(circle at center, black 30%, transparent 70%)' }}>
          <img src="assets/app-map.png" style={{ width: '100%', height: '100%', objectFit: 'cover', filter: 'blur(2px) saturate(0.7)' }} />
        </div>
      </div>

      <div style={{ position: 'relative', zIndex: 1, paddingTop: 80, paddingBottom: 60, maxWidth: 920 }}>
        <Pill t={t}>TRUSTED DATA SOURCES THAT YOU CAN VERIFY</Pill>
        <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 104, lineHeight: 0.95, letterSpacing: '-0.04em', margin: '24px 0 22px', fontWeight: 600, color: t.text, textWrap: 'balance' }}>
          {headline}
        </h1>
        <p style={{ fontSize: 20, lineHeight: 1.5, color: t.textDim, maxWidth: 620, margin: 0, textWrap: 'pretty' }}>
          {sub}
        </p>
        <div style={{ display: 'flex', gap: 12, marginTop: 36 }}>
          <Btn t={t} primary href="https://myhomeaware.app">Open the app ↗</Btn>
        </div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginTop: 28, color: t.textMute, fontSize: 13 }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 30, height: 30, borderRadius: '50%', background: `color-mix(in oklch, ${t.accent} 18%, transparent)`, color: t.accent }}>
            {Ico.leaf(t.accent)}
          </span>
          <span>Trusted by <b style={{ color: t.text, fontWeight: 600 }}>families, agents, and service providers</b> across the country.</span>
        </div>
      </div>

      {/* big laptop showcase under hero */}
      <div style={{ position: 'relative', zIndex: 1, paddingTop: 24, paddingBottom: 24 }}>
        <div style={{ display: 'flex', justifyContent: 'center' }}>
          <Laptop width={1080} dark>
            <div style={{ width: '100%', height: '100%', background: '#0a0c11', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
              <img src="assets/app-map.png" style={{ width: '100%', height: 'auto', maxHeight: '100%', display: 'block' }} />
            </div>
          </Laptop>
        </div>
      </div>
    </section>);

}

// ──────────────────────────────────────────────────────────
// Feature showcase — 3 cards w/ device frames
// ──────────────────────────────────────────────────────────
function Features({ t }) {
  return (
    <section id="product" style={{ padding: '120px 56px 80px', position: 'relative' }}>
      <SectionHead t={t} kicker="THE PRODUCT" title={<>Everything around your home,<br /><em style={{ fontStyle: 'normal', color: t.accent }}>in one searchable view.</em></>} />

      <div style={{ display: 'grid', gridTemplateColumns: '1.4fr 1fr', gap: 24, marginTop: 56 }}>
        {/* Big: Map */}
        <FeatureCard t={t} title="Search & map" tag="01" body="Type any address and instantly see EMF sources, contaminated sites, water quality, air emissions, noise, and more — within a radius you control.">
          <div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '24px 32px 32px' }}>
            <Laptop width={560} dark={t.isDark}>
              <div style={{ width: '100%', height: '100%', background: '#0a0c11', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <img src="assets/app-map.png" style={{ width: '100%', height: 'auto', maxHeight: '100%', display: 'block' }} />
              </div>
            </Laptop>
          </div>
        </FeatureCard>

        {/* Small: Favorites — actual saved-addresses screen on phone */}
        <FeatureCard t={t} title="Favorites" tag="02" body="Save every property you search for. One click to compare what's around.">
          <div style={{ position: 'absolute', left: '50%', top: 12, transform: 'translateX(-50%)' }}>
            <Phone width={240}>
              <div style={{ width: '100%', height: '100%', overflow: 'hidden' }}>
                <img src="assets/favorites.png" alt="Saved addresses" style={{ width: '100%', display: 'block' }} />
              </div>
            </Phone>
          </div>
        </FeatureCard>
      </div>

      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 24, marginTop: 24 }}>
        {/* Small: Export reports */}
        <FeatureCard t={t} title="Export reports" tag="03" body="Generate a full PDF report for any address. Every site, every source, every distance - ready to download or print.">
          <div style={{ position: 'absolute', left: '50%', top: 20, transform: 'translateX(-50%)' }}>
            <Phone width={240}><PhoneReport dark={t.isDark} /></Phone>
          </div>
        </FeatureCard>

        {/* Big: Export — actual report PDF in a laptop */}
        <FeatureCard t={t} title="Share as PDF" tag="04" body="One click and the PDF lands in anyone’s inbox — a buyer, a partner, your own records. No accounts, no friction.">
          <div style={{ position: 'absolute', right: -40, bottom: -30, top: 16, left: 200 }}>
            <Laptop width={620} dark={t.isDark}>
              <div style={{ width: '100%', height: '100%', background: '#fff', overflow: 'hidden' }}>
                <img src="assets/MyHomeAware-05-13-2026_05_16_PM.png" style={{ width: '100%', height: '100%', display: 'block', objectFit: 'cover', objectPosition: 'top' }} alt="MyHomeAware report" />
              </div>
            </Laptop>
          </div>
          <div style={{ position: 'absolute', left: 24, bottom: 24, zIndex: 3 }}>
            <ExportMock t={t} />
          </div>
        </FeatureCard>
      </div>
    </section>);

}

function SectionHead({ t, kicker, title, sub }) {
  return (
    <div style={{ maxWidth: 800 }}>
      <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '.16em', color: t.accent, marginBottom: 18 }}>{kicker}</div>
      <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 56, lineHeight: 1.02, letterSpacing: '-0.03em', margin: 0, fontWeight: 600, color: t.text, textWrap: 'balance' }}>{title}</h2>
      {sub && <p style={{ fontSize: 18, lineHeight: 1.5, color: t.textDim, maxWidth: 600, marginTop: 18, textWrap: 'pretty' }}>{sub}</p>}
    </div>);

}

function FeatureCard({ t, title, tag, body, children, h = 520, textW = '80%' }) {
  return (
    <div style={{ position: 'relative', height: h, borderRadius: 24, background: t.surface, border: `1px solid ${t.border}`, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
      <div style={{ position: 'relative', padding: '32px 32px 20px', zIndex: 3, flex: '0 0 auto', maxWidth: textW }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, color: t.textMute, fontSize: 12, fontWeight: 600, letterSpacing: '.08em' }}>
          <span>{tag}</span><span style={{ width: 20, height: 1, background: t.borderStrong }} />
        </div>
        <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 30, fontWeight: 600, letterSpacing: '-0.02em', margin: '14px 0 10px', color: t.text }}>{title}</h3>
        <p style={{ fontSize: 14.5, lineHeight: 1.5, color: t.textDim, margin: 0, textWrap: 'pretty' }}>{body}</p>
      </div>
      <div style={{ position: 'relative', flex: 1, minHeight: 0, overflow: 'hidden' }}>
        {children}
      </div>
    </div>);

}

function ExportMock({ t }) {
  const accent = t.accent;
  return (
    <div style={{ position: 'absolute', right: 24, bottom: 24, width: 290, background: t.bg, borderRadius: 14, padding: 18, boxShadow: '0 30px 60px rgba(0,0,0,.25)', border: `1px solid ${t.border}` }}>
      <div style={{ fontSize: 11, fontWeight: 700, color: t.textMute, letterSpacing: '.1em' }}>EMAIL REPORT</div>
      <div style={{ fontFamily: 'var(--font-display)', fontSize: 20, fontWeight: 600, letterSpacing: '-0.02em', marginTop: 4, color: t.text }}>142 Elm Street</div>
      <div style={{ marginTop: 12, fontSize: 11, color: t.textMute, fontWeight: 600, letterSpacing: '.06em', textTransform: 'uppercase' }}>To</div>
      <div style={{ marginTop: 6, display: 'flex', alignItems: 'center', gap: 8, padding: '10px 12px', borderRadius: 10, background: t.chip, border: `1px solid ${t.border}` }}>
        <div style={{ width: 22, height: 22, borderRadius: '50%', background: accent, color: t.accentInk, fontSize: 10, fontWeight: 700, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>R</div>
        <span style={{ fontSize: 13, color: t.text, fontWeight: 500 }}>renee.p@gmail.com</span>
      </div>
      <div style={{ marginTop: 10, display: 'flex', alignItems: 'center', gap: 10, padding: '10px 12px', borderRadius: 10, background: `color-mix(in oklch, ${accent} 12%, transparent)`, border: `1px solid ${accent}` }}>
        <div style={{ width: 28, height: 28, borderRadius: 6, background: accent, color: t.accentInk, display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--font-display)', fontWeight: 700, fontSize: 10, letterSpacing: '.04em' }}>PDF</div>
        <div style={{ flex: 1, minWidth: 0 }}>
          <div style={{ fontSize: 12.5, fontWeight: 600, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>142-Elm-St-Report.pdf</div>
          <div style={{ fontSize: 10.5, color: t.textMute, marginTop: 1 }}>18 pages · attached</div>
        </div>
      </div>
      <button style={{ width: '100%', height: 40, marginTop: 14, borderRadius: 10, border: 'none', background: accent, color: t.accentInk, fontWeight: 600, fontSize: 13, cursor: 'pointer', fontFamily: 'inherit' }}>Send PDF</button>
    </div>);

}

// ──────────────────────────────────────────────────────────
// How it works
// ──────────────────────────────────────────────────────────
function HowItWorks({ t }) {
  const steps = [
  { n: '01', title: 'Search an address', body: 'Search any property nationwide. We pull from 10+ trusted sources to see what is around it.' },
  { n: '02', title: 'See what surrounds', body: 'Browse hazards, infrastructure, and environmental signals on the map — filter by category, set a radius.' },
  { n: '03', title: 'Share the report', body: 'Email, export, or save to favorites. Every report is easy to see, easy to read, and easy to understand.' }];

  return (
    <section style={{ padding: '80px 56px', background: t.bgAlt }}>
      <SectionHead t={t} kicker="HOW IT WORKS" title="From address to insight in under a minute." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24, marginTop: 48 }}>
        {steps.map((s) =>
        <div key={s.n} style={{ padding: '28px 28px 32px', borderRadius: 18, background: t.surface, border: `1px solid ${t.border}` }}>
            <div style={{ fontFamily: 'var(--font-display)', fontSize: 36, fontWeight: 600, color: t.accent, letterSpacing: '-0.03em' }}>{s.n}</div>
            <div style={{ fontFamily: 'var(--font-display)', fontSize: 22, fontWeight: 600, color: t.text, marginTop: 18, letterSpacing: '-0.02em' }}>{s.title}</div>
            <p style={{ fontSize: 14.5, lineHeight: 1.55, color: t.textDim, marginTop: 10, marginBottom: 0, textWrap: 'pretty' }}>{s.body}</p>
          </div>
        )}
      </div>
    </section>);

}

// ──────────────────────────────────────────────────────────
// For who — homeowner vs agent
// ──────────────────────────────────────────────────────────
function ForWho({ t }) {
  return (
    <section id="use-cases" style={{ padding: '120px 56px 80px' }}>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
        <AudienceCard t={t} kicker="FOR FAMILIES" title="The home is your most important investment."
        body="Before you fall in love with a house, see what's around it. Power lines you didn't notice. A waste site two streets over. A noise corridor. Make the decision with eyes open."
        bullets={['Search any address — even one you don\'t own', 'Save favorites and compare neighborhoods', 'Visual reports, easy to understand']}
        ctaText="Open the app ↗" ctaHref="https://myhomeaware.app" />
        <AudienceCard t={t} kicker="FOR AGENTS & BROKERS" title="Win listings with the data nobody else brings."
        body="Walk into the appointment with a branded environmental report on the property. Show buyers you've done the work other agents won't."
        bullets={['Your contact information located on the report', 'Easy to identify property address', 'Two click report sent to any inbox']}
        ctaText="Send reports to your clients →" emphasised />
      </div>
    </section>);

}

function AudienceCard({ t, kicker, title, body, bullets, ctaText, ctaHref, emphasised = false }) {
  const bg = emphasised ? t.text : t.surface;
  const fg = emphasised ? t.bg : t.text;
  const dim = emphasised ? t.isDark ? 'rgba(10,12,17,.65)' : 'rgba(248,246,241,.7)' : t.textDim;
  const border = emphasised ? 'transparent' : t.border;
  const accent = emphasised && !t.isDark ? '#a78bff' : t.accent;
  return (
    <div style={{ padding: '40px 40px 36px', borderRadius: 22, background: bg, color: fg, border: `1px solid ${border}` }}>
      <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '.16em', color: accent }}>{kicker}</div>
      <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 34, fontWeight: 600, letterSpacing: '-0.025em', margin: '18px 0 14px', color: fg, textWrap: 'balance' }}>{title}</h3>
      <p style={{ fontSize: 15.5, lineHeight: 1.5, color: dim, margin: 0, textWrap: 'pretty' }}>{body}</p>
      <ul style={{ listStyle: 'none', padding: 0, margin: '22px 0 28px', display: 'flex', flexDirection: 'column', gap: 10 }}>
        {bullets.map((b) =>
        <li key={b} style={{ display: 'flex', gap: 10, fontSize: 14.5, color: fg }}>
            <span style={{ flex: '0 0 auto', width: 18, height: 18, borderRadius: 6, background: `color-mix(in oklch, ${accent} 22%, transparent)`, color: accent, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', marginTop: 1 }}>{Ico.check(accent)}</span>
            {b}
          </li>
        )}
      </ul>
      {ctaHref ?
      <a href={ctaHref} target="_blank" rel="noopener noreferrer" style={{ color: accent, fontWeight: 600, fontSize: 14, textDecoration: 'none', cursor: 'pointer' }}>{ctaText}</a> :
      <button style={{ appearance: 'none', border: 'none', background: 'transparent', color: accent, fontWeight: 600, fontSize: 14, cursor: 'pointer', padding: 0, fontFamily: 'inherit' }}>{ctaText}</button>}
    </div>);

}

// ──────────────────────────────────────────────────────────
// ──────────────────────────────────────────────────────────
// Partner inquiry modal
// ──────────────────────────────────────────────────────────
function PartnerModal({ t, onClose }) {
  const [form, setForm] = React.useState({ name: '', company: '', role: '', email: '', phone: '', message: '' });
  const [status, setStatus] = React.useState('idle'); // idle | sending | success | error
  const [errorMsg, setErrorMsg] = React.useState('');

  const set = (k) => (e) => setForm((f) => ({ ...f, [k]: e.target.value }));

  // Close on backdrop click
  const onBackdrop = (e) => { if (e.target === e.currentTarget) onClose(); };

  // Close on Escape
  React.useEffect(() => {
    const handler = (e) => { if (e.key === 'Escape') onClose(); };
    window.addEventListener('keydown', handler);
    return () => window.removeEventListener('keydown', handler);
  }, [onClose]);

  const submit = async (e) => {
    e.preventDefault();
    if (status === 'sending') return;
    setStatus('sending');
    setErrorMsg('');
    try {
      const res = await fetch('/api/partner-contact', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(form),
      });
      const data = await res.json();
      if (!res.ok) throw new Error(data.error || 'Something went wrong.');
      setStatus('success');
    } catch (err) {
      setErrorMsg(err.message || 'Something went wrong. Please try again.');
      setStatus('error');
    }
  };

  const inputStyle = {
    width: '100%', boxSizing: 'border-box',
    background: t.surface, border: `1px solid ${t.borderStrong}`,
    borderRadius: 8, padding: '10px 13px',
    color: t.text, fontSize: 14, fontFamily: 'inherit',
    outline: 'none',
  };
  const labelStyle = { display: 'block', fontSize: 12, fontWeight: 600, color: t.textDim, marginBottom: 5, letterSpacing: '.03em' };
  const fieldStyle = { marginBottom: 16 };

  return (
    <div onClick={onBackdrop} style={{
      position: 'fixed', inset: 0, zIndex: 1000,
      background: 'rgba(0,0,0,.65)', backdropFilter: 'blur(4px)',
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      padding: '16px',
    }}>
      <div style={{
        background: t.bg, borderRadius: 18, width: '100%', maxWidth: 520,
        maxHeight: '90vh', overflowY: 'auto',
        boxShadow: '0 24px 80px rgba(0,0,0,.45)',
        position: 'relative',
      }}>
        {/* Header */}
        <div style={{ padding: '28px 28px 0', display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
          <div>
            <p style={{ margin: '0 0 4px', fontSize: 11, fontWeight: 700, letterSpacing: '.1em', textTransform: 'uppercase', color: t.accent }}>Partner Inquiry</p>
            <h2 style={{ margin: 0, fontSize: 22, fontWeight: 700, color: t.text, letterSpacing: '-0.02em' }}>Become a MyHomeAware Partner</h2>
            <p style={{ margin: '8px 0 0', fontSize: 14, color: t.textDim, lineHeight: 1.5 }}>Tell us about yourself and how you’d like to work together. We’ll follow up within 1–2 business days.</p>
          </div>
          <button onClick={onClose} aria-label="Close" style={{
            background: 'none', border: 'none', cursor: 'pointer', padding: 4, marginLeft: 12, marginTop: -2,
            color: t.textMute, fontSize: 22, lineHeight: 1, fontFamily: 'inherit',
          }}>×</button>
        </div>

        {status === 'success' ? (
          <div style={{ padding: '40px 28px 36px', textAlign: 'center' }}>
            <div style={{ fontSize: 40, marginBottom: 16 }}>✅</div>
            <h3 style={{ margin: '0 0 8px', fontSize: 18, fontWeight: 700, color: t.text }}>We’ve received your inquiry!</h3>
            <p style={{ margin: '0 0 24px', fontSize: 14, color: t.textDim, lineHeight: 1.6 }}>Thanks for reaching out. Someone from the MyHomeAware team will be in touch within 1–2 business days.</p>
            <button onClick={onClose} style={{
              background: t.accent, color: t.accentInk, border: 'none', borderRadius: 10,
              padding: '10px 24px', fontWeight: 600, fontSize: 14, cursor: 'pointer', fontFamily: 'inherit',
            }}>Done</button>
          </div>
        ) : (
          <form onSubmit={submit} style={{ padding: '24px 28px 28px' }}>
            {/* Row: Name + Company */}
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, marginBottom: 16 }}>
              <div>
                <label style={labelStyle}>Full Name *</label>
                <input required style={inputStyle} placeholder="Jane Smith" value={form.name} onChange={set('name')} />
              </div>
              <div>
                <label style={labelStyle}>Company *</label>
                <input required style={inputStyle} placeholder="Acme Realty" value={form.company} onChange={set('company')} />
              </div>
            </div>

            {/* Role */}
            <div style={fieldStyle}>
              <label style={labelStyle}>Your Role *</label>
              <select required style={{ ...inputStyle, appearance: 'none' }} value={form.role} onChange={set('role')}>
                <option value="">Select a role…</option>
                <option>Real Estate Agent</option>
                <option>Home Inspector</option>
                <option>Mortgage Lender</option>
                <option>Environmental Consultant</option>
                <option>Contractor / Builder</option>
                <option>Attorney</option>
                <option>Insurance Agent</option>
                <option>Other</option>
              </select>
            </div>

            {/* Row: Email + Phone */}
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, marginBottom: 16 }}>
              <div>
                <label style={labelStyle}>Email *</label>
                <input required type="email" style={inputStyle} placeholder="jane@acmerealty.com" value={form.email} onChange={set('email')} />
              </div>
              <div>
                <label style={labelStyle}>Phone (optional)</label>
                <input type="tel" style={inputStyle} placeholder="(555) 000-0000" value={form.phone} onChange={set('phone')} />
              </div>
            </div>

            {/* Message */}
            <div style={fieldStyle}>
              <label style={labelStyle}>How would you like to partner?</label>
              <textarea style={{ ...inputStyle, resize: 'vertical', minHeight: 90, lineHeight: 1.5 }} placeholder="Tell us a bit about your business and what you have in mind…" value={form.message} onChange={set('message')} />
            </div>

            {status === 'error' && (
              <p style={{ margin: '0 0 12px', fontSize: 13, color: '#f87171' }}>{errorMsg}</p>
            )}

            <button type="submit" disabled={status === 'sending'} style={{
              width: '100%', background: t.accent, color: t.accentInk,
              border: 'none', borderRadius: 10, padding: '12px 0',
              fontWeight: 700, fontSize: 15, cursor: status === 'sending' ? 'not-allowed' : 'pointer',
              opacity: status === 'sending' ? 0.7 : 1, fontFamily: 'inherit',
            }}>
              {status === 'sending' ? 'Sending…' : 'Send Inquiry'}
            </button>
          </form>
        )}
      </div>
    </div>
  );
}

// Partners
// ──────────────────────────────────────────────────────────
function Partners({ t }) {
  const [showModal, setShowModal] = React.useState(false);
  const partners = [
  { name: 'Brain Restoration Clinic', tag: 'Neuro-wellness', url: 'https://brainrestorationclinic.com' },
  { name: 'Carolina Holistic Medicine', tag: 'Integrative care', url: 'https://carolinaholisticmedicine.com' },
  { name: 'Kingdom Builders', tag: 'Custom homes', url: 'https://kingdombuilderslmsw.com' },
  { name: 'Ecos Paints', tag: 'Non-toxic finishes', url: 'https://ecospaints.net' }];

  return (
    <section id="partners" style={{ padding: '80px 56px', background: t.bgAlt }}>
      {showModal && <PartnerModal t={t} onClose={() => setShowModal(false)} />}
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 64, alignItems: 'end' }}>
        <SectionHead t={t} kicker="OUR PARTNERS" title="The people we connect families to."
        sub="When MyHomeAware surfaces something around your home, we don't leave you stuck. These are the trusted partners we connect you with — vetted experts in health, building, and environmental care." />
        <div style={{ display: 'flex', alignItems: 'center', gap: 14, justifyContent: 'flex-end' }}>
          <Btn t={t} sm onClick={() => setShowModal(true)}>Become a partner</Btn>
        </div>
      </div>

      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 16, marginTop: 48 }}>
        {partners.map((p) => <PartnerTile key={p.name} t={t} {...p} />)}
      </div>
    </section>);

}

function PartnerTile({ t, name, tag, url }) {
  // Monochrome wordmark style — uses display font, slightly stylized
  const inner = (
    <div style={{ height: 180, borderRadius: 18, background: t.surface, border: `1px solid ${t.border}`, padding: 24, display: 'flex', flexDirection: 'column', justifyContent: 'space-between', position: 'relative', overflow: 'hidden' }}>
      <div style={{ fontSize: 11, fontWeight: 600, letterSpacing: '.12em', color: t.textMute, textTransform: 'uppercase' }}>{tag}</div>
      <div>
        <div style={{ fontFamily: 'var(--font-display)', fontSize: 22, lineHeight: 1.05, fontWeight: 600, letterSpacing: '-0.025em', color: t.text, textWrap: 'balance' }}>{name}</div>
        <div style={{ marginTop: 14, display: 'flex', alignItems: 'center', gap: 6, fontSize: 12, fontWeight: 600, color: t.accent }}>
          Visit partner {Ico.chev(t.accent)}
        </div>
      </div>
      <div style={{ position: 'absolute', top: -30, right: -30, width: 120, height: 120, borderRadius: '50%', background: `radial-gradient(circle, ${t.accent}20, transparent 70%)` }} />
    </div>);
  if (url) {
    return <a href={url} target="_blank" rel="noopener noreferrer" style={{ textDecoration: 'none', display: 'block' }}>{inner}</a>;
  }
  return inner;

}

// ──────────────────────────────────────────────────────────
// Testimonials
// ──────────────────────────────────────────────────────────
function Testimonials({ t }) {
  const quotes = [
  { q: "MyHomeAware made home searching less stressful. I have four kids and little time to do research. This app makes home searching easier and more enjoyable.", who: 'Aimee H.', role: 'Buyer · Greenville, SC' },
  { q: "It's the only tool that makes me look smarter than the buyer's agent. I bring the report to every showing now.", who: 'Marcus T.', role: 'Realtor · Charlotte, NC' },
  { q: "We use it when shortlisting homes for clients with sensitivities. It's become essential to how we work.", who: 'Dr. Lin Hayes', role: 'Carolina Holistic Medicine' }];

  return (
    <section style={{ padding: '120px 56px 80px' }}>
      <SectionHead t={t} kicker="HEARD FROM FAMILIES & AGENTS" title="Decisions made with more information." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20, marginTop: 48 }}>
        {quotes.map((q, i) =>
        <div key={i} style={{ padding: '32px 28px', borderRadius: 18, background: t.surface, border: `1px solid ${t.border}`, display: 'flex', flexDirection: 'column' }}>
            <div style={{ display: 'flex', gap: 2, marginBottom: 18 }}>
              {Array.from({ length: 5 }).map((_, j) => <span key={j} style={{ color: t.accent }}>{Ico.star(t.accent)}</span>)}
            </div>
            <p style={{ fontFamily: 'var(--font-display)', fontSize: 20, lineHeight: 1.3, fontWeight: 500, letterSpacing: '-0.015em', color: t.text, margin: 0, flex: 1, textWrap: 'pretty' }}>"{q.q}"</p>
            <div style={{ marginTop: 24, paddingTop: 18, borderTop: `1px solid ${t.border}` }}>
              <div style={{ fontSize: 14, fontWeight: 600, color: t.text }}>{q.who}</div>
              <div style={{ fontSize: 12.5, color: t.textMute, marginTop: 2 }}>{q.role}</div>
            </div>
          </div>
        )}
      </div>
    </section>);

}

// ──────────────────────────────────────────────────────────
// Final CTA
// ──────────────────────────────────────────────────────────
function FinalCTA({ t, cta }) {
  return (
    <section style={{ padding: '40px 56px 80px' }}>
      <div style={{ position: 'relative', borderRadius: 28, padding: '80px 64px', overflow: 'hidden', background: t.text, color: t.bg }}>
        <div style={{ position: 'absolute', inset: 0, background: `radial-gradient(80% 100% at 100% 50%, ${t.accent}55, transparent 60%)` }} />
        <div style={{ position: 'relative', zIndex: 1, maxWidth: 720 }}>
          <Pill t={{ ...t, accent: t.accent, chip: 'rgba(255,255,255,.1)', textDim: 'rgba(255,255,255,.7)' }}>CREATE A FREE ACCOUNT FOR FULL USE</Pill>
          <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 76, lineHeight: 0.98, letterSpacing: '-0.04em', margin: '20px 0 18px', fontWeight: 600, textWrap: 'balance' }}>
            {cta}
          </h2>
          <p style={{ fontSize: 18, lineHeight: 1.5, opacity: .75, maxWidth: 520, margin: '0 0 36px', textWrap: 'pretty' }}>No credit card. Free Report. Search nationwide.</p>
          <div style={{ display: 'flex', gap: 12 }}>
            <a href="https://myhomeaware.app" target="_blank" rel="noopener noreferrer" style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', textDecoration: 'none', appearance: 'none', border: 'none', height: 56, padding: '0 28px', borderRadius: 14, background: t.accent, color: t.accentInk, fontWeight: 600, fontSize: 16, cursor: 'pointer', fontFamily: 'inherit' }}>Open the app ↗</a>
          </div>
        </div>
        {/* Decorative phone with real app screenshot */}
        <div style={{ position: 'absolute', right: -10, bottom: -40, transform: 'rotate(8deg)', opacity: .95 }}>
          <Phone width={240}>
            <img src="assets/app-mobile.png" alt="MyHomeAware mobile app" style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
          </Phone>
        </div>
      </div>
    </section>);

}

// ──────────────────────────────────────────────────────────
// Contact modal (footer)
// ──────────────────────────────────────────────────────────
const SUPPORT_SUBJECTS = ['General Question', 'Bug Report', 'Feature Request', 'Billing', 'Other'];

function ContactModal({ t, onClose }) {
  const [form, setForm] = React.useState({ name: '', email: '', subject: 'General Question', message: '' });
  const [status, setStatus] = React.useState('idle');
  const [errorMsg, setErrorMsg] = React.useState('');

  const set = (k) => (e) => setForm((f) => ({ ...f, [k]: e.target.value }));
  const onBackdrop = (e) => { if (e.target === e.currentTarget) onClose(); };

  React.useEffect(() => {
    const h = (e) => { if (e.key === 'Escape') onClose(); };
    window.addEventListener('keydown', h);
    return () => window.removeEventListener('keydown', h);
  }, [onClose]);

  const submit = async (e) => {
    e.preventDefault();
    if (status === 'sending') return;
    setStatus('sending');
    setErrorMsg('');
    try {
      const res = await fetch('/api/send-support', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(form),
      });
      const data = await res.json();
      if (!res.ok) throw new Error(data.error || 'Something went wrong.');
      setStatus('success');
    } catch (err) {
      setErrorMsg(err.message || 'Something went wrong. Please try again.');
      setStatus('error');
    }
  };

  const inp = {
    width: '100%', boxSizing: 'border-box',
    background: t.surface, border: `1px solid ${t.borderStrong}`,
    borderRadius: 8, padding: '10px 13px',
    color: t.text, fontSize: 14, fontFamily: 'inherit', outline: 'none',
  };
  const lbl = { display: 'block', fontSize: 12, fontWeight: 600, color: t.textDim, marginBottom: 5, letterSpacing: '.03em' };

  return (
    <div onClick={onBackdrop} style={{
      position: 'fixed', inset: 0, zIndex: 1000,
      background: 'rgba(0,0,0,.65)', backdropFilter: 'blur(4px)',
      display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,
    }}>
      <div style={{
        background: t.bg, borderRadius: 18, width: '100%', maxWidth: 480,
        maxHeight: '90vh', overflowY: 'auto',
        boxShadow: '0 24px 80px rgba(0,0,0,.45)', position: 'relative',
      }}>
        <div style={{ padding: '28px 28px 0', display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
          <div>
            <p style={{ margin: '0 0 4px', fontSize: 11, fontWeight: 700, letterSpacing: '.1em', textTransform: 'uppercase', color: t.accent }}>Get in touch</p>
            <h2 style={{ margin: 0, fontSize: 22, fontWeight: 700, color: t.text, letterSpacing: '-0.02em' }}>Contact MyHomeAware</h2>
            <p style={{ margin: '8px 0 0', fontSize: 14, color: t.textDim, lineHeight: 1.5 }}>Have a question or found a bug? We'd love to hear from you.</p>
          </div>
          <button onClick={onClose} aria-label="Close" style={{
            background: 'none', border: 'none', cursor: 'pointer', padding: 4,
            marginLeft: 12, marginTop: -2, color: t.textMute, fontSize: 22, lineHeight: 1, fontFamily: 'inherit',
          }}>×</button>
        </div>

        {status === 'success' ? (
          <div style={{ padding: '40px 28px 36px', textAlign: 'center' }}>
            <div style={{ fontSize: 40, marginBottom: 16 }}>✅</div>
            <h3 style={{ margin: '0 0 8px', fontSize: 18, fontWeight: 700, color: t.text }}>Message sent!</h3>
            <p style={{ margin: '0 0 24px', fontSize: 14, color: t.textDim, lineHeight: 1.6 }}>We'll reply to <strong>{form.email}</strong> as soon as possible.</p>
            <button onClick={onClose} style={{
              background: t.accent, color: t.accentInk, border: 'none', borderRadius: 10,
              padding: '10px 24px', fontWeight: 600, fontSize: 14, cursor: 'pointer', fontFamily: 'inherit',
            }}>Done</button>
          </div>
        ) : (
          <form onSubmit={submit} style={{ padding: '24px 28px 28px' }}>
            <div style={{ marginBottom: 16 }}>
              <label style={lbl}>Your name (optional)</label>
              <input style={inp} placeholder="Jane Smith" value={form.name} onChange={set('name')} />
            </div>
            <div style={{ marginBottom: 16 }}>
              <label style={lbl}>Email address *</label>
              <input required type="email" style={inp} placeholder="jane@example.com" value={form.email} onChange={set('email')} />
            </div>
            <div style={{ marginBottom: 16 }}>
              <label style={lbl}>Subject</label>
              <select style={{ ...inp, appearance: 'none' }} value={form.subject} onChange={set('subject')}>
                {SUPPORT_SUBJECTS.map((s) => <option key={s}>{s}</option>)}
              </select>
            </div>
            <div style={{ marginBottom: 16 }}>
              <label style={lbl}>Message *</label>
              <textarea required style={{ ...inp, resize: 'vertical', minHeight: 110, lineHeight: 1.5 }}
                placeholder="Describe your question or issue…" value={form.message} onChange={set('message')} />
            </div>
            {status === 'error' && <p style={{ margin: '0 0 12px', fontSize: 13, color: '#f87171' }}>{errorMsg}</p>}
            <button type="submit" disabled={status === 'sending'} style={{
              width: '100%', background: t.accent, color: t.accentInk,
              border: 'none', borderRadius: 10, padding: '12px 0',
              fontWeight: 700, fontSize: 15, cursor: status === 'sending' ? 'not-allowed' : 'pointer',
              opacity: status === 'sending' ? 0.7 : 1, fontFamily: 'inherit',
            }}>{status === 'sending' ? 'Sending…' : 'Send message'}</button>
          </form>
        )}
      </div>
    </div>
  );
}

// ──────────────────────────────────────────────────────────
// Terms of Service view modal (footer — read-only, no accept)
// ──────────────────────────────────────────────────────────
function WebTermsModal({ t, onClose }) {
  const onBackdrop = (e) => { if (e.target === e.currentTarget) onClose(); };
  React.useEffect(() => {
    const h = (e) => { if (e.key === 'Escape') onClose(); };
    window.addEventListener('keydown', h);
    return () => window.removeEventListener('keydown', h);
  }, [onClose]);

  const h2s = { fontSize: 16, fontWeight: 700, color: t.text, margin: '24px 0 8px', letterSpacing: '-0.01em' };
  const ps = { fontSize: 14, lineHeight: 1.65, color: t.textDim, margin: '0 0 10px' };
  const lis = { fontSize: 14, lineHeight: 1.65, color: t.textDim, marginBottom: 6 };
  const caps = { fontSize: 13, fontWeight: 700, color: t.textDim, letterSpacing: '.03em', lineHeight: 1.5, margin: '0 0 10px' };
  const callout = { background: t.surface, border: `1px solid ${t.borderStrong}`, borderRadius: 8, padding: '12px 14px', fontSize: 14, color: t.textDim, margin: '12px 0' };

  return (
    <div onClick={onBackdrop} style={{
      position: 'fixed', inset: 0, zIndex: 1000,
      background: 'rgba(0,0,0,.7)', backdropFilter: 'blur(4px)',
      display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,
    }}>
      <div style={{
        background: t.bg, borderRadius: 18, width: '100%', maxWidth: 620,
        maxHeight: '90vh', display: 'flex', flexDirection: 'column',
        boxShadow: '0 24px 80px rgba(0,0,0,.5)', position: 'relative',
      }}>
        {/* Header */}
        <div style={{ padding: '24px 28px 16px', borderBottom: `1px solid ${t.border}`, display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', flexShrink: 0 }}>
          <div>
            <p style={{ margin: '0 0 2px', fontSize: 11, fontWeight: 700, letterSpacing: '.1em', textTransform: 'uppercase', color: t.accent }}>Legal</p>
            <h2 style={{ margin: 0, fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: '-0.02em' }}>MyHomeAware Terms of Service</h2>
            <p style={{ margin: '4px 0 0', fontSize: 12, color: t.textMute }}>Version 3.0 · Last Revised: April 18, 2026</p>
          </div>
          <button onClick={onClose} aria-label="Close" style={{
            background: 'none', border: 'none', cursor: 'pointer', padding: 4,
            marginLeft: 12, marginTop: -2, color: t.textMute, fontSize: 22, lineHeight: 1, fontFamily: 'inherit',
          }}>×</button>
        </div>

        {/* Scrollable body */}
        <div style={{ overflowY: 'auto', padding: '4px 28px 28px', flex: 1 }}>
          <h2 style={h2s}>1. Binding Agreement</h2>
          <p style={ps}>By accessing or using MyHomeAware (the "Platform"), you confirm that you have read, understood, and agree to be bound by these Terms of Service ("Terms"). <strong>If you do not agree, you must not use the Platform.</strong> These Terms form a legally binding agreement between you and MyHomeAware.</p>

          <h2 style={h2s}>2. About the Platform &amp; Data Sources</h2>
          <p style={ps}>MyHomeAware is a <strong>data aggregation and visualization tool</strong>. The Platform collects, normalizes, and displays publicly available environmental, infrastructure, and facility data from U.S. government agencies, including:</p>
          <ul style={{ paddingLeft: 20, margin: '0 0 10px' }}>
            <li style={lis}>U.S. Environmental Protection Agency (EPA) — Superfund/NPL sites, Toxic Release Inventory (TRI), RCRA hazardous waste handlers, NPDES discharge permits, FRS facility registry, ATTAINS impaired water bodies, brownfields, and non-NPL cleanup sites.</li>
            <li style={lis}>Federal Aviation Administration (FAA) — Public-use airport locations.</li>
            <li style={lis}>Federal Communications Commission (FCC) — Cell tower and antenna structure registrations.</li>
            <li style={lis}>U.S. Department of Transportation (DOT) / EIA — Electric transmission lines, power plants, substations, oil refineries, chemical plants, and cement/asphalt facilities.</li>
            <li style={lis}>State and local drinking water system records.</li>
          </ul>
          <p style={ps}><strong>Data Latency &amp; Completeness:</strong> All datasets are sourced from third-party government databases updated on their own schedules. Records may be incomplete, delayed, or reflect historical conditions. You should independently verify any information before relying on it.</p>

          <h2 style={h2s}>3. No Professional Advice</h2>
          <p style={ps}>The Platform is an informational research tool only. It does <strong>not</strong> constitute and should <strong>not</strong> be relied upon as real estate, appraisal, environmental, engineering, legal, financial, or investment advice. Always engage qualified professionals before making decisions about property purchase, sale, or remediation.</p>

          <h2 style={h2s}>4. Payment Terms &amp; Report Credits</h2>
          <ul style={{ paddingLeft: 20, margin: '0 0 10px' }}>
            <li style={lis}><strong>Free Tier:</strong> All users receive a limited number of free searches as stated on the Platform at the time of use.</li>
            <li style={lis}><strong>Report Credits:</strong> Additional searches require the purchase of Report Credits at <strong>$2.99 USD per credit</strong>. Each credit entitles you to one address search and the ability to export the resulting report.</li>
            <li style={lis}><strong>No Refunds on Used Credits:</strong> Credits are consumed upon conducting a paid search and are <strong>non-refundable</strong> once used.</li>
            <li style={lis}><strong>Unused Credits:</strong> If you request a refund for unused credits within 30 days of purchase, we will honor the refund. Contact us at <a href="mailto:support@myhomeaware.app" style={{ color: t.accent }}>support@myhomeaware.app</a>. After 30 days, unused credits are non-refundable.</li>
            <li style={lis}><strong>Payment Processing:</strong> All payments are processed by Stripe, Inc. MyHomeAware does not store your payment card details.</li>
            <li style={lis}><strong>Price Changes:</strong> We reserve the right to change credit pricing with at least 14 days' notice posted on the Platform.</li>
          </ul>

          <h2 style={h2s}>5. Privacy &amp; Data Collection</h2>
          <ul style={{ paddingLeft: 20, margin: '0 0 10px' }}>
            <li style={lis}><strong>Account Data:</strong> If you create an account, we collect your email address and name via our authentication provider (Clerk), used solely to manage your account.</li>
            <li style={lis}><strong>Usage Data:</strong> We store your search count, report credit balance, and Terms of Service acceptance records on Cloudflare's infrastructure.</li>
            <li style={lis}><strong>No Sale of Data:</strong> We do not sell, rent, or share your personal information with third parties for marketing purposes.</li>
            <li style={lis}><strong>Data Requests:</strong> To request access to or deletion of your data, contact <a href="mailto:support@myhomeaware.app" style={{ color: t.accent }}>support@myhomeaware.app</a>.</li>
          </ul>

          <h2 style={h2s}>6. Limitation of Liability</h2>
          <p style={caps}>TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MYHOMEAWARE, ITS AFFILIATES, OR DATA PROVIDERS BE LIABLE FOR FINANCIAL LOSS, ENVIRONMENTAL OR SAFETY RELIANCE, DATA INACCURACY, OR THIRD-PARTY RELIANCE.</p>
          <div style={callout}><strong>Liability Cap:</strong> In the event MyHomeAware is found liable despite the above, our total aggregate liability shall not exceed the greater of <strong>$50.00 USD</strong> or the total fees you paid in the preceding three months.</div>

          <h2 style={h2s}>7. Binding Arbitration &amp; Class Action Waiver</h2>
          <p style={{ ...ps, ...caps }}>PLEASE READ THIS SECTION CAREFULLY — IT AFFECTS YOUR LEGAL RIGHTS.</p>
          <ul style={{ paddingLeft: 20, margin: '0 0 10px' }}>
            <li style={lis}><strong>Governing Law:</strong> These Terms are governed by the laws of the State of Delaware.</li>
            <li style={lis}><strong>Individual Arbitration:</strong> All disputes shall be resolved through binding arbitration administered by the AAA under its Consumer Arbitration Rules.</li>
            <li style={lis}><strong>Class Action Waiver:</strong> You waive any right to participate in a class-action lawsuit or class-wide arbitration.</li>
            <li style={lis}><strong>Exception:</strong> Either party may seek emergency injunctive relief in a court of competent jurisdiction.</li>
          </ul>

          <h2 style={h2s}>8. User Indemnification</h2>
          <p style={ps}>You agree to indemnify and hold harmless MyHomeAware from any claims, liabilities, or expenses arising from your use of Platform data without independent professional verification, your redistribution of Platform data, or your violation of these Terms or any applicable law.</p>

          <h2 style={h2s}>9. Account Termination</h2>
          <p style={ps}>MyHomeAware reserves the right to suspend or terminate your account at any time for violation of these Terms, abuse of the Platform, or fraudulent activity. If we terminate your account without cause, any unused Report Credits will be refunded. You may close your account at any time by contacting <a href="mailto:support@myhomeaware.app" style={{ color: t.accent }}>support@myhomeaware.app</a>.</p>

          <h2 style={h2s}>10. Severability &amp; Survival</h2>
          <p style={ps}>If any provision of these Terms is found unenforceable, it shall be modified to the minimum extent necessary to make it enforceable. Sections 6, 7, and 8 shall survive termination of your account or these Terms.</p>
        </div>
      </div>
    </div>
  );
}

// ──────────────────────────────────────────────────────────
// Footer
// ──────────────────────────────────────────────────────────
function Footer({ t }) {
  const [showContact, setShowContact] = React.useState(false);
  const [showTerms, setShowTerms] = React.useState(false);

  const cols = [
    { heading: 'Product', links: [
      { label: 'Search', href: '#product' },
      { label: 'Favorites', href: '#product' },
      { label: 'Reports', href: '#product' },
      { label: 'Partners', href: '#partners' },
    ]},
    { heading: 'For', links: [
      { label: 'Families', href: '#use-cases' },
      { label: 'Agents', href: '#use-cases' },
    ]},
    { heading: 'Company', links: [
      { label: 'About' },
      { label: 'Insights' },
      { label: 'Contact', action: () => setShowContact(true) },
    ]},
    { heading: 'Legal', links: [
      { label: 'Privacy' },
      { label: 'Terms', action: () => setShowTerms(true) },
    ]},
  ];

  const linkStyle = { fontSize: 14, color: t.textDim, cursor: 'pointer', textDecoration: 'none', background: 'none', border: 'none', padding: 0, fontFamily: 'inherit' };

  return (
    <>
      {showContact && <ContactModal t={t} onClose={() => setShowContact(false)} />}
      {showTerms && <WebTermsModal t={t} onClose={() => setShowTerms(false)} />}
      <footer style={{ padding: '64px 56px 40px', borderTop: `1px solid ${t.border}` }}>
        <div style={{ display: 'grid', gridTemplateColumns: '2fr 1fr 1fr 1fr 1fr', gap: 32 }}>
          <div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
              <Logo t={t} />
              <span style={{ fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 19, letterSpacing: '-0.02em', color: t.text }}>MyHomeAware</span>
            </div>
            <p style={{ fontSize: 14, lineHeight: 1.5, color: t.textDim, maxWidth: 320, marginTop: 14, textWrap: 'pretty' }}>Know what's around your home. Built so families can make informed decisions about their most important investment.</p>
          </div>
          {cols.map(({ heading, links }) =>
            <div key={heading}>
              <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '.12em', color: t.textMute, textTransform: 'uppercase' }}>{heading}</div>
              <ul style={{ listStyle: 'none', padding: 0, margin: '14px 0 0', display: 'flex', flexDirection: 'column', gap: 8 }}>
                {links.map(({ label, href, action }) =>
                  <li key={label}>
                    {href
                      ? <a href={href} style={linkStyle}>{label}</a>
                      : action
                        ? <button onClick={action} style={linkStyle}>{label}</button>
                        : <span style={linkStyle}>{label}</span>}
                  </li>
                )}
              </ul>
            </div>
          )}
        </div>
        <div style={{ marginTop: 56, paddingTop: 24, borderTop: `1px solid ${t.border}`, display: 'flex', justifyContent: 'space-between', color: t.textMute, fontSize: 12.5 }}>
          <span>© 2026 MyHomeAware. All rights reserved.</span>
        </div>
      </footer>
    </>
  );

}

// ──────────────────────────────────────────────────────────
// Landing — composes the page from sections, allows reordering
// ──────────────────────────────────────────────────────────
function Landing({ variant, accent, headline, sub, cta, sectionOrder }) {
  const t = getTheme(variant, accent);
  const Hero = variant === 'signal' ? HeroSignal : HeroDaylight;

  const sectionMap = {
    features: <Features t={t} />,
    how: <HowItWorks t={t} />,
    audiences: <ForWho t={t} />,
    partners: <Partners t={t} />,
    testimonials: <Testimonials t={t} />
  };
  const order = sectionOrder || ['features', 'how', 'audiences', 'partners', 'testimonials'];

  return (
    <div style={{ background: t.bg, color: t.text, minHeight: '100%', fontFamily: 'var(--font-body)' }}>
      <Nav t={t} />
      <Hero t={t} headline={headline} sub={sub} />
      {order.map((k) => <React.Fragment key={k}>{sectionMap[k]}</React.Fragment>)}
      <FinalCTA t={t} cta={cta} />
      <Footer t={t} />
    </div>);

}

Object.assign(window, { Landing, getTheme });