/* global React, MOTIFS, CalaveraMotif, SolAzteca, CraneoVela, GlyphDiamond, Star4, PH, CATEGORIES, fmt,
   IconSearch, IconBag, IconUser, IconChevron, IconHeart, IconWhats, IconMail, IconClock,
   IconIG, IconTT, IconFB, IconPin, IconArrow */
const { createElement: e, useContext, useState } = React;

/* ---- Contexto global ---- */
const AppCtx = React.createContext(null);
const useApp = () => useContext(AppCtx);

/* ============ MODAL reutilizable ============ */
function Modal({ open, onClose, title, children, maxWidth = 520 }) {
  if (!open) return null;
  return e("div", { onClick: onClose, style: { position: "fixed", inset: 0, zIndex: 200, background: "rgba(4,8,6,.74)", backdropFilter: "blur(3px)", WebkitBackdropFilter: "blur(3px)", display: "grid", placeItems: "center", padding: 24 } },
    e("div", { onClick: ev => ev.stopPropagation(), style: { width: "100%", maxWidth, background: "var(--green)", border: "1px solid var(--gold-deep)", borderRadius: 8, boxShadow: "var(--shadow-soft)", overflow: "hidden" } },
      e("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: "1px solid var(--green-line)" } },
        e("span", { className: "display", style: { fontSize: 16, textTransform: "uppercase", letterSpacing: ".1em", color: "var(--gold-claro)" } }, title),
        e("button", { onClick: onClose, "aria-label": "Cerrar", style: { background: "none", border: "none", color: "var(--cream-soft)", display: "grid", placeItems: "center" } }, e(IconClose, { size: 20 }))),
      e("div", { style: { padding: 20 } }, children)));
}

/* ---- Modal de búsqueda ---- */
function SearchModal({ open, onClose }) {
  const { navigate } = useApp();
  const [q, setQ] = useState("");
  const term = q.trim().toLowerCase();
  const res = term ? PRODUCTS.filter(p => (p.name + " " + p.desc + " " + p.cat).toLowerCase().includes(term)).slice(0, 6) : [];
  const go = (id) => { setQ(""); onClose(); navigate("product", { id }); };
  return e(Modal, { open, onClose, title: "Buscar", maxWidth: 580 },
    e("input", { className: "field", autoFocus: true, placeholder: "Busca velas, bolsas, tarot…", value: q, onChange: ev => setQ(ev.target.value) }),
    term && (res.length
      ? e("div", { style: { marginTop: 14, display: "flex", flexDirection: "column", gap: 8 } },
          res.map(p => e("button", { key: p.id, onClick: () => go(p.id), style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 14, background: "rgba(0,0,0,.22)", border: "1px solid var(--card-line)", borderRadius: 6, padding: "12px 14px", textAlign: "left", color: "var(--cream)" } },
            e("span", { className: "serif", style: { fontSize: 17 } }, p.name),
            e("span", { className: "display", style: { fontSize: 14, color: "var(--gold-claro)", whiteSpace: "nowrap" } }, fmt(p.price)))))
      : e("p", { className: "serif", style: { marginTop: 14, color: "var(--cream-soft)", fontSize: 17 } }, "Sin resultados para “" + q + "”")));
}

/* ---- Modal de cuenta ---- */
function AccountModal({ open, onClose }) {
  const [done, setDone] = useState(false);
  return e(Modal, { open, onClose: () => { setDone(false); onClose(); }, title: "Mi cuenta" },
    done
      ? e("p", { className: "serif", style: { color: "var(--cream-soft)", fontSize: 18, lineHeight: 1.5 } }, "✦ Sesión iniciada (demostración). Este prototipo no tiene servidor todavía.")
      : e("form", { onSubmit: ev => { ev.preventDefault(); setDone(true); }, style: { display: "flex", flexDirection: "column", gap: 12 } },
          e("input", { className: "field", type: "email", required: true, placeholder: "Correo electrónico" }),
          e("input", { className: "field", type: "password", required: true, placeholder: "Contraseña" }),
          e("button", { className: "btn btn-gold btn-full", type: "submit" }, "Iniciar sesión"),
          e("div", { style: { textAlign: "center", fontSize: 14.5, color: "var(--cream-soft)", fontFamily: "var(--font-serif)" } }, "¿Nuevo en el camino? Crea tu cuenta")));
}

