/**
 * File customizer.js.
 *
 * Theme Customizer enhancements for a better user experience.
 *
 * Contains handlers to make Theme Customizer preview reload changes asynchronously.
 * 
 * It controls the pseudo code as well
 */
( function( $ ) {

	// Site title and description.
	wp.customize( 'blogname', function( value ) {
		value.bind( function( to ) {
			$( '.site-title a' ).text( to );
		} );
	} );
	wp.customize( 'blogdescription', function( value ) {
		value.bind( function( to ) {
			$( '.site-description' ).text( to );
		} );
	} );

	wp.customize( 'body_font_color', function( value ) {
		value.bind( function( to ) {
			$('head').append('<style>:root{--font-color:'+to+';}</style>');
		} );
	} );

	wp.customize( 'background_color', function( value ) {
		value.bind( function( to ) {
			$('head').append('<style>:root{--background-color:'+to+';}</style>');
		} );
	} );

	/**
	 * Site Title Color
	 */

	wp.customize( 'site_title_color', function( value ) {
		value.bind( function( to ) {
			$('head').append('<style>.site-branding .site-title-wrap .site-title a{ color:'+to+';}</style>');
		} );
	} );

	//Site Width Logo
	wp.customize( 'site_logo_size', function( value ) {
		value.bind( function( to ) {
			$( '.custom-logo-link img' ).css( 'width',to + 'px' );
		} );
	} );
	
} )( jQuery );
