<?php
/**
 * ITSWEBER CMS – Default Theme: HTML / Editor 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
 */

$title       = $data['title'] ?? '';
$subtitle    = $data['subtitle'] ?? '';
$contentHtml = $data['content_html'] ?? '';
$colorScheme = $data['color_scheme'] ?? '';
$textAlign   = $data['text_align'] ?? '';
$maxWidth    = $data['max_width'] ?? '';
$sectionTextColor = $data['section_text_color'] ?? '';

// Build CSS classes
$cls = 'html-section';
if ($colorScheme !== '') {
    $cls .= ' section--scheme-' . e($colorScheme);
}
$sectionSurface = $data['section_surface'] ?? '';
if ($sectionSurface !== '') {
    $cls .= ' section--surface-' . e($sectionSurface);
}
if ($textAlign !== '') {
    $cls .= ' section--align-' . e($textAlign);
}
if ($maxWidth !== '') {
    $cls .= ' section--maxw-' . e($maxWidth);
}
if ($sectionTextColor !== '') {
    $cls .= ' section--text-' . e($sectionTextColor);
}
?>
<section class="<?= $cls ?>" id="<?= e($sectionId) ?>">
    <div class="container">
        <?php if ($title !== '' || $subtitle !== ''): ?>
        <div class="html-section-header reveal">
            <?php if ($title !== ''): ?>
            <h2 class="html-section-title"><?= e($title) ?></h2>
            <?php endif; ?>
            <?php if ($subtitle !== ''): ?>
            <p class="html-section-subtitle"><?= e($subtitle) ?></p>
            <?php endif; ?>
        </div>
        <?php endif; ?>

        <?php if ($contentHtml !== ''): ?>
        <div class="html-section-content">
            <?= $contentHtml ?>
        </div>
        <?php endif; ?>
    </div>
</section>
