---
// Import the global.css file here so that it is included on
// all pages through the use of the <BaseHead /> component.
import '../styles/global.css';
import type { ImageMetadata } from 'astro';
import DefaultOGImage from '../assets/nicholai-medium-portrait.avif';
import { SITE_TITLE, SITE_DESCRIPTION, SOCIAL_LINKS } from '../consts';

interface Props {
	title: string;
	description: string;
	image?: ImageMetadata;
	type?: 'website' | 'article';
	publishedTime?: Date;
	modifiedTime?: Date;
}

const canonicalURL = new URL(Astro.url.pathname, Astro.site);

const { 
	title, 
	description, 
	image = DefaultOGImage,
	type = 'website',
	publishedTime,
	modifiedTime,
} = Astro.props;

// Structured Data - Person Schema (optimized for rich results)
const personSchema = {
	"@context": "https://schema.org",
	"@type": "Person",
	"@id": "https://nicholai.work/#person",
	"name": "Nicholai Vogel",
	"givenName": "Nicholai",
	"familyName": "Vogel",
	"url": "https://nicholai.work",
	"email": SOCIAL_LINKS.email,
	"image": new URL(DefaultOGImage.src, Astro.site).toString(),
	"jobTitle": "VFX Supervisor",
	"description": "VFX Supervisor and Houdini Artist specializing in commercial and music video visual effects",
	"worksFor": {
		"@type": "Organization",
		"name": "Biohazard VFX",
		"url": "https://biohazardvfx.com"
	},
	"knowsAbout": [
		"Visual Effects",
		"VFX Supervision", 
		"Compositing", 
		"Houdini", 
		"SideFX Houdini",
		"Nuke",
		"The Foundry Nuke",
		"3D Animation",
		"AI/ML Integration",
		"Motion Graphics",
		"Commercial VFX",
		"Music Video VFX"
	],
	"sameAs": [
		"https://instagram.com/nicholai.exe/",
		SOCIAL_LINKS.linkedin,
		"https://biohazardvfx.com"
	],
	"alumniOf": [],
	"award": []
};

// Structured Data - WebSite Schema with potential search action
const websiteSchema = {
	"@context": "https://schema.org",
	"@type": "WebSite",
	"@id": "https://nicholai.work/#website",
	"name": SITE_TITLE,
	"description": SITE_DESCRIPTION,
	"url": "https://nicholai.work",
	"inLanguage": "en-US",
	"author": {
		"@id": "https://nicholai.work/#person"
	},
	"publisher": {
		"@id": "https://nicholai.work/#person"
	}
};

// Structured Data - Professional Service (helps with local/service searches)
const professionalServiceSchema = {
	"@context": "https://schema.org",
	"@type": "ProfessionalService",
	"@id": "https://nicholai.work/#service",
	"name": "Nicholai Vogel - VFX Services",
	"description": "Professional visual effects services including VFX supervision, Houdini FX, compositing, and AI integration for commercials and music videos",
	"url": "https://nicholai.work",
	"provider": {
		"@id": "https://nicholai.work/#person"
	},
	"areaServed": "Worldwide",
	"serviceType": ["VFX Supervision", "Visual Effects", "Compositing", "3D Animation", "Motion Graphics"]
};
---

<!-- Global Metadata -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#0B0D11" />
<meta name="color-scheme" content="dark" />
<meta name="robots" content="index, follow" />
<meta name="author" content="Nicholai Vogel" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
<link rel="icon" type="image/png" sizes="192x192" href="/favicon-192.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="sitemap" href="/sitemap-index.xml" />
<link
	rel="alternate"
	type="application/rss+xml"
	title={SITE_TITLE}
	href={new URL('rss.xml', Astro.site)}
/>
<meta name="generator" content={Astro.generator} />

<!-- Fonts - Preconnect and load with display=swap -->
<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=IBM+Plex+Mono:wght@400;500;600;700&family=Sora:wght@300;400;500;600;700;800&display=swap"
	rel="stylesheet"
	media="print"
	onload="this.media='all'"
/>
<noscript>
	<link
		href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Sora:wght@300;400;500;600;700;800&display=swap"
		rel="stylesheet"
	/>
</noscript>

<!-- Icons - Load async to prevent render blocking -->
<!-- (Removed) Lucide CDN script: currently unused in this repo and adds a global network+JS cost. -->

<!-- Canonical URL -->
<link rel="canonical" href={canonicalURL} />

<!-- Primary Meta Tags -->
<title>{title}</title>
<meta name="title" content={title} />
<meta name="description" content={description} />

<!-- Open Graph / Facebook -->
<meta property="og:type" content={type} />
<meta property="og:url" content={Astro.url} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={new URL(image.src, Astro.url)} />
<meta property="og:site_name" content={SITE_TITLE} />
<meta property="og:locale" content="en_US" />
{publishedTime && <meta property="article:published_time" content={publishedTime.toISOString()} />}
{modifiedTime && <meta property="article:modified_time" content={modifiedTime.toISOString()} />}

<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:url" content={Astro.url.toString()} />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={new URL(image.src, Astro.url).toString()} />
<meta name="twitter:creator" content="@nicholai_exe" />

<!-- Structured Data - JSON-LD -->
<script type="application/ld+json" set:html={JSON.stringify(personSchema)} />
<script type="application/ld+json" set:html={JSON.stringify(websiteSchema)} />
<script type="application/ld+json" set:html={JSON.stringify(professionalServiceSchema)} />
