// frontend/app/[locale]/press/page.tsx
import type { Metadata } from "next";
import Link from "next/link";
import type { Locale } from "@/lib/i18n";
import { isLocale } from "@/lib/i18n";

const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || "https://newsoras.com";
const SITE_NAME = "Newsoras";

const PRESS_EMAIL = process.env.NEXT_PUBLIC_PRESS_EMAIL || "press@newsoras.com";
const LAST_UPDATED_ISO = process.env.NEXT_PUBLIC_PRESS_LAST_UPDATED || "2026-01-04";

// Opcional: PDFs/links
const PRESS_KIT_URL = process.env.NEXT_PUBLIC_PRESS_KIT_URL || ""; // e.g. https://newsoras.com/press-kit.pdf
const BRAND_ASSETS_URL = process.env.NEXT_PUBLIC_BRAND_ASSETS_URL || ""; // e.g. https://newsoras.com/brand
const MEDIA_INQUIRIES_URL = process.env.NEXT_PUBLIC_MEDIA_INQUIRIES_URL || ""; // e.g. https://newsoras.com/contact?topic=press

type Mention = {
  outlet: string;
  title: string;
  url: string; // link externo o interno
  dateISO: string; // "2026-01-04"
};

type Copy = {
  title: string;
  subtitle: string;

  metaTitle: string;
  metaDescription: string;

  lastUpdatedLabel: string;

  tocTitle: string;
  toc: { id: string; label: string }[];

  aboutTitle: string;
  aboutP: string[];

  quickFactsTitle: string;
  facts: { k: string; v: string }[];

  resourcesTitle: string;
  resourcesP: string;
  resources: { t: string; d: string; href: string; external?: boolean }[];

  inquiriesTitle: string;
  inquiriesP: string;

  mentionsTitle: string;
  mentionsP: string;
  mentionsEmpty: string;

  faqTitle: string;
  faqs: { q: string; a: string }[];

  contactTitle: string;
  contactP: string;
  contactCta: string;

  footerNote: string;
};

function fmtDate(locale: Locale, iso: string) {
  const d = new Date(iso + "T00:00:00Z");
  const y = d.getUTCFullYear();
  const m = d.getUTCMonth() + 1;
  const day = d.getUTCDate();
  const pad = (n: number) => String(n).padStart(2, "0");

  if (locale === "es") return `${pad(day)}/${pad(m)}/${y}`;
  if (locale === "zh") return `${y}-${pad(m)}-${pad(day)}`;
  return `${y}-${pad(m)}-${pad(day)}`;
}

