<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="color-scheme" content="light dark">
  <meta name="theme-color" content="#111111">
  <script>try{if(localStorage.getItem('kgv_theme')==='dark')document.documentElement.classList.add('dark');}catch(e){}</script>
  <script>try{if(!sessionStorage.getItem('kgv_booted')){document.documentElement.classList.add('booting');setTimeout(function(){document.documentElement.classList.remove('booting');},3000);}}catch(e){}</script>

  {{ $isHome := .IsHome }}
  {{ $desc := .Site.Params.description }}{{ with .Description }}{{ $desc = . }}{{ end }}
  <title>{{ if $isHome }}{{ .Site.Title }} — {{ .Site.Params.description }}{{ else }}{{ .Title }} — {{ .Site.Title }}{{ end }}</title>
  <meta name="description" content="{{ $desc }}">
  <meta name="author" content="{{ .Site.Params.author }}">
  <link rel="canonical" href="{{ .Permalink }}">

  {{/* social card image: project thumbnail, else home hero, else site default */}}
  {{ $ogimg := .Site.Params.ogImage }}
  {{ with .Params.heroImage }}{{ $ogimg = . }}{{ end }}
  {{ with .Params.thumbnail }}{{ $ogimg = . }}{{ end }}
  {{ $ogabs := "" }}{{ with $ogimg }}{{ $ogabs = . | absURL }}{{ end }}

  <meta property="og:site_name" content="{{ .Site.Title }}">
  <meta property="og:title" content="{{ if $isHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}">
  <meta property="og:description" content="{{ $desc }}">
  <meta property="og:type" content="{{ if eq .Section "portfolio" }}article{{ else }}website{{ end }}">
  <meta property="og:url" content="{{ .Permalink }}">
  <meta property="og:locale" content="{{ .Site.Language.Lang | default "en" }}">
  {{ with $ogabs }}<meta property="og:image" content="{{ . }}">{{ end }}

  <meta name="twitter:card" content="{{ if $ogabs }}summary_large_image{{ else }}summary{{ end }}">
  <meta name="twitter:title" content="{{ if $isHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}">
  <meta name="twitter:description" content="{{ $desc }}">
  {{ with $ogabs }}<meta name="twitter:image" content="{{ . }}">{{ end }}

  <link rel="preload" as="font" type="font/woff2" href="{{ "fonts/iosevka-curly-slab-400.woff2" | relURL }}" crossorigin>

  {{ $site := resources.Get "css/site.css" }}
  {{ $custom := resources.Get "css/custom.css" }}
  {{ $css := slice $site $custom | resources.Concat "css/bundle.css" | minify | fingerprint }}
  <link rel="stylesheet" href="{{ $css.RelPermalink }}">

  <link rel="icon" href="{{ "favicon.svg" | relURL }}" type="image/svg+xml">
  <link rel="icon" href="{{ "favicon-32.png" | relURL }}" sizes="32x32" type="image/png">
  <link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | relURL }}">
  <link rel="mask-icon" href="{{ "favicon.svg" | relURL }}" color="#111111">

  {{ if $isHome }}
  <script type="application/ld+json">
  {{ ( dict
      "@context" "https://schema.org"
      "@type" "Person"
      "name" .Site.Params.author
      "url" .Site.BaseURL
      "email" .Site.Params.email
      "jobTitle" "Architect"
      "address" ( dict "@type" "PostalAddress" "addressLocality" "Lucerne" "addressCountry" "CH" )
  ) | jsonify | safeJS }}
  </script>
  {{ end }}
</head>
