<?php ob_start(); ?>

<?php if (!empty($sections)): ?>
<?= render_section_assets($sections, 'head') ?>
<?php if ($page['show_title'] ?? 1): ?>
<section class="page-section page-section--title-only">
    <div class="container">
        <h1 class="page-title"><?= e($page['title'] ?? '') ?></h1>
    </div>
</section>
<?php endif; ?>
<?php foreach ($sections as $_s): ?>
    <?php if (!$_s['is_active']) continue; ?>
    <?= render_page_section($_s, $sections) ?>
<?php endforeach; ?>
<?= render_section_assets($sections, 'footer') ?>
<?php else: ?>
<section class="page-section">
    <div class="container">
        <?php if ($page['show_title'] ?? 1): ?>
        <h1 class="page-title"><?= e($page['title'] ?? '') ?></h1>
        <?php endif; ?>
        <div class="page-content">
            <?= $page['content'] ?? '' ?>
        </div>
    </div>
</section>
<?php endif; ?>

<?php $content = ob_get_clean(); include __DIR__ . '/layout.php'; ?>
