// product-page.jsx — Data-driven product page.
// Reads window.__PRODUCT_SLUG, looks up PRODUCT_DATA[slug], renders the page.
// Sections: Hero · Overview · Features · Specs · Applications · Gallery · FAQ · Related · CTA.

const ART_MAP_PP = {
  tank: ProverTankArt, measure: TestMeasureArt, water: WaterDrawArt,
  tower: TankerTowerArt, bench: TestBenchArt, lab: MinilabArt,
};

const PP_LOCALE = window.location.pathname.includes('/es/') ? 'es'
                : window.location.pathname.includes('/pt/') ? 'pt'
                : 'en';

const PP_I18N = {
  en: {
    requestQuote: 'Request a Quote',
    askEngineering: 'Ask engineering',
    downloadDatasheet: 'Download Datasheet (PDF)',
    contactHref: 'contact.html',
    ctaEyebrow: 'Get a custom configuration',
    ctaBody: "Send your flow rate, accuracy class, and the standards you must comply with. We'll return a configuration and quote within two business days.",
    chatWA: 'Chat on WhatsApp',
  },
  es: {
    requestQuote: 'Solicitar Cotización',
    askEngineering: 'Consultar a ingeniería',
    downloadDatasheet: 'Descargar ficha técnica (PDF)',
    contactHref: 'es/contacto',
    ctaEyebrow: 'Obtener una configuración a medida',
    ctaBody: 'Envíenos su caudal requerido, clase de exactitud y las normas que debe cumplir. Devolvemos una configuración y cotización en dos días hábiles.',
    chatWA: 'Chatear por WhatsApp',
  },
  pt: {
    requestQuote: 'Solicitar Cotação',
    askEngineering: 'Consultar engenharia',
    downloadDatasheet: 'Baixar ficha técnica (PDF)',
    contactHref: 'pt/contato',
    ctaEyebrow: 'Obter uma configuração sob medida',
    ctaBody: 'Envie-nos seu fluxo requerido, classe de exatidão e as normas que deve cumprir. Retornamos uma configuração e cotação em dois dias úteis.',
    chatWA: 'Conversar no WhatsApp',
  },
};
const t = PP_I18N[PP_LOCALE];

