<?php
$main = array_slice($_view["articles"], 0, 1)[0];
$first = array_slice($_view["articles"], 1, 6);
$second = array_slice($_view["articles"], 7, 6);
?>

<div class="main-container mobile-pb-0 mobile-sb">
    <section>
        <h1 class="headline big space-mb-lg text-center text-lg-start">
            <span class="underline pink">
                <?= $_view["headline"]; ?>
            </span>
        </h1>
        <div class="row g-c">
            <div class="col-xl-12 col-lg-12"> <a href="<?= $main["link"];?>" class="article-card big mobile-w-100">
                    <div class="row gx-c">
                        <div class="col-xl-8 col-lg-6">
                            <div class="article-picture" data-lazybg="<?= $main["imageLink"];?>"> </div>
                        </div>
                        <div class="col-xl-4 col-lg-6 d-flex align-items-end">
                            <div class="article-content">
                                <?php if ($main["company"] ?? null) { ?>
                                <div class="article-company"> <b><?= $main["company"];?></b> </div>
                                <?php } ?>
                                <?php if ($main["categories"] ?? null) { ?>
                                    <?= $_con->getRenderedView("magazine/categories.partial", $main["categories"]); ?>
                                <?php } ?>
                                <h2 class="headline medium mb-2 mt-2 crop-text-2"><?= $main["title"];?></h2>
                                <p class="mb-0"><?= $main["preview"];?></p>
                                <div class="article-author mt-2">
                                    <p class="txt-small mb-0">
                                        <nobr><?=$main["author"];?></nobr> • <nobr><?= date("d. M Y", $main["timeCreated"]); ?></nobr>
                                    </p>
                                </div>
                                <object>
                                    <a href="<?= $main["link"];?>" class="d-block d-lg-none read-more">Artikel lesen <i class="bi bi-arrow-right-short"></i></a>
                                </object>
                            </div>
                        </div>
                    </div>
                </a> </div>
            <?php foreach ($first as $row) { ?>
            <div class="col-xl-4 col-lg-6">
                <?= $_con->getRenderedView("magazine/articleCard.partial", $row); ?>
            </div>
            <?php } ?>
        </div>
    </section>
    <section>
        <?= $_con->getRenderedView("index/newsletter.partial"); ?>
    </section>
    <section>
        <div class="row g-c">
            <?php foreach ($second as $row) { ?>
            <div class="col-xl-4 col-lg-6">
                <?= $_con->getRenderedView("magazine/articleCard.partial", $row); ?>
            </div>
            <?php } ?>
        </div>
    </section>
    <?php if ($_view["loadMore"]) { ?>
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="bg-lightpink space-p-md mobile-space-py-xl text-center space-mt-lg mobile-w-100">
                <h4 class="headline small space-mb-xs">Noch mehr?</h4>
                <a href="<?= $_con->getLink(["magazine", "articles", ...($_view["category"] ? [$_view["category"]] : [])], ["p" => 2]); ?>"
                    class="btn lg btn-secondary ico right">
                    Alle Artikel anzeigen<span class="icon"></span>
                </a>
            </div>
        </div>
    </div>
    <?php } ?>
</div>
<?= $_con->getRenderedView("magazine/ctaMagazine.partial"); ?>