function getCopy(locale: Locale): Copy {
  if (locale === "es") {
    return {
      title: "Press",
      subtitle: "Recursos para prensa, menciones y solicitudes de entrevistas.",

      metaTitle: "Press — Newsoras",
      metaDescription:
        "Página de prensa de Newsoras: descripción del medio, datos rápidos, recursos de marca, kit de prensa, solicitudes de entrevistas y contacto.",

      lastUpdatedLabel: "Última actualización",

      tocTitle: "Índice",
      toc: [
        { id: "sobre", label: "Sobre Newsoras" },
        { id: "datos", label: "Datos rápidos" },
        { id: "recursos", label: "Recursos" },
        { id: "consultas", label: "Consultas" },
        { id: "menciones", label: "Menciones" },
        { id: "faq", label: "FAQ" },
        { id: "contacto", label: "Contacto" },
      ],

      aboutTitle: "Sobre Newsoras",
      aboutP: [
        "Newsoras es periodismo independiente con foco en geopolítica, mercados y tecnología.",
        "Publicamos con estándares editoriales altos: separación clara entre editorial y publicidad, transparencia en patrocinio cuando aplica, y correcciones cuando hay errores verificables.",
        "Usamos herramientas de IA como asistente de redacción (por ejemplo, para resumir material fuente o mejorar claridad), pero la responsabilidad editorial final es humana.",
      ],

      quickFactsTitle: "Datos rápidos",
      facts: [
        { k: "Nombre", v: "Newsoras" },
        { k: "Enfoque", v: "Geopolítica • Mercados • Tecnología" },
        { k: "Modelo editorial", v: "Independiente • Transparencia • Correcciones" },
        { k: "IA en redacción", v: "Asistente (no fuente). Revisión humana final." },
        { k: "Contacto prensa", v: PRESS_EMAIL },
      ],

      resourcesTitle: "Recursos",
      resourcesP:
        "Para notas, entrevistas o referencias, acá tenés enlaces oficiales. Si algo no está, pedilo por email y lo agregamos.",
      resources: [
        {
          t: "Kit de prensa",
          d: "Logos, descripción corta/larga, fotos, y lineamientos de uso.",
          href: PRESS_KIT_URL || "#contacto",
          external: !!PRESS_KIT_URL,
        },
        {
          t: "Brand assets",
          d: "Logos en varios formatos + guía rápida de uso.",
          href: BRAND_ASSETS_URL || "#contacto",
          external: !!BRAND_ASSETS_URL,
        },
        {
          t: "Página About",
          d: "Misión, enfoque editorial y principios.",
          href: "/about",
          external: false,
        },
        {
          t: "Política de privacidad",
          d: "Cómo manejamos datos y cookies.",
          href: "/privacy-policy",
          external: false,
        },
      ],

      inquiriesTitle: "Solicitudes de entrevistas / Media inquiries",
      inquiriesP:
        "Si querés una entrevista, comentario o participación en un panel, indicá tema, fecha, formato (texto/audio/video) y deadline.",

      mentionsTitle: "Menciones",
      mentionsP:
        "Acá listamos menciones verificables (con links). Si falta una, mandanos el enlace para revisarla y agregarla.",
      mentionsEmpty:
        "Todavía no hay menciones públicas listadas. Cuando existan, aparecerán aquí (solo con links verificables).",

      faqTitle: "FAQ",
      faqs: [
        {
          q: "¿Puedo usar el logo de Newsoras en mi nota?",
          a: "Sí, siempre que sea para referencia editorial y respetando la guía de marca. Si necesitás archivos oficiales, pedilos por email.",
        },
        {
          q: "¿Qué debo citar si uso información de Newsoras?",
          a: "El título del artículo, autor, fecha y el enlace directo. Evitá capturas sin contexto.",
        },
        {
          q: "¿Aceptan comunicados de prensa?",
          a: "Sí. Los evaluamos por relevancia y verificabilidad. No garantizamos publicación.",
        },
      ],

      contactTitle: "Contacto",
      contactP:
        "Para prensa: entrevistas, aclaraciones, correcciones, permisos de marca o menciones. Respondemos lo más rápido posible.",
      contactCta: "Escribir a Press",

      footerNote: "Newsoras — Independencia editorial + transparencia.",
    };
  }

  if (locale === "zh") {
    return {
      title: "Press",
      subtitle: "媒体资源、提及与采访请求。",

      metaTitle: "Press — Newsoras",
      metaDescription:
        "Newsoras 媒体页面：媒体简介、快速信息、品牌资源、Press Kit、采访请求与联系邮箱。",

      lastUpdatedLabel: "最后更新",

      tocTitle: "目录",
      toc: [
        { id: "sobre", label: "关于 Newsoras" },
        { id: "datos", label: "快速信息" },
        { id: "recursos", label: "资源" },
        { id: "consultas", label: "采访请求" },
        { id: "menciones", label: "媒体提及" },
        { id: "faq", label: "FAQ" },
        { id: "contacto", label: "联系" },
      ],

      aboutTitle: "关于 Newsoras",
      aboutP: [
        "Newsoras 是独立新闻与分析平台，聚焦地缘政治、市场与科技。",
        "我们坚持编辑标准：编辑与广告清晰区分，赞助内容透明标注，出现可核查错误会更正。",
        "AI 可作为写作助手（如摘要与提升清晰度），但最终编辑责任由人类承担。",
      ],

      quickFactsTitle: "快速信息",
      facts: [
        { k: "名称", v: "Newsoras" },
        { k: "聚焦", v: "地缘政治 • 市场 • 科技" },
        { k: "编辑模式", v: "独立 • 透明 • 更正机制" },
        { k: "AI 写作", v: "仅作助手（非来源），最终人工审核" },
        { k: "媒体联系", v: PRESS_EMAIL },
      ],

      resourcesTitle: "资源",
      resourcesP: "如需 Press Kit 或品牌素材，请通过邮件索取，我们会补充到此页面。",
      resources: [
        { t: "Press Kit", d: "Logo、简介、照片与使用规范。", href: PRESS_KIT_URL || "#contacto", external: !!PRESS_KIT_URL },
        { t: "品牌素材", d: "Logo 多格式与快速使用指南。", href: BRAND_ASSETS_URL || "#contacto", external: !!BRAND_ASSETS_URL },
        { t: "About 页面", d: "使命、编辑原则与定位。", href: "/about", external: false },
        { t: "隐私政策", d: "数据与 cookies 处理方式。", href: "/privacy-policy", external: false },
      ],

      inquiriesTitle: "采访/媒体请求",
      inquiriesP: "请提供主题、日期、形式（文字/音频/视频）与截止时间。",

      mentionsTitle: "媒体提及",
      mentionsP: "我们仅列出可核查的提及（含链接）。如需补充请发送链接。",
      mentionsEmpty: "目前暂无公开提及列表。未来将仅添加可核查链接。",

      faqTitle: "FAQ",
      faqs: [
        { q: "可以在报道中使用 Newsoras logo 吗？", a: "可以，用于编辑引用并遵守品牌规范。需要官方文件可邮件索取。" },
        { q: "引用 Newsoras 内容应如何标注？", a: "建议注明标题、作者、日期与原文链接。" },
      ],

      contactTitle: "联系",
      contactP: "媒体合作、采访、澄清、更正、品牌许可与提及收录，请联系：",
      contactCta: "发送邮件",

      footerNote: "Newsoras — 独立编辑判断 + 透明。",
    };
  }

  return {
    title: "Press",
    subtitle: "Press resources, mentions, and interview requests.",

    metaTitle: "Press — Newsoras",
    metaDescription:
      "Newsoras press page: newsroom description, quick facts, brand resources, press kit, interview requests, and press contact.",

    lastUpdatedLabel: "Last updated",

    tocTitle: "Contents",
    toc: [
      { id: "sobre", label: "About Newsoras" },
      { id: "datos", label: "Quick facts" },
      { id: "recursos", label: "Resources" },
      { id: "consultas", label: "Inquiries" },
      { id: "menciones", label: "Mentions" },
      { id: "faq", label: "FAQ" },
      { id: "contacto", label: "Contact" },
    ],

    aboutTitle: "About Newsoras",
    aboutP: [
      "Newsoras is independent journalism focused on geopolitics, markets, and technology.",
      "We publish with strict editorial standards: clear separation of editorial and advertising, transparent labeling for sponsorships, and corrections when verifiable errors are found.",
      "We may use AI tools as editorial assistance (e.g., summarizing source material), but final editorial responsibility is human.",
    ],

    quickFactsTitle: "Quick facts",
    facts: [
      { k: "Name", v: "Newsoras" },
      { k: "Focus", v: "Geopolitics • Markets • Technology" },
      { k: "Editorial model", v: "Independent • Transparency • Corrections" },
      { k: "AI in writing", v: "Assistant (not a source). Human review is final." },
      { k: "Press contact", v: PRESS_EMAIL },
    ],

    resourcesTitle: "Resources",
    resourcesP:
      "For press notes, interviews, or references, here are official links. If something is missing, email us and we’ll add it.",
    resources: [
      {
        t: "Press kit",
        d: "Logos, short/long boilerplate, photos, and usage guidelines.",
        href: PRESS_KIT_URL || "#contacto",
        external: !!PRESS_KIT_URL,
      },
      {
        t: "Brand assets",
        d: "Logo files in multiple formats + a quick usage guide.",
        href: BRAND_ASSETS_URL || "#contacto",
        external: !!BRAND_ASSETS_URL,
      },
      { t: "About page", d: "Mission, editorial focus, and principles.", href: "/about", external: false },
      { t: "Privacy policy", d: "How we handle data and cookies.", href: "/privacy-policy", external: false },
    ],

    inquiriesTitle: "Interview requests / Media inquiries",
    inquiriesP:
      "Include topic, date, format (text/audio/video), and your deadline. We’ll respond as fast as we can.",

    mentionsTitle: "Mentions",
    mentionsP: "We list verifiable mentions with links. If one is missing, send the URL for review and inclusion.",
    mentionsEmpty: "No public mentions listed yet. When available, they’ll appear here with verifiable links.",

    faqTitle: "FAQ",
    faqs: [
      { q: "Can I use the Newsoras logo in my story?", a: "Yes for editorial reference, respecting brand guidelines. Email us for official files." },
      { q: "How should I cite Newsoras?", a: "Include the article title, author, date, and the direct link." },
      { q: "Do you accept press releases?", a: "Yes. We review for relevance and verifiability; publication isn’t guaranteed." },
    ],

    contactTitle: "Contact",
    contactP: "For interviews, clarifications, corrections, brand permissions, or mentions.",
    contactCta: "Email Press",

    footerNote: "Newsoras — Independent editorial standards + transparency.",
  };
}

