<!doctype html>
{{ "<!-- This site was created with Hugo Blox. https://hugoblox.com -->" | safeHTML }}
{{ printf "<!-- Last Published: %s -->" (now | time.Format ":date_long") | safeHTML }}
{{- $language_code := site.Language.Locale | default "en-us" -}}
<html lang="{{$language_code}}" {{ if in hugo.Data.i18n.rtl.rtl $language_code }}dir="rtl"{{else}}dir="ltr"{{end}}
      data-wc-theme-default="{{ (lower site.Params.hugoblox.theme.mode) | default "system" }}"
      data-hbb-relurl="{{ "" | relURL }}">
  {{ partial "site_head" . }}
  <body class="bg-[var(--hb-color-background)] text-[var(--hb-color-foreground)] page-wrapper" id="top">
    <div id="page-bg"></div>
    <div class="page-header {{ if site.Params.hugoblox.header.sticky }}sticky top-0 z-30{{ end }}">
      {{/* Load header block */}}
      {{ $show_navbar := ((site.Params.hugoblox.header.enable | default true) | and (ne .Params.header.navbar.enable false)) | or .Params.header.navbar.enable }}
      {{ if $show_navbar }}
        {{- $header_config := .Params.header.navbar | default site.Params.hugoblox.header | default dict -}}
        {{- $block_name := partial "hbx/resolve-block-param" (dict "config" $header_config "context" "header") | default "navbar" -}}
        {{ $block_path := printf "components/headers/%s.html" $block_name }}
        {{ if not (templates.Exists (printf "_partials/%s" $block_path)) }}
          {{ errorf "Check your `header` config in `params.yaml` and/or front matter. Cannot find header block at `layouts/_partials/%s`" $block_path }}
        {{ else }}
          {{ partial $block_path . }}
        {{ end }}
      {{ end }}
    </div>
    {{ $cover := partial "functions/get_cover_image.html" . }}
    <div class="page-body {{if and (ne .Type "landing") (not $cover)}} my-10{{end}}">
      {{ block "main" . }}{{ end }}
    </div>
    <div class="page-footer">
      {{ partial "site_footer" . }}
    </div>

    {{/* Notification Container for toasts/alerts */}}
    {{ partial "notification-container" . }}

    {{/* EXTENSIBILITY HOOK: BODY-END */}}
    {{ partial "functions/get_hook" (dict "hook" "body-end" "context" .) }}

    {{/* HBX Dev: ensure debug export and HUD are injected in dev */}}
    {{ if hugo.IsServer | and (site.Params.hugoblox.debug.enable | default false) }}
      {{ partial "hooks/body-end/hbx-debug-export.html" . }}
      {{ partial "hooks/body-end/hbx-debug-hud.html" . }}
    {{ end }}
  </body>
</html>
