/**
 * RootLayout — 学生端根布局（ai14）
 *
 * 职责：
 * - next/font/google 加载三套字体（Inter / Fraunces / JetBrains_Mono）
 *   并暴露 CSS 变量 --font-sans / --font-serif / --font-mono
 * - 注入全局样式 globals.css（含三层设计令牌）
 * - 通过 Providers 客户端组件挂载 QueryClient + GraphQL + MSW
 *
 * 设计依据：02-architecture-design.md §1.1 / §3.4
 * 字体规范：project_rules §3.10（仅 primitive.css 可定义字面量，此处用 next/font 提供变量）
 */

import type { Metadata } from "next";
import { Inter, Fraunces, JetBrains_Mono } from "next/font/google";
import "../styles/globals.css";
import Providers from "./providers";

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

const fraunces = Fraunces({
  subsets: ["latin"],
  variable: "--font-serif",
  display: "swap",
});

const jetbrainsMono = JetBrains_Mono({
  subsets: ["latin"],
  variable: "--font-mono",
  display: "swap",
});

export const metadata: Metadata = {
  title: "Edu Student Portal",
  description: "K12 智慧学习平台 - 学生端",
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}): JSX.Element {
  return (
    <html
      lang="zh-CN"
      className={`${inter.variable} ${fraunces.variable} ${jetbrainsMono.variable}`}
    >
      <body className="bg-paper text-ink font-sans antialiased">
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}