/* ─── Product hero ──────────────────────────────────────────────────── */
function ProductHero({ data }) {
  const heroSrc = LONETTI_PHOTOS[data.heroPhoto];
  const Art = ART_MAP_PP[data.art];
  return (
    <section className="surface-dark grid-bg" style={{ paddingTop: 64, paddingBottom: 96, position: "relative", overflow: "hidden" }}>
      <div className="container">
        {/* Breadcrumb */}
        <nav aria-label="Breadcrumb" style={{ marginBottom: 56, fontSize: 13, color: "rgba(255,255,255,0.55)" }}>
          <span style={{ display: "inline-flex", gap: 8, alignItems: "center" }}>
            <a href="index.html" style={{ color: "rgba(255,255,255,0.65)" }}>Home</a>
            <span style={{ opacity: 0.4 }}>/</span>
            <a href="#" style={{ color: "rgba(255,255,255,0.65)" }}>Products</a>
            <span style={{ opacity: 0.4 }}>/</span>
            <span style={{ color: "#fff" }}>{data.h1Plain}</span>
          </span>
        </nav>

        <div style={{ display: "grid", gridTemplateColumns: "1.1fr 0.9fr", gap: 80, alignItems: "center" }}>
          <div>
            <div className="eyebrow on-dark" style={{ marginBottom: 22 }}>{data.eyebrow}</div>
            <h1 style={{ color: "#fff", maxWidth: "13ch", marginBottom: 28 }}
              dangerouslySetInnerHTML={{ __html: data.h1.replace(/<em>/g, '<em style="color:var(--red); font-style:normal;">') }}/>
            <p className="lede" style={{ color: "rgba(255,255,255,0.72)", marginBottom: 36, maxWidth: "52ch" }}>
              {data.lede}
            </p>

            <div style={{ display: "flex", gap: 14, marginBottom: 48, flexWrap: "wrap" }}>
              <a className="btn btn-primary" href={t.contactHref}>{t.requestQuote} <Icon name="arrow" size={16} stroke="#fff"/></a>
              <a className="btn btn-ghost-light" href="#"><Icon name="download" size={16}/> {t.downloadDatasheet}</a>
            </div>

            {/* Quick specs strip */}
            <div className="product-quickspecs" style={{
              display: "grid", gridTemplateColumns: `repeat(${data.quickSpecs.length}, 1fr)`,
              borderTop: "1px solid rgba(255,255,255,0.16)",
              borderBottom: "1px solid rgba(255,255,255,0.16)",
            }}>
              {data.quickSpecs.map(([k, v], i) => (
                <div key={k} style={{
                  padding: "20px 16px 20px 0",
                  paddingLeft: i === 0 ? 0 : 20,
                  borderLeft: i === 0 ? 0 : "1px solid rgba(255,255,255,0.1)",
                }}>
                  <div className="mono" style={{ fontSize: 10, letterSpacing: "0.12em", color: "rgba(255,255,255,0.55)", textTransform: "uppercase", marginBottom: 8 }}>{k}</div>
                  <div style={{ fontFamily: "var(--f-display)", fontWeight: 700, fontSize: 22, color: "#fff", letterSpacing: "-0.01em" }}>{v}</div>
                </div>
              ))}
            </div>
          </div>

          <div style={{ position: "relative", minHeight: 520 }} className="product-hero-photo">
            <div style={{ position: "absolute", inset: 0, borderRadius: 6, overflow: "hidden", background: "var(--navy-2)" }}>
              <img src={heroSrc} alt={data.h1Plain}
                style={{ width: "100%", height: "100%", objectFit: "cover" }}/>
              {data.heroCallouts.map((c, i) => (
                <CalloutTag key={i} {...c.pos} label={c.label}/>
              ))}
              {/* Small inline SVG drawing badge — keeps the engineering-diagram identity */}
              <div className="hide-on-mobile" style={{
                position: "absolute", bottom: 16, left: 16,
                width: 88, height: 88, borderRadius: 6,
                background: "rgba(11,15,26,0.78)", backdropFilter: "blur(8px)",
                border: "1px solid rgba(255,255,255,0.18)",
                display: "flex", alignItems: "center", justifyContent: "center",
                color: "#fff",
              }}>
                <Art size={70} accent="#FF6B5A"/>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function CalloutTag({ top, right, left, bottom, label }) {
  return (
    <div className="hide-on-mobile" style={{
      position: "absolute", top, right, left, bottom,
      transform: left ? "translate(-100%, -50%)" : right ? "translate(100%, -50%)" : "translateY(-50%)",
      fontFamily: "var(--f-mono)", fontSize: 10, letterSpacing: "0.14em", textTransform: "uppercase",
      color: "rgba(255,255,255,0.8)", whiteSpace: "nowrap",
      padding: "5px 8px", border: "1px solid rgba(255,255,255,0.22)", borderRadius: 2,
      background: "rgba(11,15,26,0.75)", backdropFilter: "blur(8px)",
    }}>
      {label}
    </div>
  );
}

/* ─── Overview (with SVG drawing inline) ────────────────────────────── */
function OverviewSection({ data }) {
  const Art = ART_MAP_PP[data.art];
  return (
    <section style={{ paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "auto 1fr auto", gap: 64, alignItems: "start" }}>
          <div style={{ maxWidth: 240 }}>
            <div className="eyebrow" style={{ marginBottom: 14 }}>Overview</div>
            <div className="mono" style={{ fontSize: 12, color: "var(--text-3)", letterSpacing: "0.1em", textTransform: "uppercase" }}>
              §1 — {data.overviewKicker}
            </div>
          </div>
          <div style={{ maxWidth: "60ch" }}>
            {data.overviewParas.map((p, i) => (
              <p key={i} style={{
                fontSize: i === 0 ? 19 : 16, lineHeight: i === 0 ? 1.55 : 1.7,
                color: i === 0 ? "var(--text)" : "var(--text-2)",
                margin: 0, marginBottom: 24,
              }}>{p}</p>
            ))}
          </div>
          <div style={{ width: 200, color: "var(--charcoal)", border: "1px solid var(--line)", borderRadius: 6, padding: 18, background: "var(--bg-alt)" }}>
            <div className="mono" style={{ fontSize: 10, letterSpacing: "0.12em", color: "var(--text-3)", textTransform: "uppercase", marginBottom: 12 }}>
              Schematic
            </div>
            <div style={{ display: "flex", justifyContent: "center" }}>
              <Art size={160} accent="var(--red)"/>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Features ──────────────────────────────────────────────────────── */
function FeaturesSection({ data }) {
  return (
    <section style={{ background: "var(--bg-alt)", paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <SectionHead
          eyebrow="Key features"
          h2={`${data.features.length} properties that define a Lonetti ${data.h1Plain.split(" ").slice(-2).join(" ").toLowerCase()}.`}
          lede="Specification points worth comparing against any other supplier — accuracy class, material grade, standards compliance, and configurability."
        />
        <div style={{ marginTop: 56, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0,
          borderTop: "1px solid var(--line)",
          borderLeft: "1px solid var(--line)",
        }}>
          {data.features.map((f) => (
            <div key={f.title} style={{
              padding: "32px 28px",
              borderRight: "1px solid var(--line)",
              borderBottom: "1px solid var(--line)",
              background: "#fff",
              minHeight: 220,
            }}>
              <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 24 }}>
                <span className="mono" style={{ fontSize: 11, letterSpacing: "0.12em", color: "var(--red)" }}>{f.n}</span>
                <span style={{ width: 32, height: 1, background: "var(--line-2)" }}/>
              </div>
              <h3 className="h3" style={{ fontSize: 18, marginBottom: 12 }}>{f.title}</h3>
              <p style={{ margin: 0, fontSize: 14, color: "var(--text-2)", lineHeight: 1.6 }}>{f.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ─── Specs table ───────────────────────────────────────────────────── */
function SpecsSection({ data }) {
  return (
    <section style={{ paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "0.9fr 1.5fr", gap: 80, alignItems: "start" }}>
          <div style={{ position: "sticky", top: 100 }}>
            <div className="eyebrow" style={{ marginBottom: 18 }}>Specifications</div>
            <h2 className="h2" style={{ fontSize: 40, marginBottom: 24, maxWidth: "12ch" }}>
              Built to your spec, certified to ours.
            </h2>
            <p className="lede" style={{ marginBottom: 28 }}>
              These are the parameters our engineering team needs to start a quote.
              For a full technical datasheet of a specific configuration, request the PDF.
            </p>
            <a className="btn btn-ghost-dark" href="#"><Icon name="download" size={16}/> Download full datasheet</a>
          </div>

          <div style={{ border: "1px solid var(--line)", borderRadius: 6, overflow: "hidden", background: "#fff" }}>
            <table style={{ width: "100%", borderCollapse: "collapse", fontSize: 14 }}>
              <tbody>
                {data.specs.map(([k, v], i) => (
                  <tr key={k} style={{ borderBottom: i < data.specs.length - 1 ? "1px solid var(--line)" : 0 }}>
                    <td style={{
                      padding: "18px 24px",
                      fontFamily: "var(--f-mono)", fontSize: 12, letterSpacing: "0.06em",
                      textTransform: "uppercase", color: "var(--text-3)",
                      verticalAlign: "top", width: "40%",
                      background: "var(--bg-alt)",
                    }}>{k}</td>
                    <td style={{ padding: "18px 24px", color: "var(--text)", lineHeight: 1.55 }}>{v}</td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Applications ──────────────────────────────────────────────────── */
function ApplicationsSection({ data }) {
  return (
    <section className="surface-dark" style={{ paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <SectionHead
          dark
          eyebrow="Applications"
          h2={`Where Lonetti ${data.h1Plain.toLowerCase().split(" ").slice(-2).join(" ")} go to work.`}
          lede="The same engineering platform serves several distinct use cases. Configuration varies; accuracy class doesn't."
        />
        <div style={{ marginTop: 56, display: "grid", gridTemplateColumns: `repeat(${data.applications.length}, 1fr)`, gap: 0 }}>
          {data.applications.map((a, i) => (
            <div key={a.title} style={{
              padding: "32px 24px",
              borderLeft: i === 0 ? 0 : "1px solid rgba(255,255,255,0.12)",
            }}>
              <div className="mono" style={{ fontSize: 11, letterSpacing: "0.12em", color: "var(--red)", marginBottom: 28 }}>0{i + 1}</div>
              <h3 style={{ fontFamily: "var(--f-display)", fontWeight: 600, fontSize: 19, color: "#fff", marginBottom: 12, letterSpacing: "-0.01em" }}>{a.title}</h3>
              <p style={{ margin: 0, fontSize: 13.5, color: "rgba(255,255,255,0.66)", lineHeight: 1.6 }}>{a.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ─── Gallery + lightbox ────────────────────────────────────────────── */
function GallerySection({ data }) {
  const [lightbox, setLightbox] = useState(null);
  // Resolve photoKey → real photo URL (also accept literal paths like "measurement-equipment-on-trailer")
  const items = data.gallery.map((it) => ({
    ...it,
    photo: LONETTI_PHOTOS[it.photoKey] || `images/${it.photoKey}.jpg`,
  }));
  return (
    <section style={{ background: "var(--bg-alt)", paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <SectionHead
          eyebrow="Gallery"
          h2="Workshop, field, and deployment."
        />
        <div style={{ marginTop: 56, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }}>
          {items.map((it, i) => (
            <button key={i} onClick={() => setLightbox(i)} style={{
              position: "relative", overflow: "hidden",
              aspectRatio: "4/3", border: 0, padding: 0,
              background: "var(--charcoal)", borderRadius: 6,
              cursor: "pointer",
            }}>
              <img src={it.photo} alt={it.caption} loading="lazy"
                style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" }}/>
              <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.75) 100%)", pointerEvents: "none" }}/>
              <div style={{ position: "absolute", top: 14, left: 14, pointerEvents: "none" }}>
                <span className="chip on-dark" style={{ fontSize: 10, background: "rgba(11,15,26,0.7)", backdropFilter: "blur(6px)" }}>{it.tag}</span>
              </div>
              <div style={{ position: "absolute", bottom: 14, left: 14, right: 14, color: "#fff", fontSize: 13, fontWeight: 500, textAlign: "left", pointerEvents: "none" }}>
                {it.caption}
              </div>
            </button>
          ))}
        </div>
      </div>
      {lightbox !== null && (
        <Lightbox item={items[lightbox]}
          onClose={() => setLightbox(null)}
          onPrev={() => setLightbox((lightbox - 1 + items.length) % items.length)}
          onNext={() => setLightbox((lightbox + 1) % items.length)}
          idx={lightbox} total={items.length}/>
      )}
    </section>
  );
}

function Lightbox({ item, onClose, onPrev, onNext, idx, total }) {
  useEffect(() => {
    const onKey = (e) => {
      if (e.key === "Escape") onClose();
      if (e.key === "ArrowLeft") onPrev();
      if (e.key === "ArrowRight") onNext();
    };
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [onClose, onPrev, onNext]);
  return (
    <div style={{
      position: "fixed", inset: 0, zIndex: 200,
      background: "rgba(11,15,26,0.94)",
      display: "flex", alignItems: "center", justifyContent: "center",
    }} onClick={onClose}>
      <button onClick={(e) => { e.stopPropagation(); onClose(); }} style={{
        position: "absolute", top: 24, right: 24,
        width: 44, height: 44, borderRadius: "50%", background: "rgba(255,255,255,0.08)",
        border: "1px solid rgba(255,255,255,0.18)", color: "#fff",
      }}><Icon name="close" size={20} stroke="#fff"/></button>

      <button onClick={(e) => { e.stopPropagation(); onPrev(); }} style={{
        position: "absolute", left: 32, top: "50%",
        width: 52, height: 52, borderRadius: "50%", background: "rgba(255,255,255,0.06)",
        border: "1px solid rgba(255,255,255,0.18)", color: "#fff", display: "flex", alignItems: "center", justifyContent: "center",
        transform: "translateY(-50%) rotate(180deg)",
      }}><Icon name="arrow" size={20} stroke="#fff"/></button>

      <button onClick={(e) => { e.stopPropagation(); onNext(); }} style={{
        position: "absolute", right: 32, top: "50%", transform: "translateY(-50%)",
        width: 52, height: 52, borderRadius: "50%", background: "rgba(255,255,255,0.06)",
        border: "1px solid rgba(255,255,255,0.18)", color: "#fff", display: "flex", alignItems: "center", justifyContent: "center",
      }}><Icon name="arrow" size={20} stroke="#fff"/></button>

      <div onClick={(e) => e.stopPropagation()} style={{
        background: "var(--navy-2)", borderRadius: 6, overflow: "hidden",
        width: "min(80vw, 1000px)", aspectRatio: "4/3",
        position: "relative",
      }}>
        <img src={item.photo} alt={item.caption}
          style={{ width: "100%", height: "100%", objectFit: "cover" }}/>
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.78) 100%)", pointerEvents: "none" }}/>
        <div style={{ position: "absolute", bottom: 24, left: 32, right: 32, display: "flex", justifyContent: "space-between", alignItems: "end", color: "#fff" }}>
          <div>
            <div className="eyebrow on-dark" style={{ marginBottom: 8 }}>{item.tag}</div>
            <div style={{ fontFamily: "var(--f-display)", fontWeight: 600, fontSize: 22 }}>{item.caption}</div>
          </div>
          <div className="mono" style={{ fontSize: 12, color: "rgba(255,255,255,0.7)" }}>
            {String(idx + 1).padStart(2, "0")} / {String(total).padStart(2, "0")}
          </div>
        </div>
      </div>
    </div>
  );
}

/* ─── FAQ ───────────────────────────────────────────────────────────── */
function FaqSection({ data }) {
  const [open, setOpen] = useState(0);
  return (
    <section style={{ paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1.4fr", gap: 80, alignItems: "start" }}>
          <div style={{ position: "sticky", top: 100 }}>
            <div className="eyebrow" style={{ marginBottom: 18 }}>FAQ</div>
            <h2 className="h2" style={{ fontSize: 40, marginBottom: 18, maxWidth: "14ch" }}>
              Common questions.
            </h2>
            <p style={{ fontSize: 15, color: "var(--text-2)", lineHeight: 1.6, marginBottom: 24, maxWidth: "44ch" }}>
              Don't see your question? Talk to our engineering team — they answer within one business day.
            </p>
            <a className="btn btn-ghost-dark" href={t.contactHref}>{t.askEngineering} <Icon name="arrow" size={16}/></a>
          </div>
          <div>
            {data.faq.map((qa, i) => (
              <div key={qa.q} style={{
                borderBottom: i < data.faq.length - 1 ? "1px solid var(--line)" : 0,
              }}>
                <button onClick={() => setOpen(open === i ? -1 : i)} style={{
                  width: "100%", textAlign: "left", padding: "24px 0",
                  display: "flex", alignItems: "center", justifyContent: "space-between", gap: 24,
                  border: 0, background: "transparent",
                  fontFamily: "var(--f-display)", fontWeight: 600, fontSize: 19, color: "var(--text)", letterSpacing: "-0.01em",
                  lineHeight: 1.3,
                }}>
                  <span>{qa.q}</span>
                  <span style={{ flexShrink: 0, width: 36, height: 36, borderRadius: "50%",
                    background: open === i ? "var(--red)" : "var(--bg-alt)",
                    color: open === i ? "#fff" : "var(--text)",
                    display: "flex", alignItems: "center", justifyContent: "center",
                    transition: "all 200ms ease",
                  }}>
                    <Icon name={open === i ? "minus" : "plus"} size={16} stroke="currentColor"/>
                  </span>
                </button>
                {open === i && (
                  <div style={{ padding: "0 0 28px", fontSize: 15.5, color: "var(--text-2)", lineHeight: 1.65, maxWidth: "60ch" }}>
                    {qa.a}
                  </div>
                )}
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Related ───────────────────────────────────────────────────────── */
function RelatedSection({ data }) {
  const related = data.related.map((slug) => PRODUCT_DATA[slug]).filter(Boolean);
  return (
    <section style={{ background: "var(--bg-alt)", paddingTop: 96, paddingBottom: 96 }}>
      <div className="container">
        <SectionHead
          eyebrow="Related products"
          h2="Often specified alongside."
        />
        <div style={{ marginTop: 56, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 24 }}>
          {related.map((r) => {
            const photo = LONETTI_PHOTOS[r.heroPhoto];
            return (
              <a key={r.slug} href={`${r.slug}.html`} style={{
                display: "flex", flexDirection: "column",
                background: "#fff",
                border: "1px solid var(--line)", borderRadius: 6,
                overflow: "hidden",
                transition: "all 200ms ease",
              }}
              onMouseEnter={(e) => { e.currentTarget.style.borderColor = "var(--navy)"; e.currentTarget.style.transform = "translateY(-2px)"; }}
              onMouseLeave={(e) => { e.currentTarget.style.borderColor = "var(--line)"; e.currentTarget.style.transform = "translateY(0)"; }}>
                <div style={{ height: 200, background: "var(--bg-mid)", position: "relative", overflow: "hidden", borderBottom: "1px solid var(--line)" }}>
                  <img src={photo} alt={r.h1Plain} loading="lazy"
                    style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }}/>
                </div>
                <div style={{ padding: "24px 28px 28px", display: "flex", flexDirection: "column", gap: 8 }}>
                  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
                    <span className="mono" style={{ fontSize: 11, letterSpacing: "0.12em", color: "var(--text-3)", textTransform: "uppercase" }}>0{r.nav} / 06</span>
                    <Icon name="arrow" size={16} stroke="var(--text-3)"/>
                  </div>
                  <h3 className="h3" style={{ fontSize: 20, margin: 0 }}>{r.h1Plain}</h3>
                </div>
              </a>
            );
          })}
        </div>
      </div>
    </section>
  );
}

/* ─── Bottom CTA ─────────────────────────────────────────────────────── */
function ProductCtaBlock({ data }) {
  return (
    <section id="quote" style={{ background: "var(--red)", color: "#fff", padding: "96px 0", position: "relative", overflow: "hidden" }}>
      <div style={{
        position: "absolute", inset: 0, opacity: 0.08, pointerEvents: "none",
        backgroundImage: "linear-gradient(45deg, #fff 1px, transparent 1px)",
        backgroundSize: "10px 10px",
      }}/>
      <div className="container" style={{ position: "relative", textAlign: "center" }}>
        <div className="eyebrow on-dark" style={{ color: "#fff", opacity: 0.7, marginBottom: 20, justifyContent: "center" }}>{t.ctaEyebrow}</div>
        <h2 className="h2" style={{ color: "#fff", maxWidth: "22ch", margin: "0 auto", fontSize: "clamp(36px, 4vw, 56px)" }}>
          {data.ctaTitle}
        </h2>
        <p className="lede" style={{ color: "rgba(255,255,255,0.85)", margin: "24px auto 36px", maxWidth: "56ch" }}>
          {t.ctaBody}
        </p>
        <div style={{ display: "flex", gap: 14, justifyContent: "center", flexWrap: "wrap" }}>
          <a className="btn" style={{ background: "#fff", color: "var(--red)", fontWeight: 700 }} href={t.contactHref}>
            {t.requestQuote} <Icon name="arrow" size={16} stroke="var(--red)"/>
          </a>
          <a className="btn btn-ghost-light" href="https://wa.me/5491127884190" target="_blank" rel="noopener noreferrer">
            <Icon name="whatsapp" size={16}/> {t.chatWA}
          </a>
        </div>
      </div>
    </section>
  );
}

/* ─── Product page root ─────────────────────────────────────────────── */
function ProductPage() {
  const slug = window.__PRODUCT_SLUG;
  const data = PRODUCT_DATA[slug];
  if (!data) {
    return <div style={{ padding: 80, textAlign: "center" }}>Product not found: {slug}</div>;
  }
  return (
    <>
      <Nav active="products"/>
      <main>
        <ProductHero data={data}/>
        <OverviewSection data={data}/>
        <FeaturesSection data={data}/>
        <SpecsSection data={data}/>
        <ApplicationsSection data={data}/>
        <GallerySection data={data}/>
        <FaqSection data={data}/>
        <RelatedSection data={data}/>
        <ProductCtaBlock data={data}/>
      </main>
      <Footer/>
      <FloatingWhatsApp/>
    </>
  );
}

Object.assign(window, { ProductPage });
