/* global React */
const { useState, useEffect, useRef } = React;

// ── Icons (inline SVG, simple geometric only) ───────────────────────────────
const Icon = {
  Phone: (p) => (
    <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.37 1.9.72 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.35 1.85.59 2.81.72A2 2 0 0 1 22 16.92z"/>
    </svg>
  ),
  Arrow: (p) => (
    <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <path d="M5 12h14M13 5l7 7-7 7"/>
    </svg>
  ),
  Check: (p) => (
    <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <path d="M20 6 9 17l-5-5"/>
    </svg>
  ),
  Shield: (p) => (
    <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
    </svg>
  ),
  Clock: (p) => (
    <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>
    </svg>
  ),
  Star: (p) => (
    <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" {...p}>
      <path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
    </svg>
  ),
  Award: (p) => (
    <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}>
      <circle cx="12" cy="8" r="6"/><path d="M8.21 13.89 7 22l5-3 5 3-1.21-8.12"/>
    </svg>
  ),
};

const StarRow = ({ n = 5 }) => (
  <span className="stars" aria-label={`${n} out of 5 stars`}>
    {Array.from({ length: n }).map((_, i) => <Icon.Star key={i} style={{marginRight:2}} />)}
  </span>
);

// ── Top Nav ─────────────────────────────────────────────────────────────────
function Nav({ phone }) {
  const [scrolled, setScrolled] = useState(false);
  const [open, setOpen] = useState(false);
  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 40);
    onScroll();
    window.addEventListener('scroll', onScroll, { passive: true });
    return () => window.removeEventListener('scroll', onScroll);
  }, []);
  useEffect(() => {
    document.body.style.overflow = open ? 'hidden' : '';
    return () => { document.body.style.overflow = ''; };
  }, [open]);
  const close = () => setOpen(false);
  return (
    <nav className={`nav ${scrolled ? 'scrolled' : ''} ${open ? 'is-open' : ''}`}>
      <a href="#top" className="nav-logo" onClick={close}>
        <span className="dot"></span>
        Mock Plumb Co.
      </a>
      <div className="nav-links">
        <a href="#services">Services</a>
        <a href="#pricing">Pricing</a>
        <a href="#areas">Areas</a>
        <a href="#team">About</a>
        <a href={`tel:${phone.replace(/\s/g,'')}`} className="nav-call">
          <Icon.Phone /> {phone}
        </a>
      </div>
      <div className="nav-mobile-actions">
        <a href={`tel:${phone.replace(/\s/g,'')}`} className="nav-call-compact" aria-label={`Call ${phone}`}>
          <Icon.Phone />
        </a>
        <button
          className="nav-burger"
          aria-label={open ? 'Close menu' : 'Open menu'}
          aria-expanded={open}
          onClick={() => setOpen(o => !o)}
        >
          <span className={`burger-icon ${open ? 'open' : ''}`}>
            <span></span><span></span><span></span>
          </span>
        </button>
      </div>
      <div className={`nav-drawer ${open ? 'open' : ''}`} onClick={close}>
        <div className="nav-drawer-inner" onClick={(e) => e.stopPropagation()}>
          <a href="#services" onClick={close}>Services</a>
          <a href="#pricing" onClick={close}>Pricing</a>
          <a href="#areas" onClick={close}>Areas</a>
          <a href="#team" onClick={close}>About</a>
          <a href="#book" onClick={close}>Book</a>
          <div className="nav-drawer-cta">
            <a href={`tel:${phone.replace(/\s/g,'')}`} className="btn btn-primary" onClick={close}>
              <Icon.Phone /> Call {phone}
            </a>
          </div>
        </div>
      </div>
    </nav>
  );
}

