/**
 * File customizer.js.
 *
 * Theme Customizer enhancements for a better user experience.
 *
 * Contains handlers to make Theme Customizer preview reload changes asynchronously.
 */

( function ( $ ) {

	// Services Section
	wp.customize(
		'paws_and_care_services_title', function( value ) {
			value.bind(
				function( newval ) {
					$( '.services-section .section-title' ).text( newval );
				}
			);
		}
	);
	
	wp.customize(
		'paws_and_care_services_subtitle', function( value ) {
			value.bind(
				function( newval ) {
					$( '.services-section .lead' ).text( newval );
				}
			);
		}
	);
	
	// About Section
	wp.customize(
		'paws_and_care_about_title', function( value ) {
			value.bind(
				function( newval ) {
					$( '.about-section .section-title' ).text( newval );
				}
			);
		}
	);
	
	wp.customize(
		'paws_and_care_about_lead', function( value ) {
			value.bind(
				function( newval ) {
					$( '.about-section .lead' ).text( newval );
				}
			);
		}
	);

	wp.customize(
		'paws_and_care_about_description', function( value ) {
			value.bind(
				function( newval ) {
					$( '.about-section p.text-dark' ).text( newval );
				}
			);
		}
	);
	
	// Blog Section
	wp.customize(
		'paws_and_care_blog_title', function( value ) {
			value.bind(
				function( newval ) {
					$( '.blog-section .section-title' ).text( newval );
				}
			);
		}
	);
	
	wp.customize(
		'paws_and_care_blog_subtitle', function( value ) {
			value.bind(
				function( newval ) {
					$( '.blog-section .lead' ).text( newval );
				}
			);
		}
	);
	
	// Footer Copyright
	wp.customize(
		'paws_and_care_copyright', function( value ) {
			value.bind(
				function( newval ) {
					// This is a bit complex due to {year} and {site_name} placeholders
					// For preview, we just show the raw text as a simple feedback
					$( '.footer-copyrights, .copyright' ).text( newval );
				}
			);
		}
	);
	
} )( jQuery );