/* ============ DIVISOR ORNAMENTAL (reemplaza papel picado) ============ */
function Flourish({ color = "var(--gold-deep)", mt = 0, mb = 0 }) {
  return e("div", { className: "flourish", style: { marginTop: mt, marginBottom: mb, color } },
    e("span", { className: "ln" }),
    e(Star4, { size: 12 }), e(GlyphDiamond, { size: 13 }), e(Star4, { size: 12 }),
    e("span", { className: "ln r" }));
}
/* alias para compatibilidad: tira de greca dorada */
function PapelPicado({ height = 18 }) {
  const tile = encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' width='44' height='18' viewBox='0 0 44 18'><g fill='none' stroke='%238A6A2A' stroke-width='1.4'><path d='M2 13 V7 H11 V3 H22 V7 H33 V13'/></g><circle cx='22' cy='15' r='1.4' fill='%23C49A4A'/></svg>");
  return e("div", { style: { height, width: "100%", flex: "none", backgroundImage: `url("data:image/svg+xml,${tile}")`, backgroundRepeat: "repeat-x", backgroundSize: "auto 100%", backgroundPosition: "center", opacity: .85, borderTop: "1px solid rgba(138,106,42,.25)", borderBottom: "1px solid rgba(138,106,42,.25)" } });
}

/* ============ ENCABEZADO DE SECCIÓN ============ */
function SectionHead({ children, color = "var(--gold-claro)", lineColor = "var(--gold-deep)" }) {
  return e("div", { className: "section-head" },
    e("div", { className: "line", style: { background: `linear-gradient(90deg,transparent,${lineColor})` } }),
    e(Star4, { size: 13, style: { color: lineColor } }),
    e("h2", { style: { color } }, children),
    e(Star4, { size: 13, style: { color: lineColor } }),
    e("div", { className: "line r", style: { background: `linear-gradient(90deg,${lineColor},transparent)` } }));
}

/* ============ PLACEHOLDER FOTO ============ */
function Foto({ motif = "calavera", color = "noche", hint = "Sube tu foto", src, style }) {
  const pal = PH[color] || PH.noche;
  const Motif = MOTIFS[motif] || CalaveraMotif;
  /* si hay foto real, se muestra con marco; el SVG queda solo de respaldo */
  if (src) {
    return e("div", { className: "foto foto-img", style: { backgroundImage: `url("${src}")`, backgroundSize: "cover", backgroundPosition: "center", ...style } },
      e("div", { className: "talavera-frame" }),
      e(GlyphDiamond, { className: "corner tl", size: 14 }),
      e(GlyphDiamond, { className: "corner tr", size: 14 }),
      e(GlyphDiamond, { className: "corner bl", size: 14 }),
      e(GlyphDiamond, { className: "corner br", size: 14 }));
  }
  return e("div", { className: "foto", style: { "--ph-bg": pal.bg, "--ph-ink": pal.ink, "--ph-line": pal.line, ...style } },
    e("div", { className: "talavera-frame" }),
    e(GlyphDiamond, { className: "corner tl", size: 14 }),
    e(GlyphDiamond, { className: "corner tr", size: 14 }),
    e(GlyphDiamond, { className: "corner bl", size: 14 }),
    e(GlyphDiamond, { className: "corner br", size: 14 }),
    e(Motif, { className: "motif" }),
    hint && e("div", { className: "ph-hint" }, hint));
}