// ── Hero ────────────────────────────────────────────────────────────────────
function Hero({ phone, headline, sub, mobileLayout = 'overlay' }) {
  return (
    <header className={`hero hero-mobile-${mobileLayout}`} id="top">
      <div className="hero-media">
        {/* Swap this <img> for a <video autoPlay loop muted playsInline> later */}
        <img src="assets/hero-van.jpg" alt="Mock Plumb Co. team arriving at a Sydney terrace" />
      </div>
      <div className="hero-inner">
        <div className="hero-grid">
          <div>
            <div className="hero-rating">
              <StarRow n={5} />
              <span>4.9 · 480+ Google reviews</span>
            </div>
            <h1 dangerouslySetInnerHTML={{ __html: headline }} />
            <p className="hero-sub">{sub}</p>
            <div className="hero-ctas">
              <a href="#book" className="btn btn-primary">Book online <Icon.Arrow /></a>
              <a href={`tel:${phone.replace(/\s/g,'')}`} className="btn btn-secondary">
                <Icon.Phone /> Call {phone}
              </a>
            </div>
            <div className="hero-microcopy">
              <span><span className="tick">✓</span>NSW Lic. 123456C</span>
              <span className="sep"></span>
              <span><span className="tick">✓</span>Fully insured</span>
              <span className="sep"></span>
              <span><span className="tick">✓</span>24/7 emergency</span>
            </div>
          </div>
          <div></div>
        </div>
      </div>
    </header>
  );
}

// ── Trust Bar ───────────────────────────────────────────────────────────────
function TrustBar() {
  const items = [
    { icon: <Icon.Shield />, label: 'NSW Fair Trading', strong: 'Lic. 123456C' },
    { icon: <Icon.Award />, label: 'Master Plumbers', strong: 'Member since 2014' },
    { icon: <Icon.Star />, label: 'Google Reviews', strong: '4.9 · 480+ reviews' },
    { icon: <Icon.Clock />, label: 'On the tools since', strong: '2011' },
    { icon: <Icon.Check />, label: 'Fully insured', strong: '$20M public liability' },
  ];
  return (
    <div className="trust-bar">
      <div className="container trust-bar-inner">
        {items.map((it, i) => (
          <div className="trust-item" key={i}>
            <span className="ico">{it.icon}</span>
            <span>{it.label} <strong>· {it.strong}</strong></span>
          </div>
        ))}
      </div>
    </div>
  );
}

