<?php
/**
 * KIS Theme Customizer
 *
 * @package KIS
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function kis_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->get_setting( 'header_image' )->transport      = 'postMessage';
	$wp_customize->get_setting( 'header_image_data' )->transport = 'postMessage';
	$wp_customize->get_section( 'colors' )->panel                = 'kis_colors';
	$wp_customize->get_section( 'colors' )->title                = __( 'Header Colors', 'kis' );
	$wp_customize->get_section( 'colors' )->priority             = 10;
	$wp_customize->get_section( 'background_image' )->title      = __( 'Background Image/Color', 'kis' );
	$wp_customize->get_control( 'background_color' )->section    = 'background_image';

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'blogname',
			array(
				'selector'        => '.site-title a',
				'render_callback' => 'kis_customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'kis_customize_partial_blogdescription',
			)
		);
	}
}
add_action( 'customize_register', 'kis_customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function kis_customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function kis_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Hooking in JS code to affect the controls in the Customizer.
 */
function kis_customize_controls() {
	wp_enqueue_script( 'kis-customize-controls', get_template_directory_uri() . '/js/customize-controls.js', array( 'customize-controls' ), filemtime( get_theme_file_path( '/js/customize-controls.js' ) ), true );
	$customizer_settings = array(
		'class_kirki_exists'           => class_exists( 'Kirki' ),
		'install_kirki_notification'   => esc_html__( 'Please install the Kirki plugin to take full advantage of this theme\'s customizer capabilities.', 'kis' ),
		'install_kirki_button_value'   => esc_html__( 'Install Now', 'kis' ),
		'install_kirki_admin_url'      => admin_url( 'plugin-install.php?s=mods&tab=search&type=tag' ),
		'install_kirki_section_title'  => esc_html__( 'Install Kirki', 'kis' ),
		'install_kirki_section_action' => esc_html__( 'Link to install Kirki', 'kis' ),
	);
	wp_localize_script( 'kis-customize-controls', 'kis_cc', $customizer_settings );
}
add_action( 'customize_controls_enqueue_scripts', 'kis_customize_controls' );

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function kis_customize_preview_js() {
	wp_enqueue_script( 'kis-customizer-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'jquery', 'customize-preview' ), filemtime( get_theme_file_path( '/js/customize-preview.js' ) ), true );
}
add_action( 'customize_preview_init', 'kis_customize_preview_js' );

/**
 * Ensuring that all CSS & fonts will work if the plugin is not installed or removed.
 */
Kis_Kirki::add_config(
	'kis',
	array(
		'capability'  => 'edit_theme_options',
		'option_type' => 'theme_mod',
	)
);

// Display Site Title and Tagline.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'checkbox',
		'settings'  => 'display_title_tagline',
		'label'     => __( 'Display Site Title and Tagline', 'kis' ),
		'section'   => 'title_tagline',
		'default'   => true,
		'priority'  => 20,
		'transport' => 'postMessage',
	)
);

// Site Title Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'site_title_color',
		'label'     => __( 'Site Title Color', 'kis' ),
		'section'   => 'colors',
		'default'   => '#93b876',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'header h1.site-title a',
				'property' => 'color',
			),
		),
	)
);

// Site Description Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'site_description_color',
		'label'     => __( 'Site Description Color', 'kis' ),
		'section'   => 'colors',
		'default'   => '#C8C8C8',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'header p.site-description',
				'property' => 'color',
			),
		),
	)
);

// Header Background Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'        => 'color-alpha',
		'settings'    => 'header_background_color',
		'label'       => __( 'Header Background Color', 'kis' ),
		'description' => __( 'Transparent is set by default.<br>Remember to increase the opacity<br>to see your changes !', 'kis' ),
		'section'     => 'colors',
		'default'     => 'rgba(255,255,255,0)',
		'priority'    => 15,
		'transport'   => 'auto',
		'output'      => array(
			array(
				'element'  => 'header.site-header',
				'property' => 'background-color',
			),
		),
	)
);

