<?php if ($item = $block->obj()->toObject()) : ?>
    <?php $image = $item->photo()->toFile(); ?>


    <div class="card mainnav-item" style="background-image: url('<?= $image ? $image->url() : '' ?>')">
        <?php if ($lp = $item->linkedPage()->toPage()) : ?>
            <a class="no-decoration" href="<?= $lp->url() ?>">
            <?php endif ?>

            <div class="card-body">
                <?php if ($item->headline()->isNotEmpty()) : ?>
                    <div class="h2-container">
                        <h2><?= $item->headline() ?></h2>
                    </div>
                <?php endif ?>
                <?php if ($item->btn_label()->isNotEmpty() && $lp) : ?>
                    <div class="btn-container">
                        <button class="btn btn-primary"><?= $item->btn_label() ?><i class="fas fa-arrow-right"></i></button>
                    </div>
                <?php endif ?>
            </div>

            <?php if ($lp) : ?>
            </a>
        <?php endif ?>
    </div>

<?php endif ?>