@php
    $bodyClass = 'case-studies-detail';
    $layout_path = 'frontend.layouts.content-sidebar';
    if($caseStudy->layout_type == 'blocks') {
        $bodyClass .= ' case-studies-detail--blocks';
        $layout_path = 'frontend.layouts.main';

        if($caseStudy->header_overlap) {
            $bodyClass .= ' header-over';
        }
    } else {
        if (!$caseStudy->slides->isEmpty()) {
            $bodyClass .= ' header-over';
        }
    }
@endphp

@extends($layout_path, [
    'body_class' => $bodyClass,
    'objectEmbeds' => $caseStudy->codeEmbeds
])

@if($caseStudy->layout_type == 'blocks')

    @section('content')
        <div class="case-studies-detail__content">
            @include('frontend.templates.components.blocks_section', ['blocks' => $caseStudy->blocks])
        </div>
    @stop

@else

    @if(!$caseStudy->slides->isEmpty())
        @section('content-header')
            <div class="case-studies-detail__header">
                @include('frontend.templates.components.gallery-slider', array(
                    "slides" => $caseStudy->slides,
                    "overlayId" => "case-studies-overlay-container"
                ))
                <div id="case-studies-overlay-container" class="case-studies-detail__header-overlay">
                    {{--
                    @include('frontend.templates.components.default_header_content', [
                        'headerTitle' => $caseStudy->title,
                        'headerTagline' => $caseStudy->tagline
                    ])
                    --}}
                </div>
            </div>
        @stop
    @endif
    @section('content-toolbar')
        <?php
            $caseStudyPub = $caseStudy->downloads->first();
        ?>
        @if($caseStudyPub !== null && !empty($caseStudyPub->pardot_url))
            <a
                href="#"
                class="download-btn download-btn--simple"
                data-download_id="{{ $caseStudyPub->id }}"
                data-download="{{ base64_encode(json_encode(["title" => $caseStudyPub->title, "url" => $caseStudyPub->pardot_url ])) }}"
                data-controller="components/form-modal"
                data-popupid="download-modal"
            >
            </a>
        @endif
        @include('frontend.templates.components.share_buttons')
    @stop

    @section('content-top')
        <div class="rich-content">
            <h2 class="case-studies-detail__client">
                {{$caseStudy->client_name}}
                <span>
                    @lang('frontend.Case_Study')
                </span>
            </h2>
            <h1>{{$caseStudy->title}}</h1>
        </div>
    @stop
    @section('content-left')
        @if($caseStudy->objective)
            <div class="rich-content rich-content__objective">
                <div class="heading3">{!! strip_tags($caseStudy->objective, '<b><sup><strong><sub><i><span><u>') !!}</div>
            </div>
        @endif
        @if($caseStudy->content)
            <div class="rich-content">
                {!! $caseStudy->content !!}
            </div>
        @endif
    @stop
    @section('content-footer')
        @include('frontend.templates.components.simple_related_items', array('title' => trans('frontend.further_reading')))
    @stop
@endif