// 1- Site Layout Section.
kis_Kirki::add_section(
	'site_layout',
	array(
		'title'       => __( 'Site Layout', 'kis' ),
		'description' => __( 'Choose Site\'s Layout !', 'kis' ),
		'priority'    => 25,
		'capability'  => 'edit_theme_options',
	)
);
// 1.1- Site Layouts
kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'radio-image',
		'settings'  => 'site_layouts',
		'label'     => __( 'Site Layouts', 'kis' ),
		'section'   => 'site_layout',
		'default'   => 'sidebar-right',
		'priority'  => 5,
		'choices'   => array(
			'fullwidth'     => plugins_url() . '/kirki/assets/images/1c.png',
			'sidebar-right' => plugins_url() . '/kirki/assets/images/2cr.png',
			'sidebar-left'  => plugins_url() . '/kirki/assets/images/2cl.png',
		),
		'transport' => 'postMessage',
	)
);

// 2- Footer Options Panel.
Kis_Kirki::add_panel(
	'kis_footer_options',
	array(
		'priority' => 160,
		'title'    => __( 'Footer Options', 'kis' ),
	)
);

// 2.1- Social Sites Links Section.
Kis_Kirki::add_section(
	'kis_social_sites_section',
	array(
		'title'    => esc_html__( 'Footer Social Sites Links', 'kis' ),
		'panel'    => 'kis_footer_options',
		'priority' => 20,
	)
);


// 2.1.1- Facebook URL.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'link',
		'settings'        => 'facebook',
		'label'           => __( 'Facebook URL', 'kis' ),
		'section'         => 'kis_social_sites_section',
		'default'         => '',
		'partial_refresh' => array(
			'facebook' => array(
				'selector'        => 'footer#colophon ul.social-links',
				'render_callback' => 'kis_social_media_icons',
			),
		),
		'priority'        => 5,
	)
);

// 2.1.2- Twitter URL.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'link',
		'settings'        => 'twitter',
		'label'           => __( 'Twitter URL', 'kis' ),
		'section'         => 'kis_social_sites_section',
		'default'         => '',
		'partial_refresh' => array(
			'twitter' => array(
				'selector'        => 'footer#colophon ul.social-links',
				'render_callback' => 'kis_social_media_icons',
			),
		),
		'priority'        => 10,
	)
);

// 2.1.3- Google Plus URL.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'link',
		'settings'        => 'googleplus',
		'label'           => __( 'Google Plus URL', 'kis' ),
		'section'         => 'kis_social_sites_section',
		'default'         => '',
		'partial_refresh' => array(
			'googleplus' => array(
				'selector'        => 'footer#colophon ul.social-links',
				'render_callback' => 'kis_social_media_icons',
			),
		),
		'priority'        => 15,
	)
);

// 2.1.4- WordPress URL.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'link',
		'settings'        => 'wordpress',
		'label'           => __( 'WordPress URL', 'kis' ),
		'section'         => 'kis_social_sites_section',
		'default'         => '',
		'partial_refresh' => array(
			'wordpress' => array(
				'selector'        => 'footer#colophon ul.social-links',
				'render_callback' => 'kis_social_media_icons',
			),
		),
		'priority'        => 20,
	)
);

// 2.1.5- Email Address.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'              => 'text',
		'settings'          => 'email',
		'label'             => __( 'Email Address', 'kis' ),
		'section'           => 'kis_social_sites_section',
		'default'           => '',
		'input_attrs'       => array(
			'placeholder' => __( 'Enter a valid email address !', 'kis' ),
		),
		'partial_refresh'   => array(
			'email' => array(
				'selector'        => 'footer#colophon ul.social-links',
				'render_callback' => 'kis_social_media_icons',
			),
		),
		'priority'          => 25,
		'sanitize_callback' => 'sanitize_email',
	)
);

// 2.1.6- Social Sites Links Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'social_sites_links_color',
		'label'     => __( 'Social Sites Links Color', 'kis' ),
		'section'   => 'kis_social_sites_section',
		'default'   => '#34393A',
		'priority'  => 30,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'footer#colophon ul.social-links li a',
					'footer#colophon ul.social-links li a:visited',
				),
				'property' => 'color',
			),
		),
	)
);

// 2.1.7- Social Sites Links Hover Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'social_sites_links_hover_color',
		'label'     => __( 'Social Sites Links Hover Color', 'kis' ),
		'section'   => 'kis_social_sites_section',
		'default'   => '#6C934D',
		'priority'  => 35,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'footer#colophon ul.social-links li a:hover',
					'footer#colophon ul.social-links li a:focus',
				),
				'property' => 'color',
			),
		),
	)
);

