{{ define "main" }}
  <header>
    <h1>{{ .Title }}</h1>
    {{ with .Summary }}
    <p class="lede">{{ . | markdownify }}</p>
    {{ end }}
  </header>
  <section id="studies">

  {{ range where .Site.RegularPages "Section" "studies" }}
    {{- $page := . -}}
    {{- $image := "" -}}
    {{- $color := "" -}}
    {{- $cardID := .Slug | default .File.ContentBaseName -}}
    {{- with .Params.list.img -}}
      {{- $match := $page.Resources.GetMatch . -}}
      {{- if not $match -}}
        {{- $match = $page.Resources.GetMatch (printf "%s" .) -}}
      {{- end -}}
      {{- with $match -}}
        {{- $image = .RelPermalink -}}
      {{- end -}}
    {{- end -}}
    {{- with .Params.list.color -}}
      {{- $color = . -}}
    {{- end -}}
    <article id="{{ $cardID }}"{{ with $color }} color="{{ . }}"{{ end }}{{ with $image }} style="--card-bg: url('{{ . }}');"{{ end }}>
      <a href="{{ .RelPermalink }}">
        <h2>{{ .Title }}</h2>
        <p>{{ .Summary }}</p>
      {{ with .Params.list.more }}<p>{{ . }}</p>{{ end }}
      {{- with .Params.study.facts -}}
        <div>
        {{- range . -}}
          {{- if or (eq .label "Role") (eq .label "Tools") (eq .label "Industry") -}}
            {{- $fact := . -}}
            {{- $iconColor := "" -}}
            {{- range $page.Params.list.facts -}}
              {{- if eq (lower .key) (lower $fact.label) -}}
                {{- $iconColor = .color -}}
              {{- end -}}
            {{- end -}}
          <figure>
            {{- with $fact.icon -}}
              {{ partial "icon.html" (dict "name" . "color" $iconColor) }}
            {{- end -}}
            <figcaption {{ with $fact.class }}class='{{ . }}'{{ end }}>{{ $fact.value | markdownify }}</figcaption>
          </figure>
          {{- end -}}
        {{- end -}}
        </div>
      {{- end -}}
      </a>
    </article>
  {{- end -}}
  </section>
{{ end }}