<?php
if (!function_exists('united_blog_get_inline_css')) :
    /**
     * Outputs theme custom CSS.
     *
     * @since 1.0.0
     */
    function united_blog_get_inline_css()
    {
        // Get the default theme options.
        $defaults = united_blog_get_default_theme_options();

        // Get the user-set options.
        $background_color = united_blog_get_option('background_color');
        $banner_section_bg_color = united_blog_get_option('banner_section_bg_color');
        $footer_background_color = united_blog_get_option('footer_background_color');
        $footer_text_color = united_blog_get_option('footer_text_color');

        $united_blog_slider_text_color = united_blog_get_option('slider_text_color');
        $united_blog_slider_text_link_color = united_blog_get_option('slider_text_link_color');

        // Start output buffering to capture the CSS.
        ob_start();
        ?>

        :root {
        <?php if (!empty($background_color) && $background_color != 'ffffff') : ?>
        --united-background-color: #<?php echo esc_attr($background_color); ?>;
    <?php endif; ?>

        <?php if ($footer_background_color !== $defaults['footer_background_color']) : ?>
        --united-footer-background: <?php echo esc_attr($footer_background_color); ?>;
    <?php endif; ?>

        <?php if ($footer_text_color !== $defaults['footer_text_color']) : ?>
        --united-footer-color: <?php echo esc_attr($footer_text_color); ?>;
    <?php endif; ?>
        }

        .united-banner-block {
        <?php if ($banner_section_bg_color !== $defaults['banner_section_bg_color']) : ?>
        --united-background-color: <?php echo esc_attr($banner_section_bg_color); ?>;
    <?php endif; ?>

        <?php if ($united_blog_slider_text_color !== $defaults['slider_text_color']) : ?>
        --united-general-text-color: <?php echo esc_attr($united_blog_slider_text_color); ?>;
    <?php endif; ?>

        <?php if ($united_blog_slider_text_link_color !== $defaults['slider_text_link_color']) : ?>
        --united-link-color: <?php echo esc_attr($united_blog_slider_text_link_color); ?>;
    <?php endif; ?>
        }

        <?php
        // Return the buffered output (CSS).
        return ob_get_clean();
    }
endif;