/* ============ TARJETA DE PRODUCTO ============ */
const BADGE_BG = { "Más vendido": "var(--wine)", "Nuevo": "var(--green-3)", "Edición limitada": "var(--gold-deep)", "Yule": "var(--green-3)" };

function ProductCard({ p, height = 280 }) {
  const { navigate, addToCart, isFav, toggleFav } = useApp();
  const fav = isFav(p.id);
  const hasModels = Array.isArray(p.models) && p.models.length > 0;
  const isCustom = !!p.custom;
  const minPrice = hasModels ? Math.min.apply(null, p.models.map(m => m.price)) : p.price;
  return e("article", { className: "card", style: { cursor: "pointer", display: "flex", flexDirection: "column" }, onClick: () => navigate("product", { id: p.id }) },
    e("div", { style: { position: "relative", height } },
      e(Foto, { motif: p.motif, color: p.color, src: p.img || null, hint: (CATEGORIES.find(c => c.id === p.cat) || {}).name, style: { height: "100%" } }),
      p.badge && e("span", { className: "badge", style: { position: "absolute", top: 12, left: 12, background: BADGE_BG[p.badge] || "var(--wine)", border: "1px solid rgba(231,206,138,.3)" } }, p.badge),
      e("button", { "aria-label": "Favorito", onClick: (ev) => { ev.stopPropagation(); toggleFav(p.id); }, style: { position: "absolute", top: 10, right: 10, width: 34, height: 34, borderRadius: "50%", border: "1px solid var(--card-line)", background: "rgba(8,16,11,.7)", display: "grid", placeItems: "center", color: fav ? "var(--rose)" : "var(--cream-soft)" } },
        e(IconHeart, { size: 17, fill: fav ? "currentColor" : "none" }))),
    e("div", { style: { padding: "18px 16px 18px", textAlign: "center", display: "flex", flexDirection: "column", gap: 8, flex: 1 } },
      e("h3", { className: "serif", style: { fontSize: 21, fontWeight: 600, margin: 0, lineHeight: 1.15, color: "var(--cream)", flex: 1 } }, p.name),
      e("div", { className: "display", style: { fontSize: 17, color: "var(--gold-claro)", letterSpacing: ".05em" } }, p.draft ? "Precio a definir" : (hasModels ? "desde " + fmt(minPrice) : fmt(p.price))),
      p.draft
        ? e("button", { className: "btn btn-ghost btn-full", style: { marginTop: 8, fontSize: 11.5, padding: "13px 0" }, onClick: (ev) => { ev.stopPropagation(); navigate("product", { id: p.id }); } }, "Próximamente")
        : hasModels
        ? e("button", { className: "btn btn-wine btn-full", style: { marginTop: 8, fontSize: 11.5, padding: "13px 0" }, onClick: (ev) => { ev.stopPropagation(); navigate("product", { id: p.id }); } },
            "Elegir " + ((p.variantLabel || "modelo").toLowerCase()), e(IconChevron, { size: 14, style: { transform: "rotate(-90deg)" } }))
        : isCustom
        ? e("button", { className: "btn btn-wine btn-full", style: { marginTop: 8, fontSize: 11.5, padding: "13px 0" }, onClick: (ev) => { ev.stopPropagation(); navigate("product", { id: p.id }); } },
            "Personalizar", e(IconChevron, { size: 14, style: { transform: "rotate(-90deg)" } }))
        : e("button", { className: "btn btn-wine btn-full", style: { marginTop: 8, fontSize: 11.5, padding: "13px 0" }, onClick: (ev) => { ev.stopPropagation(); addToCart(p, 1); } },
            "Agregar al carrito", e(IconBag, { size: 15 }))));
}

/* ============ HEADER ============ */
const NAV_L = [
  { label: "Inicio", to: ["home", {}] },
  { label: "Tienda", to: ["catalog", {}], drop: true },
  { label: "Lo Nuevo", to: ["catalog", { nuevo: true }] }
];
const NAV_R = [
  { label: "Colecciones", to: ["catalog", {}] },
  { label: "Contacto", to: ["home", { contacto: true }] }
];

