/* Template 3 "The Showcase" - Re-Ignite · part C: ortho, finance calculator, reviews, FAQ, final CTA, footer */
(function () {
  const e = React.createElement;
  const { useState } = React;
  const { useCountdown, fmtDate } = window;
  const Icon = window.Icon;
  const B = (props, ...kids) => e(window.T3Btn, props, ...kids);
  const Word = window.T3Word;

  /* orthodontist / principal dentist ------------------------------------- */
  const Ortho = ({ cfg }) =>
    e("section", { className: "t3-sec t3-cont" },
      e("div", { className: "t3-ortho__grid" },
        e("div", { className: "t3-ortho__visual" },
          e("div", { className: "t3-ortho__img" },
            e("img", { src: "assets/rid-doctor.jpg", alt: "Dr Imran Nisar at Re-Ignite Dental" })),
          e("div", { className: "t3-ortho__chip" },
            e("div", null,
              e("b", null, "Dr Imran Nisar"),
              e("span", null, "Principal Dentist")),
            e("span", { className: "badge" }, "Invisalign Gold"))),
        e("div", { className: "t3-ortho__copy" },
          e("span", { className: "t3-kick" }, "Who you’ll meet"),
          e("h2", { className: "t3-h2" }, "Care from ", e("span", { className: "alt" }, "Dr Imran Nisar"), ", with the technology to match."),
          e("p", { className: "t3-body" },
            "Dr Imran Nisar leads Re-Ignite Dental and is an Invisalign Gold provider, close to Platinum. We have completed hundreds of cases. His background is in aesthetic restorative dentistry, with postgraduate diplomas in aesthetic restorative dentistry, endodontology and periodontology."),
          e("p", { className: "t3-body", style: { marginTop: 16 } },
            "Every scan is taken on the iTero Lumina - a fully digital approach with no putty impressions. The path to your finished smile is mapped out from the start, and you can see your potential result before committing to anything."),
          e("ul", { className: "t3-cred" },
            [["Invisalign Gold status - a proven, experienced provider"],
             ["Hundreds of cases completed"],
             ["Postgraduate diplomas in aesthetic restorative dentistry, endodontology & periodontology"]].map(([t], i) =>
              e("li", { key: i }, e(Icon, { name: "check" }), e("span", null, e("b", null, t))))),
          B({ variant: "light", href: "#reserve" }, "Reserve your spot"))),
    );

  /* finance - interactive 0% calculator ---------------------------------- */
  const Finance = ({ cfg }) => {
    const PRICE = 2995; // Invisalign Go Express from £2,995, incl. whitening & retainers
    const [term, setTerm] = useState(60);
    const monthly = Math.round(PRICE / term);
    return e("section", { className: "t3-sec t3-cont", id: "finance" },
      e("div", { className: "t3-fin__card t3-reveal" },
        e("div", { className: "t3-fin__head" },
          e("span", { className: "t3-kick", style: { color: "var(--rid-mint)" } }, "Clear, fair pricing"),
          e("h2", { className: "t3-h2" }, "Spread it ", e("span", { className: "alt" }, "interest-free"), ", up to 5 years."),
          e("p", { className: "t3-lead" }, "Invisalign at Re-Ignite starts from £2,995, with whitening and retainers included. Take up to £955 off on the day, then spread the rest at 0% over up to five years.")),
        e("div", { className: "t3-calc" },
          e("div", { className: "t3-calc__controls" },
            e("div", { className: "t3-calc__row" },
              e("div", { className: "t3-calc__rowhead" },
                e("span", { className: "t3-calc__lbl" }, "Spread over"),
                e("span", { className: "t3-calc__pillval" }, term, " months")),
              e("input", { className: "t3-calc__range", type: "range", min: 12, max: 60, step: 6, value: term, onChange: (ev) => setTerm(Number(ev.target.value)) }),
              e("div", { className: "t3-calc__ticks" }, e("span", null, "1 yr"), e("span", null, "3 yrs"), e("span", null, "5 yrs"))),
            e("div", { className: "t3-calc__row" },
              e("div", { className: "t3-calc__rowhead" },
                e("span", { className: "t3-calc__lbl" }, "Example treatment, from"),
                e("span", { className: "t3-calc__pillval" }, "£", PRICE.toLocaleString())))),
          e("div", { className: "t3-calc__result" },
            e("div", { className: "t3-calc__big" }, "£", monthly, e("small", null, "/mo")),
            e("div", { className: "t3-calc__sub" }, "0% APR over ", term, " months, subject to status"),
            e("span", { className: "t3-calc__chip" }, "£10 deposit secures your place"))),
        e("p", { className: "t3-fin__note" },
          "Figures are indicative, based on Invisalign Go Express from £2,995 before any open-day saving. Up to £955 off applies to Invisalign Go Plus. ", e("span", null, cfg.practice), " is a credit broker, not a lender. Finance subject to status. Every plan is written down and agreed in advance - no hidden or surprise fees.")),
    );
  };

  /* reviews (3 genuine Google reviews) ------------------------------------ */
  const Reviews = () => {
    const data = [
      ["Perfect experience! Everyone at the practice is so lovely and welcoming, and Dr Imran is really professional and reliable. Can’t wait to see my final result from Invisalign, whitening and composite.", "Beth Southcott", "BS"],
      ["Dr Imran undertook my Invisalign and did a brilliant job. He’s been amazing with aftercare too - always finding time to make adjustments or fix things. Great work and even better support.", "Sam H", "SH"],
      ["Thank you so much, Imran, for all the time and effort getting the best results for my teeth. Such a friendly dentist who made me feel comfortable. I’d definitely recommend you for Invisalign.", "Shell Hughes", "SH"],
    ];
    return e("section", { className: "t3-sec t3-cont" },
      e("div", { className: "t3-rev__head" },
        e("div", null,
          e("span", { className: "t3-kick" }, "Loved locally"),
          e("h2", { className: "t3-h2", style: { marginTop: 14 } }, "Smiles that started ", e("span", { className: "alt" }, "like yours"), ".")),
        e("div", { className: "t3-hq__score" },
          e("div", { className: "t3-hq__num", style: { color: "var(--rid-midnight)" } }, "5.0", e("span", null, "/5")),
          e("div", { className: "t3-hq__by" },
            e("div", { className: "t3-hq__stars" }, "★★★★★"),
            e("span", null, "368 Google reviews")))),
      e("div", { className: "t3-rev__grid" },
        data.map(([q, n, initials], i) => e("div", { className: "t3-revcard", key: i },
          e("div", { className: "t3-revcard__st" }, "★★★★★"),
          e("p", { className: "t3-revcard__q" }, "“", q, "”"),
          e("div", { className: "t3-revcard__by" },
            e("div", { className: "t3-revcard__av", style: { background: "var(--rid-teal-soft)", color: "var(--rid-teal-pressed)", display: "grid", placeItems: "center", font: "700 15px/1 var(--font-poppins)" } }, initials),
            e("div", null, e("div", { className: "t3-revcard__n" }, n), e("div", { className: "t3-revcard__m" }, "Google review")))))),
    );
  };

  /* faq ------------------------------------------------------------------- */
  const FAQ = () => {
    const [open, setOpen] = useState(0);
    const items = [
      ["Will people notice I’m wearing them?", "The aligners are clear and fit closely over your teeth, so most people won’t realise you’re wearing them at all."],
      ["Is it uncomfortable?", "Most patients describe a feeling of gentle pressure for a day or two with each new aligner, which settles quickly. The whole approach is calm and unhurried."],
      ["How soon can I start?", "Once you’ve had your scan and approved your plan, treatment can often begin within about four weeks."],
      ["What’s included in the price?", "Whitening and retainers are included in your Invisalign treatment fee as standard. Your consultation and iTero 3D scan on the open day are free, with no obligation to go ahead."],
      ["How much can I save?", "Up to £955 off, applied on the day. The full £955 applies to Invisalign Go Plus; your exact saving depends on the treatment that’s right for you, and we’ll confirm it in writing."],
      ["What is the £10 deposit for?", "It simply secures your place on the day. It comes off the cost of your treatment, is refundable if you cancel, and is only lost if you don’t turn up."],
      ["Can I spread the cost?", "Yes. You can spread the whole amount interest-free over up to 5 years."],
      ["What happens after I reserve a spot?", "Our team will call you to confirm your time and answer any questions ahead of the day. We’ll arrange everything by phone."],
      ["What is Invisalign?", "A series of clear, removable aligners that gently guide your teeth into place over time. They’re barely visible, and you take them out to eat, drink and brush - so daily life carries on as normal."],
    ];
    return e("section", { className: "t3-sec t3-cont", id: "faq" },
      e("div", { className: "t3-faq__grid" },
        e("div", { className: "t3-faq__head" },
          e("span", { className: "t3-kick" }, "Good to know"),
          e("h2", { className: "t3-h2" }, "Your questions, ", e("span", { className: "alt" }, "answered"), ".")),
        e("div", { className: "t3-faq__list" },
          items.map(([q, a], i) => e("div", { className: "t3-faq__item", key: i, "data-open": open === i },
            e("button", { className: "t3-faq__q", onClick: () => setOpen(open === i ? -1 : i) },
              e("span", null, q),
              e("span", { className: "t3-faq__ic" }, e(Icon, { name: "plus" }))),
            e("div", { className: "t3-faq__a", style: { maxHeight: open === i ? 320 : 0 } },
              e("div", { className: "t3-faq__a-in" }, a)))))));
  };

  /* final cta ------------------------------------------------------------- */
  const FinalCTA = ({ cfg }) => {
    const t = useCountdown(cfg.eventISO);
    const u = [["Days", t.days], ["Hrs", t.hours], ["Min", t.mins], ["Sec", t.secs]];
    return e("section", { className: "t3-sec t3-cont" },
      e("div", { className: "t3-final__card t3-ondark" },
        e("div", { className: "t3-final__inner" },
          e("span", { className: "t3-eyebrow t3-eyebrow--plain" }, "One day only · limited places"),
          e("h2", { className: "t3-display" }, "Reserve your spot for ", e("span", { className: "alt" }, "Saturday 11th July"), "."),
          cfg.showCountdown && e("div", { className: "t3-final__cd" },
            u.map(([l, v], i) => e("div", { className: "u", key: i },
              e("b", null, String(v).padStart(2, "0")), e("span", null, l)))),
          e("p", { className: "t3-lead", style: { color: "rgba(244,246,247,.82)", maxWidth: 620, margin: "0 auto 30px" } },
            "Places are limited and offered on a first-come basis. Secure yours now with a £10 deposit, fully refundable if you cancel, and we’ll call to confirm your time."),
          e("div", { className: "t3-final__actions" },
            B({ variant: "gold", lg: true, href: "#reserve" }, "Reserve your spot"),
            B({ variant: "light", lg: true, href: "tel:" + cfg.phone.replace(/\s/g, "") }, "Call " + cfg.phone)),
          e("p", { className: "t3-final__fine" }, cfg.address, " · 10:00am–2:30pm"))),
    );
  };

  /* footer ---------------------------------------------------------------- */
  const Footer = ({ cfg }) =>
    e("footer", { className: "t3-footer" },
      e("div", { className: "t3-footer__card" },
        e("div", { className: "t3-footer__top" },
          e("div", null,
            e("div", { className: "t3-footer__brand", style: { fontSize: 22 } }, e(Word, null)),
            e("p", { style: { maxWidth: 340 } }, "Confidence rejuvenated. A cosmetic dental practice in ",
              e("span", null, cfg.city), ", specialising in Invisalign and smile transformations."),
            e("div", { className: "t3-footer__badges" },
              ["Invisalign Gold Provider", "iTero Lumina", "5-star · 368 reviews"].map((b, i) =>
                e("span", { className: "t3-footer__badge", key: i }, b)))),
          e("div", null,
            e("h4", null, "Visit us"),
            e("p", null, cfg.address),
            e("p", { style: { marginTop: 10 } }, e("a", { href: "tel:" + cfg.phone.replace(/\s/g, "") }, cfg.phone)),
            e("p", null, e("a", { href: "mailto:" + cfg.email }, cfg.email))),
          e("div", null,
            e("h4", null, "The open day"),
            e("ul", null,
              [["The package", "#offer"], ["The day", "#day"], ["Reviews", "#results"], ["Pricing & finance", "#finance"], ["FAQs", "#faq"], ["Reserve a place", "#reserve"]].map(([l, h], i) =>
                e("li", { key: i }, e("a", { href: h }, l)))))),
        e("div", { className: "t3-footer__bar" },
          e("span", null, "© ", new Date().getFullYear(), " ", cfg.practice, ". Confidence Rejuvenated."),
          e("span", { style: { maxWidth: 720 } }, "The practice guarantees keeping your teeth straight for 2 years, as long as you abide by the conditions, sign up to the plan, etc."))),
    );

  /* sticky mobile CTA ----------------------------------------------------- */
  const StickyCTA = ({ cfg }) => {
    const [show, setShow] = useState(false);
    React.useEffect(() => {
      const onScroll = () => { const p = window.scrollY > 520; setShow(p); document.documentElement.classList.toggle("past-fold", p); };
      window.addEventListener("scroll", onScroll, { passive: true });
      onScroll();
      return () => window.removeEventListener("scroll", onScroll);
    }, []);
    return e("div", { className: "t3-stickycta" + (show ? " is-on" : ""), "aria-hidden": !show },
      e("a", { className: "t3-stickycta__call", href: "tel:" + cfg.phone.replace(/\s/g, ""), "aria-label": "Call us" },
        e(Icon, { name: "phone" }), e("span", null, "Call")),
      e("a", { className: "t3-stickycta__book", href: "#reserve" }, "Reserve your spot"));
  };

  window.T3C = { Ortho, Finance, Reviews, FAQ, FinalCTA, Footer, StickyCTA };
})();