// ── Services ────────────────────────────────────────────────────────────────
function Services() {
  const services = [
    { num: '01', title: 'Emergency plumbing', body: 'Burst pipes, overflows, blocked toilets at 2am. We answer the phone, dispatch within the hour across our service area.', from: 'Call out from $145' },
    { num: '02', title: 'Blocked drains', body: 'Camera inspection, high-pressure jetting, root cutting. Most jobs cleared same-day with a 12-month no-blockage promise.', from: 'From $189' },
    { num: '03', title: 'Hot water systems', body: 'Repair, replace or upgrade. Gas, electric, heat pump and solar. Stocked vans means most replacements done in a single visit.', from: 'From $1,290 installed' },
    { num: '04', title: 'Gas fitting', body: 'Licensed gas fitters for cooktops, ovens, hot water and outdoor connections. Compliance certificates issued on the spot.', from: 'From $320' },
    { num: '05', title: 'Leak detection', body: 'Acoustic and thermal leak detection. We find it without tearing up your floor — or we don\'t charge for the search.', from: 'From $440' },
    { num: '06', title: 'Bathroom renovations', body: 'Full plumbing rough-in and finishing for bathroom renos. Working alongside your builder, or end-to-end with our trusted partners.', from: 'Quoted on-site' },
  ];
  return (
    <section className="services" id="services">
      <div className="container">
        <div className="services-header">
          <div>
            <div className="section-eyebrow">Services</div>
            <h2 className="section-title">The work we do, and what it costs to start.</h2>
          </div>
          <p className="section-lede">
            We don't do everything. We do residential plumbing, properly, in older Sydney homes. If it's outside our wheelhouse we'll tell you, and recommend someone good.
          </p>
        </div>
        <div className="services-grid">
          {services.map((s) => (
            <a className="service-card" key={s.num} href="#book">
              <span className="num">{s.num}</span>
              <h3>{s.title}</h3>
              <p>{s.body}</p>
              <div className="price">
                <span>{s.from}</span>
                <span className="arrow"><Icon.Arrow /></span>
              </div>
            </a>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── How it works ────────────────────────────────────────────────────────────
function HowItWorks() {
  const steps = [
    { n: '01', t: 'Chat or book online, 24/7.', b: 'Our assistant takes your details, asks the right diagnostic questions, and books you into the next available window — in under two minutes.' },
    { n: '02', t: 'We arrive in your window.', b: 'On time, in uniform, in a sign-written van. We diagnose the job and give you a fixed quote on-site, before any work starts.' },
    { n: '03', t: 'Job done, guaranteed.', b: 'Tidy site, tested twice, photos sent to your inbox. 12-month workmanship guarantee on every job we do.' },
  ];
  return (
    <section className="how">
      <div className="container">
        <div className="section-eyebrow">How it works</div>
        <h2 className="section-title">Three steps. No surprises.</h2>
        <div className="how-grid">
          {steps.map((s) => (
            <div className="how-step" key={s.n}>
              <div className="step-num">{s.n}</div>
              <h4>{s.t}</h4>
              <p>{s.b}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Pricing ─────────────────────────────────────────────────────────────────
function Pricing() {
  const rows = [
    { job: 'Blocked drain (single)', desc: 'Camera, jet, clear. Most clear in under 90 minutes.', from: '$189' },
    { job: 'Burst pipe repair', desc: 'Standard copper or PEX repair, accessible location.', from: '$245' },
    { job: 'Toilet replacement', desc: 'Like-for-like swap, includes pan collar and seal.', from: '$420' },
    { job: 'Hot water system (electric)', desc: '50L–315L Rheem or Vulcan, fully installed.', from: '$1,290' },
    { job: 'Hot water system (gas)', desc: 'Continuous flow, Rinnai or Bosch, fully installed.', from: '$1,890' },
    { job: 'Gas cooktop install', desc: 'Includes compliance cert, regulator, leak test.', from: '$320' },
    { job: 'Tap or mixer replacement', desc: 'Standard kitchen or bathroom mixer, your hardware.', from: '$165' },
    { job: 'After-hours call out', desc: 'Weeknights 6pm–7am, weekends, public holidays.', from: '$285' },
  ];
  return (
    <section className="pricing" id="pricing">
      <div className="container">
        <div className="section-eyebrow">Pricing</div>
        <h2 className="section-title">No surprises. Here's what things actually cost.</h2>
        <p className="section-lede">
          Every job gets a fixed quote on-site before we lift a tool. These starting prices are real — what we typically charge for the most common version of each job in 2026.
        </p>
        <div className="pricing-table">
          {rows.map((r) => (
            <a className="pricing-row" href="#book" key={r.job}>
              <div className="job">{r.job}</div>
              <div className="desc">{r.desc}</div>
              <div className="from">
                from <span className="price-num">{r.from}</span>
              </div>
              <div className="arrow"><Icon.Arrow /></div>
            </a>
          ))}
        </div>
        <div className="pricing-note">
          <Icon.Check style={{color:'var(--success)'}} /> All prices include GST, parts, travel within service area, and clean-up. Quoted on-site, never over the phone.
        </div>
      </div>
    </section>
  );
}

// ── Service area + map ──────────────────────────────────────────────────────
function Areas() {
  const regions = [
    { h: 'Inner West', subs: ['Balmain', 'Leichhardt', 'Annandale', 'Glebe', 'Marrickville', 'Newtown', 'Stanmore', 'Petersham'] },
    { h: 'Eastern Suburbs', subs: ['Paddington', 'Woollahra', 'Bondi', 'Bondi Junction', 'Bronte', 'Coogee', 'Randwick', 'Double Bay'] },
    { h: 'Lower North Shore', subs: ['Mosman', 'Cremorne', 'Neutral Bay', 'Kirribilli', 'Cammeray', 'Lane Cove', 'Crows Nest', 'Northbridge'] },
    { h: 'Inner City', subs: ['Surry Hills', 'Darlinghurst', 'Potts Point', 'Pyrmont', 'Ultimo', 'Redfern', 'Waterloo', 'Alexandria'] },
  ];
  return (
    <section className="areas" id="areas">
      <div className="container">
        <div className="section-eyebrow">Service area</div>
        <h2 className="section-title">If you can see the harbour bridge, we cover you.</h2>
        <p className="section-lede">
          We stay close so we can stay fast. If you're outside the map we'll still take the call, but we'll be straight with you about response time.
        </p>
        <div className="areas-grid">
          <div className="map-wrap">
            <SydneyMap />
          </div>
          <div className="suburb-cols">
            {regions.map((r) => (
              <div className="suburb-region" key={r.h}>
                <h5>{r.h}</h5>
                <ul>{r.subs.map((s) => <li key={s}>{s}</li>)}</ul>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// Stylised harbour map (abstract, not an actual geo render)
function SydneyMap() {
  return (
    <svg className="map-svg" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <pattern id="dotgrid" width="14" height="14" patternUnits="userSpaceOnUse">
          <circle cx="1" cy="1" r="0.6" fill="rgba(255,255,255,0.08)"/>
        </pattern>
      </defs>
      <rect width="400" height="300" fill="url(#dotgrid)"/>

      {/* Harbour water — abstracted */}
      <path d="M0,140 C40,135 70,150 100,148 C130,146 145,120 175,125 C200,130 215,160 245,158 C280,156 295,135 325,138 C355,141 380,150 400,148 L400,180 C370,178 350,170 320,172 C290,174 270,195 240,193 C210,191 195,170 165,168 C135,166 120,185 90,183 C60,181 30,170 0,172 Z"
        fill="rgba(201,115,51,0.12)" stroke="rgba(201,115,51,0.45)" strokeWidth="0.8"/>

      {/* Coverage circles */}
      <g opacity="0.85">
        <circle cx="120" cy="195" r="48" fill="rgba(201,115,51,0.07)" stroke="rgba(201,115,51,0.55)" strokeWidth="1" strokeDasharray="3,3"/>
        <circle cx="290" cy="200" r="46" fill="rgba(201,115,51,0.07)" stroke="rgba(201,115,51,0.55)" strokeWidth="1" strokeDasharray="3,3"/>
        <circle cx="225" cy="105" r="44" fill="rgba(201,115,51,0.07)" stroke="rgba(201,115,51,0.55)" strokeWidth="1" strokeDasharray="3,3"/>
        <circle cx="200" cy="170" r="36" fill="rgba(201,115,51,0.10)" stroke="rgba(201,115,51,0.7)" strokeWidth="1"/>
      </g>

      {/* Pins */}
      {[
        {x:120,y:195,l:'Inner West'},
        {x:290,y:200,l:'Eastern'},
        {x:225,y:105,l:'North Shore'},
        {x:200,y:170,l:'Inner City'},
      ].map((p,i)=>(
        <g key={i}>
          <circle cx={p.x} cy={p.y} r="4" fill="#C97333"/>
          <circle cx={p.x} cy={p.y} r="8" fill="none" stroke="#C97333" strokeWidth="1" opacity="0.5">
            <animate attributeName="r" values="4;14;4" dur="3s" repeatCount="indefinite" begin={`${i*0.5}s`}/>
            <animate attributeName="opacity" values="0.6;0;0.6" dur="3s" repeatCount="indefinite" begin={`${i*0.5}s`}/>
          </circle>
          <text x={p.x+10} y={p.y-8} fill="rgba(255,255,255,0.85)" fontFamily="Inter Tight, sans-serif" fontSize="10" letterSpacing="0.04em">{p.l}</text>
        </g>
      ))}

      {/* HQ marker */}
      <g>
        <rect x="195" y="165" width="10" height="10" fill="#fff" transform="rotate(45 200 170)"/>
        <text x="200" y="148" fill="#fff" fontFamily="Inter Tight, sans-serif" fontSize="9" textAnchor="middle" letterSpacing="0.08em">HQ — LEICHHARDT</text>
      </g>
    </svg>
  );
}

// ── How we work (replaces Team) ─────────────────────────────────────────────
function Team() {
  const values = [
    { n: '01', t: 'Family-owned, on the tools since 2014.', b: 'Started out of a single van in the Inner West. Still independent, still answering our own phone.' },
    { n: '02', t: 'No subbies. No rotating crews.', b: 'Every plumber on a Mock Plumb Co. job is on our books — fully licensed, uniformed, in a sign-written van.' },
    { n: '03', t: 'Properly licensed, properly insured.', b: 'NSW Lic. 123456C. Master Plumbers member. $20M public liability cover on every job, every time.' },
    { n: '04', t: 'We say no when it isn\'t our work.', b: 'Commercial, civil, septic — not us. We\'ll tell you straight up and point you to someone we\'d use ourselves.' },
  ];
  return (
    <section className="team" id="team">
      <div className="container">
        <div className="section-eyebrow">How we work</div>
        <h2 className="section-title">A small Sydney plumber, doing the basics properly.</h2>
        <p className="section-lede">
          Mock Plumb Co. is a family-run residential plumbing business based in Leichhardt. Four principles run every job — they're why people book us, and why they keep booking us.
        </p>
        <div className="values-grid">
          {values.map((v) => (
            <div className="value-card" key={v.n}>
              <span className="value-num">{v.n}</span>
              <h4>{v.t}</h4>
              <p>{v.b}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Reviews ─────────────────────────────────────────────────────────────────
function Reviews() {
  const reviews = [
    { stars:5, q:"Hot water system died on a Sunday night. The team had someone at our place by 8am Monday with a replacement on the van. Fixed price quoted before they started — no upsell, no surprises. The bathroom was tidier when they left than when they arrived.", n:"Eleanor M.", s:"Paddington · Hot water replacement" },
    { stars:5, q:"We had three plumbers tell us they'd need to dig up the hallway to find a slab leak. Mock Plumb Co. found it in 40 minutes with acoustic gear, behind the laundry wall. Saved us thousands and a week of demolition. Worth every cent.", n:"David & Anh L.", s:"Mosman · Leak detection" },
    { stars:5, q:"Used them for a full ensuite renovation rough-in. They worked alongside our builder, came back exactly when they said they would, and the inspection passed first try. Charged us what they quoted, to the dollar. Have already booked them for the kitchen.", n:"Sarah K.", s:"Annandale · Bathroom reno" },
    { stars:5, q:"Blocked drain at 6pm with guests arriving at 7. They had someone there in 35 minutes. Cleared it, jetted it, and threw in a camera inspection because they'd been quicker than expected. Kind of plumber you tell your friends about.", n:"James O'Reilly", s:"Bondi · Blocked drain" },
  ];
  return (
    <section className="reviews">
      <div className="container">
        <div className="section-eyebrow">Reviews</div>
        <h2 className="section-title">Long reviews are the honest ones.</h2>
        <p className="section-lede">
          Pulled directly from Google. No carousels, no cherry-picked star quotes. If you want to read all 480, the link's in the footer.
        </p>
        <div className="reviews-grid">
          {reviews.map((r,i)=>(
            <div className="review-card" key={i}>
              <StarRow n={r.stars} />
              <blockquote>"{r.q}"</blockquote>
              <div className="review-meta">
                <span className="name">{r.n}</span>
                <span className="suburb">{r.s}</span>
              </div>
            </div>
          ))}
        </div>
        <div className="reviews-aggregate">
          <StarRow n={5} />
          <span><strong style={{color:'var(--navy)'}}>4.9 average</strong> across 480+ Google reviews · Read all on Google →</span>
        </div>
      </div>
    </section>
  );
}

// ── Guarantee ───────────────────────────────────────────────────────────────
function Guarantee() {
  return (
    <section className="guarantee">
      <div className="container guarantee-inner">
        <div>
          <div className="section-eyebrow">The guarantee</div>
          <h2>If we did it, we stand behind it. For twelve months. No excuses.</h2>
          <p>
            If something we installed or repaired fails within 12 months, we come back and fix it. No call-out fee, no diagnostic charge, no debate about whose fault it is.
          </p>
          <div className="guarantee-stat">
            <strong>11</strong>
            <span>times we've had to use the guarantee in the last four years.<br/>Out of roughly 6,400 jobs.</span>
          </div>
        </div>
        <div>
          <div className="guarantee-seal">
            <div className="guarantee-seal-text">
              <span className="big">12</span>
              <span className="sm">Month guarantee</span>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ── Booking form ────────────────────────────────────────────────────────────
function Booking({ phone }) {
  const [form, setForm] = useState({ name:'', suburb:'', phoneN:'', service:'', problem:'' });
  const [errors, setErrors] = useState({});
  const [submitted, setSubmitted] = useState(false);

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

  const submit = (e) => {
    e.preventDefault();
    const errs = {};
    if (!form.name.trim()) errs.name = 'We need to know who to ask for.';
    if (!form.suburb.trim()) errs.suburb = 'So we know if we can get there fast.';
    if (!/^[\d\s+()-]{8,}$/.test(form.phoneN.trim())) errs.phoneN = 'Please enter a valid phone number.';
    if (!form.problem.trim()) errs.problem = 'A sentence is plenty.';
    setErrors(errs);
    if (Object.keys(errs).length === 0) {
      setSubmitted(true);
    }
  };

  return (
    <section className="book" id="book">
      <div className="container book-grid">
        <div className="book-side">
          <div className="section-eyebrow">Book</div>
          <h2 className="section-title">Tell us what's going on. We'll be in touch within the hour.</h2>
          <ul>
            <li><span className="check"><Icon.Check /></span><span><strong>Reply within the hour.</strong> Every booking gets a confirmation and a window, fast.</span></li>
            <li><span className="check"><Icon.Check /></span><span><strong>Fixed quote on-site.</strong> Always before any work starts.</span></li>
            <li><span className="check"><Icon.Check /></span><span><strong>Same-day where we can.</strong> If we can't, we tell you straight up.</span></li>
          </ul>
          <div className="book-emergency">
            <div className="label">Burst pipe right now?</div>
            <div className="num">{phone}</div>
            <div className="note">24/7 emergency line. We answer within two rings.</div>
          </div>
        </div>
        <div className="book-form">
          {submitted ? (
            <div className="book-success show">
              <div className="check"><Icon.Check style={{width:24,height:24}} /></div>
              <h4>Got it, {form.name.split(' ')[0]}.</h4>
              <p>We'll be in touch on {form.phoneN} within the hour to confirm a window. If it's urgent, ring us on {phone}.</p>
            </div>
          ) : (
            <form onSubmit={submit} noValidate>
              <div className="field-row">
                <div className={`field ${errors.name ? 'invalid' : ''}`}>
                  <label htmlFor="name">Your name</label>
                  <input id="name" type="text" value={form.name} onChange={update('name')} placeholder="Jane Smith" />
                  <div className="field-error">{errors.name}</div>
                </div>
                <div className={`field ${errors.suburb ? 'invalid' : ''}`}>
                  <label htmlFor="suburb">Suburb</label>
                  <input id="suburb" type="text" value={form.suburb} onChange={update('suburb')} placeholder="Annandale" />
                  <div className="field-error">{errors.suburb}</div>
                </div>
              </div>
              <div className={`field ${errors.phoneN ? 'invalid' : ''}`}>
                <label htmlFor="phoneN">Best phone number</label>
                <input id="phoneN" type="tel" value={form.phoneN} onChange={update('phoneN')} placeholder="0412 345 678" />
                <div className="field-error">{errors.phoneN}</div>
              </div>
              <div className="field">
                <label htmlFor="service">What kind of job? <span style={{textTransform:'none',letterSpacing:0,color:'var(--text-muted)'}}>(optional)</span></label>
                <select id="service" value={form.service} onChange={update('service')}>
                  <option value="">Not sure yet</option>
                  <option>Emergency — water everywhere</option>
                  <option>Blocked drain</option>
                  <option>Hot water system</option>
                  <option>Gas fitting</option>
                  <option>Leak detection</option>
                  <option>Bathroom renovation</option>
                  <option>Something else</option>
                </select>
              </div>
              <div className={`field ${errors.problem ? 'invalid' : ''}`}>
                <label htmlFor="problem">In one sentence, what's going on?</label>
                <textarea id="problem" value={form.problem} onChange={update('problem')} placeholder="Slow drain in the kitchen, getting worse over the last week."></textarea>
                <div className="field-error">{errors.problem}</div>
              </div>
              <button type="submit" className="btn btn-dark" style={{width:'100%', justifyContent:'center', padding:'16px 22px'}}>
                Send booking request <Icon.Arrow />
              </button>
              <p style={{marginTop:14, fontSize:13, color:'var(--text-muted)', textAlign:'center', fontFamily:'var(--mono)'}}>
                We'll never share your details. We'll only call about your job.
              </p>
            </form>
          )}
        </div>
      </div>
    </section>
  );
}

// ── Footer ──────────────────────────────────────────────────────────────────
function Footer({ phone }) {
  return (
    <footer className="foot">
      <div className="container">
        <div className="foot-grid">
          <div className="foot-brand">
            <h3>Mock Plumb Co.</h3>
            <p>Sydney's quietly excellent plumber. Booked in minutes, fixed properly, priced before we start. Family-owned, on the tools since 2014.</p>
          </div>
          <div className="foot-col">
            <h6>Services</h6>
            <ul>
              <li><a href="#services">Emergency</a></li>
              <li><a href="#services">Blocked drains</a></li>
              <li><a href="#services">Hot water</a></li>
              <li><a href="#services">Gas fitting</a></li>
              <li><a href="#services">Bathroom reno</a></li>
            </ul>
          </div>
          <div className="foot-col">
            <h6>Areas</h6>
            <ul>
              <li><a href="#areas">Inner West</a></li>
              <li><a href="#areas">Eastern Suburbs</a></li>
              <li><a href="#areas">North Shore</a></li>
              <li><a href="#areas">Inner City</a></li>
            </ul>
          </div>
          <div className="foot-col">
            <h6>Contact</h6>
            <ul>
              <li><a href={`tel:${phone.replace(/\s/g,'')}`}>{phone}</a></li>
              <li><a href="mailto:hi@mockexampleplumb.co">hi@mockexampleplumb.co</a></li>
              <li>Mon–Fri 7am–7pm</li>
              <li>24/7 emergency line</li>
            </ul>
          </div>
        </div>
        <div className="foot-bottom">
          <span>© 2026 Mock Plumb Co. Pty Ltd · ABN 12 345 678 901 · NSW Lic. 123456C</span>
          <span>Sydney, Australia</span>
        </div>
      </div>
    </footer>
  );
}

Object.assign(window, {
  Nav, Hero, TrustBar, Services, HowItWorks, Pricing, Areas, Team, Reviews, Guarantee, Booking, Footer
});