function NavLink({ label, onClick, drop }) {
  return e("button", { onClick, style: { background: "none", border: "none", color: "var(--cream)", fontFamily: "var(--font-ui)", fontSize: 12.5, fontWeight: 500, letterSpacing: ".16em", textTransform: "uppercase", padding: "6px 0", display: "inline-flex", alignItems: "center", gap: 6 },
    onMouseOver: (ev) => ev.currentTarget.style.color = "var(--gold-claro)", onMouseOut: (ev) => ev.currentTarget.style.color = "var(--cream)" },
    label, drop && e(IconChevron, { size: 14 }));
}

/* Listón de anuncios — ahora va DEBAJO del hero (no en la cima) */
function AnnouncementBar() {
  return e("div", { style: { background: "#08110B", color: "var(--gold-claro)", fontSize: 11.5, letterSpacing: ".14em", textTransform: "uppercase", fontWeight: 500, borderTop: "1px solid var(--green-line)", borderBottom: "1px solid var(--green-line)" } },
    e("div", { className: "wrap", style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 28, minHeight: 42, flexWrap: "wrap", textAlign: "center", padding: "8px 0" } },
      e("span", { style: { color: "var(--cream-soft)" } }, "Envíos a todo México"),
      e(Star4, { size: 9, style: { color: "var(--gold-deep)", flex: "none" } }),
      e("span", { style: { color: "var(--cream-soft)" } }, "Entrega en CDMX"),
      e(Star4, { size: 9, style: { color: "var(--gold-deep)", flex: "none" } }),
      e("a", { href: "https://wa.me/message/CR42U3DQIYNNI1", target: "_blank", rel: "noopener noreferrer", style: { display: "inline-flex", alignItems: "center", gap: 8, color: "var(--cream-soft)", textDecoration: "none" } }, e(IconWhats, { size: 13, style: { color: "var(--gold)" } }), "WhatsApp")));
}

