import './globals.css'
import Header from '@/components/Header'
import { TerminalProvider } from '@/lib/TerminalContext'
import { LanguageProvider } from '@/lib/LanguageContext'

export const metadata = {
  title: 'Rock Liang — Portfolio & Live Infrastructure',
  description: 'Personal portfolio showcasing Kubernetes, Terraform, and cloud-native systems.',
  icons: {
    icon: '/rock-svg-icon.svg',
    apple: '/rock-svg-icon.svg',
  },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body className="bg-white dark:bg-gray-950 text-gray-900 dark:text-white">
        <script
          dangerouslySetInnerHTML={{
            __html: `
              (function() {
                try {
                  var stored = localStorage.getItem('theme');
                  var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
                  if (stored === 'dark' || (!stored && prefersDark)) {
                    document.documentElement.classList.add('dark');
                  }
                } catch (e) {}
              })();
            `,
          }}
        />
        <LanguageProvider>
          <TerminalProvider>
            <Header />
            {children}
          </TerminalProvider>
        </LanguageProvider>
      </body>
    </html>
  );
}
