<!doctype html>
<html lang="{{ .Site.LanguageCode }}" class="scroll-smooth">
<head>
  {{- partial "head.html" . -}}
</head>
<body
  class="bg-void text-paper font-body min-h-screen flex flex-col antialiased"
  hx-boost="true"
  hx-select="#main-content"
  hx-target="#main-content"
  hx-swap="outerHTML"
  hx-push-url="true"
>

  <!-- HTMX transition progress bar -->
  <div id="progress-bar" aria-hidden="true"></div>

  {{- partial "nav.html" . -}}

  {{- block "page-background" . -}}{{- end -}}

  <main id="main-content" class="flex-1" style="view-transition-name: main-content">
    {{- block "main" . }}{{- end }}
  </main>

  {{- partial "footer.html" . -}}

  <!-- HTMX (page transitions & progressive enhancement) -->
  <script src="https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js"></script>
  <!-- Alpine.js store initialisation (must run before alpine:init) -->
  <script>
    document.addEventListener('alpine:init', () => {
      Alpine.store('nav', { path: window.location.pathname, open: false })
    })
  </script>
  <!-- Alpine.js (reactive UI — nav, interactions) -->
  <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.8/dist/cdn.min.js"></script>
  <!-- Site JS -->
  {{- $js := resources.Get "js/main.js" -}}
  {{- if eq hugo.Environment "production" -}}
    {{- $js = $js | minify | fingerprint "sha256" -}}
  {{- end -}}
  <script src="{{ $js.RelPermalink }}"{{ if eq hugo.Environment "production" }} integrity="{{ $js.Data.Integrity }}"{{ end }} defer></script>

  {{- block "scripts" . }}{{- end }}

  {{- if and (eq hugo.Environment "production") .Site.Params.umamiId -}}
  <!-- Umami analytics — cookie-free, self-hosted -->
  <script defer src="{{ .Site.Params.umamiSrc }}" data-website-id="{{ .Site.Params.umamiId }}"></script>
  {{- end -}}
</body>
</html>
