import type { Metadata } from "next";
import type { Viewport } from "next";
import { Inter } from "next/font/google";
import Footer from "@/components/layout/Footer";
import Navbar from "@/components/layout/Navbar";
import NavbarUserMenu from "@/components/layout/NavbarUserMenu";
import "./globals.css";

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

export const viewport: Viewport = {
  width: "device-width",
  initialScale: 1,
};

export const metadata: Metadata = {
  metadataBase: new URL(
    process.env.NEXT_PUBLIC_SITE_URL || "https://parallax.com",
  ),
  title: {
    default: "Parallax — Geopolitics, without the noise.",
    template: "%s — Parallax",
  },
  description:
    "In-depth reports on geopolitics, economics, and global power. Factual, neutral, visual, systematic.",
  keywords: [
    "geopolitics",
    "international relations",
    "foreign policy",
    "world economy",
    "military",
    "global affairs",
    "analysis",
  ],
  authors: [{ name: "Parallax" }],
  creator: "Parallax",
  publisher: "Parallax",
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
  openGraph: {
    type: "website",
    locale: "en_GB",
    siteName: "Parallax",
    title: "Parallax — Geopolitics, without the noise.",
    description:
      "In-depth reports on geopolitics, economics, and global power.",
    images: [
      {
        url: "/og-default.jpg",
        width: 1200,
        height: 630,
        alt: "Parallax — Geopolitics, without the noise.",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "Parallax — Geopolitics, without the noise.",
    description:
      "In-depth reports on geopolitics, economics, and global power.",
    images: ["/og-default.jpg"],
  },
  alternates: {
    canonical: "/",
  },
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html
      lang="en"
      className={`${inter.variable} h-full antialiased`}
    >
      <head>
        <link rel="icon" href="/favicon.ico" sizes="any" />
        <link rel="icon" href="/icon.svg" type="image/svg+xml" />
        <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
      </head>
      <body
        suppressHydrationWarning
        className="min-h-full bg-[var(--color-bg)] font-sans text-[var(--color-text-primary)]"
      >
        <div className="flex min-h-screen flex-col bg-[var(--color-bg)]">
          <Navbar userMenuSlot={<NavbarUserMenu />} />
          <main className="flex-1 pt-[52px] md:pt-14">{children}</main>
          <Footer />
        </div>
      </body>
    </html>
  );
}
