import type { Metadata, Viewport } from "next";
import { Nunito, Shrikhand } from "next/font/google";
import "./globals.css";

const body = Nunito({ variable: "--font-body", subsets: ["latin"] });
const heading = Shrikhand({ variable: "--font-heading", subsets: ["latin"], weight: "400" });

// Schermate di avvio iPhone generate da scripts/build-icons.sh: larghezza, altezza (punti), densità
const SPLASH = [
  [430, 932, 3], [393, 852, 3], [402, 874, 3], [440, 956, 3], [390, 844, 3],
  [428, 926, 3], [375, 812, 3], [414, 896, 2], [375, 667, 2],
] as const;

export const metadata: Metadata = {
  title: "AmiCibi",
  description: "Cosa mangiano (e cosa no) i nostri amici",
  robots: { index: false, follow: false, nocache: true, googleBot: { index: false, follow: false } },
  appleWebApp: {
    capable: true,
    title: "AmiCibi",
    statusBarStyle: "default",
    startupImage: SPLASH.map(([w, h, d]) => ({
      url: `/splash/splash-${w}x${h}@${d}x.png`,
      media: `(device-width: ${w}px) and (device-height: ${h}px) and (-webkit-device-pixel-ratio: ${d}) and (orientation: portrait)`,
    })),
  },
  formatDetection: { telephone: false },
};

export const viewport: Viewport = {
  width: "device-width",
  initialScale: 1,
  viewportFit: "cover",
  themeColor: [
    { media: "(prefers-color-scheme: light)", color: "#2f55c9" },
    { media: "(prefers-color-scheme: dark)", color: "#2a4ab0" },
  ],
};

export default function RootLayout({ children }: LayoutProps<"/">) {
  return (
    <html lang="it" className={`${body.variable} ${heading.variable} h-full antialiased`}>
      <body className="min-h-full">{children}</body>
    </html>
  );
}