// 2.2- Copyright Area Section.
kis_Kirki::add_section(
	'copyright_area',
	array(
		'title'    => __( 'Copyright Area', 'kis' ),
		'panel'    => 'kis_footer_options',
		'priority' => 40,
	)
);

// 2.2.1- Display Credits.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'checkbox',
		'settings'        => 'display_credits',
		'label'           => __( 'Keep WP Love & Credit Developers', 'kis' ),
		'section'         => 'copyright_area',
		'default'         => true,
		'partial_refresh' => array(
			'display_credits' => array(
				'selector'        => 'footer#colophon div.site-info',
				'render_callback' => 'kis_site_info',
			),
		),
		'priority'        => 5,
	)
);

// 2.2.2- Custom Copyright.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'            => 'code',
		'settings'        => 'custom_copyright',
		'label'           => __( 'Custom Copyright', 'kis' ),
		'description'     => __( 'Enter a custom copyright using HTML .<br>Remember to uncheck the above control ! ', 'kis' ),
		'section'         => 'copyright_area',
		'default'         => '',
		'partial_refresh' => array(
			'custom_copyright' => array(
				'selector'        => 'div.site-info',
				'render_callback' => 'kis_site_info',
			),
		),
		'choices'         => array(
			'language' => 'html',
		),
		'priority'        => 10,
	)
);

// 2.2.3- Copyright Content Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'copyright_content_color',
		'label'     => __( 'Copyright Content Color', 'kis' ),
		'section'   => 'copyright_area',
		'default'   => '#34393A',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'footer#colophon div.site-info',
				'property' => 'color',
			),
		),
	)
);

// 2.2.4- Copyright Links Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'copyright_links_color',
		'label'     => __( 'Copyright Links Color', 'kis' ),
		'section'   => 'copyright_area',
		'default'   => '#6C934D',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'footer#colophon div.site-info a',
					'footer#colophon div.site-info a:visited',
				),
				'property' => 'color',
			),
		),
	)
);

// 2.2.5- Copyright Links Hover Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'copyright_links_hover_color',
		'label'     => __( 'Copyright Links Hover Color', 'kis' ),
		'section'   => 'copyright_area',
		'default'   => '#34393A',
		'priority'  => 25,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'footer#colophon div.site-info a:hover',
					'footer#colophon div.site-info a:focus',
				),
				'property' => 'color',
			),
		),
	)
);

// 2.3- Footer Background Color Section.
kis_Kirki::add_section(
	'footer_background_color_section',
	array(
		'title'    => __( 'Footer Background Color', 'kis' ),
		'panel'    => 'kis_footer_options',
		'priority' => 60,
	)
);

// 2.3.1- Footer Background Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'footer_background_color',
		'label'     => __( 'Footer Background Color', 'kis' ),
		'section'   => 'footer_background_color_section',
		'default'   => '#F6F5F5',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'footer#colophon',
				'property' => 'background-color',
			),
		),
	)
);

// 3- KIS Colors Panel.
Kis_Kirki::add_panel(
	'kis_colors',
	array(
		'priority' => 40,
		'title'    => __( 'KIS Colors', 'kis' ),
	)
);

// 3.1- Menu Colors.
kis_Kirki::add_section(
	'menu_colors',
	array(
		'title'    => __( 'Menu Colors', 'kis' ),
		'panel'    => 'kis_colors',
		'priority' => 5,
	)
);

// 3.1.1- Menu Border Top.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'menu_border_top',
		'label'     => __( 'Menu Border Top', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#9FCC7F',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '.header--fixed',
				'property' => 'border-top-color',
				'suffix'   => ' !important',
			),
		),
	)
);

// 3.1.2- Menu Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'menu_background',
		'label'     => __( 'Menu Background', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#F5F4F3',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'#nav-wrap',
					'ul#nav ul',
				),
				'property' => 'background',
			),
		),
	)
);

// 3.1.3- Menu Item.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'menu_item',
		'label'     => __( 'Menu Item', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#666666',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'ul#nav li a',
				'property' => 'color',
			),
		),
	)
);

// 3.1.4- Menu Item Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'menu_item_hover',
		'label'     => __( 'Menu Item Hover', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#222',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'ul#nav li a:hover',
				'property' => 'color',
			),
		),
	)
);

