<div class="hero-form hero-form--{{ $block->bg_color }} block-margin-top--{{ $block->margin_type_top }} block-margin-bottom--{{$block->margin_type_bottom}}" data-controller="blocks/hero-form">
    @if ($block->anchor_id )
        <div id="{{ $block->anchor_id }}" class="anchor-offset"></div>
    @endif
    <div class="hero-form__container">
        <div class="hero-form__wrapper">
            <div class="hero-form__inner" data-aos="fade" data-aos-delay="400">
                <div class="hero-form__bg" data-aos="fade" data-aos-delay="600">
                    @if($block->image1)
                        <picture>
                            <source media="(min-width: 768px)" type="image/webp" srcset="{{ getMediaUrl($block->image1->filename, '1145x700') }}.webp">
                            <source media="(min-width: 768px)" srcset="{{ getMediaUrl($block->image1->filename, '1145x700') }}">
                            <source type="image/webp" srcset="{{ getMediaUrl($block->image1->filename, '660x520') }}.webp">
                            <img src="{{ getMediaUrl($block->image1->filename, '660x520') }}" alt="{{ htmlentities($block->block_title) }}">
                        </picture>
                    @endif
                </div>
                <div class="hero-form__content" data-aos="fade-up" data-aos-delay="700">
                    <div class="hero-form__content-inner">
                        @if ($block->block_title)
                            <h1>@title($block->block_title)</h1>
                        @endif
                        @if (!empty($heroEvent))
                            <div class="hero-form__event-detail">
                                <div class="hero-form__event-info">
                                    <div class="hero-form__event-icon">
                                        @include('frontend.svg.icon-calendar')
                                    </div>
                                    <div class="hero-form__event-text">
                                        <div class="hero-form__event-label">@lang('frontend.when')</div>
                                        <div>
                                            @if($type == 'event')
                                                {{ event_date($item->date, $item->end_date) }}
                                            @else
                                                {{ format_date($item->date, true) }}
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                @if($item->time)
                                    <div class="hero-form__event-info">
                                        <div class="hero-form__event-icon">
                                            @include('frontend.svg.icon-time')
                                        </div>
                                        <div class="hero-form__event-text">
                                            <div class="hero-form__event-label">@lang('frontend.time')</div>
                                            <div>
                                                @foreach(explode("\n", $item->time) as $timeEntry)<span class="hero-form__time-separator">{{ $timeEntry }}</span>@endforeach
                                            </div>
                                        </div>
                                    </div>
                                @endif
                                <div class="hero-form__event-info">
                                    <div class="hero-form__event-icon">
                                        @include('frontend.svg.icon-marker')
                                    </div>
                                    <div class="hero-form__event-text">
                                        <div class="hero-form__event-label">@lang('frontend.where')</div>
                                        <div>{{ $eventsDetail->location }}</div>
                                    </div>
                                </div>
                            </div>
                        @elseif ($block->block_subject)
                            <p>{{ $block->block_subject }}</p>
                        @endif
                    </div>
                </div>
            </div>
            <div class="hero-form__form-box-container">
                <div class="hero-form__form-box-content hero-form--desktop" data-aos="fade" data-aos-delay="200" data-aos-offset="0">
                    @if ($block->block_subtitle)
                        <h2>{{ $block->block_subtitle }}</h2>
                    @endif
                    <div class="rich-content">
                        {!! $block->content !!}
                    </div>
                </div>
                @php
                    $registrationClosed = isset($type) && $type == 'event' && !empty($block->pardotForm) && $item->end_date < now()->startOfDay();
                @endphp
                <div class="hero-form__form-box @if($registrationClosed) hero-form--registration-closed @endif" data-aos="fade" data-aos-delay="800" data-aos-offset="0">
                    <div class="hero-form__form-box-wrapper">
                        <div>
                            <div class="hero-form__form-title" data-action="toggle">
                                @if(!$registrationClosed)
                                    {{ $block->form_title }}
                                @elseif(!empty($block->pardotForm))
                                    <span class="hero-form__registration-closed">
                                        @lang('frontend.registration_closed')
                                    </span>
                                @endif
                            </div>
                            <div class="hero-form__form" data-role="form-shutter">
                                @if(!$registrationClosed && !empty($block->pardotForm))
                                    <div data-role="form-inner">
                                        @include("frontend.components.pardot_form", array(
                                            "pardotForm" => $block->pardotForm,
                                            "pageUrl" => getRequestUrl(),
                                            "pageTitle" => !empty($metaData->meta_title) ? $metaData->meta_title : '',
                                            "downloadUrl" => !empty($block->publication->pardot_url) ? $block->publication->pardot_url : null,
                                            "extraQueryVars" => !empty($block->publication->pardot_url) ? "File_URL=" . urlencode($block->publication->pardot_url) . "&File_Title=" . urlencode($block->publication->title) : null
                                        ))
                                    </div>
                                @elseif(!empty($block->pardotForm))
                                    <span class="hero-form__registration-closed">
                                        @lang('frontend.registration_closed')
                                    </span>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="hero-form__form-box-content hero-form--mobile">
        @if ($block->block_subtitle)
            <h2>{{ $block->block_subtitle }}</h2>
        @endif
        <div class="rich-content">
            {!! $block->content !!}
        </div>
    </div>
</div>
