import type { Metadata } from "next";
import { JetBrains_Mono, Inter } from "next/font/google";
import "./globals.css";
import { CommandPalette } from "@/components/command-palette";
import { LocaleToggle, getLocale } from "@/components/locale-toggle";

const inter = Inter({ subsets: ["latin"], variable: "--font-sans" });
const mono = JetBrains_Mono({ subsets: ["latin"], variable: "--font-mono" });

export const metadata: Metadata = {
  title: "The Disclosure Bureau",
  description:
    "Investigative case folder of declassified UAP/UFO documents, " +
    "worked by 8 AI detectives (Holmes · Locard · Dupin · Schneier · " +
    "Poirot · Taleb · Tetlock · Case-Writer).",
};

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const locale = await getLocale();
  return (
    <html lang={locale === "en" ? "en" : "pt-BR"} className="dark" data-locale={locale}>
      <body className={`${inter.variable} ${mono.variable}`}>
        {children}
        <CommandPalette />
        <div className="fixed bottom-3 left-3 z-40 opacity-70 hover:opacity-100 transition">
          <LocaleToggle current={locale} />
        </div>
      </body>
    </html>
  );
}
