<?php

$settingsContent = settings('content')->getAll();

// Декодируем banner-logo из JSON
$bannerLogo = [];
if (isset($settingsContent['banner-logo']) && !empty($settingsContent['banner-logo'])) {
    $bannerLogo = json_decode($settingsContent['banner-logo'], true) ?: [];
}

ob_start();

?>

<?php if (!empty($bannerLogo['src'])): ?>
    <section class="banner">
        <div class="banner__img-wrp">
            <img class="banner__img redirect-js" src="<?= htmlspecialchars($bannerLogo['src']) ?>" alt="<?= htmlspecialchars($bannerLogo['alt'] ?? '') ?>" title="<?= htmlspecialchars($bannerLogo['title'] ?? '') ?>">
        </div>
    </section>
<?php endif; ?>


<div class="section-wrapper">
    <div class="container">
        <section class="content-bg section text">
            <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit. </h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. 
                Quis dolore qui nemo quaerat aperiam aliquam nobis inventore,
                accusamus eos doloremque, a quam dolorum culpa, aliquid
                deserunt impedit ex possimus illo.</p>
            <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit. </h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. 
                Quis dolore qui nemo quaerat aperiam aliquam nobis inventore,
                accusamus eos doloremque, a quam dolorum culpa, aliquid
                deserunt impedit ex possimus illo.</p>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. 
                Quis dolore qui nemo quaerat aperiam aliquam nobis inventore,
                accusamus eos doloremque, a quam dolorum culpa, aliquid
                deserunt impedit ex possimus illo.</p>
        </section>
    </div>

</div>


<!-- <section>
    <div class="container">
        <h1 class="main__title"><?= $content['title'] ?></h1>
        <div class="main__banner">
            <?php if (!empty($bannerLogo['src'])): ?>
                <img class="redirect-js"
                    width="<?= $bannerLogo['width'] ?? '' ?>"
                    height="<?= $bannerLogo['height'] ?? '' ?>"
                    src="<?= htmlspecialchars($bannerLogo['src']) ?>"
                    alt="<?= $bannerLogo['alt'] ?? '' ?>"
                    title="<?= $bannerLogo['title'] ?? '' ?>">
            <?php endif; ?>
        </div>
        <div class="container">
            <?php if (!empty($content['author-img'])): ?>
                <div class="author">
                    <div class="author__img">
                        <img width="" height="" src="<?= htmlspecialchars($content['author-img']) ?>" alt="<?= htmlspecialchars($content['author-name'] ?? '') ?>" title="<?= htmlspecialchars($content['author-name'] ?? '') ?>">
                    </div>
                    <div class="author__info">
                        <div class="author__name"><?= htmlspecialchars($content['author-name'] ?? '') ?></div>
                        <div class="author__date"> <?= $content['modified-date'] ?? '' ?></div>
                    </div>
                </div>
            <?php endif; ?>
            <div class="main__text">
                <?= $content['top_text'] ?>
            </div>
            <?php if (empty($content['hide-btns'])): ?>
                <div class="pulse__btn main__btn accent-color pass-btn-color redirect-js"><?= $content['content_btn'] ?></div>
            <?php endif; ?>
        </div>
</section>
<section>
    <div class="container">
        <div class="secondary__text">
            <?= htmlspecialchars_decode($content['bottom_text']); ?>
        </div>
    </div>
</section>
<section>
    <div class="container">
        <h2><?= $content['faq-title'] ?? '' ?></h2>
        <div class="accordion-container">
            <?php foreach ($faqItems as $item): ?>
                <div class="accordion-item">
                    <h3 class="accordion-header faq-title-hover-font-color secondary-color faq-title-font-color">
                        <?= htmlspecialchars($item['question']) ?>
                        <span class="icon  faq-title-hover-font-color faq-title-font-color">+</span>
                    </h3>
                    <div class="accordion-content secondary-color faq-title-font-color">
                        <p>
                            <?= htmlspecialchars($item['answer']) ?>
                        </p>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    </div>
</section> -->

<?php
$pageContent = ob_get_clean();
include __DIR__ . '/layouts/main.php';
?>