// --- JSON-LD ---------------------------------------------------------------
function jsonLdOrganization(locale: Locale) {
  const inLanguage = locale === "es" ? "es" : locale === "zh" ? "zh" : "en";
  return {
    "@context": "https://schema.org",
    "@type": "Organization",
    "@id": `${SITE_URL}#organization`,
    name: SITE_NAME,
    url: SITE_URL,
    logo: `${SITE_URL}/logo.png`,
    email: PRESS_EMAIL,
    inLanguage,
  };
}

function jsonLdWebsite(locale: Locale) {
  const inLanguage = locale === "es" ? "es" : locale === "zh" ? "zh" : "en";
  return {
    "@context": "https://schema.org",
    "@type": "WebSite",
    "@id": `${SITE_URL}#website`,
    url: SITE_URL,
    name: SITE_NAME,
    publisher: { "@id": `${SITE_URL}#organization` },
    inLanguage,
  };
}

function jsonLdPressPage(locale: Locale) {
  const inLanguage = locale === "es" ? "es" : locale === "zh" ? "zh" : "en";
  const url = `${SITE_URL}/${locale}/press`;

  return {
    "@context": "https://schema.org",
    "@type": "WebPage",
    "@id": `${url}#webpage`,
    url,
    name: `${SITE_NAME} — Press`,
    isPartOf: { "@id": `${SITE_URL}#website` },
    about: { "@id": `${SITE_URL}#organization` },
    inLanguage,
  };
}

