<?php
if (TL_MODE == 'FE') {
    $GLOBALS['TL_CSS'][] = 'files/base/layout/css/elements/custom-elements/ce_rsce_landingpageentry.min.css|static';
}
?>

<div <?php echo $this->cssID; ?> class="content--element <?php echo $this->class; ?>">
    <div class="ce--inner ">
        <?php if ($this->headline || $this->subline || $this->topline) : ?>
        <div class="ce--headline container"
             data-aos="<?php if ($this->animation_type) : ?><?php echo $this->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
            <?php if ($this->topline) : ?>
                <span class="ce--topline"><?php echo $this->topline; ?></span>
            <?php endif; ?>
            <?php if ($this->headline) : ?>
            <<?php echo($this->hl); ?>><?php echo($this->headline); ?></<?php echo($this->hl); ?>>
    <?php endif; ?>
        <?php if ($this->subline) : ?>
            <span class="ce--subline"><?php echo $this->subline; ?></span>
        <?php endif; ?>
    </div>
    <?php endif; ?>
    <div class="ce--landingpage-entry">

        <?php if ($this->boxed_image): ?>
            <div class="boxed--image">
                <img class="lazy"
                     data-aos="<?php if ($this->boxed_image_animation_type) : ?><?php echo $this->boxed_image_animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>"
                     data-src="<?= Image::get(FilesModel::findByUuid($this->boxed_image)->path, null, null, null); ?>">
            </div>
        <?php endif; ?>

        <div class="row gx-0">
            <?php foreach ($this->kachel as $i => $b) : ?>

            <div class="<?php echo $b->column_width; ?>">
                <div id="landingpageColumn_<?= $this->id; ?>_<?= $i; ?>" class="landingpage-column"
                     style="<?php if ($b->column_background_color): ?>
                             background-color: <?= $b->column_background_color;?>;
                        <?php endif; ?>

                     <?php if ($b->column_text_color): ?>
                             color: <?= $b->column_text_color;?>;
                        <?php endif; ?>">

                    <style>
                        <?php if($b->top_background_hover_color):?>
                        <?php
                             $top_background_hover_color = $b->top_background_hover_color;
                             $top_background_hover_color = str_replace("&#41", ")",$top_background_hover_color);
                             $top_background_hover_color = str_replace("&#40", "(",$top_background_hover_color);
                             $top_background_hover_color = str_replace("(;", "(",$top_background_hover_color);
                             $top_background_hover_color = str_replace("&#35;", "#",$top_background_hover_color);
                                $top_background_hover_color = str_replace(");", ")",$top_background_hover_color);
                         ?>

                        #landingpageColumn_<?=$this->id;?>_<?= $i;?>:hover .lp--top:after {
                            background-color: <?= $top_background_hover_color;?> !important;
                        }

                        <?php endif;?>

                        <?php if($b->middle_text_hover_color):?>
                        <?php
                             $middle_text_hover_color = $b->middle_text_hover_color;
                             $middle_text_hover_color = str_replace("&#41", ")",$middle_text_hover_color);
                             $middle_text_hover_color = str_replace("&#40", "(",$middle_text_hover_color);
                             $middle_text_hover_color = str_replace("(;", "(",$middle_text_hover_color);
                             $middle_text_hover_color = str_replace("&#35;", "#",$middle_text_hover_color);
                             $middle_text_hover_color = str_replace(");", ")",$middle_text_hover_color);
                         ?>

                        #landingpageColumn_<?=$this->id;?>_<?= $i;?>:hover .lp--middle .middle--content a:hover {
                            color: <?= $middle_text_hover_color;?> !important;
                        }

                        <?php endif;?>

                    </style>

                    <div class="lp--inner">

                        <div class="lp--top"
                             style="<?php if ($b->image_as_bg && $this->image_height) : ?>height: <?= $this->image_height;?>px<?php endif; ?>">
                            <a href="<?= $b->middle_link_url; ?>"></a>

                            <div style=" background: url(<?= Image::get(FilesModel::findByUuid($b->image)->path, null, null, null); ?>) center center no-repeat; background-size: cover;"
                                 class="lp--image-holder"></div>
                        </div>

                        <div class="lp--middle">
                            <div class="middle--content" style="<?php if ($b->middle_background_color): ?>
                                    background-color: <?= $b->middle_background_color;?>;
                        <?php endif; ?>

                            <?php if ($b->middle_text_color): ?>
                                    color: <?= $b->middle_text_color;?>;
                        <?php endif; ?>">

                                <a href="<?= $b->middle_link_url; ?>"
                                   data-aos="<?php if ($b->animation_type) : ?><?php echo $b->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>"
                                   style="color: <?= $b->middle_text_color; ?>;"

                                ><?= $b->middle_link_text; ?></a>

                            </div>
                        </div>

                        <div class="lp--bottom <?= $b->textalign; ?>" style="<?php if ($b->bottom_background_color): ?>
                                background-color: <?= $b->bottom_background_color;?>;
                        <?php endif; ?>

                        <?php if ($b->bottom_text_color): ?>
                                color: <?= $b->bottom_text_color;?>;
                        <?php endif; ?>">
                            <div class="content--inner"
                                 data-aos="<?php if ($b->animation_type) : ?><?php echo $b->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
                                <?php if ($b->content_headline) : ?>
                                <div class="headline">
                                    <<?php echo $b->headline_type; ?> style=" <?php if ($b->bottom_text_color): ?>
                                        color: <?= $b->bottom_text_color; ?>;
                                    <?php endif; ?>">
                                    <?php echo $b->content_headline; ?>
                                </<?php echo $b->headline_type; ?>>
                            </div>
                            <?php endif; ?>
                            <?php if ($b->text) : ?>
                                <div class="text">
                                    <?php echo $b->text; ?>
                                </div>
                            <?php endif; ?>

                            <?php if ($b->buttons[0]->link_text != "") : ?>
                                <div class="buttons mt-5 <?= $b->button_textalign; ?>">
                                    <?php foreach ($b->buttons as $button) : ?>
                                        <a <?php if ($button->new_tab): ?>target="_blank"<?php endif; ?>
                                           class="mt-2 btn <?php if ($button->link_size) : ?><?php echo $button->link_size; ?><?php endif; ?> <?php echo $button->link_type; ?>"
                                           data-aos="<?php if ($button->animation_type) : ?><?php echo $button->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>"
                                           href="<?php echo $button->link_url; ?><?php if ($button->link_betreff) : ?>?subject=<?php echo $button->link_betreff; ?><?php endif; ?>"><?php echo $button->link_text; ?> </a>
                                    <?php endforeach ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php endforeach; ?>
    </div>
</div></div></div>