<?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
 */

$_s_classes = ['cta-section'];
if (!empty($data['color_scheme']))    $_s_classes[] = 'section--scheme-' . $data['color_scheme'];
if (!empty($data['section_text_color'])) $_s_classes[] = 'section--text-' . $data['section_text_color'];
if (!empty($data['text_align']))      $_s_classes[] = 'section--align-' . $data['text_align'];
if (!empty($data['overlay_strength']))$_s_classes[] = 'cta--overlay-' . $data['overlay_strength'];
if (!empty($data['image']))           $_s_classes[] = 'cta--has-bg';
$_cta_bg = !empty($data['image']) ? "background-image: url('/uploads/" . e($data['image']) . "')" : '';
?>
<section id="<?= e($sectionId) ?>" class="<?= e(implode(' ', $_s_classes)) ?>"<?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>
