---
import Nav from '../components/Nav.astro';
import Footer from '../components/Footer.astro';
import SeoHead from '../components/SeoHead.astro';
import VercelAnalytics from '../components/VercelAnalytics.astro';
import MetaPixel from '../components/MetaPixel.astro';
import GoogleAnalytics from '../components/GoogleAnalytics.astro';
import GoogleAdsConversion from '../components/GoogleAdsConversion.astro';
import CookieBanner from '../components/CookieBanner.astro';
import '../styles/global.css';

interface Props {
  title: string;
  description: string;
  current?: string;
  type?: 'website' | 'article';
  image?: string;
  keywords?: string[];
  noindex?: boolean;
  schema?: Record<string, unknown> | Record<string, unknown>[];
}

const {
  title,
  description,
  current = '',
  type = 'website',
  image,
  keywords,
  noindex = false,
  schema,
} = Astro.props;
---

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <SeoHead
    title={title}
    description={description}
    type={type}
    image={image}
    keywords={keywords}
    noindex={noindex}
    schema={schema}
  />

  <!-- Favicon -->
  <link rel="icon" type="image/svg+xml" href="/favicon.svg">

  <!-- Fonts -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">

  <VercelAnalytics />
</head>
<body>
  <Nav current={current} />
  <main>
    <slot />
  </main>
  <Footer />

  <!-- Marketing tracking — env-gated dormant; nothing renders
       until PUBLIC_META_PIXEL_ID / PUBLIC_GA4_MEASUREMENT_ID /
       PUBLIC_GOOGLE_ADS_CONVERSION_ID are set on Vercel.  Each
       script also gates on `kiln_consent` cookie at script-init
       time (advertising for Meta/Google-Ads, analytics for GA4).
       See PRIVACY.md §3.2 for disclosure. -->
  <MetaPixel />
  <GoogleAnalytics />
  <GoogleAdsConversion />
  <CookieBanner />
</body>
</html>
