{{ $_hugo_config := `{ "version": 1 }` }}
{{ $blockID := "td-cover-block-1" }}
{{ $promo_image := (.Page.Resources.ByType "image").GetMatch "**background*" }}
{{ $logo_image := (.Page.Resources.ByType "image").GetMatch "**logo*" }}
{{ $col_id := .Param "color" | default "dark" }}
{{ $image_anchor := .Param "image_anchor" | default "smart" }}
{{ $logo_anchor := .Param "logo_anchor" | default "smart" }}
{{/* Height can be one of: auto, min, med, max, full. */}}
{{ $height := .Param "height" | default "max" }}
{{ $description := .Param "description" | default "" }}
{{ with $promo_image }}
{{ $promo_image_big := (.Fill (printf "1920x1080 %s" $image_anchor)) }}
{{ $promo_image_small := (.Fill (printf "960x540 %s" $image_anchor)) }}
<link rel="preload" as="image" href="{{ $promo_image_small.RelPermalink }}" media="(max-width: 1200px)">
<link rel="preload" as="image" href="{{ $promo_image_big.RelPermalink }}" media="(min-width: 1200px)">
<style>
#{{ $blockID }} {
    background-image: url({{ $promo_image_small.RelPermalink }});
}
@media only screen and (min-width: 1200px) {
    #{{ $blockID }} {
        background-image: url({{ $promo_image_big.RelPermalink }});
    }
}
</style>
{{ end }}
<section id="{{ $blockID }}" class="row td-cover-block td-cover-block--height-{{ $height }}{{ if not .Site.Params.ui.navbar_translucent_over_cover_disable }} js-td-cover{{ end }} td-overlay td-overlay--dark -bg-{{ $col_id }}">
  <div class="container td-overlay__inner">
    <div class="row">
      <div class="col-12">
        <div class="text-center">
          {{ with .Param "title" }}<h1 class="display-1 mt-0 mt-md-5 pb-4">{{ $title := . }}{{ with $logo_image }}{{ $logo_image_resized := (.Fit (printf "70x70 %s" $logo_anchor)) }}<img class="td-cover-logo" src="{{ $logo_image_resized.RelPermalink }}" alt="{{ $title | html }} Logo">{{ end }}{{ $title | html }}</h1>{{ end }}
          {{ with .Param "subtitle" }}<p class="display-2 text-uppercase mb-0">{{ . | html }}</p>{{ end }}
          <div class="pt-3 lead">
            <div class="mx-auto">
              <a class="btn btn-lg btn-primary mr-3 mb-4" href="{{ relref . "specifications" }}">
                Specification <i class="fas fa-arrow-alt-circle-right ml-2"></i>
              </a>
              {{ if $description }}
              <p class="lead mt-5">{{ $description }}</p>
              {{ end }}
              <a class="btn btn-link text-blue" href="#td-block-1" aria-label="{{ T "ui_read_more"}}"><i class="fa-solid fa-circle-chevron-down" style="font-size: 400%"></i></a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>
