@inject('type', 'Type')
@extends('template.'.config('settings.template').'.content.master')

@php
    $typeAnkundigung = $type->get("Ankündigung");
    $typeLeistungen = $type->get("Leistungen");
    $typeNews = $type->get("News");
    $typeProdukte = $type->get("Produkte");
@endphp

@section('head')
    <style>
        .block {
            width: 100%;
            height: 100%;
            position: relative;
            overflow: hidden;
            font-size: 16px;
        }
        .img-parallax {
            width: 100vmax;
            z-index: -1;
            position: absolute;
            top: 0;
            left: 50%;
            transform: translate(-50%, 0);
            pointer-events: none;
        }
    </style>
@stop
@section('content')

    @if($_hero_is_container)
    <div class="container">
    @endif
        <div class="block" style="height: 100%;">
            <x-img src="{{$cover}}" data-speed="-1" class="img-parallax" alt="{{config('settings.name')}} Cover" loading="eager" blur="off"/>
            <div class="d-none d-lg-flex" style="margin-top: 10%; margin-bottom: 8%;">
                <div class="p-3 rounded container" style="width: 45vw;  background: rgba(255, 255, 255, 0.35);
                border-radius: 16px;
                box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
                backdrop-filter: blur(5px);
                -webkit-backdrop-filter: blur(5px);
                border: 1px solid rgba(255, 255, 255, 0.3);">
                    <h1 class="card-title mb-1 text-center" style="text-shadow: 0 2px 4px {{$_primary_ci_color}}36;">
                        {{config('settings.name')}}
                    </h1>
                    <p class="card-text my-2 text-white fs-5" style="text-shadow: 0 2px 4px {{$_primary_ci_color}}36;">
                        {{config('settings.description')}}
                    </p>
                </div>
            </div>
        </div>
        <div class="card text-bg-dark border-0 d-lg-none" style="border-radius:0; box-shadow:none;">
            <x-img src="{{$cover}}" style="object-fit:cover; aspect-ratio:3/1;" class="img-fluid shadow-lg" alt="{{config('settings.name')}} Cover" />
            <div class="card-img-overlay d-none d-lg-flex align-items-center" styles="border-radius:0; background: radial-gradient(rgba(0,0,0,.5) 20%,rgba(0,0,0,.1)); box-shadow:inset 0 0 3px 1px rgba(0,0,0,.1), inset 0 0 25px 2px rgba(0,0,0,.2);">
                <div class="container p-3 rounded" style="width: 55vw; border-radius:0; background: radial-gradient({{$_primary_ci_color}}50,{{$_primary_ci_color}}30); box-shadow:inset 0 0 3px 1px {{$_primary_ci_color}}10, inset 0 0 25px 2px rgba(0,0,0,.2);">
                    <h1 class="card-title text-white mb-5 text-center text-uppercase">{{config('settings.name')}}</h1>
                    <p class="card-text my-2 text-white fs-5">{{config('settings.description')}}</p>
                </div>
            </div>
        </div>

    @if($_hero_is_container)
        </div>
    @endif

    <div class="container d-lg-none">
        <div class="row">
            <div class="col-12">
                <h1 class="card-title my-3">{{config('settings.name')}}</h1>
                <p class="card-text my-2 text-muted fs-5">{{config('settings.description')}}</p>
            </div>
        </div>
    </div>
    
    @if($typeAnkundigung->status)
        @if($typeAnkundigung->contents->isNotEmpty())
            <div class="container">
                <div class="row pt-1 pt-lg-4">
                    @foreach($typeAnkundigung->contents->take(3) as $content)
                        <div class="col-12">
                            @isset($content->link)
                                <a href="{{ $content->link }}" class="text-decoration-none" data-aos="fade-up">
                                    <div class="alert alert-{{ $content->color }} my-2" role="alert">
                                        <h5 class="alert-heading">
                                            <svg width="25" height="25" class="me-2" style="fill: currentColor;">
                                                <image id="type-icon" xlink:href="{{asset('fonts/icons/font-awesome/light/')}}/{{ $content->icon }}.svg" width="25" height="25"/>
                                            </svg>
                                            {{ $content->title }}</h5>
                                        {{ $content->ankundigung }}
                                        <div class="text-end">
                                            <i class="text-end me-5">Mehr lesen
                                                <svg style="width: 20px; fill: currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M507.3 267.3c6.2-6.2 6.2-16.4 0-22.6l-144-144c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6L457.4 240 16 240c-8.8 0-16 7.2-16 16s7.2 16 16 16l441.4 0L340.7 388.7c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0l144-144z"/></svg>
                                            </i>
                                        </div>
                                    </div>
                                </a>
                            @else
                                <div class="alert alert-{{ $content->color }} my-2" role="alert">
                                    <h5 class="alert-heading">
                                        <svg width="25" height="25" class="me-2" style="fill: currentColor;">
                                            <image id="type-icon" xlink:href="{{asset('fonts/icons/font-awesome/light')}}/{{ $content->icon }}.svg" width="25" height="25"/>
                                        </svg>
                                        {{ $content->title }}
                                    </h5>
                                    {{ $content->ankundigung }}
                                </div>
                            @endisset
                        </div>
                    @endforeach
                </div>
            </div>
        @endif
    @endif
    @if($typeLeistungen->status)
        @if($typeLeistungen->contents->isNotEmpty())
            <section>
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <h2 id="leistungen" class="mb-4">Leistungen</h2>
                        </div>
                        @foreach($typeLeistungen->contents->take(3) as $contentIndex => $content)
                            <a href="{{ $content->path }}" class="text-decoration-none">
                                <div class="card mb-4" >
                                    <div class="row g-0">
                                        <div class="col-md-4">
                                            <x-img src="{{$content->image()}}" alt="{{$content->title}}" style="aspect-ratio:9/5; object-fit:cover;" sizes="(max-width: 330px) 330px, 540px" class="img-fluid card-img-top rounded" loading="{{$contentIndex == 0?'eager':'lazy'}}"/>
                                        </div>
                                        <div class="col-md-7 ps-4">
                                            <div class="card-body py-lg-4 px-lg-3">
                                                <h3 class="card-title h4">{{$content->title}}</h3>
                                                <p class="card-text">{{$content->kurzbeschreibung}}</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        @endforeach
                        @if($typeLeistungen->contents->count() > 3)
                        <div class="col-12 text-center mt-3">
                            <a href="{{url('/leistungen')}}" class="text-muted text-decoration-none">
                                Alle Leistungen
                                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
                                    <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" />
                                </svg>
                            </a>
                        </div>
                        @endif
                    </div>
                </div>
            </section>
        @endif
    @endif
    @if($typeNews->status)
        @if($typeNews->contents->isNotEmpty())
            <section id="article-section" style="margin-top:120px;">
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <h2 id="aktuelles" class="mb-4">Aktuelles</h2>
                        </div>
                        @foreach($typeNews->contents->take(3) as $index => $content)
                            <div class="col-12 col-md-6 col-lg-4 mb-4" data-aos="fade-up" data-aos-delay="{{$index * 250}}">
                                <div class="card shadow-sm h-100">
                                    <a href="{{ $content->path }}" class="text-decoration-none">
                                        <x-img src="{{$content->image()}}" alt="{{$content->title}}" style="aspect-ratio:9/5; object-fit:cover;" sizes="(max-width: 330px) 330px, 540px" class="img-fluid card-img-top"/>
                                    </a>
                                    <div class="card-body">
                                        <h3 class="h5 mb-2">
                                            <a href="{{ $content->path }}" class="text-decoration-none">
                                                {{$content->title}}
                                            </a>
                                        </h3>
                                        <div class="text-muted small my-3">
                                            <span title="{{$content->created_at}}">
                                                <svg style="fill: currentColor;width:15px;margin-bottom: 5px;margin-right: 3px;}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M112 0c8.8 0 16 7.2 16 16V64H320V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v32 32V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 160 128C0 92.7 28.7 64 64 64H96V16c0-8.8 7.2-16 16-16zM416 192H32V448c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V192zM384 96H64c-17.7 0-32 14.3-32 32v32H416V128c0-17.7-14.3-32-32-32z"/></svg>
                                            {{ $content->updated_at->diffForHumans() }}
                                            </span>
                                        </div>

                                        {!! Str::limit($content->vorschau, 280) !!}
                                    </div>
                                    <div class="card-footer text-end">
                                        <a class="btn btn-sm btn-ci" href="{{ $content->path }}" onclick="gtag('event', 'See Job', {'event_category' : 'Home', 'event_label' : '{{$content->title}}'});">
                                            Mehr lesen
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
                                                <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" />
                                            </svg>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        @endforeach
                        @if($typeNews->contents->count() > 3)
                            <div class="col-12 text-center mt-3">
                                <a href="{{url('/aktuelles')}}" class="text-muted text-decoration-none">
                                    <svg style="fill: currentColor; width: 14px; margin-right: 4px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M32 132V48c0-8.8-7.2-16-16-16S0 39.2 0 48V176c0 8.8 7.2 16 16 16H144c8.8 0 16-7.2 16-16s-7.2-16-16-16H53.6C89.5 84.3 166.7 32 256 32c123.7 0 224 100.3 224 224s-100.3 224-224 224c-73.3 0-138.3-35.2-179.2-89.6c-5.3-7.1-15.3-8.5-22.4-3.2s-8.5 15.3-3.2 22.4C97.9 471.8 172.2 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C159.6 0 75.7 53.3 32 132zm224-4c-8.8 0-16 7.2-16 16V256c0 4.2 1.7 8.3 4.7 11.3l80 80c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6L272 249.4V144c0-8.8-7.2-16-16-16z"/></svg>
                                    Ältere Nachrichten
                                </a>
                            </div>
                        @endif
                    </div>
                </div>
            </section>
        @endif
    @endif
    @if($typeProdukte->status)
        @if($typeProdukte->contents->isNotEmpty())
            <section id="article-section" style="margin-top:120px;">
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <h2 id="aktuelles" class="mb-4">Produkte</h2>
                        </div>
                        @foreach($typeProdukte->contents->take(3) as $content)
                            <div class="col-12 col-md-6 col-lg-4 mb-4">
                                <div class="card shadow-sm h-100">
                                    <a href="{{ $content->path }}" class="text-decoration-none">
                                        <x-img src="{{$content->image()}}" alt="{{$content->title}}" style="aspect-ratio:9/5; object-fit:cover;" sizes="(max-width: 330px) 330px, 540px" class="img-fluid card-img-top"/>
                                    </a>
                                    <div class="card-body">
                                        <h3 class="h5 mb-2">
                                            <a href="{{ $content->path }}" class="text-decoration-none">
                                                {{$content->title}}
                                            </a>
                                        </h3>
                                        <div class="text-muted small my-3">
                                            <span title="{{$content->created_at}}">
                                                <svg style="fill: currentColor;width:15px;margin-bottom: 5px;margin-right: 3px;}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M112 0c8.8 0 16 7.2 16 16V64H320V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v32 32V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 160 128C0 92.7 28.7 64 64 64H96V16c0-8.8 7.2-16 16-16zM416 192H32V448c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V192zM384 96H64c-17.7 0-32 14.3-32 32v32H416V128c0-17.7-14.3-32-32-32z"/></svg>
                                                {{$content->updated_at->diffForHumans()}}
                                            </span>
                                        </div>
                                        {{$content->kurzbeschreibung}}
                                    </div>
                                    <div class="card-footer text-end">
                                        <a class="btn btn-sm btn-ci" href="{{$content->path}}" onclick="gtag('event', 'See Job', {'event_category' : 'Home', 'event_label' : '{{$content->title}}'});">
                                            Mehr lesen
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
                                                <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" />
                                            </svg>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        @endforeach
                        @if($typeProdukte->contents->count() > 3)
                            <div class="col-12 text-center mt-3">
                                <a href="{{url('/aktuelles')}}" class="text-muted text-decoration-none">
                                    <svg style="fill: currentColor; width: 14px; margin-right: 4px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M32 132V48c0-8.8-7.2-16-16-16S0 39.2 0 48V176c0 8.8 7.2 16 16 16H144c8.8 0 16-7.2 16-16s-7.2-16-16-16H53.6C89.5 84.3 166.7 32 256 32c123.7 0 224 100.3 224 224s-100.3 224-224 224c-73.3 0-138.3-35.2-179.2-89.6c-5.3-7.1-15.3-8.5-22.4-3.2s-8.5 15.3-3.2 22.4C97.9 471.8 172.2 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C159.6 0 75.7 53.3 32 132zm224-4c-8.8 0-16 7.2-16 16V256c0 4.2 1.7 8.3 4.7 11.3l80 80c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6L272 249.4V144c0-8.8-7.2-16-16-16z"/></svg>
                                    Ältere Nachrichten
                                </a>
                            </div>
                        @endif
                    </div>
                </div>
            </section>
        @endif
    @endif
    <section id="kontakt">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <h2 class="mt-4 mb-5">Kontakt</h2>
                    <br>
                </div>
                <div class="col-md-4 text-center" data-aos="zoom-in">
                    <div class="icon-box-2">
                        <div class="icon-box-content">
                            <svg style="fill: {{$_title_color}} ; width: 70px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M487.8 24.1L387 .8c-14.7-3.4-29.8 4.2-35.8 18.1l-46.5 108.5c-5.5 12.7-1.8 27.7 8.9 36.5l53.9 44.1c-34 69.2-90.3 125.6-159.6 159.6l-44.1-53.9c-8.8-10.7-23.8-14.4-36.5-8.9L18.9 351.3C5 357.3-2.6 372.3.8 387L24 487.7C27.3 502 39.9 512 54.5 512 306.7 512 512 307.8 512 54.5c0-14.6-10-27.2-24.2-30.4zM55.1 480l-23-99.6 107.4-46 59.5 72.8c103.6-48.6 159.7-104.9 208.1-208.1l-72.8-59.5 46-107.4 99.6 23C479.7 289.7 289.6 479.7 55.1 480z"/></svg>
                            <p class="mt-4">
                                Telefon: <a href="tel://{{$_telefonnummer}}" class="text-decoration-none">{{$_telefonnummer}}</a>
                            </p>
                            <br>
                            <br>
                            <br>
                        </div>

                    </div>

                </div>
                <div class="col-md-4 text-center" data-aos="zoom-in" data-aos-delay="250">
                    <div class="icon-box-2">
                        <svg style="fill: {{$_title_color}}; width: 70px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C118.941 8 8 118.919 8 256c0 137.058 110.919 248 248 248 52.925 0 104.68-17.078 147.092-48.319 5.501-4.052 6.423-11.924 2.095-17.211l-5.074-6.198c-4.018-4.909-11.193-5.883-16.307-2.129C346.93 457.208 301.974 472 256 472c-119.373 0-216-96.607-216-216 0-119.375 96.607-216 216-216 118.445 0 216 80.024 216 200 0 72.873-52.819 108.241-116.065 108.241-19.734 0-23.695-10.816-19.503-33.868l32.07-164.071c1.449-7.411-4.226-14.302-11.777-14.302h-12.421a12 12 0 0 0-11.781 9.718c-2.294 11.846-2.86 13.464-3.861 25.647-11.729-27.078-38.639-43.023-73.375-43.023-68.044 0-133.176 62.95-133.176 157.027 0 61.587 33.915 98.354 90.723 98.354 39.729 0 70.601-24.278 86.633-46.982-1.211 27.786 17.455 42.213 45.975 42.213C453.089 378.954 504 321.729 504 240 504 103.814 393.863 8 256 8zm-37.92 342.627c-36.681 0-58.58-25.108-58.58-67.166 0-74.69 50.765-121.545 97.217-121.545 38.857 0 58.102 27.79 58.102 65.735 0 58.133-38.369 122.976-96.739 122.976z"/></svg>
                        <div class="icon-box-content">
                            <p class="mt-4">
                                <a href="mailto:{{config('settings.contact_email')}}" class="text-decoration-none">{{config('settings.contact_email')}}</a>
                            </p>
                            <br>
                            <br>
                            <br>
                        </div>

                    </div>
                </div>
                <div class="col-md-4 text-center" data-aos="zoom-in" data-aos-delay="500">
                    <div class="icon-box-2">
                        <svg style="fill: {{$_title_color}}; width: 70px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M570.53,242,512,190.75V48a16,16,0,0,0-16-16H400a16,16,0,0,0-16,16V78.75L298.53,4a16,16,0,0,0-21.06,0L5.47,242a16,16,0,0,0,21.07,24.09L64,233.27V464a48.05,48.05,0,0,0,48,48H464a48.05,48.05,0,0,0,48-48V233.27l37.46,32.79A16,16,0,0,0,570.53,242ZM480,464a16,16,0,0,1-16,16H112a16,16,0,0,1-16-16V205.27l192-168,192,168Zm0-301.25-64-56V64h64ZM208,218.67V325.34A26.75,26.75,0,0,0,234.66,352H341.3A26.76,26.76,0,0,0,368,325.34V218.67A26.75,26.75,0,0,0,341.3,192H234.66A26.74,26.74,0,0,0,208,218.67ZM240,224h96v96H240Z"/></svg>
                        <div class="icon-box-content">
                            <p class="mt-4">
                                <strong>{{$_legal_name}}</strong>
                                <br>
                                {{$_legal_address}}
                                <br>
                                {{$_legal_zip_code}} {{$_legal_city}}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div>
    </section>
@stop
@section('scripts')
    <script>
        document.addEventListener("DOMContentLoaded", () => {
            $('.img-parallax').each(function() {
                var $image = $(this);
                var $imageParent = $(this).parent().parent().parent();

                function parallaxImg () {
                    var speed = $image.data('speed');
                    var imageY = $imageParent.offset().top;
                    var winY = $(this).scrollTop();
                    var winH = $(this).height();
                    var parentH = $imageParent.innerHeight();
                    // The next pixel to show on screen
                    var winBottom = winY + winH;

                    // If block is shown on screen
                    if (winBottom > imageY && winY < imageY + parentH) {
                        // Number of pixels shown after block appear
                        var imgBottom = ((winBottom - imageY) * speed);
                        // Max number of pixels until block disappear
                        var imgTop = winH + parentH;
                        // Percentage between start showing until disappearing
                        var imgPercent = ((imgBottom / imgTop) * 100) + (50 - (speed * 50));
                    }

                    $image.css({ top: imgPercent + '%', transform: 'translate(-50%, -' + imgPercent + '%)' });
                }

                $(document).on({ scroll: function () { parallaxImg(); } });

                parallaxImg();
            });
        });
    </script>
@stop
