<?php
/**
* Dynamic styles for theme
*
*
*/

add_action( 'wp_enqueue_scripts', 'portfolio_one_dynamic_styles' );

if( ! function_exists('portfolio_one_dynamic_styles')):
	function portfolio_one_dynamic_styles(){

		ob_start();

		$default 					= portfolio_one_customizer_defaults();
		$cww_header_cta_bg 			= get_theme_mod( 'cww_header_cta_bg', $default['cww_header_cta_bg'] );
		$cww_header_bg 				= get_theme_mod( 'cww_header_bg', $default['cww_header_bg'] );
		$cww_menu_link_color 		= get_theme_mod( 'cww_menu_link_color', $default['cww_menu_link_color'] );
		$cww_menu_link_color_hover 	= get_theme_mod( 'cww_menu_link_color_hover', $default['cww_menu_link_color_hover'] );
		$cww_theme_color 			= get_theme_mod( 'cww_theme_color', $default['cww_theme_color'] );
		

		 if($cww_header_cta_bg != $default['cww_header_cta_bg'] ){ ?>
			.header-cta-wrapp.layout-one a,
			.header-cta-wrapp.layout-two span.icon-wrap,
			.header-cta-wrapp.layout-two a:hover .inner-btn-wrapp{
				background-color: <?php echo  portfolio_one_sanitize_color($cww_header_cta_bg);?>;
			}
		<?php }

		if( $cww_header_bg != $default['cww_header_bg'] ){ ?>
			header.site-header,
			body.header-layout-two header.site-header{
				background-color: <?php echo  portfolio_one_sanitize_color($cww_header_bg);?>;
			}
		<?php } 

		if( $cww_menu_link_color != $default['cww_menu_link_color'] ){?>
			.main-navigation a{
				color: <?php echo  portfolio_one_sanitize_color($cww_menu_link_color);?>;
			}
		<?php }

		if( $cww_menu_link_color_hover != $default['cww_menu_link_color_hover'] ){?>
			.main-navigation a:hover{
				color: <?php echo  portfolio_one_sanitize_color($cww_menu_link_color_hover);?>;
			}
		<?php }

		

		if( $cww_theme_color != $default['cww_theme_color'] ){?>
			:root{
				--theme-color: <?php echo  portfolio_one_sanitize_color($cww_theme_color);?>;
			}

		<?php }


		

		$custom_css = ob_get_clean();
		$custom_css = portfolio_one_strip_css_whitespace( $custom_css );

		wp_add_inline_style( 'portfolio-one-style', $custom_css );

	}
endif;