import type { Metadata, Viewport } from "next";
import { Plus_Jakarta_Sans } from "next/font/google";
import { EVENT, getPublicUrls } from "@/lib/config";
import "./globals.css";

const jakarta = Plus_Jakarta_Sans({
  subsets: ["latin"],
  variable: "--font-jakarta",
  display: "swap",
});

const description = `${EVENT.title} oleh ${EVENT.organizer}. Tema: ${EVENT.theme}. Pilih ikut luring (kuota ${EVENT.totalOfflineQuota} peserta) atau daring, lalu daftar melalui Simdiklat.`;

export const metadata: Metadata = {
  metadataBase: new URL(getPublicUrls().siteUrl),
  title: {
    default: EVENT.title,
    template: `%s | ${EVENT.shortTitle}`,
  },
  description,
  keywords: [
    "Seminar Nasional",
    "Apresiasi GTK",
    "BGTK NTB",
    "Guru",
    "Tenaga Kependidikan",
    "Perlindungan Guru",
    "Simdiklat",
    "NTB 2026",
  ],
  authors: [{ name: EVENT.organizer }],
  openGraph: {
    type: "website",
    locale: "id_ID",
    title: EVENT.title,
    description,
    siteName: EVENT.organizer,
  },
  twitter: {
    card: "summary_large_image",
    title: EVENT.title,
    description,
  },
  robots: { index: true, follow: true },
};

export const viewport: Viewport = {
  themeColor: "#101A36",
  width: "device-width",
  initialScale: 1,
  viewportFit: "cover",
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="id" className={jakarta.variable}>
      <body className="font-sans">{children}</body>
    </html>
  );
}
