---
import "@/styles/global.css"
import TrackingScripts from "@/components/TrackingScripts.astro"

interface Props {
  title?: string
  description?: string
}

const {
  title = "Astro Tina Starter",
  description = "Astro 6 + Tina CMS starter template",
} = Astro.props

const consentSiteId = import.meta.env.PUBLIC_CONSENT_SITE_ID || 'demo'
const consentApiBase = import.meta.env.PUBLIC_CONSENT_API_BASE || 'https://consent.moreminimore.com'
---

<!doctype html>
<html lang="th">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content={description} />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <title>{title}</title>
  </head>
  <body class="bg-primary-50 text-primary-900 min-h-screen">
    <slot />

    <!-- Tracking Scripts (ConsentOS will auto-block until consent) -->
    <TrackingScripts />

    <!-- ConsentOS - Consent Management -->
    <script
      src={`${consentApiBase}/consent-loader.js`}
      data-site-id={consentSiteId}
      data-api-base={consentApiBase}
    ></script>
  </body>
</html>