// 3.1.5- Menu Item Children Indicator.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'menu_item_children_indicator',
		'label'     => __( 'Menu Item Children Indicator', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#9FCC7F',
		'priority'  => 25,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => 'ul#nav li.menu-item-has-children > a::after',
				'property' => 'color',
			),
		),
	)
);

// 3.1.6- Current Menu Item Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'current_menu_item_background',
		'label'     => __( 'Current Menu Item Background', 'kis' ),
		'section'   => 'menu_colors',
		'default'   => '#fff',
		'priority'  => 30,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'ul#nav li.current-menu-item > a',
					'ul#nav li.current-menu-ancestor > a',
				),
				'property' => 'background',
			),
		),
	)
);

// 3.3- Content Colors.
kis_Kirki::add_section(
	'content_colors',
	array(
		'title'    => __( 'Content Colors', 'kis' ),
		'panel'    => 'kis_colors',
		'priority' => 15,
	)
);

// 3.3.1- Titles Color.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'titles_color',
		'label'     => __( 'Titles Color', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#444',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'.entry-header h2',
					'.entry-header h2 a',
					'h1.entry-title',
					'#secondary h2.widget-title',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.2- Posts Date & Author.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'posts_date_author',
		'label'     => __( 'Posts Date & Author', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#B7B9BD',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'#primary .entry-header .entry-meta',
					'#primary .entry-header .entry-meta span a',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.3- Article Content.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'article_content',
		'label'     => __( 'Article Content', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#4A5153',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'body article .entry-content',
					'body article .entry-content h1',
					'body article .entry-content h2',
					'body article .entry-content h3',
					'body article .entry-content h4',
					'body article .entry-content h5',
					'body article .entry-content h6',
					'body article .entry-content dt',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.4- Article Links.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'article_links',
		'label'     => __( 'Article Links', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#93B876',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'body article .entry-content a',
					'body article .entry-content a:visited',
					'body article .entry-footer a',
					'body article .entry-footer a:visited',

				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.5- Article Links Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'article_links_hover',
		'label'     => __( 'Article Links Hover', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#34393A',
		'priority'  => 25,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'body article .entry-content a:hover',
					'body article .entry-content a:focus',
					'body article .entry-footer a:hover',
					'body article .entry-footer a:focus',

				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.6- Posts Navigation Links.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'posts_navigation_links',
		'label'     => __( 'Posts Navigation Links', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#93B876',
		'priority'  => 30,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'.post-navigation div div a',
					'.posts-navigation div div a',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.7- Posts Navigation Links Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'        => 'color-alpha',
		'settings'    => 'posts_navigation_links_hover',
		'label'       => __( 'Posts Navigation Links Hover', 'kis' ),
		'description' => __( 'Works only on blog, search and archives !', 'kis' ),
		'section'     => 'content_colors',
		'default'     => '#34393A',
		'priority'    => 35,
		'transport'   => 'auto',
		'output'      => array(
			array(
				'element'  => array(
					'.hfeed .nav-links .nav-previous a:hover',
					'.hfeed .nav-links .nav-next a:hover',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.3.8- Posts Navigation Titles.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'posts_navigation_titles',
		'label'     => __( 'Posts Navigation Titles', 'kis' ),
		'section'   => 'content_colors',
		'default'   => '#888',
		'priority'  => 40,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '.post-navigation div div a .post-title',
				'property' => 'color',
			),
		),
	)
);

// 3.4- Sidebar Widgets Colors Panel.
Kis_Kirki::add_panel(
	'sidebar_widgets_colors',
	array(
		'title'    => __( 'Sidebar Widgets Colors', 'kis' ),
		'panel'    => 'kis_colors',
		'priority' => 20,
	)
);

// 3.4.1- Search Widget Section.
Kis_Kirki::add_section(
	'search_widget',
	array(
		'title'    => __( 'Search Widget', 'kis' ),
		'panel'    => 'sidebar_widgets_colors',
		'priority' => 5,
	)
);

// 3.4.1.1- Search Widget Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'search_widget_background',
		'label'     => __( 'Search Widget Background', 'kis' ),
		'section'   => 'search_widget',
		'default'   => '#E9EBEE',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary inputarray(type="search")',
				'property' => 'background',
			),
		),
	)
);

// 3.4.1.2- Search Widget Text.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'search_widget_text',
		'label'     => __( 'Search Widget Text', 'kis' ),
		'section'   => 'search_widget',
		'default'   => '#B1B1B1',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary inputarray(type="search")',
				'property' => 'color',
			),
		),
	)
);

