<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {{ $description := .Site.Params.description }}
    {{ with .Description }}
      {{ $description = . }}
    {{ else }}
      {{ with .Summary }}
        {{ $description = . | plainify }}
      {{ end }}
    {{ end }}
    <title>
      {{ if .IsHome }}
        {{ .Site.Title }}
      {{ else }}
        {{ .Title }} | {{ .Site.Title }}
      {{ end }}
    </title>
    <meta name="description" content="{{ $description }}">
    {{ with resources.Get "css/site.css" | fingerprint }}
      <link rel="stylesheet" href="{{ .RelPermalink }}">
    {{ end }}
    {{ if or .IsHome (and .IsPage (eq .Section "studies") .Params.study.toc) }}
      {{ with resources.Get "js/main.js" | fingerprint }}
      <script src="{{ .RelPermalink }}" defer></script>
      {{ end }}
    {{ end }}
  </head>
  <body id='{{ with .Params.body.id }}{{ . }}{{ else }}{{ with .Slug }}{{ . }}{{ else }}default{{ end }}{{ end }}'{{ with .Params.body.class }} class='{{ . }}'{{ end }}>
    {{- $pageLabel := "" -}}
    {{- $pageHref := "" -}}
    {{- if and .IsSection (eq .Section "studies") -}}
      {{- $pageLabel = "Case studies" -}}
      {{- $pageHref = "/studies" | relURL -}}
    {{- end -}}
    {{- if and .IsPage (eq .Section "studies") -}}
      {{- $pageLabel = "Case study" -}}
      {{- $pageHref = "/studies" | relURL -}}
    {{- end -}}
    {{- with .Params.header.page -}}
      {{- with .title -}}
        {{- $pageLabel = . -}}
      {{- end -}}
      {{- with .url -}}
        {{- $pageHref = . | relURL -}}
      {{- end -}}
    {{- end -}}
    <header>
      <div class="title">
        <a class="logo" href="{{ "/" | relURL }}">
          {{- if $pageLabel -}}
          <span class="tablet-hide">AG</span>
          <span class="tablet-show">Andrew Gioia</span>
          {{- else -}}
          <span>Andrew Gioia</span>
          {{- end -}}
        </a>
        {{- if $pageLabel -}}
        <a class="page" href="{{ $pageHref }}">
          {{ $pageLabel }}
        </a>
        {{ end }}
      </div>
      <menu aria-label="Primary">
        <li>
          <a href='{{ "/studies" | relURL }}'>
            <span>Case studies</span>
            {{ partial "icon.html" (dict "name" "book") }}
          </a>
        </li>
        <li>
          <a href="https://linkedin.com/in/andrewgioia">
            <span>Get in touch</span>
            {{ partial "icon.html" (dict "name" "mail") }}
          </a>
        </li>
        <li>
          <a href="https://github.com/andrewgioia">
            <span>GitHub</span>
            {{ partial "icon.html" (dict "name" "github") }}
          </a>
        </li>
      </menu>
    </header>
    <main>
      {{ block "main" . }}{{ end }}
    </main>
    <footer>
      {{ partial "footer.html" . }}
    </footer>
  </body>
</html>