// Hero (TypeScript). One editorial split hero:
// left — oversized serif statement + CTAs + verifiable facts;
// right — ozone molecule specimen panel;
// below — a live category index built from RIO3_DATA.
// Loaded as a global script — no import/export. Published on window at the end.

const Hero: React.FC<HeroProps> = ({ setPage, onBook }) => {
  const { categories, treatments } = window.RIO3_DATA;
  const countFor = (id: string) => treatments.filter((t) => t.cat === id).length;

  return (
    <section className="hero" aria-label="Introduction">
      <div className="shell">
        <div className="hero-grid">
          <div className="hero-copy">
            <span className="eyebrow">Integrative health · Deerfield Beach, FL</span>
            <h1>
              Medicine that treats the <em>root</em>,<br />
              not the symptom.
            </h1>
            <p className="lede">
              Rio3 is a clinician-led integrative practice offering ozone therapy,
              IV nutrition, regenerative injections and longevity protocols —
              built around your labs, your history and your goals.
            </p>
            <div className="hero-cta">
              <button className="btn btn-primary" onClick={() => onBook && onBook("consultation")}>
                Book a visit <Arrow />
              </button>
              <button className="btn btn-ghost" onClick={() => setPage && setPage("treatments")}>
                Explore treatments <Arrow />
              </button>
            </div>
            <dl className="hero-facts">
              <div><dt>Founded</dt><dd>2019</dd></div>
              <div><dt>Location</dt><dd>Deerfield Beach, FL</dd></div>
              <div><dt>Languages</dt><dd>EN · PT · ES</dd></div>
              <div><dt>Parking</dt><dd>Suite 205 · free</dd></div>
            </dl>
          </div>

          <aside className="hero-panel" aria-label="Ozone — O3">
            <div className="hero-panel-stage">
              <OzoneMolecule animate={false} />
            </div>
            <div className="hero-panel-note">
              <span className="hero-panel-label">O₃ — three oxygen atoms</span>
              <p>
                Ozone is at the center of how we work — paired with IV nutrition,
                regenerative injections and rigorous diagnostics.
              </p>
            </div>
          </aside>
        </div>

        <nav className="hero-index" aria-label="Treatment categories">
          {categories.map((c, i) => (
            <button
              key={c.id}
              className="hero-index-item"
              onClick={() => setPage && setPage("treatments")}
            >
              <span className="hii-num">{String(i + 1).padStart(2, "0")}</span>
              <span className="hii-label">{c.label}</span>
              <span className="hii-count">{countFor(c.id)}</span>
              <Arrow />
            </button>
          ))}
        </nav>
      </div>
    </section>
  );
};

Object.assign(window, { Hero });