function jsonLdBreadcrumbs(locale: Locale) {
  const url = `${SITE_URL}/${locale}/press`;
  const home = `${SITE_URL}/${locale}`;

  return {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    itemListElement: [
      { "@type": "ListItem", position: 1, name: "Home", item: home },
      { "@type": "ListItem", position: 2, name: "Press", item: url },
    ],
  };
}

function jsonLdFAQ(locale: Locale) {
  const t = getCopy(locale);
  const url = `${SITE_URL}/${locale}/press`;

  return {
    "@context": "https://schema.org",
    "@type": "FAQPage",
    "@id": `${url}#faq`,
    mainEntity: t.faqs.map((x) => ({
      "@type": "Question",
      name: x.q,
      acceptedAnswer: { "@type": "Answer", text: x.a },
    })),
  };
}

function jsonLdNewsMediaOrganization(locale: Locale) {
  const inLanguage = locale === "es" ? "es" : locale === "zh" ? "zh" : "en";
  return {
    "@context": "https://schema.org",
    "@type": "NewsMediaOrganization",
    "@id": `${SITE_URL}#newsmediaorg`,
    name: SITE_NAME,
    url: SITE_URL,
    logo: `${SITE_URL}/logo.png`,
    email: PRESS_EMAIL,
    foundingDate: process.env.NEXT_PUBLIC_FOUNDING_DATE || undefined, // opcional
    inLanguage,
    sameAs: [
      // Opcional: redes (si tenés)
      process.env.NEXT_PUBLIC_X_URL || "",
      process.env.NEXT_PUBLIC_INSTAGRAM_URL || "",
      process.env.NEXT_PUBLIC_YOUTUBE_URL || "",
    ].filter(Boolean),
  };
}