// 3.4.1.3- Search Widget Background Focus.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'search_widget_background_focus',
		'label'     => __( 'Search Widget Background Focus', 'kis' ),
		'section'   => 'search_widget',
		'default'   => '#AFB7BE',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary inputarray(type="search"):focus',
				'property' => 'background',
			),
		),
	)
);

// 3.4.1.4- Search Widget Text Focus.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'search_widget_text_focus',
		'label'     => __( 'Search Widget Text Focus', 'kis' ),
		'section'   => 'search_widget',
		'default'   => '#fff',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary inputarray(type="search"):focus',
				'property' => 'color',
			),
		),
	)
);

// 3.4.2- Calendar Widget Section.
Kis_Kirki::add_section(
	'calendar_widget',
	array(
		'title'    => __( 'Calendar Widget', 'kis' ),
		'panel'    => 'sidebar_widgets_colors',
		'priority' => 10,
	)
);

// 3.4.2.1- Calendar Widget Caption Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_caption_background',
		'label'     => __( 'Calendar Widget Caption Background', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#93B876',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar caption',
				'property' => 'background-color',
			),
		),
	)
);

// 3.4.2.2- Calendar Widget Caption Text.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_caption_text',
		'label'     => __( 'Calendar Widget Caption Text', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#fff',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar caption',
				'property' => 'color',
			),
		),
	)
);

// 3.4.2.3- Calendar Widget Header Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_header_background',
		'label'     => __( 'Calendar Widget Header Background', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#F5F4F3',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar thead',
				'property' => 'background-color',
			),
		),
	)
);

// 3.4.2.4- Calendar Widget Header Text.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_header_text',
		'label'     => __( 'Calendar Widget Header Text', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#4A5153',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar thead',
				'property' => 'color',
			),
		),
	)
);

// 3.4.2.5- Calendar Widget Body Text.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_body_text',
		'label'     => __( 'Calendar Widget Body Text', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#4A5153',
		'priority'  => 25,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar tbody',
				'property' => 'color',
			),
		),
	)
);

// 3.4.2.6- Calendar Widget Footer Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_footer_background',
		'label'     => __( 'Calendar Widget Footer Background', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#F5F4F3',
		'priority'  => 30,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary #wp-calendar tfoot',
				'property' => 'background-color',
			),
		),
	)
);

// 3.4.2.7- Calendar Widget Links.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_links',
		'label'     => __( 'Calendar Widget Links', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#93B876',
		'priority'  => 35,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'#secondary #wp-calendar a',
					'#secondary #wp-calendar a:visited',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.4.2.8- Calendar Widget Links Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'calendar_widget_links_hover',
		'label'     => __( 'Calendar Widget Links Hover', 'kis' ),
		'section'   => 'calendar_widget',
		'default'   => '#34393A',
		'priority'  => 40,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'#secondary #wp-calendar a:hover',
					'#secondary #wp-calendar a:focus',
				),
				'property' => 'color',
			),
		),
	)
);

// 3.4.3- Recent Posts Widget Section.
Kis_Kirki::add_section(
	'recent_posts_widget',
	array(
		'title'    => __( 'Recent Posts Widget', 'kis' ),
		'panel'    => 'sidebar_widgets_colors',
		'priority' => 15,
	)
);

// 3.4.3.1- Recent Posts Widget Links.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'recent_posts_widget_links',
		'label'     => __( 'Recent Posts Widget Links', 'kis' ),
		'section'   => 'recent_posts_widget',
		'default'   => '#4A5153',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .widget_recent_entries ul li a',
				'property' => 'color',
			),
		),
	)
);

// 3.4.3.2- Recent Posts Widget Links Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'recent_posts_widget_links_hover',
		'label'     => __( 'Recent Posts Widget Links', 'kis' ),
		'section'   => 'recent_posts_widget',
		'default'   => '#313131',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .widget_recent_entries ul li a:hover',
				'property' => 'color',
			),
		),
	)
);

// 3.4.4- Tag Cloud Widget Section.
Kis_Kirki::add_section(
	'tag_cloud_widget',
	array(
		'title'    => __( 'Posts Tag Cloud Widget', 'kis' ),
		'panel'    => 'sidebar_widgets_colors',
		'priority' => 20,
	)
);

