<?php
if( ! function_exists( 'electromix_dynamic_style' ) ):
    function electromix_dynamic_style() {
		$output_css = '';
		
		 /**
		 *  Breadcrumb Style
		 */
		$breadcrumb_bg_img			= get_theme_mod('breadcrumb_bg_img',esc_url(get_template_directory_uri() .'/assets/images/breadcrumb/img.png')); 
		$breadcrumb_bg_img_opacity	= get_theme_mod('breadcrumb_bg_img_opacity','0.6');
		$breadcrumb_overlay_color	= get_theme_mod('breadcrumb_overlay_color','#080808');
		list($br, $bg, $bb) = sscanf($breadcrumb_overlay_color, "#%02x%02x%02x");
		
		if($breadcrumb_bg_img !== '') { 
			$output_css .=".breadcrumb-area::before {
					background-color: rgba($br $bg $bb / " .esc_attr($breadcrumb_bg_img_opacity). ");
				}\n";
		}
		
		 if ( !function_exists( 'ecommerce_companion_activate' ) ) : 
			$output_css .=".theme-mobile-menu .menu-primary {
					margin-top: 60px;
				}\n";
		 endif;
		 
		$footer_bg_image	= get_theme_mod('footer_bg_img',get_template_directory_uri(). '/assets/images/footer/footer_bg.png');
		$footer_bg_clr	= get_theme_mod('footer_bg_clr','#222529');
		$footer_clr_opacity	= get_theme_mod('footer_clr_opacity','0.8');
		
			if(!empty($footer_bg_image)):
				 $output_css .=".footer-section{ 
					   background-image: url('" .esc_attr($footer_bg_image). "');
				}\n";
			endif;
			
			if(!empty($footer_bg_clr)):
				 $output_css .=".footer-section{ 
					   background-color: color-mix(in srgb, var(--sp-primary) 8%, ".esc_attr($footer_bg_clr)." 100%);
				}\n";
			endif;
				
        wp_add_inline_style( 'electromix-style', $output_css );
    }
endif;
add_action( 'wp_enqueue_scripts', 'electromix_dynamic_style' );