// --- Page -------------------------------------------------------------------
export default async function PressPage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale: rawLocale } = await params;
  const locale: Locale = isLocale(rawLocale) ? rawLocale : "en";
  const t = getCopy(locale);
  const lastUpdated = fmtDate(locale, LAST_UPDATED_ISO);

  const subject =
    locale === "es" ? "Press — Newsoras" : locale === "zh" ? "媒体联系 — Newsoras" : "Press — Newsoras";

  const mailtoHref = `mailto:${encodeURIComponent(PRESS_EMAIL)}?subject=${encodeURIComponent(subject)}`;

  const orgLd = jsonLdOrganization(locale);
  const siteLd = jsonLdWebsite(locale);
  const pageLd = jsonLdPressPage(locale);
  const crumbsLd = jsonLdBreadcrumbs(locale);
  const faqLd = jsonLdFAQ(locale);
  const newsOrgLd = jsonLdNewsMediaOrganization(locale);

  // ✅ Menciones: dejalo vacío por ahora (sin inventar)
  const mentions: Mention[] = [];

  const isInternalHref = (href: string) => href.startsWith("/");

  return (
    <main className="container" style={{ paddingTop: 22, paddingBottom: 30 }}>
      {/* ✅ JSON-LD */}
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(orgLd) }}
      />
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(siteLd) }}
      />
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(pageLd) }}
      />
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(crumbsLd) }}
      />
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(faqLd) }}
      />
      <script
        type="application/ld+json"
        // eslint-disable-next-line react/no-danger
        dangerouslySetInnerHTML={{ __html: JSON.stringify(newsOrgLd) }}
      />

      {/* Hero */}
      <section className="card" style={{ position: "relative", overflow: "hidden", padding: 22 }}>
        <div
          aria-hidden
          style={{
            position: "absolute",
            inset: -60,
            background:
              "radial-gradient(600px 220px at 20% 0%, var(--accent-glow), transparent 70%), radial-gradient(500px 220px at 80% 20%, rgba(37, 99, 235, 0.25), transparent 70%)",
            filter: "blur(8px)",
            opacity: 0.9,
          }}
        />
        <div style={{ position: "relative" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 12, marginBottom: 10 }}>
            <div
              style={{
                width: 44,
                height: 44,
                borderRadius: 12,
                background: "linear-gradient(135deg, var(--accent), #2563eb)",
                boxShadow: "0 0 18px var(--accent-glow)",
              }}
            />
            <div>
              <h1 className="h1" style={{ margin: 0 }}>
                {t.title}
              </h1>
              <p className="p" style={{ margin: "6px 0 0 0", color: "var(--text-secondary)" }}>
                {t.subtitle}
              </p>
            </div>
          </div>

          <div style={{ display: "flex", flexWrap: "wrap", gap: 10, alignItems: "center", marginTop: 10 }}>
            <span className="badge" style={{ borderColor: "var(--text-muted)" }}>
              {t.lastUpdatedLabel}: {lastUpdated}
            </span>
            <span className="badge">Corrections</span>
            <span className="badge">Transparency</span>
            <span className="badge">Mobile-first</span>
          </div>

          <div style={{ display: "flex", gap: 10, flexWrap: "wrap", marginTop: 12 }}>
            <a href={mailtoHref} className="badge" style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}>
              {t.contactCta} ({PRESS_EMAIL})
            </a>
            <Link href={`/${locale}/about`} className="badge" style={{ padding: "10px 14px" }}>
              About
            </Link>
            <Link
              href={`/${locale}/contact`}
              className="badge"
              style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}
            >
              {locale === "es" ? "Contacto" : locale === "zh" ? "联系" : "Contact"}
            </Link>
          </div>
        </div>
      </section>

      {/* TOC */}
      <section className="card" style={{ padding: 20, marginTop: 18 }}>
        <h2 className="h2" style={{ marginBottom: 12 }}>
          {t.tocTitle}
        </h2>
        <div style={{ display: "flex", gap: 10, flexWrap: "wrap" }}>
          {t.toc.map((x) => (
            <a key={x.id} href={`#${x.id}`} className="badge" style={{ borderColor: "var(--text-muted)" }}>
              {x.label}
            </a>
          ))}
        </div>
      </section>

      {/* About */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="sobre">
        <h2 className="h2" style={{ marginBottom: 10 }}>
          {t.aboutTitle}
        </h2>
        {t.aboutP.map((p) => (
          <p key={p} className="p" style={{ marginTop: 10, color: "var(--text-secondary)" }}>
            {p}
          </p>
        ))}
      </section>

      {/* Quick facts */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="datos">
        <h2 className="h2" style={{ marginBottom: 12 }}>
          {t.quickFactsTitle}
        </h2>

        <div
          style={{
            display: "grid",
            gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
            gap: 12,
          }}
        >
          {t.facts.map((x) => (
            <div
              key={x.k}
              style={{
                border: "1px solid var(--line)",
                borderRadius: 16,
                padding: 14,
                background: "rgba(255,255,255,0.02)",
              }}
            >
              <div style={{ fontSize: 12, color: "var(--text-muted)", marginBottom: 6 }}>{x.k}</div>
              <div style={{ fontWeight: 900, color: "var(--text-primary)" }}>{x.v}</div>
            </div>
          ))}
        </div>
      </section>

      {/* Resources */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="recursos">
        <h2 className="h2" style={{ marginBottom: 10 }}>
          {t.resourcesTitle}
        </h2>
        <p className="p" style={{ marginTop: 10, color: "var(--text-secondary)" }}>
          {t.resourcesP}
        </p>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))", gap: 12, marginTop: 12 }}>
          {t.resources.map((r) => {
            const href = r.href.startsWith("#") ? r.href : isInternalHref(r.href) ? `/${locale}${r.href}` : r.href;

            const Card = (
              <div
                style={{
                  border: "1px solid var(--line)",
                  borderRadius: 18,
                  padding: 16,
                  background: "rgba(255,255,255,0.02)",
                  display: "flex",
                  flexDirection: "column",
                  gap: 10,
                  height: "100%",
                }}
              >
                <div style={{ fontWeight: 1000, fontSize: "1.05rem" }}>{r.t}</div>
                <div style={{ color: "var(--text-secondary)", fontSize: 14, lineHeight: 1.6 }}>{r.d}</div>
                <div style={{ marginTop: "auto", display: "flex", gap: 10, flexWrap: "wrap" }}>
                  <span className="badge" style={{ borderColor: "var(--text-muted)" }}>
                    {locale === "es" ? "Abrir" : locale === "zh" ? "打开" : "Open"}
                  </span>
                </div>
              </div>
            );

            if (href.startsWith("#")) {
              return (
                <a key={r.t} href={href} style={{ textDecoration: "none", color: "inherit" }}>
                  {Card}
                </a>
              );
            }

            if (!isInternalHref(href) && r.external) {
              return (
                <a
                  key={r.t}
                  href={href}
                  target="_blank"
                  rel="noopener noreferrer"
                  style={{ textDecoration: "none", color: "inherit" }}
                >
                  {Card}
                </a>
              );
            }

            // Internal routes
            return (
              <Link key={r.t} href={href} style={{ textDecoration: "none", color: "inherit" }}>
                {Card}
              </Link>
            );
          })}
        </div>

        {/* Quick CTA row */}
        <div style={{ display: "flex", gap: 10, flexWrap: "wrap", marginTop: 14 }}>
          {PRESS_KIT_URL ? (
            <a
              href={PRESS_KIT_URL}
              target="_blank"
              rel="noopener noreferrer"
              className="badge"
              style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}
            >
              {locale === "es" ? "Descargar Press Kit" : locale === "zh" ? "下载 Press Kit" : "Download press kit"}
            </a>
          ) : null}
          <Link href={`/${locale}/about`} className="badge" style={{ padding: "10px 14px" }}>
            {locale === "es" ? "Boilerplate (About)" : locale === "zh" ? "简介（About）" : "Boilerplate (About)"}
          </Link>
        </div>
      </section>

      {/* Inquiries */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="consultas">
        <h2 className="h2" style={{ marginBottom: 10 }}>
          {t.inquiriesTitle}
        </h2>
        <p className="p" style={{ marginTop: 10, color: "var(--text-secondary)" }}>
          {t.inquiriesP}
        </p>

        <div style={{ display: "flex", gap: 10, flexWrap: "wrap", marginTop: 12 }}>
          <a href={mailtoHref} className="badge" style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}>
            {t.contactCta} ({PRESS_EMAIL})
          </a>

          {MEDIA_INQUIRIES_URL ? (
            <a
              href={MEDIA_INQUIRIES_URL}
              className="badge"
              style={{ padding: "10px 14px" }}
              target="_blank"
              rel="noopener noreferrer"
            >
              {locale === "es" ? "Formulario (si aplica)" : locale === "zh" ? "表单（如有）" : "Form (if any)"}
            </a>
          ) : (
            <Link href={`/${locale}/contact`} className="badge" style={{ padding: "10px 14px" }}>
              {locale === "es" ? "Ir a Contacto" : locale === "zh" ? "前往联系页" : "Go to Contact"}
            </Link>
          )}
        </div>
      </section>

      {/* Mentions */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="menciones">
        <h2 className="h2" style={{ marginBottom: 10 }}>
          {t.mentionsTitle}
        </h2>
        <p className="p" style={{ marginTop: 10, color: "var(--text-secondary)" }}>
          {t.mentionsP}
        </p>

        {mentions.length === 0 ? (
          <div
            style={{
              marginTop: 12,
              border: "1px dashed var(--line)",
              borderRadius: 16,
              padding: 14,
              color: "var(--text-muted)",
              background: "rgba(255,255,255,0.02)",
            }}
          >
            {t.mentionsEmpty}
          </div>
        ) : (
          <div style={{ display: "grid", gridTemplateColumns: "1fr", gap: 10, marginTop: 12 }}>
            {mentions.map((m) => (
              <a
                key={m.url}
                href={m.url}
                target="_blank"
                rel="noopener noreferrer"
                style={{
                  textDecoration: "none",
                  color: "inherit",
                  border: "1px solid var(--line)",
                  borderRadius: 16,
                  padding: 14,
                  background: "rgba(255,255,255,0.02)",
                }}
              >
                <div style={{ display: "flex", gap: 10, flexWrap: "wrap", alignItems: "center" }}>
                  <span className="badge" style={{ borderColor: "var(--text-muted)" }}>
                    {m.outlet}
                  </span>
                  <span style={{ color: "var(--text-muted)", fontSize: 12 }}>{fmtDate(locale, m.dateISO)}</span>
                </div>
                <div style={{ marginTop: 8, fontWeight: 900 }}>{m.title}</div>
                <div style={{ marginTop: 6, color: "var(--text-secondary)", fontSize: 13 }}>
                  {locale === "es" ? "Abrir mención" : locale === "zh" ? "打开提及" : "Open mention"}
                </div>
              </a>
            ))}
          </div>
        )}
      </section>

      {/* FAQ */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="faq">
        <h2 className="h2" style={{ marginBottom: 14 }}>
          {t.faqTitle}
        </h2>

        <div style={{ display: "grid", gridTemplateColumns: "1fr", gap: 10 }}>
          {t.faqs.map((x, idx) => (
            <details
              key={x.q}
              style={{
                border: "1px solid var(--line)",
                borderRadius: 16,
                padding: 14,
                background: "rgba(255,255,255,0.02)",
              }}
              open={idx === 0}
            >
              <summary style={{ cursor: "pointer", fontWeight: 900, color: "var(--text-primary)", listStyle: "none" }}>
                {x.q}
              </summary>
              <p className="p" style={{ marginTop: 10, color: "var(--text-secondary)" }}>
                {x.a}
              </p>
            </details>
          ))}
        </div>
      </section>

      {/* Contact */}
      <section className="card" style={{ padding: 20, marginTop: 18 }} id="contacto">
        <h2 className="h2" style={{ marginBottom: 8 }}>
          {t.contactTitle}
        </h2>
        <p className="p" style={{ marginTop: 8, color: "var(--text-secondary)" }}>
          {t.contactP}
        </p>

        <div style={{ display: "flex", gap: 10, flexWrap: "wrap", marginTop: 12 }}>
          <a href={mailtoHref} className="badge" style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}>
            {t.contactCta} ({PRESS_EMAIL})
          </a>
          <Link href={`/${locale}/contact`} className="badge" style={{ padding: "10px 14px" }}>
            {locale === "es" ? "Página de contacto" : locale === "zh" ? "联系页面" : "Contact page"}
          </Link>
          <Link href={`/${locale}/privacy-policy`} className="badge" style={{ padding: "10px 14px", borderColor: "var(--text-muted)" }}>
            {locale === "es" ? "Privacidad" : locale === "zh" ? "隐私" : "Privacy"}
          </Link>
          <Link href={`/${locale}`} className="badge" style={{ padding: "10px 14px" }}>
            Home
          </Link>
        </div>

        <div style={{ marginTop: 14, color: "var(--text-muted)", fontSize: 12 }}>
          {t.footerNote}
        </div>
      </section>
    </main>
  );
}

