<?php
/**
 * ITSWEBER CMS – Default Theme: CTA Section Template
 * Page Builder section template (3.2.0)
 *
 * Variables: $data (array), $section (DB row), $sectionId (string)
 *
 * @author  Benny Weber
 * @copyright ITSWEBER, www.itsweber.de
 */

$extra = [];
if (!empty($data['overlay_strength'])) $extra[] = 'cta--overlay-' . $data['overlay_strength'];
if (!empty($data['image']))            $extra[] = 'cta--has-bg';
$_cta_bg = !empty($data['image']) ? "background-image: url('/uploads/" . e($data['image']) . "')" : '';
?>
<section id="<?= e($sectionId) ?>" class="<?= build_section_classes('cta', $data, $extra) ?>"<?php if ($_cta_bg): ?> style="<?= $_cta_bg ?>"<?php endif; ?>>
    <div class="container">
        <?php if (!empty($data['eyebrow'])): ?>
        <span class="cta-eyebrow reveal"><?= e($data['eyebrow']) ?></span>
        <?php endif; ?>
        <h2 class="reveal"><?= e($data['title'] ?? '') ?></h2>
        <?php if (!empty($data['text'])): ?>
        <div class="cta-text reveal"><?= nl2br(e($data['text'])) ?></div>
        <?php endif; ?>
        <?php if (!empty($data['cta_text']) || !empty($data['cta2_text'])): ?>
        <div class="cta-buttons reveal">
            <?php if (!empty($data['cta_text'])): ?>
            <a href="<?= e($data['cta_url'] ?? '#') ?>" class="btn btn-cta"><?= e($data['cta_text']) ?></a>
            <?php endif; ?>
            <?php if (!empty($data['cta2_text'])): ?>
            <a href="<?= e($data['cta2_url'] ?? '#') ?>" class="btn btn-secondary"><?= e($data['cta2_text']) ?></a>
            <?php endif; ?>
        </div>
        <?php endif; ?>
    </div>
</section>
