// Hero — full-bleed cinematic image with editorial headline overlay
function Hero() {
  // Animate the stat numbers once in view
  const statsRef = useRef(null);
  const [inView, setInView] = useState(false);
  useEffect(() => {
    if (!statsRef.current) return;
    const io = new IntersectionObserver((ents) => {
      ents.forEach(e => { if (e.isIntersecting) { setInView(true); io.disconnect(); } });
    }, { threshold: .3 });
    io.observe(statsRef.current);
    return () => io.disconnect();
  }, []);
  const cap = useCountUp(13, { when: inView });
  const crew = useCountUp(8700, { when: inView, duration: 2000 });
  const perm = useCountUp(390, { when: inView });
  const ac = useCountUp(720, { when: inView });

  return (
    <section id="overview" style={{ position: 'relative', background: 'var(--paper)' }}>

      {/* FULL-BLEED CINEMATIC HERO */}
      <div style={{
        position: 'relative',
        width: '100%',
        minHeight: '100vh',
        background: 'linear-gradient(180deg, rgba(8,14,11,.35) 0%, rgba(8,14,11,.15) 35%, rgba(8,14,11,.7) 100%), url(/images/hero.webp) center/cover',
        display: 'flex',
        flexDirection: 'column',
      }}>

        {/* Masthead bar — sits on top of image */}
        <div style={{ padding: '96px 40px 0', maxWidth: 1440, width: '100%', margin: '0 auto', color: 'var(--cream-50)' }}>
          <Reveal>
            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: 16, paddingBottom: 18, borderBottom: '1px solid rgba(250,247,241,.22)' }}>
              <div style={{ display: 'inline-flex', alignItems: 'center', gap: 10, fontFamily: 'var(--font-body)', fontSize: 11, fontWeight: 600, letterSpacing: '.22em', textTransform: 'uppercase', color: 'rgba(250,247,241,.85)' }}>
                <span style={{ width: 5, height: 5, borderRadius: '50%', background: 'var(--accent)' }} />
                Piedmont, Oklahoma · Kingfisher County
              </div>
              <div style={{ fontFamily: 'var(--font-body)', fontSize: 11, letterSpacing: '.22em', textTransform: 'uppercase', color: 'rgba(250,247,241,.55)' }}>Vol. 01 — A proposal to the community</div>
            </div>
          </Reveal>
        </div>

        {/* Headline block — flex-grow pushes bottom caption down */}
        <div style={{ flex: 1, display: 'flex', alignItems: 'center', padding: '80px 40px', maxWidth: 1440, width: '100%', margin: '0 auto', boxSizing: 'border-box' }}>
          <div style={{ color: 'var(--cream-50)', maxWidth: 1100 }}>
            <Reveal delay={1}>
              <h1 className="h1" data-content-path="hero.headline" style={{ margin: 0, color: 'var(--cream-50)' }}>
                Responsible infrastructure,<br/>
                <span className="italic-serif" style={{ color: 'var(--accent-soft)', opacity: .95 }}>built as a good neighbor</span><br/>
                to the place we call home.
              </h1>
            </Reveal>
            <Reveal delay={2}>
              <div style={{ marginTop: 36, display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
                <a href="#benefits" className="btn-primary" data-content-path="cta.primary" style={{ background: 'var(--cream-50)', color: 'var(--ink)' }}>What's planned <ArrowRight /></a>
                <a href="#faq" className="btn-ghost" style={{ color: 'var(--cream-50)', borderColor: 'rgba(250,247,241,.4)' }}>Questions & concerns</a>
              </div>
            </Reveal>
          </div>
        </div>

        {/* Bottom caption bar */}
        <div style={{ padding: '0 40px 64px', maxWidth: 1440, width: '100%', margin: '0 auto', color: 'var(--cream-50)', boxSizing: 'border-box' }}>
          <Reveal delay={3}>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr auto', gap: 40, alignItems: 'end', paddingTop: 28, borderTop: '1px solid rgba(250,247,241,.22)' }}>
              <div style={{ maxWidth: 680 }}>
                <div style={{ fontFamily: 'var(--font-body)', fontSize: 11, letterSpacing: '.22em', textTransform: 'uppercase', color: 'rgba(250,247,241,.6)', marginBottom: 10 }}>Site context</div>
                <div className="italic-serif" data-content-path="hero.subheadline" style={{ fontSize: 'clamp(18px, 1.8vw, 22px)', lineHeight: 1.35, color: 'var(--cream-50)' }}>
                  720 acres along the county's northeast corridor — low‑profile buildings, 150‑foot setbacks, natural edges kept intact.
                </div>
              </div>
              <div style={{ textAlign: 'right', fontFamily: 'var(--font-body)', fontSize: 11, letterSpacing: '.22em', textTransform: 'uppercase', color: 'rgba(250,247,241,.6)' }}>
                Fig. 01 — Kingfisher County
              </div>
            </div>
          </Reveal>
        </div>

        {/* Site marker pin — absolute */}
        <div style={{ position: 'absolute', left: '66%', top: '56%', pointerEvents: 'none' }}>
          <div style={{ position: 'relative', width: 14, height: 14 }}>
            <span className="pulse-ring" />
            <span style={{ position: 'absolute', inset: 3, borderRadius: '50%', background: 'var(--cream-50)', border: '2px solid var(--forest-900)' }} />
          </div>
        </div>
      </div>

      {/* PULL-QUOTE — editorial standfirst on paper */}
      <div className="container-x" style={{ paddingTop: 96 }}>
        <Reveal>
          <div style={{ display: 'grid', gridTemplateColumns: '180px 1fr', gap: 48, alignItems: 'start' }}>
            <div style={{ fontFamily: 'var(--font-body)', fontSize: 11, letterSpacing: '.22em', textTransform: 'uppercase', color: 'var(--slate-500)', paddingTop: 12, borderTop: '1px solid var(--accent)' }}>
              In brief
            </div>
            <blockquote style={{ margin: 0, fontFamily: 'var(--font-display)', fontWeight: 400, fontSize: 'clamp(26px, 3vw, 40px)', lineHeight: 1.22, letterSpacing: '-0.015em', color: 'var(--ink)', maxWidth: 1080 }}>
              <span className="italic-serif" style={{ color: 'var(--forest-800)' }}>Powering the future. Funding our community.</span> A sustainable $13B economic engine, operating quietly in the background.
            </blockquote>
          </div>
        </Reveal>

        {/* Lede paragraph, right-aligned rail */}
        <Reveal delay={1}>
          <div style={{ display: 'grid', gridTemplateColumns: '180px 1fr', gap: 48, alignItems: 'start', marginTop: 56 }}>
            <div />
            <p style={{ fontSize: 17, lineHeight: 1.65, color: 'var(--slate-700)', margin: 0, maxWidth: 760, fontFamily: 'var(--font-body)' }}>
              Piedmont Technology Park is a proposed 720‑acre campus in Kingfisher County — designed with careful setbacks, preserved natural edges, and long‑term investment in local schools, roads, and first responders.
            </p>
          </div>
        </Reveal>

        {/* Stat slab — animated numbers */}
        <div ref={statsRef} style={{ marginTop: 88, borderTop: '1px solid rgba(20,32,27,.22)', borderBottom: '1px solid rgba(20,32,27,.22)', paddingBottom: 96 }}>
          <Reveal>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 0 }}>
              {[
                { k: `$${cap.toFixed(0)}B`, v: 'Capital investment', note: 'Largest in Kingfisher County history' },
                { k: Math.round(crew).toLocaleString(), v: 'Construction jobs', note: 'Phased, multi‑year build' },
                { k: Math.round(perm).toLocaleString(), v: 'Permanent positions', note: 'Average wages ~2× local' },
                { k: Math.round(ac), v: 'Acre campus', note: '10% open space · 150 ft setbacks' },
              ].map((s, i) => (
                <div key={i} style={{ padding: '40px 32px 36px', borderRight: i < 3 ? '1px solid rgba(20,32,27,.14)' : 'none' }}>
                  <div style={{ fontFamily: 'var(--font-body)', fontSize: 11, letterSpacing: '.22em', textTransform: 'uppercase', color: 'var(--slate-500)', marginBottom: 18 }}>
                    0{i+1}
                  </div>
                  <div className="font-display num" style={{ fontSize: 'clamp(38px, 3.8vw, 54px)', fontWeight: 500, letterSpacing: '-0.025em', lineHeight: 1, color: 'var(--ink)' }}>{s.k}</div>
                  <div style={{ marginTop: 12, fontFamily: 'var(--font-display)', fontSize: 17, color: 'var(--ink)' }}>{s.v}</div>
                  <div style={{ marginTop: 6, fontFamily: 'var(--font-body)', fontSize: 12, color: 'var(--slate-500)', lineHeight: 1.5 }}>{s.note}</div>
                </div>
              ))}
            </div>
          </Reveal>
        </div>

      </div>

      <style>{`
        @media (max-width: 820px){
          #overview > div > div:nth-of-type(1) { padding-top: 80px !important; padding-left: 20px !important; padding-right: 20px !important; }
          #overview > div > div:nth-of-type(2) { padding: 60px 20px !important; }
          #overview > div > div:nth-of-type(3) { padding: 0 20px 48px !important; }
          #overview > div > div:nth-of-type(3) > div > div { grid-template-columns: 1fr !important; }
          #overview .container-x > div { grid-template-columns: 1fr !important; gap: 16px !important; }
          #overview .container-x > div > div:first-child { border-top: none !important; padding-top: 0 !important; }
          #overview .container-x > div:last-child > div > div { grid-template-columns: repeat(2, 1fr) !important; }
          #overview .container-x > div:last-child > div > div > div:nth-child(2) { border-right: none !important; }
          #overview .container-x > div:last-child > div > div > div:nth-child(1),
          #overview .container-x > div:last-child > div > div > div:nth-child(2) { border-bottom: 1px solid rgba(20,32,27,.14); }
        }
      `}</style>
    </section>
  );
}

window.Hero = Hero;