// --- SEO: generateMetadata ---------------------------------------------------
export async function generateMetadata({
  params,
}: {
  params: Promise<{ locale: string }>;
}): Promise<Metadata> {
  const { locale: rawLocale } = await params;
  const locale: Locale = isLocale(rawLocale) ? rawLocale : "en";
  const t = getCopy(locale);

  const canonical = new URL(`/${locale}/press`, SITE_URL).toString();

  return {
    title: t.metaTitle,
    description: t.metaDescription,
    alternates: {
      canonical,
      languages: {
        en: new URL(`/en/press`, SITE_URL).toString(),
        es: new URL(`/es/press`, SITE_URL).toString(),
        zh: new URL(`/zh/press`, SITE_URL).toString(),
      },
    },
    openGraph: {
      type: "website",
      url: canonical,
      siteName: SITE_NAME,
      title: t.metaTitle,
      description: t.metaDescription,
      locale: locale === "es" ? "es_ES" : locale === "zh" ? "zh_CN" : "en_US",
      images: [
        {
          // ✅ crear: /public/og/press.png (1200x630)
          url: new URL(`/og/press.png`, SITE_URL).toString(),
          width: 1200,
          height: 630,
          alt: `${SITE_NAME} — Press`,
        },
      ],
    },
    twitter: {
      card: "summary_large_image",
      title: t.metaTitle,
      description: t.metaDescription,
      images: [new URL(`/og/press.png`, SITE_URL).toString()],
    },
    robots: {
      index: true,
      follow: true,
      googleBot: {
        index: true,
        follow: true,
        "max-image-preview": "large",
        "max-snippet": -1,
        "max-video-preview": -1,
      },
    },
  };
}

// --- Notes (assets + env) ----------------------------------------------------
// 1) /public/og/press.png (1200x630)
// 2) /public/logo.png     (512x512)
// 3) .env.local (opcionales):
//    NEXT_PUBLIC_SITE_URL=https://newsoras.com
//    NEXT_PUBLIC_PRESS_EMAIL=press@newsoras.com
//    NEXT_PUBLIC_PRESS_LAST_UPDATED=2026-01-04
//    NEXT_PUBLIC_PRESS_KIT_URL=https://newsoras.com/press-kit.pdf
//    NEXT_PUBLIC_BRAND_ASSETS_URL=https://newsoras.com/brand
//    NEXT_PUBLIC_MEDIA_INQUIRIES_URL=https://newsoras.com/contact?topic=press
//    NEXT_PUBLIC_FOUNDING_DATE=2026-01-01
//    NEXT_PUBLIC_X_URL=...
//    NEXT_PUBLIC_INSTAGRAM_URL=...
//    NEXT_PUBLIC_YOUTUBE_URL=...
