{{ define "main" }}

{{ $data := index .Site.Data .Site.Language.Lang }}

{{ if $data.homepage.slider.enable }}
{{ with $data.homepage.slider }}
<section class="hero-section overlay bg-cover hero-default" data-background="{{ .bg_image | absURL }}">
  <div class="container">
    <div class="hero-slider">
        <div class="row">
          <div class="col-md-12">
            <h2 class="text-white">{{ $data.homepage.slider.title | markdownify }}</h2>
            <div class="hero-slider-items">
            {{ range .slider_item }}
              <div class="hero-slider-item">
                <p class="text-muted mb-4" >{{ .content | markdownify }}</p>
                {{ if .button.enable }}
                  <a href="{{ .button.link | absLangURL }}" class="btn btn-primary">{{ .button.label }}</a>
                {{ end }}
              </div>
            {{ end }}
            </div>
          </div>
        </div>
    </div>
  </div>
</section>
{{ end }}
<noscript>
  <style>
    .hero-default {
      display: none;
    }
  </style>
  <section class="hero-section overlay bg-cover" style="background-image: url({{ $data.homepage.slider.bg_image | absURL }});">
    <div class="container">
      <div class="hero-slider">
          <div class="row">
            <div class="col-md-12">
              <h1 class="text-white">{{ $data.homepage.slider.title | markdownify }}</h1>
              {{ range first 1 $data.homepage.slider.slider_item }}
                <p class="text-muted mb-4">{{ .content | markdownify }}</p>
                {{ if .button.enable }}
                  <a href="{{ .button.link | absLangURL }}" class="btn btn-primary">{{ .button.label }}</a>
                {{ end }}
              {{ end }}
            </div>
          </div>
        </div>
    </div>
  </section>
</noscript>
{{ end }}

{{ if $data.homepage.header_logos.enable }}
{{ with $data.homepage.header_logos }}
<section class="bg-white">
  <div class="container">
    <div class="row align-items-center">
      {{ range .logos }}
        <div class="col-md-3 col-6 order-1 order-md-2 mt-4">
          <a href="{{ .link }}" target="_blank" title="{{ .title }}"><img class="img-fluid w-100" src="{{ .image }}"></a>
        </div>
		  {{ end }}
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ if $data.homepage.about.enable }}
{{ with $data.homepage.about }}
<section class="section-sm">
  <div class="container">
    <div class="row align-items-center">
      <div class="col-md-10 order-2 order-md-1">
        <h3 class="section-title">{{ .title | markdownify }}</h3>
        <div class="content">
          {{ .content | markdownify }}
        </div>
        {{ if .button.enable }}
        {{ with .button }}
        <a href="{{ .link | absLangURL }}" class="btn btn-primary">{{ .label }}</a>
        {{ end }}
        {{ end }}
      </div>
      {{ with .image }}
      <div class="col-md-2 col-6 order-1 order-md-2 mb-md-0 mx-auto">
        <img class="img-fluid w-100" src="{{ . | absURL }}">
      </div>
      {{ end }}
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ if $data.ausblick.enable }}
{{ with $data.ausblick }}
  {{ partial "modal" . }}
{{ end }}
{{ end }}

{{ if $data.homepage.blog.enable }}
<section class="mb-4">
  <div class="container">
    <div class="row">
      <div class="col-12">
        <h2 class="section-title">{{ $data.homepage.blog.title }}</h2>
      </div>
    </div>
    <div class="row justify-content-center">
      <div class="col-lg-4 col-sm-6 mb-5 mb-lg-0">
        <div class="card rounded-0 border-primary hover-shadow">
          <img class="card-img-top rounded-0" src="{{ $data.ausblick.image | relURL }}" alt="{{ $data.ausblick.title }}">
          <div class="card-body">
            <ul class="list-inline mb-3">
              <li class="list-inline-item mr-3 ml-0"><i class="mdi mdi-fountain-pen-tip"></i> <a
                href="{{ `author` | relLangURL }}/{{ $data.ausblick.author | urlize }}">{{ $data.ausblick.author | title }}</a></li>
            </ul>
              <h4 class="card-title">{{ $data.ausblick.title }}</h4>
            <p class="card-text">{{ $data.ausblick.content | truncate 100 }}</p>
            <button type="button" class="btn btn-primary btn-sm" onclick="$('#{{ md5 $data.ausblick.title }}').modal('show');">{{
              i18n "show_more"}}</button>
          </div>
        </div>
      </div>
      {{ range first 2 (where .Site.RegularPages "Type" "post")}}
      <article class="col-lg-4 col-sm-6 mb-5 mb-lg-0">
        {{ .Render "card" }}
      </article>
      {{ end }}
    </div>
  </div>
</section>
{{ end }}