function Header() {
  const { navigate, cartCount, favCount } = useApp();
  const [openCat, setOpenCat] = useState(false);
  const [modal, setModal] = useState(null); // "search"
  const [menuOpen, setMenuOpen] = useState(false);
  const scrollFooter = () => { const sc = document.querySelector(".app-scroll"); if (sc) sc.scrollTo({ top: sc.scrollHeight, behavior: "smooth" }); };
  return e(React.Fragment, null,
    e("header", { style: { position: "sticky", top: 0, zIndex: 50 } },
    e("div", { className: "foliage", style: { background: "linear-gradient(180deg,var(--green),var(--bg-2))" } },
      e("div", { className: "wrap", style: { position: "relative", display: "flex", alignItems: "center", justifyContent: "space-between", height: 76, gap: 20 } },
        e("button", { className: "nav-burger", "aria-label": "Menú", onClick: () => setMenuOpen(v => !v), style: { color: "var(--gold-claro)" } },
          e("svg", { width: 26, height: 26, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round" },
            menuOpen ? e("path", { d: "M6 6 L18 18 M6 18 L18 6" })
                     : e(React.Fragment, null, e("path", { d: "M3 6h18" }), e("path", { d: "M3 12h18" }), e("path", { d: "M3 18h18" })))),
        e("nav", { className: "nav-desktop-l", style: { display: "flex", gap: 26, flex: 1 } },
          NAV_L.map((n, i) => n.drop
            ? e("div", { key: i, style: { position: "relative" }, onMouseEnter: () => setOpenCat(true), onMouseLeave: () => setOpenCat(false) },
                e(NavLink, { label: n.label, drop: true, onClick: () => navigate(...n.to) }),
                openCat && e("div", { style: { position: "absolute", top: "100%", left: -14, background: "var(--green)", border: "1px solid var(--green-line)", borderRadius: 6, padding: "10px 0", minWidth: 200, boxShadow: "var(--shadow-card)", zIndex: 60 } },
                  CATEGORIES.map(cat => e("button", { key: cat.id, onClick: () => { navigate("catalog", { cat: cat.id }); setOpenCat(false); }, style: { display: "block", width: "100%", textAlign: "left", background: "none", border: "none", color: "var(--cream)", padding: "9px 20px", fontFamily: "var(--font-serif)", fontSize: 16 }, onMouseOver: ev => { ev.currentTarget.style.color = "var(--gold-claro)"; ev.currentTarget.style.background = "rgba(0,0,0,.2)"; }, onMouseOut: ev => { ev.currentTarget.style.color = "var(--cream)"; ev.currentTarget.style.background = "none"; } }, cat.name))))
            : e(NavLink, { key: i, label: n.label, onClick: () => navigate(...n.to) }))),
        e("button", { onClick: () => navigate("home", {}), "aria-label": "Inicio", style: { background: "none", border: "none", position: "absolute", left: "50%", transform: "translateX(-50%)", display: "grid", placeItems: "center", cursor: "pointer", padding: 0 } },
          e("img", { src: "img/logo-craneo-oro.png", alt: "Mictlán", style: { height: 58, width: "auto", display: "block" } })),
        e("div", { style: { display: "flex", alignItems: "center", gap: 16, flex: 1, justifyContent: "flex-end", color: "var(--cream)" } },
          e("nav", { className: "nav-desktop-r", style: { display: "flex", gap: 26, marginRight: 8 } }, NAV_R.map((n, i) => e(NavLink, { key: i, label: n.label, onClick: n.label === "Contacto" ? scrollFooter : () => navigate(...n.to) }))),
          e("button", { style: ICONBTN, "aria-label": "Buscar", onClick: () => setModal("search") }, e(IconSearch, { size: 19 })),
          e("button", { style: { ...ICONBTN, position: "relative" }, "aria-label": "Favoritos", onClick: () => navigate("catalog", { favs: true }) },
            e(IconHeart, { size: 19 }),
            favCount > 0 && e("span", { style: { position: "absolute", top: -7, right: -8, background: "var(--wine-2)", color: "var(--gold-claro)", fontSize: 9.5, fontWeight: 700, minWidth: 16, height: 16, borderRadius: 8, display: "grid", placeItems: "center", padding: "0 4px" } }, favCount)),
          e("button", { style: { ...ICONBTN, position: "relative" }, "aria-label": "Carrito", onClick: () => navigate("cart", {}) },
            e(IconBag, { size: 19 }),
            cartCount > 0 && e("span", { style: { position: "absolute", top: -7, right: -8, background: "var(--gold)", color: "#1c1205", fontSize: 9.5, fontWeight: 700, minWidth: 16, height: 16, borderRadius: 8, display: "grid", placeItems: "center", padding: "0 4px" } }, cartCount)))),
      e("div", { className: "nav-drawer" + (menuOpen ? " open" : "") },
        NAV_L.map((n, i) => n.drop
          ? e(React.Fragment, { key: "tienda" },
              e("button", { className: "nav-drawer-link", onClick: () => { navigate(...n.to); setMenuOpen(false); } }, n.label),
              CATEGORIES.map(cat => e("button", { key: cat.id, className: "nav-drawer-link nav-drawer-sub", onClick: () => { navigate("catalog", { cat: cat.id }); setMenuOpen(false); } }, cat.name)))
          : e("button", { key: "l" + i, className: "nav-drawer-link", onClick: () => { navigate(...n.to); setMenuOpen(false); } }, n.label)),
        NAV_R.map((n, i) => e("button", { key: "r" + i, className: "nav-drawer-link", onClick: () => { (n.label === "Contacto" ? scrollFooter() : navigate(...n.to)); setMenuOpen(false); } }, n.label))))),
    e(SearchModal, { open: modal === "search", onClose: () => setModal(null) }));
}
const ICONBTN = { background: "none", border: "none", color: "inherit", padding: 0, display: "grid", placeItems: "center" };

/* ============ FOOTER ============ */
const PAYMENTS = ["VISA", "MASTERCARD", "AMEX", "OXXO", "PayPal", "STRIPE"];
function FooterCol({ title, items }) {
  const { navigate } = useApp();
  return e("div", null,
    e("div", { className: "eyebrow", style: { color: "var(--gold-claro)", marginBottom: 18, fontSize: 11.5 } }, title),
    e("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: 10 } },
      items.map((it, i) => {
        const label = typeof it === "string" ? it : it.label;
        const to = (it && it.to) ? it.to : ["catalog", {}];
        return e("li", { key: i },
          e("button", { onClick: () => navigate(to[0], to[1] || {}), style: { background: "none", border: "none", color: "var(--cream-soft)", fontFamily: "var(--font-serif)", fontSize: 16, padding: 0, textAlign: "left", cursor: "pointer" }, onMouseOver: ev => ev.currentTarget.style.color = "var(--gold-claro)", onMouseOut: ev => ev.currentTarget.style.color = "var(--cream-soft)" }, label));
      })));
}

function Footer() {
  const { navigate } = useApp();
  const [sent, setSent] = useState(false);
  return e("footer", { className: "foliage", style: { background: "linear-gradient(180deg,var(--bg-2),#070D09)", color: "var(--cream)", borderTop: "1px solid var(--green-line)" } },
    e("div", { className: "wrap footer-grid", style: { padding: "56px 32px 34px", display: "grid", gridTemplateColumns: "1.5fr 1.1fr 1.1fr 1.2fr", gap: 40, position: "relative", zIndex: 2 } },
      e("div", { style: { textAlign: "center" } },
        e("div", { style: { cursor: "pointer" }, onClick: () => navigate("home", {}) },
          e("img", { src: "logo-mictlan.png", alt: "MICTLÁN", style: { width: 200, height: "auto", display: "block", margin: "0 auto", filter: "drop-shadow(0 5px 18px rgba(0,0,0,.95))" } }),
          e("div", { className: "flourish", style: { justifyContent: "center", marginTop: 8, color: "var(--gold-deep)" } }, e("span", { className: "ln" }), e(GlyphDiamond, { size: 11 }), e("span", { className: "ln r" })),
          e("div", { style: { fontSize: 9.5, letterSpacing: ".3em", color: "var(--cream-faint)", marginTop: 8, textTransform: "uppercase", lineHeight: 1.7 } }, "Artículos que hablan", e("br"), "desde la oscuridad")),
        e("div", { style: { display: "flex", gap: 12, marginTop: 26, justifyContent: "center" } },
          [[IconIG, "https://www.instagram.com/mictlan_00/"], [IconTT, "https://www.tiktok.com/@mictlan_00"], [IconFB, "https://www.facebook.com/Mictlan00"]].map(([Ic, url], i) => e("a", { key: i, href: url, target: "_blank", rel: "noopener noreferrer", "aria-label": "Red social", style: { width: 38, height: 38, borderRadius: "50%", border: "1px solid var(--green-line)", display: "grid", placeItems: "center", color: "var(--gold-claro)" } }, e(Ic, { size: 18 }))))),
      e(FooterCol, { title: "Atención al cliente", items: [{ label: "Preguntas frecuentes", to: ["faq", {}] }, { label: "Envíos", to: ["envios", {}] }, { label: "Cambios y devoluciones", to: ["cambios", {}] }, { label: "Guía de tallas", to: ["tallas", {}] }, { label: "Términos y condiciones", to: ["terminos", {}] }, { label: "Política de privacidad", to: ["privacidad", {}] }] }),
      e("div", null,
        e("div", { className: "eyebrow", style: { color: "var(--gold-claro)", marginBottom: 18, fontSize: 11.5 } }, "Contacto"),
        e("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: 14 } },
          e("li", null, e("a", { href: "https://wa.me/message/CR42U3DQIYNNI1", target: "_blank", rel: "noopener noreferrer", style: CONTACT }, e(IconWhats, { size: 18, style: { color: "var(--gold)", flex: "none" } }), e("span", null, "WhatsApp", e("br"), "Escríbenos directo"))),
          e("li", null, e("a", { href: "mailto:mictlan.talento@gmail.com", style: CONTACT }, e(IconMail, { size: 18, style: { color: "var(--gold)", flex: "none" } }), "mictlan.talento@gmail.com")),
          e("li", { style: { ...CONTACT, alignItems: "flex-start" } }, e(IconClock, { size: 18, style: { color: "var(--gold)", flex: "none", marginTop: 2 } }), e("span", null, "Lunes a viernes: 10:00 – 20:00 hrs", e("br"), "Sábados: 10:00 – 15:00 hrs"))),
        e("div", { className: "eyebrow", style: { color: "var(--gold-claro)", margin: "24px 0 14px", fontSize: 11.5 } }, "Métodos de pago"),
        e("div", { style: { display: "flex", flexWrap: "wrap", gap: 7 } },
          PAYMENTS.map((pm, i) => e("span", { key: i, style: { background: "var(--cream)", color: "#1c1205", fontFamily: "var(--font-ui)", fontWeight: 700, fontSize: 9.5, letterSpacing: ".04em", padding: "6px 8px", borderRadius: 3, fontStyle: pm === "PayPal" ? "italic" : "normal" } }, pm)))),
      e("div", null,
        e("div", { className: "eyebrow", style: { color: "var(--gold-claro)", marginBottom: 18, fontSize: 11.5 } }, "Newsletter"),
        e("p", { className: "serif", style: { fontSize: 17, color: "var(--cream-soft)", lineHeight: 1.5, marginTop: 0, marginBottom: 16 } }, "Suscríbete y recibe ofertas exclusivas, rituales y novedades del inframundo."),
        sent
          ? e("div", { style: { fontFamily: "var(--font-display)", fontSize: 15, color: "var(--gold-claro)", letterSpacing: ".06em" } }, "✦ Bienvenido al otro lado.")
          : e("form", { onSubmit: ev => { ev.preventDefault(); setSent(true); }, style: { display: "flex", gap: 8 } },
              e("input", { className: "field", type: "email", required: true, placeholder: "Tu correo electrónico", style: { flex: 1 } }),
              e("button", { className: "btn btn-gold", type: "submit", style: { padding: "0 16px", flex: "none" }, "aria-label": "Suscribirse" }, e(IconArrow, { size: 18 }))))),
    e("div", { style: { borderTop: "1px solid var(--green-line)", padding: "18px 0", position: "relative", zIndex: 2 } },
      e("div", { className: "wrap", style: { display: "flex", justifyContent: "center", alignItems: "center", gap: 14, fontSize: 11, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--cream-faint)" } },
        e(GlyphDiamond, { size: 10, style: { color: "var(--gold-deep)" } }), "© 2026 Mictlán Store · Todos los derechos reservados", e(GlyphDiamond, { size: 10, style: { color: "var(--gold-deep)" } }))));
}
const CONTACT = { display: "flex", alignItems: "center", gap: 11, color: "var(--cream-soft)", fontFamily: "var(--font-serif)", fontSize: 16, lineHeight: 1.4 };

/* TrustBadges (compat, no usado en v2) */
function TrustBadges() { return null; }

Object.assign(window, { AppCtx, useApp, Modal, SearchModal, AccountModal, Flourish, PapelPicado, SectionHead, Foto, ProductCard, Header, Footer, TrustBadges, AnnouncementBar });
