<?php
/**
 * The template for displaying the footer
 *
 * @package Blog_Over
 */

$footer_bg_image = get_theme_mod('blog_over_footer_bg_image', '');
?>

</div><!-- #page -->

<?php do_action('blog_over_before_footer'); ?>

<footer id="colophon" class="blog-over-footer" <?php if ($footer_bg_image): ?>
        style="background-image: url('<?php echo esc_url($footer_bg_image); ?>');" <?php endif; ?>>

    <?php if ($footer_bg_image): ?>
        <div class="blog-over-footer-overlay"></div>
    <?php endif; ?>

    <?php get_template_part('template-parts/sections/footer-widgets'); ?>

    <?php if (get_theme_mod('blog_over_footer_social_show', false)): ?>
        <div class="blog-over-footer-social">
            <div class="blog-over-container">
                <?php blog_over_footer_social_icons(); ?>
            </div>
        </div>
    <?php endif; ?>

    <?php if (get_theme_mod('blog_over_copyright_show', true)): ?>
        <div class="blog-over-footer-bottom"
            style="background-color: <?php echo esc_attr(get_theme_mod('blog_over_copyright_bg', '#000000')); ?>; color: <?php echo esc_attr(get_theme_mod('blog_over_copyright_text_color', '#888888')); ?>;">
            <div class="blog-over-container">
                <div class="blog-over-site-info">
                    <?php
                    $copyright_text = get_theme_mod('blog_over_copyright_text', '© {year} {site}. All rights reserved.');
                    // Replace placeholders with actual values
                    $copyright_text = str_replace('{year}', gmdate('Y'), $copyright_text);
                    $copyright_text = str_replace('{site}', get_bloginfo('name'), $copyright_text);
                    echo wp_kses_post($copyright_text);
                    ?>
                </div>
            </div>
        </div>
    <?php endif; ?>
</footer>

<?php if (get_theme_mod('blog_over_scroll_top', true)): ?>
    <?php
    $icon = get_theme_mod('blog_over_scroll_top_icon', 'fas fa-chevron-up');
    $position = get_theme_mod('blog_over_scroll_top_position', 'right');
    ?>
    <button class="blog-over-scroll-top blog-over-scroll-pos-<?php echo esc_attr($position); ?>"
        aria-label="<?php esc_attr_e('Scroll to top', 'blog-over'); ?>">
        <i class="<?php echo esc_attr($icon); ?>"></i>
    </button>
<?php endif; ?>


<?php wp_footer(); ?>


</body>

</html>