{{ if $data.homepage.success_banner.enable }}
{{ with $data.homepage.success_banner }}
<section class="section bg-cover" data-background="{{ .image | absURL }}" id="success">
  <div class="container">
    <div class="row no-gutters">
      <div class="col-12">
        <div class="row feature-blocks bg-white justify-content-between">
          {{ range .feature_item }}
          <div class="col-xl-5 mb-xl-5 mb-4 text-sm-left">
            {{ with .image }}
              <img src="{{ . }}" class="mb-xl-4 mb-lg-3 mb-4 feature-icon"></img>
            {{ end }}
            {{ with .icon }}
              <i class="{{ . }} mb-xl-4 mb-lg-3 mb-4 feature-icon"></i>
            {{ end }}
            <h3 class="mb-xl-4 mb-lg-3 mb-4">{{ .name | markdownify }}</h3>
            <div class="content">
              {{ .content | markdownify }}
            </div>
          </div>
          {{ end }}
        </div>
      </div>
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ if $data.homepage.ganztagsangebote.enable }}
<section class="section-sm">
  <div class="container">
    <div class="row">
      <div class="col-12">
        <div class="d-flex align-items-center section-title justify-content-between">
          <h2 class="mb-0 text-nowrap mr-3">{{ $data.homepage.ganztagsangebote.title }}</h2>
          <div class="border-top w-100 border-primary d-none d-sm-block"></div>
          <div>
            <a href="{{ `ganztagsangebote` | relLangURL }}" class="btn btn-sm btn-primary-outline ml-sm-3 d-none d-sm-block">{{ i18n "see_all" }}</a>
          </div>
        </div>
      </div>
    </div>
    <div class="row justify-content-center">
      {{ range first 6 (where .Site.RegularPages "Type" "ganztagsangebote" | shuffle)}}
      <div class="col-lg-4 col-sm-6">
        {{ .Render "ganztag" }}
      </div>
      {{ end }}
    </div>
    <div class="row">
      <div class="col-12 text-center">
        <a href="{{ `ganztagsangebote` | relLangURL }}" class="btn btn-sm btn-primary-outline d-sm-none d-inline-block">{{ i18n "see_all" }}</a>
      </div>
    </div>
  </div>
</section>
{{ end }}

{{ if $data.homepage.cta.enable }}
{{ with $data.homepage.cta }}
<section class="section bg-primary">
  <div class="container">
    <div class="row">
      <div class="col-12 text-center">
        <h2 class="text-white font-secondary mb-0">{{ .title | markdownify }}</h2>
        <h5 class="section-title text-white">{{ .subtitle | markdownify }}</h5>
        {{ if .button.enable }}
        {{ with .button }}
        <a href="{{ .link | absLangURL }}" class="btn btn-secondary text-uppercase">{{ .label }}</a>
        {{ end }}
        {{ end }}
      </div>
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ if $data.homepage.info.enable }}
{{ partial "info.html" . }}
{{ end }}

{{ if $data.homepage.termine.enable }}
<section class="section bg-gray">
  <div class="container">
    <div class="row">
      <div class="col-12">
        <div class="d-flex align-items-center section-title justify-content-between">
          <h2 class="mb-0 text-nowrap mr-3">{{ $data.homepage.termine.title }}</h2>
          <div class="border-top w-100 border-primary d-none d-sm-block"></div>
          <div>
            <a href="{{`termine` | relLangURL }}" class="btn btn-sm btn-primary-outline ml-sm-3 d-none d-sm-block text-nowrap">{{ i18n "all_events" }}</a>
          </div>
        </div>
      </div>
    </div>
    <div class="row justify-content-center px-2">
      
      {{ with .Site.GetPage "/termine/_index.md" }}

      {{ $events := slice }}
      {{ range .Params.events }}
        {{ if or (ge (.date | time.AsTime).Unix now.Unix) (and .enddate (ge (.enddate | time.AsTime).Unix now.Unix)) }}
          {{ $events = $events | append . }}
        {{ end }}
      {{ end }}

      {{ range first 3 $events }}
      <li class="d-md-table mb-4 w-100 border-bottom hover-shadow">
        <div class="d-md-table-cell text-center p-4 bg-primary text-white mb-4 mb-md-0 termin-tc">
          <span class="h2 d-block">{{ time.Format "2" .date}}</span>
          <span class="d-block">{{ time.Format "Jan 2006" .date}}</span>
          {{ with .enddate }}
            <br>
            bis {{ time.Format "2 Jan 2006" . }}
          {{ end }}
        </div>
        <div class="d-md-table-cell px-4 vertical-align-middle mb-4 mb-md-0 p-2">
          <p class="h4 mb-0 d-block">{{ .title }}</p>
        </div>
        {{ with .location }}
        <div class="d-md-table-cell text-right pr-0 pr-md-4 p-2 vertical-align-middle">
          <p>
            <i class="mdi mdi-map-marker-radius-outline icon-s text-primary mr-2"></i>
            {{ . | markdownify }}
          </p>
        </div>
        {{ end }}
      </li>
      {{ end }}

      {{ end }}

    </div>
    <div class="row">
      <div class="col-12 text-center">
        <a href="{{`termine` | relLangURL }}" class="btn btn-sm btn-primary-outline d-sm-none d-inline-block">{{ i18n "see_all" }}</a>
      </div>
    </div>
  </div>
</section>
{{ end }}

{{ if $data.homepage.digitalpakt.enable }}
{{ with $data.homepage.digitalpakt }}
<section class="section bg-footer">
  <div class="container">
    <div class="row align-items-center">
      <div class="col-md-7 order-2 order-md-1">
        <h3 class="section-title text-white font-secondary">{{ .title | markdownify }}</h2>
        <div class="content ">
          {{ .content | markdownify }}
        </div>
        {{ if .button.enable }}
        {{ with .button }}
        <a href="{{ .link | absLangURL }}" class="btn btn-primary">{{ .label }}</a>
        {{ end }}
        {{ end }}
      </div>
      {{ with .image }}
      <div class="col-md-5 order-1 order-md-2 mb-4 mb-md-0">
        <img class="img-fluid w-100" src="{{ . | absURL }}">
      </div>
      {{ end }}
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ if $data.homepage.footer_logos.enable }}
{{ with $data.homepage.footer_logos }}
<section class="bg-footer">
  <div class="container">
    <div class="row align-items-center">
		{{ range .logos }}
        <div class="col-md-2 col-4 order-1 order-md-2 mb-4">
          <a href="{{ .link }}" target="_blank" title="{{ .title }}"><img class="img-fluid w-100" src="{{ .image }}"></a>
        </div>
		{{ end }}
    </div>
  </div>
</section>
{{ end }}
{{ end }}

{{ end }}