// 3.4.4.1- Tag Cloud Widget Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'tag_cloud_widget_background',
		'label'     => __( 'Tag Cloud Widget Background', 'kis' ),
		'section'   => 'tag_cloud_widget',
		'default'   => '#E9EBEE',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .tagcloud a',
				'property' => 'background',
			),
		),
	)
);

// 3.4.4.2- Tag Cloud Widget Text.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'tag_cloud_widget_text',
		'label'     => __( 'Tag Cloud Widget Text', 'kis' ),
		'section'   => 'tag_cloud_widget',
		'default'   => '#778888',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .tagcloud a',
				'property' => 'color',
			),
		),
	)
);

// 3.4.4.2- Tag Cloud Widget Background Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'tag_cloud_widget_background_hover',
		'label'     => __( 'Tag Cloud Widget Background Hover', 'kis' ),
		'section'   => 'tag_cloud_widget',
		'default'   => '#93B876',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .tagcloud a:hover',
				'property' => 'background',
			),
		),
	)
);

// 3.4.4.4- Tag Cloud Widget Text Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'tag_cloud_widget_text_hover',
		'label'     => __( 'Tag Cloud Widget Text hover', 'kis' ),
		'section'   => 'tag_cloud_widget',
		'default'   => '#fff',
		'priority'  => 20,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#secondary .tagcloud a:hover',
				'property' => 'color',
			),
		),
	)
);

// 3.4.5- Other Widgets Styles Section.
Kis_Kirki::add_section(
	'other_widgets_styles',
	array(
		'title'    => __( 'Other Widgets Styles', 'kis' ),
		'panel'    => 'sidebar_widgets_colors',
		'priority' => 25,
	)
);

// 3.4.5.1- Other Widgets Content.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'        => 'color-alpha',
		'settings'    => 'other_widgets_content',
		'label'       => __( 'Other Widgets Content', 'kis' ),
		'description' => __( 'Affects texts and paragraphs<br>like text widget content.', 'kis' ),
		'section'     => 'other_widgets_styles',
		'default'     => '#4A5153',
		'priority'    => 5,
		'transport'   => 'auto',
		'output'      => array(
			array(
				'element'  => 'body #secondary',
				'property' => 'color',
			),
		),
	)
);

// 3.4.5.2- Other Widgets Links.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'other_widgets_links',
		'label'     => __( 'Other Widgets Links', 'kis' ),
		'section'   => 'other_widgets_styles',
		'default'   => '#93B876',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'body #secondary a',
					'body #secondary a:visited',

				),
				'property' => 'color',
			),
		),
	)
);

// 3.4.5.3- Other Widgets Links Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'other_widgets_links_hover',
		'label'     => __( 'Other Widgets Links Hover', 'kis' ),
		'section'   => 'other_widgets_styles',
		'default'   => '#34393A',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => array(
					'body #secondary a:hover',
					'body #secondary a:focus',

				),
				'property' => 'color',
			),
		),
	)
);

// 3.5- Back to Top Section.
Kis_Kirki::add_section(
	'back_to_top',
	array(
		'title'    => __( 'Back to Top', 'kis' ),
		'panel'    => 'kis_colors',
		'priority' => 25,
	)
);

// 3.5.1- Back to Top Background.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'back_to_top_background',
		'label'     => __( 'Back to Top Background', 'kis' ),
		'section'   => 'back_to_top',
		'default'   => '#494949',
		'priority'  => 5,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#go-top a',
				'property' => 'background-color',
			),
		),
	)
);

// 3.5.2- Back to Top Background Hover.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'back_to_top_background_hover',
		'label'     => __( 'Back to Top Background Hover', 'kis' ),
		'section'   => 'back_to_top',
		'default'   => '#7BA857',
		'priority'  => 10,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#go-top a:hover',
				'property' => 'background',
			),
		),
	)
);

// 3.5.3- Back to Top Arrow.
Kis_Kirki::add_field(
	'kis',
	array(
		'type'      => 'color-alpha',
		'settings'  => 'back_to_top_arrow',
		'label'     => __( 'Back to Top Arrow', 'kis' ),
		'section'   => 'back_to_top',
		'default'   => '#fff',
		'priority'  => 15,
		'transport' => 'auto',
		'output'    => array(
			array(
				'element'  => '#go-top a span',
				'property' => 'color',
			),
		),
	)
);
