/**
 * Update Customizer settings live.
 *
 * @since 1.0.0
 */
(function ($) {
	'use strict';

	// Declare variables
	var api = wp.customize,
		$body = $('body'),
		$head = $('head'),
		$style_tag,
		$link_tag,
		business_interface_visibility_classes = 'business-interface-hide-mobile business-interface-hide-tablet business-interface-hide-mobile-tablet',
		business_interface_style_tag_collection = [],
		business_interface_link_tag_collection = [];

	/**
	 * Helper function to get style tag with id.
	 */
	function business_interface_get_style_tag(id) {
		if (business_interface_style_tag_collection[id]) {
			return business_interface_style_tag_collection[id];
		}

		$style_tag = $('head').find('#business-interface-dynamic-' + id);

		if (!$style_tag.length) {
			$('head').append('<style id="business-interface-dynamic-' + id + '" type="text/css" href="#"></style>');
			$style_tag = $('head').find('#business-interface-dynamic-' + id);
		}

		business_interface_style_tag_collection[id] = $style_tag;

		return $style_tag;
	}

	/**
	 * Helper function to get link tag with id.
	 */
	function business_interface_get_link_tag(id, url) {
		if (business_interface_link_tag_collection[id]) {
			return business_interface_link_tag_collection[id];
		}

		$link_tag = $('head').find('#business-interface-dynamic-link-' + id);

		if (!$link_tag.length) {
			$('head').append('<link id="business-interface-dynamic-' + id + '" type="text/css" rel="stylesheet" href="' + url + '"/>');
			$link_tag = $('head').find('#business-interface-dynamic-link-' + id);
		} else {
			$link_tag.attr('href', url);
		}

		business_interface_link_tag_collection[id] = $link_tag;

		return $link_tag;
	}

	/*
	 * Helper function to print visibility classes.
	 */
	function business_interface_print_visibility_classes($element, newval) {
		if (!$element.length) {
			return;
		}

		$element.removeClass(business_interface_visibility_classes);

		if ('all' !== newval) {
			$element.addClass('business-interface-' + newval);
		}
	}

	/*
	 * Helper function to convert hex to rgba.
	 */
	function business_interface_hex2rgba(hex, opacity) {
		if ('rgba' === hex.substring(0, 4)) {
			return hex;
		}

		// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF").
		var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;

		hex = hex.replace(shorthandRegex, function (m, r, g, b) {
			return r + r + g + g + b + b;
		});

		var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);

		if (opacity) {
			if (opacity > 1) {
				opacity = 1;
			}

			opacity = ',' + opacity;
		}

		if (result) {
			return 'rgba(' + parseInt(result[1], 16) + ',' + parseInt(result[2], 16) + ',' + parseInt(result[3], 16) + opacity + ')';
		}

		return false;
	}

	/**
	 * Helper function to lighten or darken the provided hex color.
	 */
	function business_interface_luminance(hex, percent) {
		// Convert RGB color to HEX.
		if (hex.includes('rgb')) {
			hex = business_interface_rgba2hex(hex);
		}

		// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF").
		var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;

		hex = hex.replace(shorthandRegex, function (m, r, g, b) {
			return r + r + g + g + b + b;
		});

		var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);

		var isColor = /^#[0-9A-F]{6}$/i.test(hex);

		if (!isColor) {
			return hex;
		}

		var from, to;

		for (var i = 1; i <= 3; i++) {
			result[i] = parseInt(result[i], 16);
			from = percent < 0 ? 0 : result[i];
			to = percent < 0 ? result[i] : 255;
			result[i] = result[i] + Math.ceil((to - from) * percent);
		}

		result = '#' + business_interface_dec2hex(result[1]) + business_interface_dec2hex(result[2]) + business_interface_dec2hex(result[3]);

		return result;
	}

	/**
	 * Convert dec to hex.
	 */
	function business_interface_dec2hex(c) {
		var hex = c.toString(16);
		return hex.length == 1 ? '0' + hex : hex;
	}

	/**
	 * Convert rgb to hex.
	 */
	function business_interface_rgba2hex(c) {
		var a, x;

		a = c.split('(')[1].split(')')[0].trim();
		a = a.split(',');

		var result = '';

		for (var i = 0; i < 3; i++) {
			x = parseInt(a[i]).toString(16);
			result += 1 === x.length ? '0' + x : x;
		}

		if (result) {
			return '#' + result;
		}

		return false;
	}

	/**
	 * Check if is light color.
	 */
	function business_interface_is_light_color(color = '') {
		var r, g, b, brightness;

		if (color.match(/^rgb/)) {
			color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
			r = color[1];
			g = color[2];
			b = color[3];
		} else {
			color = +('0x' + color.slice(1).replace(color.length < 5 && /./g, '$&$&'));
			r = color >> 16;
			g = (color >> 8) & 255;
			b = color & 255;
		}

		brightness = (r * 299 + g * 587 + b * 114) / 1000;

		return brightness > 137;
	}

	/**
	 * Detect if we should use a light or dark color on a background color.
	 */
	function business_interface_light_or_dark(color, dark = '#000000', light = '#FFFFFF') {
		return business_interface_is_light_color(color) ? dark : light;
	}

	/**
	 * Spacing field CSS.
	 */
	function business_interface_spacing_field_css(selector, property, setting, responsive) {
		if (!Array.isArray(setting) && 'object' !== typeof setting) {
			return;
		}

		// Set up unit.
		var unit = 'px',
			css = '';

		if ('unit' in setting) {
			unit = setting.unit;
		}

		var before = '',
			after = '';

		Object.keys(setting).forEach(function (index, el) {
			if ('unit' === index) {
				return;
			}

			if (responsive) {
				if ('tablet' === index) {
					before = '@media only screen and (max-width: 768px) {';
					after = '}';
				} else if ('mobile' === index) {
					before = '@media only screen and (max-width: 480px) {';
					after = '}';
				} else {
					before = '';
					after = '';
				}

				css += before + selector + '{';

				Object.keys(setting[index]).forEach(function (position) {
					if ('border' === property) {
						position += '-width';
					}

					if (setting[index][position]) {
						css += property + '-' + position + ': ' + setting[index][position] + unit + ';';
					}
				});

				css += '}' + after;
			} else {
				if ('border' === property) {
					index += '-width';
				}

				css += property + '-' + index + ': ' + setting[index] + unit + ';';
			}
		});

		if (!responsive) {
			css = selector + '{' + css + '}';
		}

		return css;
	}

	/**
	 * Range field CSS.
	 */
	function business_interface_range_field_css(selector, property, setting, responsive, unit) {
		var css = '',
			before = '',
			after = '';

		if (responsive && (Array.isArray(setting) || 'object' === typeof setting)) {
			Object.keys(setting).forEach(function (index, el) {
				if (setting[index]) {
					if ('tablet' === index) {
						before = '@media only screen and (max-width: 768px) {';
						after = '}';
					} else if ('mobile' === index) {
						before = '@media only screen and (max-width: 480px) {';
						after = '}';
					} else if ('desktop' === index) {
						before = '';
						after = '';
					} else {
						return;
					}

					css += before + selector + '{' + property + ': ' + setting[index] + unit + '; }' + after;
				}
			});
		}

		if (!responsive) {
			if (setting.value) {
				setting = setting.value;
			} else {
				setting = 0;
			}

			css = selector + '{' + property + ': ' + setting + unit + '; }';
		}

		return css;
	}

	/**
	 * Typography field CSS.
	 */
	function business_interface_typography_field_css(selector, setting) {
		var css = '';

		css += selector + '{';

		if ('default' === setting['font-family']) {
			css += 'font-family: ' + interface_customizer_preview.default_system_font + ';';
		} else if (setting['font-family'] in interface_customizer_preview.fonts.standard_fonts.fonts) {
			css += 'font-family: ' + interface_customizer_preview.fonts.standard_fonts.fonts[setting['font-family']]['fallback'] + ';';
		} else if ('inherit' !== setting['font-family']) {
			css += 'font-family: "' + setting['font-family'] + '";';
		}

		css += 'font-weight:' + setting['font-weight'] + ';';
		css += 'font-style:' + setting['font-style'] + ';';
		css += 'text-transform:' + setting['text-transform'] + ';';

		if ('text-decoration' in setting) {
			css += 'text-decoration:' + setting['text-decoration'] + ';';
		}

		if ('letter-spacing' in setting) {
			css += 'letter-spacing:' + setting['letter-spacing'] + setting['letter-spacing-unit'] + ';';
		}

		if ('line-height-desktop' in setting) {
			css += 'line-height:' + setting['line-height-desktop'] + ';';
		}

		if ('font-size-desktop' in setting && 'font-size-unit' in setting) {
			css += 'font-size:' + setting['font-size-desktop'] + setting['font-size-unit'] + ';';
		}

		css += '}';

		if ('font-size-tablet' in setting && setting['font-size-tablet']) {
			css += '@media only screen and (max-width: 768px) {' + selector + '{' + 'font-size: ' + setting['font-size-tablet'] + setting['font-size-unit'] + ';' + '}' + '}';
		}

		if ('line-height-tablet' in setting && setting['line-height-tablet']) {
			css += '@media only screen and (max-width: 768px) {' + selector + '{' + 'line-height:' + setting['line-height-tablet'] + ';' + '}' + '}';
		}

		if ('font-size-mobile' in setting && setting['font-size-mobile']) {
			css += '@media only screen and (max-width: 480px) {' + selector + '{' + 'font-size: ' + setting['font-size-mobile'] + setting['font-size-unit'] + ';' + '}' + '}';
		}

		if ('line-height-mobile' in setting && setting['line-height-mobile']) {
			css += '@media only screen and (max-width: 480px) {' + selector + '{' + 'line-height:' + setting['line-height-mobile'] + ';' + '}' + '}';
		}

		return css;
	}

	/**
	 * Load google font.
	 */
	function business_interface_enqueue_google_font(font) {
		if (interface_customizer_preview.fonts.google_fonts.fonts[font]) {
			var id = 'google-font-' + font.trim().toLowerCase().replace(' ', '-');
			var url = interface_customizer_preview.google_fonts_url + '/css?family=' + font + ':' + interface_customizer_preview.google_font_weights;

			var tag = business_interface_get_link_tag(id, url);
		}
	}

	/**
	 * Design Options field CSS.
	 */
	function business_interface_design_options_css(selector, setting, type) {
		var css = '',
			before = '',
			after = '';

		if ('background' === type) {
			var bg_type = setting['background-type'];

			css += selector + '{';

			if ('color' === bg_type) {
				setting['background-color'] = setting['background-color'] ? setting['background-color'] : 'inherit';
				css += 'background: ' + setting['background-color'] + ';';
			} else if ('gradient' === bg_type) {
				css += 'background: ' + setting['gradient-color-1'] + ';';

				if ('linear' === setting['gradient-type']) {
					css +=
						'background: -webkit-linear-gradient(' +
						setting['gradient-linear-angle'] +
						'deg, ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);' +
						'background: -o-linear-gradient(' +
						setting['gradient-linear-angle'] +
						'deg, ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);' +
						'background: linear-gradient(' +
						setting['gradient-linear-angle'] +
						'deg, ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);';
				} else if ('radial' === setting['gradient-type']) {
					css +=
						'background: -webkit-radial-gradient(' +
						setting['gradient-position'] +
						', circle, ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);' +
						'background: -o-radial-gradient(' +
						setting['gradient-position'] +
						', circle, ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);' +
						'background: radial-gradient(circle at ' +
						setting['gradient-position'] +
						', ' +
						setting['gradient-color-1'] +
						' ' +
						setting['gradient-color-1-location'] +
						'%, ' +
						setting['gradient-color-2'] +
						' ' +
						setting['gradient-color-2-location'] +
						'%);';
				}
			} else if ('image' === bg_type) {
				css +=
					'' +
					'background-image: url(' +
					setting['background-image'] +
					');' +
					'background-size: ' +
					setting['background-size'] +
					';' +
					'background-attachment: ' +
					setting['background-attachment'] +
					';' +
					'background-position: ' +
					setting['background-position-x'] +
					'% ' +
					setting['background-position-y'] +
					'%;' +
					'background-repeat: ' +
					setting['background-repeat'] +
					';';
			}

			css += '}';

			// Background image color overlay.
			if ('image' === bg_type && setting['background-color-overlay'] && setting['background-image']) {
				css += selector + '::after { background-color: ' + setting['background-color-overlay'] + '; }';
			} else {
				css += selector + '::after { background-color: initial; }';
			}
		} else if ('color' === type) {
			setting['text-color'] = setting['text-color'] ? setting['text-color'] : 'inherit';
			setting['link-color'] = setting['link-color'] ? setting['link-color'] : 'inherit';
			setting['link-hover-color'] = setting['link-hover-color'] ? setting['link-hover-color'] : 'inherit';

			css += selector + ' { color: ' + setting['text-color'] + '; }';
			css += selector + ' a { color: ' + setting['link-color'] + '; }';
			css += selector + ' a:hover { color: ' + setting['link-hover-color'] + ' !important; }';
		} else if ('border' === type) {
			setting['border-color'] = setting['border-color'] ? setting['border-color'] : 'inherit';
			setting['border-style'] = setting['border-style'] ? setting['border-style'] : 'solid';
			setting['border-left-width'] = setting['border-left-width'] ? setting['border-left-width'] : 0;
			setting['border-top-width'] = setting['border-top-width'] ? setting['border-top-width'] : 0;
			setting['border-right-width'] = setting['border-right-width'] ? setting['border-right-width'] : 0;
			setting['border-bottom-width'] = setting['border-bottom-width'] ? setting['border-bottom-width'] : 0;

			css += selector + '{';
			css += 'border-color: ' + setting['border-color'] + ';';
			css += 'border-style: ' + setting['border-style'] + ';';
			css += 'border-left-width: ' + setting['border-left-width'] + 'px;';
			css += 'border-top-width: ' + setting['border-top-width'] + 'px;';
			css += 'border-right-width: ' + setting['border-right-width'] + 'px;';
			css += 'border-bottom-width: ' + setting['border-bottom-width'] + 'px;';
			css += '}';
		} else if ('separator_color' === type) {
			css += selector + ':after{ background-color: ' + setting['separator-color'] + '; }';
		}

		return css;
	}

	/**
	 * Logo max height.
	 */
	api('business_interface_logo_max_height', function (value) {
		value.bind(function (newval) {
			var $logo = $('.business-interface-logo');

			if (!$logo.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_logo_max_height');
			var style_css = '';

			style_css += business_interface_range_field_css('.business-interface-logo img', 'max-height', newval, true, 'px');
			style_css += business_interface_range_field_css('.business-interface-logo img.si-svg-logo', 'height', newval, true, 'px');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Logo text font size.
	 */
	api('business_interface_logo_text_font_size', function (value) {
		value.bind(function (newval) {
			var $logo = $('#business-interface-header .business-interface-logo .site-title');

			if (!$logo.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_logo_text_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css('#business-interface-header .business-interface-logo .site-title', 'font-size', newval, true, newval.unit);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Logo margin.
	 */
	api('business_interface_logo_margin', function (value) {
		value.bind(function (newval) {
			var $logo = $('.business-interface-logo');

			if (!$logo.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_logo_margin');

			var style_css = business_interface_spacing_field_css('.business-interface-logo .logo-inner', 'margin', newval, true);
			$style_tag.html(style_css);
		});
	});

	/**
	 * Tagline.
	 */
	api('blogdescription', function (value) {
		value.bind(function (newval) {
			if ($('.business-interface-logo').find('.site-description').length) {
				$('.business-interface-logo').find('.site-description').html(newval);
			}
		});
	});

	/**
	 * Site Title.
	 */
	api('blogname', function (value) {
		value.bind(function (newval) {
			if ($('.business-interface-logo').find('.site-title').length) {
				$('.business-interface-logo').find('.site-title').find('a').html(newval);
			}
		});
	});

	/**
	 * Site Layout.
	 */
	api('business_interface_site_layout', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-layout__\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-layout__' + newval);
		});
	});

	/**
	 * Sticky Sidebar.
	 */
	api('business_interface_sidebar_sticky', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)si-sticky-\S+/g) || []).join(' ');
			});

			if (newval) {
				$body.addClass('si-sticky-' + newval);
			}
		});
	});

	/**
	 * Sidebar width.
	 */
	api('business_interface_sidebar_width', function (value) {
		value.bind(function (newval) {
			var $sidebar = $('#secondary');

			if (!$sidebar.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_sidebar_width');
			var style_css = '#secondary { width: ' + newval.value + '%; }';
			style_css += 'body:not(.business-interface-no-sidebar) #primary { ' + 'max-width: ' + (100 - parseInt(newval.value)) + '%;' + '};';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Sidebar style.
	 */
	api('business_interface_sidebar_style', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-sidebar-style-\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-sidebar-style-' + newval);
		});
	});

	/**
	 * Responsive sidebar position.
	 */
	api('business_interface_sidebar_responsive_position', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)si-sidebar-r__\S+/g) || []).join(' ');
			});

			if (newval) {
				$body.addClass('si-sidebar-r__' + newval);
			}
		});
	});

	/**
	 * Featured Image Position (Horizontal Blog layout)
	 */
	api('business_interface_blog_image_position', function (value) {
		value.bind(function (newval) {
			$('.si-blog-entry-wrapper').removeClass(function (index, className) {
				return (className.match(/(^|\s)si-thumb-\S+/g) || []).join(' ');
			});

			$('.si-blog-entry-wrapper').addClass('si-thumb-' + newval);
		});
	});

	/**
	 * Single page - title in header alignment.
	 */
	api('business_interface_single_title_alignment', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)si-page-title-align-\S+/g) || []).join(' ');
			});

			$body.addClass('si-page-title-align-' + newval);
		});
	});

	/**
	 * Single Page title spacing.
	 */
	api('business_interface_single_title_spacing', function (value) {
		value.bind(function (newval) {
			var $page_header = $('.page-header');

			if (!$page_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_single_title_spacing');

			var style_css = business_interface_spacing_field_css('.si-single-title-in-page-header .page-header .si-page-header-wrapper', 'padding', newval, true);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Single post narrow container width.
	 */
	api('business_interface_single_narrow_container_width', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_single_narrow_container_width');
			var style_css = '';

			style_css +=
				'.single-post.narrow-content .entry-content > :not([class*="align"]):not([class*="gallery"]):not(.wp-block-image):not(.quote-inner):not(.quote-post-bg), ' +
				'.single-post.narrow-content .mce-content-body:not([class*="page-template-full-width"]) > :not([class*="align"]):not([data-wpview-type*="gallery"]):not(blockquote):not(.mceTemp), ' +
				'.single-post.narrow-content .entry-footer, ' +
				'.single-post.narrow-content .post-nav, ' +
				'.single-post.narrow-content .entry-content > .alignwide, ' +
				'.single-post.narrow-content p.has-background:not(.alignfull):not(.alignwide)' +
				'.single-post.narrow-content #business-interface-comments-toggle, ' +
				'.single-post.narrow-content #comments, ' +
				'.single-post.narrow-content .entry-content .aligncenter, ' +
				'.single-post.narrow-content .si-narrow-element, ' +
				'.single-post.narrow-content.si-single-title-in-content .entry-header, ' +
				'.single-post.narrow-content.si-single-title-in-content .entry-meta, ' +
				'.single-post.narrow-content.si-single-title-in-content .post-category, ' +
				'.single-post.narrow-content.business-interface-no-sidebar .si-page-header-wrapper, ' +
				'.single-post.narrow-content.business-interface-no-sidebar .si-breadcrumbs > .interface-container > nav {' +
				'max-width: ' +
				parseInt(newval.value) +
				'px; margin-left: auto; margin-right: auto; ' +
				'}';

			style_css += '.single-post.narrow-content .author-box, ' + '.single-post.narrow-content .entry-content > .alignwide { ' + 'max-width: ' + (parseInt(newval.value) + 70) + 'px;' + '}';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Single post content font size.
	 */
	api('business_interface_single_content_font_size', function (value) {
		value.bind(function (newval) {
			var $content = $('.single-post');

			if (!$content.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_single_content_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css('.single-post .entry-content', 'font-size', newval, true, newval.unit);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Header container width.
	 */
	api('business_interface_header_container_width', function (value) {
		value.bind(function (newval) {
			var $header = $('#business-interface-header');

			if (!$header.length) {
				return;
			}

			if ('full-width' === newval) {
				$header.addClass('interface-container__wide');
			} else {
				$header.removeClass('interface-container__wide');
			}
		});
	});

	/**
	 * Main navigation disply breakpoint.
	 */
	api('business_interface_main_nav_mobile_breakpoint', function (value) {
		value.bind(function (newval) {
			var $nav = $('#business-interface-header-inner .business-interface-nav');

			if (!$nav.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_main_nav_mobile_breakpoint');
			var style_css = '';

			style_css += '@media screen and (min-width: ' + parseInt(newval) + 'px) {#business-interface-header-inner .business-interface-nav {display:flex} .si-mobile-nav {display:none;} }';
			style_css += '@media screen and (max-width: ' + parseInt(newval) + 'px) {#business-interface-header-inner .business-interface-nav {display:none} .si-mobile-nav {display:inline-flex;} }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Mobile Menu Button Label.
	 */
	api('business_interface_main_nav_mobile_label', function (value) {
		value.bind(function (newval) {
			if ($('.si-hamburger-business-interface-primary-nav').find('.hamburger-label').length) {
				$('.si-hamburger-business-interface-primary-nav').find('.hamburger-label').html(newval);
			}
		});
	});

	/**
	 * Main Nav Font color.
	 */
	api('business_interface_main_nav_font_color', function (value) {
		value.bind(function (newval) {
			var $navigation = $('#business-interface-header-inner .business-interface-nav');

			if (!$navigation.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_main_nav_font_color');
			var style_css = '';

			// Link color.
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			style_css += '#business-interface-header-inner .business-interface-nav > ul > li > a { color: ' + newval['link-color'] + '; }';

			// Link hover color.
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : api.value('business_interface_accent_color')();
			style_css +=
				'#business-interface-header-inner .business-interface-nav > ul > li > a:hover, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.menu-item-has-children:hover > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-item > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-ancestor > a ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.page_item_has_children:hover > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current_page_item > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current_page_ancestor > a ' +
				'{ color: ' +
				newval['link-hover-color'] +
				'; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Main Nav Background.
	 */
	api('business_interface_main_nav_background', function (value) {
		value.bind(function (newval) {
			var $navigation = $('.business-interface-header-layout-3 .si-nav-container');

			if (!$navigation.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_main_nav_background');
			var style_css = business_interface_design_options_css('.business-interface-header-layout-3 .si-nav-container', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Main Nav Border.
	 */
	api('business_interface_main_nav_border', function (value) {
		value.bind(function (newval) {
			var $navigation = $('.business-interface-header-layout-3 .si-nav-container');

			if (!$navigation.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_main_nav_border');
			var style_css = business_interface_design_options_css('.business-interface-header-layout-3 .si-nav-container', newval, 'border');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Main Nav font size.
	 */
	api('business_interface_main_nav_font_size', function (value) {
		value.bind(function (newval) {
			var $nav = $('#business-interface-header-inner');

			if (!$nav.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_main_nav_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css('.business-interface-nav.si-header-element, .business-interface-header-layout-1 .si-header-widgets, .business-interface-header-layout-2 .si-header-widgets', 'font-size', newval, false, newval.unit);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Top Bar container width.
	 */
	api('business_interface_top_bar_container_width', function (value) {
		value.bind(function (newval) {
			var $topbar = $('#business-interface-topbar');

			if (!$topbar.length) {
				return;
			}

			if ('full-width' === newval) {
				$topbar.addClass('interface-container__wide');
			} else {
				$topbar.removeClass('interface-container__wide');
			}
		});
	});

	/**
	 * Top Bar visibility.
	 */
	api('business_interface_top_bar_visibility', function (value) {
		value.bind(function (newval) {
			var $topbar = $('#business-interface-topbar');

			business_interface_print_visibility_classes($topbar, newval);
		});
	});

	/**
	 * Top Bar widgets separator.
	 */
	api('business_interface_top_bar_widgets_separator', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-topbar__separators-\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-topbar__separators-' + newval);
		});
	});

	/**
	 * Top Bar background.
	 */
	api('business_interface_top_bar_background', function (value) {
		value.bind(function (newval) {
			var $topbar = $('#business-interface-topbar');

			if (!$topbar.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_top_bar_background');
			var style_css = business_interface_design_options_css('#business-interface-topbar', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Top Bar color.
	 */
	api('business_interface_top_bar_text_color', function (value) {
		value.bind(function (newval) {
			var $topbar = $('#business-interface-topbar');

			if (!$topbar.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_top_bar_text_color');
			var style_css = '';

			newval['text-color'] = newval['text-color'] ? newval['text-color'] : 'inherit';
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : 'inherit';

			// Text color.
			style_css += '#business-interface-topbar { color: ' + newval['text-color'] + '; }';

			// Link color.
			style_css += '.si-topbar-widget__text a, ' + '.si-topbar-widget .business-interface-nav > ul > li > a, ' + '.si-topbar-widget__socials .business-interface-social-nav > ul > li > a, ' + '#business-interface-topbar .si-topbar-widget__text .si-icon { color: ' + newval['link-color'] + '; }';

			// Link hover color.
			style_css +=
				'#business-interface-topbar .business-interface-nav > ul > li > a:hover, ' +
				'#business-interface-topbar .business-interface-nav > ul > li.menu-item-has-children:hover > a,  ' +
				'#business-interface-topbar .business-interface-nav > ul > li.current-menu-item > a, ' +
				'#business-interface-topbar .business-interface-nav > ul > li.current-menu-ancestor > a, ' +
				'#business-interface-topbar .si-topbar-widget__text a:hover, ' +
				'#business-interface-topbar .business-interface-social-nav > ul > li > a .si-icon.bottom-icon { color: ' +
				newval['link-hover-color'] +
				'; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Top Bar border.
	 */
	api('business_interface_top_bar_border', function (value) {
		value.bind(function (newval) {
			var $topbar = $('#business-interface-topbar');

			if (!$topbar.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_top_bar_border');
			var style_css = business_interface_design_options_css('#business-interface-topbar', newval, 'border');

			style_css += business_interface_design_options_css('#business-interface-topbar .si-topbar-widget', newval, 'separator_color');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Header menu item hover animation.
	 */
	api('business_interface_main_nav_hover_animation', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-menu-animation-\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-menu-animation-' + newval);
		});
	});

	/**
	 * Header widgets separator.
	 */
	api('business_interface_header_widgets_separator', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-header__separators-\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-header__separators-' + newval);
		});
	});

	/**
	 * Header background.
	 */
	api('business_interface_header_background', function (value) {
		value.bind(function (newval) {
			var $header = $('#business-interface-header-inner');

			if (!$header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_header_background');
			var style_css = business_interface_design_options_css('#business-interface-header-inner', newval, 'background');

			if ('color' === newval['background-type'] && newval['background-color']) {
				style_css += '.si-header-widget__cart .si-cart .si-cart-count { border: 2px solid ' + newval['background-color'] + '; }';
			} else {
				style_css += '.si-header-widget__cart .si-cart .si-cart-count { border: none; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Header font color.
	 */
	api('business_interface_header_text_color', function (value) {
		value.bind(function (newval) {
			var $header = $('#business-interface-header');

			if (!$header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_header_text_color');
			var style_css = '';

			// Text color.
			style_css += '.business-interface-logo .site-description { color: ' + newval['text-color'] + '; }';

			// Link color.
			if (newval['link-color']) {
				style_css += '#business-interface-header, ' + '.si-header-widgets a:not(.interface-button), ' + '.business-interface-logo a,' + '.si-hamburger { color: ' + newval['link-color'] + '; }';
				style_css += '.hamburger-inner,' + '.hamburger-inner::before,' + '.hamburger-inner::after { background-color: ' + newval['link-color'] + '; }';
			}

			// Link hover color.
			if (newval['link-hover-color']) {
				style_css +=
					'.si-header-widgets a:not(.interface-button):hover, ' +
					'#business-interface-header-inner .si-header-widgets .business-interface-active,' +
					'.business-interface-logo .site-title a:hover, ' +
					'.si-hamburger:hover .hamburger-label, ' +
					'.is-mobile-menu-active .si-hamburger .hamburger-label,' +
					'#business-interface-header-inner .business-interface-nav > ul > li > a:hover,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.menu-item-has-children:hover > a,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-item > a,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-ancestor > a,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.page_item_has_children:hover > a,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.current_page_item > a,' +
					'#business-interface-header-inner .business-interface-nav > ul > li.current_page_ancestor > a { color: ' +
					newval['link-hover-color'] +
					'; }';

				style_css +=
					'.si-hamburger:hover .hamburger-inner,' +
					'.si-hamburger:hover .hamburger-inner::before,' +
					'.si-hamburger:hover .hamburger-inner::after,' +
					'.is-mobile-menu-active .si-hamburger .hamburger-inner,' +
					'.is-mobile-menu-active .si-hamburger .hamburger-inner::before,' +
					'.is-mobile-menu-active .si-hamburger .hamburger-inner::after { background-color: ' +
					newval['link-hover-color'] +
					'; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Header border.
	 */
	api('business_interface_header_border', function (value) {
		value.bind(function (newval) {
			var $header = $('#business-interface-header-inner');

			if (!$header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_header_border');
			var style_css = business_interface_design_options_css('#business-interface-header-inner', newval, 'border');

			// Separator color.
			newval['separator-color'] = newval['separator-color'] ? newval['separator-color'] : 'inherit';
			style_css += '.si-header-widget:after { background-color: ' + newval['separator-color'] + '; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Hero container width.
	 */
	api('business_interface_hero_hover_slider_container', function (value) {
		value.bind(function (newval) {
			var $hero_container = $('#hero .si-hero-container');

			if (!$hero_container.length) {
				return;
			}

			if ('full-width' === newval) {
				$hero_container.addClass('interface-container__wide');
			} else {
				$hero_container.removeClass('interface-container__wide');
			}
		});
	});

	/**
	 * Hero overlay style.
	 */
	api('business_interface_hero_hover_slider_overlay', function (value) {
		value.bind(function (newval) {
			var $hero = $('#hero .si-hover-slider');

			if (!$hero.length) {
				return;
			}

			$hero
				.removeClass(function (index, className) {
					return (className.match(/(^|\s)slider-overlay-\S+/g) || []).join(' ');
				})
				.addClass('slider-overlay-' + newval);
		});
	});

	/**
	 * Hero height.
	 */
	api('business_interface_hero_hover_slider_height', function (value) {
		value.bind(function (newval) {
			var $hero = $('#hero');

			if (!$hero.length) {
				return;
			}

			$hero.find('.hover-slide-item').css('height', newval.value + 'px');
		});
	});

	/**
	 * Hero visibility.
	 */
	api('business_interface_hero_visibility', function (value) {
		value.bind(function (newval) {
			business_interface_print_visibility_classes($('#hero'), newval);
		});
	});

	/**
	 * Custom input style.
	 */
	api('business_interface_custom_input_style', function (value) {
		value.bind(function (newval) {
			if (newval) {
				$body.addClass('si-input-supported');
			} else {
				$body.removeClass('si-input-supported');
			}
		});
	});

	/**
	 * Pre Footer Call to Action Enable.
	 */
	api('business_interface_enable_pre_footer_cta', function (value) {
		value.bind(function (newval) {
			if (newval) {
				$body.addClass('si-pre-footer-cta-style-' + api.value('business_interface_pre_footer_cta_style')());
			} else {
				$body.removeClass(function (index, className) {
					return (className.match(/(^|\s)si-pre-footer-cta-style-\S+/g) || []).join(' ');
				});
			}
		});
	});

	/**
	 * Pre Footer Call to Action visibility.
	 */
	api('business_interface_pre_footer_cta_visibility', function (value) {
		value.bind(function (newval) {
			var $cta = $('.si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			business_interface_print_visibility_classes($cta, newval);
		});
	});

	/**
	 * Pre Footer Call to Action Text.
	 */
	api('business_interface_pre_footer_cta_text', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			$cta.find('p.h3').html(newval);
		});
	});

	/**
	 * Pre Footer Call to Action Style.
	 */
	api('business_interface_pre_footer_cta_style', function (value) {
		value.bind(function (newval) {
			$body
				.removeClass(function (index, className) {
					return (className.match(/(^|\s)si-pre-footer-cta-style-\S+/g) || []).join(' ');
				})
				.addClass('si-pre-footer-cta-style-' + api.value('business_interface_pre_footer_cta_style')());
		});
	});

	/**
	 * Pre Footer Call to Action Button Text.
	 */
	api('business_interface_pre_footer_cta_btn_text', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			if (newval) {
				$cta.find('a').css('display', 'inline-flex').html(newval);
			} else {
				$cta.find('a').css('display', 'none').html('');
			}
		});
	});

	/**
	 * Pre Footer Call to Action Background.
	 */
	api('business_interface_pre_footer_cta_background', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_pre_footer_cta_background');
			var style_css = '';

			if ('color' === newval['background-type']) {
				style_css += business_interface_design_options_css('.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::before, .si-pre-footer-cta-style-2 #si-pre-footer::before', newval, 'background');
				style_css += '.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::after,' + '.si-pre-footer-cta-style-2 #si-pre-footer::after' + '{ background-image: none; }';
			} else {
				style_css += business_interface_design_options_css('.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::after', newval, 'background');
				style_css += business_interface_design_options_css('.si-pre-footer-cta-style-2 #si-pre-footer::after', newval, 'background');
			}

			if ('image' === newval['background-type'] && newval['background-color-overlay'] && newval['background-image']) {
				style_css += '.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::before,' + '.si-pre-footer-cta-style-2 #si-pre-footer::before' + '{ background-color: ' + newval['background-color-overlay'] + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Pre Footer Call to Action Text Color.
	 */
	api('business_interface_pre_footer_cta_text_color', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_pre_footer_cta_text_color');
			var style_css = '';

			style_css += business_interface_design_options_css('#si-pre-footer .h2', newval, 'color');
			style_css += business_interface_design_options_css('#si-pre-footer .h3', newval, 'color');
			style_css += business_interface_design_options_css('#si-pre-footer .h4', newval, 'color');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Pre Footer Call to Action Border.
	 */
	api('business_interface_pre_footer_cta_border', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_pre_footer_cta_border');
			var style_css = business_interface_design_options_css('.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::before, .si-pre-footer-cta-style-2 #si-pre-footer::before', newval, 'border');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Pre Footer CTA font size.
	 */
	api('business_interface_pre_footer_cta_font_size', function (value) {
		value.bind(function (newval) {
			var $cta = $('#si-pre-footer .si-pre-footer-cta');

			if (!$cta.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_pre_footer_cta_font_size');
			var style_css = business_interface_range_field_css('#si-pre-footer .h3', 'font-size', newval, true, newval.unit);

			$style_tag.html(style_css);
		});
	});

	/**
	 * WooCommerce sale badge text.
	 */
	api('business_interface_product_sale_badge_text', function (value) {
		value.bind(function (newval) {
			var $badge = $('.woocommerce ul.products li.product .onsale, .woocommerce span.onsale').not('.sold-out');

			if (!$badge.length) {
				return;
			}

			$badge.html(newval);
		});
	});

	/**
	 * Accent color.
	 */
	api('business_interface_accent_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_accent_color');
			var style_css;

			// Background colors.
			style_css =
				'.si-header-widgets .si-cart .si-cart-count,' +
				'#si-scroll-top:hover::before, ' +
				'.business-interface-menu-animation-underline #business-interface-header-inner .business-interface-nav > ul > li > a > span::before, ' +
				'.interface-button, ' +
				'#infinite-handle span, ' +
				'input[type=submit], ' +
				'.comment-form input[type=checkbox]:checked, ' +
				'#comments .bypostauthor-badge, ' +
				'input[type=radio]:checked::before, ' +
				'.single .post-tags a:hover, ' +
				'.single .post-category .cat-links a:hover, ' +
				'#main .mejs-controls .mejs-time-rail .mejs-time-current, ' +
				'.si-hamburger:hover .hamburger-inner, ' +
				'.si-hamburger:hover .hamburger-inner::before, ' +
				'.si-hamburger:hover .hamburger-inner::after, ' +
				'.tagcloud a:hover, ' +
				'.interface-button.business-interface-read-more::after, ' +
				'.post_format-post-format-quote .si-blog-entry-content .quote-post-bg::after, ' +
				'.si-hover-slider .post-category a,' +
				'.si-single-title-in-page-header.single .page-header .post-category a,' +
				'.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::after,' +
				'.si-pre-footer-cta-style-2 #si-pre-footer::after,' +
				'.entry-media > a:hover .entry-media-icon::before, ' +
				'.si-woo-steps .si-step.is-active > span:first-child, ' +
				'.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::after, ' +
				'.si-pre-footer-cta-style-2 #si-pre-footer::after, ' +
				'.site-main .woocommerce #respond input#submit, ' +
				'.site-main .woocommerce a.button, ' +
				'.site-main .woocommerce button.button, ' +
				'.site-main .woocommerce input.button, ' +
				'.select2-container--default .select2-results__option--highlighted[data-selected], ' +
				'.si-input-supported input[type=radio]:checked:before, ' +
				'.si-input-supported input[type=checkbox]:checked, ' +
				'.woocommerce ul.products li.product .onsale, ' +
				'.woocommerce span.onsale, ' +
				'.woocommerce-store-notice, ' +
				'p.demo_store, ' +
				'.woocommerce ul.products li.product .button, ' +
				'.business-interface-sidebar-style-2 #secondary .widget-title:before, ' +
				'.widget.woocommerce .wc-layered-nav-term:hover .count, ' +
				'.widget.woocommerce .product-categories li a:hover ~ .count, ' +
				'.widget.woocommerce .woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a:before, ' +
				'.woocommerce .widget_rating_filter ul li.chosen a::before, ' +
				'.widget.woocommerce .wc-layered-nav-term.chosen .count, ' +
				'.widget.woocommerce .product-categories li.current-cat > .count, ' +
				'.woocommerce .widget_price_filter .ui-slider .ui-slider-handle, ' +
				'.woocommerce .widget_price_filter .ui-slider .ui-slider-handle:after, ' +
				'.woocommerce .widget_layered_nav_filters ul li a:hover, ' +
				'.woocommerce div.product form.cart .button, ' +
				'.widget.woocommerce .wc-layered-nav-rating a:hover em, ' +
				'.widget.woocommerce .wc-layered-nav-rating.chosen a em, ' +
				'.widget .cat-item a:hover + span, ' +
				'.widget_archive li a:hover + span, ' +
				'.widget .cat-item.current-cat a + span, ' +
				'#business-interface-footer .widget .cat-item a:hover + span, ' +
				'#business-interface-footer .widget_archive li a:hover + span, ' +
				'#business-interface-footer .widget .cat-item.current-cat a + span, ' +
				'.interface-button.btn-outline:hover, ' +
				'.si-hamburger:hover .hamburger-inner, ' +
				'.si-hamburger:hover .hamburger-inner::before, ' +
				'.si-hamburger:hover .hamburger-inner::after, ' +
				'.is-mobile-menu-active .si-hamburger .hamburger-inner, ' +
				'.is-mobile-menu-active .si-hamburger .hamburger-inner::before, ' +
				'.is-mobile-menu-active .si-hamburger .hamburger-inner::after, ' +
				'.woocommerce div.product div.images .woocommerce-product-gallery__trigger:hover:before, ' +
				'.woocommerce #review_form #respond .form-submit input { ' +
				'background-color: ' +
				newval +
				';' +
				'}';

			// Hover accent background color.
			style_css +=
				'.interface-button:hover, ' +
				'input[type=submit]:hover, ' +
				'#infinite-handle span:hover, ' +
				'.site-main .woocommerce #respond input#submit, ' +
				'.site-main .woocommerce a.button:hover, ' +
				'.site-main .woocommerce button.button:hover, ' +
				'.site-main .woocommerce input.button:hover, ' +
				'.si-hover-slider .post-category a:hover, ' +
				'.si-single-title-in-page-header.single .page-header .post-category a:hover, ' +
				'.woocommerce ul.products li.product .button:hover, ' +
				'.woocommerce .widget_price_filter .ui-slider .ui-slider-range, ' +
				'.wc-layered-nav-rating a:hover .star-rating span:before, ' +
				'.woocommerce #review_form #respond .form-submit input:hover { ' +
				'background-color: ' +
				business_interface_luminance(newval, 0.15) +
				';' +
				'}';

			// Hover accent color.
			style_css += '.wc-layered-nav-rating a:hover .star-rating span:before { ' + 'color: ' + business_interface_luminance(newval, 0.15) + ';' + '}';

			style_css += 'code, ' + 'kbd, ' + 'var, ' + 'samp, ' + 'mark, ' + 'span.highlight, ' + 'tt { ' + 'background-color: ' + business_interface_hex2rgba(newval, 0.12) + ';' + '}';

			style_css += 'code.block { ' + 'background-color: ' + business_interface_hex2rgba(newval, 0.075) + ';' + '}';

			// Colors.
			style_css +=
				'.content-area a:not(.interface-button):not(.wp-block-button__link),' +
				'.si-sidebar-container a:hover:not(.interface-button), ' +
				'.si-header-widgets .si-header-widget:hover, ' +
				'.si-header-widgets .si-header-widget.business-interface-active .si-icon.si-search, ' +
				'#business-interface-header-inner .si-header-widgets .business-interface-active, ' +
				'.business-interface-logo .site-title a:hover,' +
				'#business-interface-header-inner .business-interface-nav > ul > li > a:hover, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.menu-item-has-children:hover > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-item > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current-menu-ancestor > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.page_item_has_children:hover > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current_page_item > a, ' +
				'#business-interface-header-inner .business-interface-nav > ul > li.current_page_ancestor > a, ' +
				'#business-interface-topbar .business-interface-nav > ul > li > a:hover, ' +
				'#business-interface-topbar .business-interface-nav > ul > li.menu-item-has-children:hover > a,  ' +
				'#business-interface-topbar .business-interface-nav > ul > li.current-menu-item > a, ' +
				'#business-interface-topbar .business-interface-nav > ul > li.current-menu-ancestor > a, ' +
				'.si-topbar-widget__text a:hover, ' +
				'.si-topbar-widget__text a, ' +
				'.si-header-widgets a:not(.interface-button):hover, ' +
				'.business-interface-social-nav > ul > li > a .si-icon.bottom-icon, ' +
				'.business-interface-pagination .navigation .nav-links .page-numbers:hover, ' +
				'.widget .cat-item.current-cat > a, ' +
				'.widget ul li.current_page_item > a, ' +
				'#main .search-form .search-submit:hover, ' +
				'#cancel-comment-reply-link:hover, ' +
				'.comment-form .required, ' +
				'.navigation .nav-links .page-numbers:hover, ' +
				'#main .entry-meta a:hover, ' +
				'#main .author-box-title a, ' +
				'.single .post-category a, ' +
				'.page-links span:hover, ' +
				'.site-content .page-links span:hover, ' +
				'.wc-cart-widget-header .si-cart-subtotal span, ' +
				'.si-header-widget__cart:hover > a, ' +
				'.woocommerce #yith-wcwl-form table.shop_table .product-subtotal .amount, ' +
				'.woocommerce .woocommerce-cart-form table.shop_table .product-subtotal .amount, ' +
				'.si-woo-steps .si-step.is-active, ' +
				'.cart_totals .order-total td, ' +
				'.navigation .nav-links .page-numbers.current, ' +
				'.page-links > span, ' +
				'.site-content .page-links > span, ' +
				'.woocommerce ul.products li.product .price, ' +
				'.woocommerce .woocommerce-checkout-review-order .order-total .woocommerce-Price-amount.amount, ' +
				'.woocommerce-info::before, ' +
				'#main .woocommerce-MyAccount-navigation li.is-active, ' +
				'.woocommerce .star-rating span::before, ' +
				'.widget.woocommerce .wc-layered-nav-term:hover a, ' +
				'.widget.woocommerce .wc-layered-nav-term a:hover,' +
				'.widget.woocommerce .product-categories li a:hover, ' +
				'.widget.woocommerce .product-categories li.current-cat > a, ' +
				'.woocommerce ins .amount, ' +
				'.woocommerce .widget_rating_filter ul li.chosen a::before, ' +
				'.widget.woocommerce .woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a, ' +
				'.woocommerce .widget_shopping_cart .total .amount, ' +
				'.woocommerce .widget_shopping_cart .total .tax_label, ' +
				'.woocommerce.widget_shopping_cart .total .amount, ' +
				'.woocommerce.widget_shopping_cart .total .tax_label, ' +
				'.interface-button.btn-outline, ' +
				'.woocommerce .widget_shopping_cart .cart_list li a.remove:hover:before, ' +
				'.woocommerce div.product .woocommerce-tabs ul.tabs li.active > a,' +
				'.woocommerce.widget_shopping_cart .cart_list li a.remove:hover:before, ' +
				'.woocommerce div.product p.price, ' +
				'.woocommerce div.product span.price, ' +
				'.woocommerce div.product #reviews .comment-form-rating .stars a, ' +
				'.woocommerce div.product .woocommerce-pagination ul li span.current, ' +
				'.woocommerce div.product .woocommerce-pagination ul li a:hover, ' +
				'code, ' +
				'kbd, ' +
				'var, ' +
				'samp, ' +
				'tt, ' +
				'.is-mobile-menu-active .si-hamburger .hamburger-label, ' +
				'.si-hamburger:hover .hamburger-label, ' +
				'.single #main .post-nav a:hover, ' +
				'#business-interface-topbar .si-topbar-widget__text .si-icon {' +
				'color: ' +
				newval +
				';' +
				'}';

			// Selection.
			style_css += '#main ::-moz-selection { background-color: ' + newval + '; color: #FFF; }';
			style_css += '#main ::selection { background-color: ' + newval + '; color: #FFF; }';

			// Border color.
			style_css +=
				'#comments .comment-actions .reply a:hover, ' +
				'.comment-form input[type=checkbox]:checked, .comment-form input[type=checkbox]:focus, ' +
				'.comment-form input[type=radio]:checked, .comment-form input[type=radio]:focus, ' +
				'.single .post-category a, ' +
				'#secondary .widget-title, ' +
				'.si-hover-slider .post-category a, ' +
				'.si-single-title-in-page-header.single .page-header .post-category a, ' +
				'.entry-content blockquote, ' +
				'.wp-block-quote.is-style-large, ' +
				'.wp-block-quote.is-large, ' +
				'.wp-block-quote.has-text-align-right, ' +
				'[type="radio"]:checked + label:before, ' +
				'.si-input-supported input[type=radio]:checked, ' +
				'.si-input-supported input[type=checkbox]:checked, ' +
				'.widget.woocommerce .woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a:before, ' +
				'.widget.woocommerce .widget_rating_filter.chosen a:after, ' +
				'.interface-button.btn-outline, ' +
				'.page-links > span, .site-content .page-links > span, ' +
				'.navigation .nav-links .page-numbers.current, ' +
				'.woocommerce div.product div.images .flex-control-thumbs li img.flex-active, ' +
				'.woocommerce div.product .woocommerce-pagination ul li span.current {' +
				'border-color: ' +
				newval +
				';' +
				'}';

			// Border bottom color.
			style_css +=
				'#masthead .si-header-widgets .dropdown-item::after, ' +
				'.business-interface-nav > ul .sub-menu::after,' +
				'textarea:focus, ' +
				'input[type="text"]:focus, ' +
				'input[type="email"]:focus, ' +
				'input[type=password]:focus, ' +
				'input[type=tel]:focus, ' +
				'input[type=url]:focus, ' +
				'input[type=search]:focus, ' +
				'input[type=date]:focus, ' +
				'#add_payment_method table.cart td.actions .coupon .input-text:focus, ' +
				'.woocommerce-cart table.cart td.actions .coupon .input-text:focus, ' +
				'.woocommerce-checkout table.cart td.actions .coupon .input-text:focus  {' +
				'border-bottom-color: ' +
				newval +
				';' +
				'}';

			// Border top color.
			style_css += '.si-header-widgets .dropdown-item, ' + '.site .woocommerce-info, ' + '.preloader-1 > div, ' + '.si-header-element.business-interface-nav .sub-menu {' + 'border-top-color: ' + newval + ';' + '}';

			// Fill color.
			style_css +=
				'.business-interface-animate-arrow:hover .arrow-handle, ' +
				'.business-interface-animate-arrow:hover .arrow-bar, ' +
				'.business-interface-animate-arrow:focus .arrow-handle, ' +
				'.business-interface-animate-arrow:focus .arrow-bar, ' +
				'.business-interface-pagination .navigation .nav-links .page-numbers.next:hover .business-interface-animate-arrow .arrow-handle,' +
				'.business-interface-pagination .navigation .nav-links .page-numbers.prev:hover .business-interface-animate-arrow .arrow-handle,' +
				'.business-interface-pagination .navigation .nav-links .page-numbers.next:hover .business-interface-animate-arrow .arrow-bar,' +
				'.business-interface-pagination .navigation .nav-links .page-numbers.prev:hover .business-interface-animate-arrow .arrow-bar {' +
				'fill: ' +
				newval +
				';' +
				'}';

			// Box shadow.
			style_css += '.si-input-supported input[type=checkbox]:focus:hover { ' + 'box-shadow: inset 0 0 0 2px ' + newval + '; ' + '}';

			// Gradient.
			style_css +=
				'.si-pre-footer-cta-style-1 #si-pre-footer .si-flex-row::before,' +
				'.si-pre-footer-cta-style-2 #si-pre-footer::before { ' +
				'background: linear-gradient(to right, ' +
				business_interface_hex2rgba(newval, 0.9) +
				' 0%, ' +
				business_interface_hex2rgba(newval, 0.82) +
				' 35%, ' +
				business_interface_hex2rgba(newval, 0.4) +
				' 100% );' +
				'-webkit-gradient(linear, left top, right top, from(' +
				business_interface_hex2rgba(newval, 0.9) +
				'), color-stop(35%, ' +
				business_interface_hex2rgba(newval, 0.82) +
				'), to(' +
				business_interface_hex2rgba(newval, 0.4) +
				')); }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Content background color.
	 */
	api('business_interface_boxed_content_background_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_boxed_content_background_color');
			var style_css = '';

			if (newval) {
				style_css =
					'.business-interface-layout__boxed #page, ' +
					'.business-interface-layout__boxed-separated #content, ' +
					'.business-interface-layout__boxed-separated.business-interface-sidebar-style-3 #secondary .interface-widget, ' +
					'.business-interface-layout__boxed-separated.business-interface-sidebar-style-3 .elementor-widget-sidebar .interface-widget, ' +
					'.business-interface-layout__boxed-separated.blog .business-interface-article, ' +
					'.business-interface-layout__boxed-separated.search-results .business-interface-article, ' +
					'.business-interface-layout__boxed-separated.category .business-interface-article { background-color: ' +
					newval +
					'; }';

				style_css += '@media screen and (max-width: 960px) { ' + '.business-interface-layout__boxed-separated #page { background-color: ' + newval + '; }' + '}';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Content text color.
	 */
	api('business_interface_content_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_content_text_color');
			var style_css = '';

			if (newval) {
				style_css =
					'body { ' +
					'color: ' +
					newval +
					';' +
					'}' +
					'.comment-form .comment-notes, ' +
					'#comments .no-comments, ' +
					'#page .wp-caption .wp-caption-text,' +
					'#comments .comment-meta,' +
					'.comments-closed,' +
					'.entry-meta,' +
					'.si-entry cite,' +
					'legend,' +
					'.si-page-header-description,' +
					'.page-links em,' +
					'.site-content .page-links em,' +
					'.single .entry-footer .last-updated,' +
					'.single .post-nav .post-nav-title,' +
					'#main .widget_recent_comments span,' +
					'#main .widget_recent_entries span,' +
					'#main .widget_calendar table > caption,' +
					'.post-thumb-caption, ' +
					'.wp-block-image figcaption, ' +
					'.si-cart-item .si-x,' +
					'.woocommerce form.login .lost_password a,' +
					'.woocommerce form.register .lost_password a,' +
					'.woocommerce a.remove,' +
					'#add_payment_method .cart-collaterals .cart_totals .woocommerce-shipping-destination, ' +
					'.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-destination, ' +
					'.woocommerce-checkout .cart-collaterals .cart_totals .woocommerce-shipping-destination,' +
					'.woocommerce ul.products li.product .si-loop-product__category-wrap a,' +
					'.woocommerce ul.products li.product .si-loop-product__category-wrap,' +
					'.woocommerce .woocommerce-checkout-review-order table.shop_table thead th,' +
					'#add_payment_method #payment div.payment_box, ' +
					'.woocommerce-cart #payment div.payment_box, ' +
					'.woocommerce-checkout #payment div.payment_box,' +
					'#add_payment_method #payment ul.payment_methods .about_paypal, ' +
					'.woocommerce-cart #payment ul.payment_methods .about_paypal, ' +
					'.woocommerce-checkout #payment ul.payment_methods .about_paypal,' +
					'.woocommerce table dl,' +
					'.woocommerce table .wc-item-meta,' +
					'.widget.woocommerce .reviewer,' +
					'.woocommerce.widget_shopping_cart .cart_list li a.remove:before,' +
					'.woocommerce .widget_shopping_cart .cart_list li a.remove:before,' +
					'.woocommerce .widget_shopping_cart .cart_list li .quantity, ' +
					'.woocommerce.widget_shopping_cart .cart_list li .quantity,' +
					'.woocommerce div.product .woocommerce-product-rating .woocommerce-review-link,' +
					'.woocommerce div.product .woocommerce-tabs table.shop_attributes td,' +
					'.woocommerce div.product .product_meta > span span:not(.si-woo-meta-title), ' +
					'.woocommerce div.product .product_meta > span a,' +
					'.woocommerce .star-rating::before,' +
					'.woocommerce div.product #reviews #comments ol.commentlist li .comment-text p.meta,' +
					'.ywar_review_count,' +
					'.woocommerce .add_to_cart_inline del, ' +
					'.woocommerce div.product p.price del, ' +
					'.woocommerce div.product span.price del { color: ' +
					business_interface_hex2rgba(newval, 0.75) +
					'; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Content link hover color.
	 */
	api('business_interface_content_link_hover_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_content_link_hover_color');
			var style_css = '';

			if (newval) {
				// Content link hover.
				style_css +=
					'.content-area a:not(.interface-button):not(.wp-block-button__link):hover, ' +
					'.si-woo-before-shop select.custom-select-loaded:hover ~ #si-orderby, ' +
					'#add_payment_method #payment ul.payment_methods .about_paypal:hover, ' +
					'.woocommerce-cart #payment ul.payment_methods .about_paypal:hover, ' +
					'.woocommerce-checkout #payment ul.payment_methods .about_paypal:hover, ' +
					'.si-breadcrumbs a:hover, ' +
					'.woocommerce div.product .woocommerce-product-rating .woocommerce-review-link:hover, ' +
					'.woocommerce ul.products li.product .meta-wrap .woocommerce-loop-product__link:hover, ' +
					'.woocommerce ul.products li.product .si-loop-product__category-wrap a:hover { ' +
					'color: ' +
					newval +
					';' +
					'}';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Content text color.
	 */
	api('business_interface_headings_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_headings_color');
			var style_css = '';

			if (newval) {
				style_css = 'h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .business-interface-logo .site-title, .error-404 .page-header h1 { ' + 'color: ' + newval + ';' + '}';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Scroll Top visibility.
	 */
	api('business_interface_scroll_top_visibility', function (value) {
		value.bind(function (newval) {
			business_interface_print_visibility_classes($('#si-scroll-top'), newval);
		});
	});

	/**
	 * Page Preloader visibility.
	 */
	api('business_interface_preloader_visibility', function (value) {
		value.bind(function (newval) {
			business_interface_print_visibility_classes($('#si-preloader'), newval);
		});
	});

	/**
	 * Footer visibility.
	 */
	api('business_interface_footer_visibility', function (value) {
		value.bind(function (newval) {
			business_interface_print_visibility_classes($('#business-interface-footer'), newval);
		});
	});

	/**
	 * Footer background.
	 */
	api('business_interface_footer_background', function (value) {
		value.bind(function (newval) {
			var $footer = $('#colophon');

			if (!$footer.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_footer_background');
			var style_css = business_interface_design_options_css('#colophon', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Footer font color.
	 */
	api('business_interface_footer_text_color', function (value) {
		var $footer = $('#business-interface-footer'),
			copyright_separator_color,
			style_css;

		value.bind(function (newval) {
			if (!$footer.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_footer_text_color');

			style_css = '';

			newval['text-color'] = newval['text-color'] ? newval['text-color'] : 'inherit';
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : 'inherit';
			newval['widget-title-color'] = newval['widget-title-color'] ? newval['widget-title-color'] : 'inherit';

			// Text color.
			style_css += '#colophon { color: ' + newval['text-color'] + '; }';

			// Link color.
			style_css += '#colophon a { color: ' + newval['link-color'] + '; }';

			// Link hover color.
			style_css += '#colophon a:hover, #colophon li.current_page_item > a, #colophon .business-interface-social-nav > ul > li > a .si-icon.bottom-icon ' + '{ color: ' + newval['link-hover-color'] + '; }';

			// Widget title color.
			style_css += '#colophon .widget-title, #colophon .wp-block-heading { color: ' + newval['widget-title-color'] + '; }';

			// Copyright separator color.
			copyright_separator_color = business_interface_light_or_dark(newval['text-color'], 'rgba(255,255,255,0.1)', 'rgba(0,0,0,0.1)');
			// copyright_separator_color = business_interface_luminance( newval['text-color'], 0.8 );

			style_css += '#business-interface-copyright.contained-separator > .interface-container:before { background-color: ' + copyright_separator_color + '; }';
			style_css += '#business-interface-copyright.fw-separator { border-top-color: ' + copyright_separator_color + '; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Footer border.
	 */
	api('business_interface_footer_border', function (value) {
		value.bind(function (newval) {
			var $footer = $('#business-interface-footer');

			if (!$footer.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_footer_border');
			var style_css = '';

			if (newval['border-top-width']) {
				style_css += '#colophon { ' + 'border-top-width: ' + newval['border-top-width'] + 'px;' + 'border-top-style: ' + newval['border-style'] + ';' + 'border-top-color: ' + newval['border-color'] + ';' + '}';
			}

			if (newval['border-bottom-width']) {
				style_css += '#colophon { ' + 'border-bottom-width: ' + newval['border-bottom-width'] + 'px;' + 'border-bottom-style: ' + newval['border-style'] + ';' + 'border-bottom-color: ' + newval['border-color'] + ';' + '}';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Copyright layout.
	 */
	api('business_interface_copyright_layout', function (value) {
		value.bind(function (newval) {
			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)business-interface-copyright-layout-\S+/g) || []).join(' ');
			});

			$body.addClass('business-interface-copyright-' + newval);
		});
	});

	/**
	 * Copyright separator.
	 */
	api('business_interface_copyright_separator', function (value) {
		value.bind(function (newval) {
			var $copyright = $('#business-interface-copyright');

			if (!$copyright.length) {
				return;
			}

			$copyright.removeClass('fw-separator contained-separator');

			if ('none' !== newval) {
				$copyright.addClass(newval);
			}
		});
	});

	/**
	 * Copyright visibility.
	 */
	api('business_interface_copyright_visibility', function (value) {
		value.bind(function (newval) {
			business_interface_print_visibility_classes($('#business-interface-copyright'), newval);
		});
	});

	/**
	 * Copyright background.
	 */
	api('business_interface_copyright_background', function (value) {
		value.bind(function (newval) {
			var $copyright = $('#business-interface-copyright');

			if (!$copyright.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_copyright_background');
			var style_css = business_interface_design_options_css('#business-interface-copyright', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Copyright text color.
	 */
	api('business_interface_copyright_text_color', function (value) {
		value.bind(function (newval) {
			var $copyright = $('#business-interface-copyright');

			if (!$copyright.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_copyright_text_color');
			var style_css = '';

			newval['text-color'] = newval['text-color'] ? newval['text-color'] : 'inherit';
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : 'inherit';

			// Text color.
			style_css += '#business-interface-copyright { color: ' + newval['text-color'] + '; }';

			// Link color.
			style_css += '#business-interface-copyright a { color: ' + newval['link-color'] + '; }';

			// Link hover color.
			style_css +=
				'#business-interface-copyright a:hover, #business-interface-copyright .business-interface-social-nav > ul > li > a .si-icon.bottom-icon, #business-interface-copyright li.current_page_item > a, #business-interface-copyright .business-interface-nav > ul > li.current-menu-item > a, #business-interface-copyright .business-interface-nav > ul > li.current-menu-ancestor > a #business-interface-copyright .business-interface-nav > ul > li:hover > a, #business-interface-copyright .business-interface-social-nav > ul > li > a .si-icon.bottom-icon { color: ' +
				newval['link-hover-color'] +
				'; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Container width.
	 */
	api('business_interface_container_width', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_container_width');
			var style_css;

			style_css = '.interface-container,' + '.alignfull > div { ' + 'max-width: ' + newval.value + 'px;' + '}';

			style_css +=
				'.business-interface-layout__boxed #page, .business-interface-layout__boxed.si-sticky-header.business-interface-is-mobile #business-interface-header-inner, ' +
				'.business-interface-layout__boxed.si-sticky-header:not(.business-interface-header-layout-3) #business-interface-header-inner, ' +
				'.business-interface-layout__boxed.si-sticky-header:not(.business-interface-is-mobile).business-interface-header-layout-3 #business-interface-header-inner .si-nav-container > .interface-container { max-width: ' +
				(parseInt(newval.value) + 100) +
				'px; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Transparent Header Logo max height.
	 */
	api('business_interface_tsp_logo_max_height', function (value) {
		value.bind(function (newval) {
			var $logo = $('.si-tsp-header .business-interface-logo');

			if (!$logo.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_tsp_logo_max_height');
			var style_css = '';

			style_css += business_interface_range_field_css('.si-tsp-header .business-interface-logo img', 'max-height', newval, true, 'px');
			style_css += business_interface_range_field_css('.si-tsp-header .business-interface-logo img.si-svg-logo', 'height', newval, true, 'px');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Transparent Header Logo margin.
	 */
	api('business_interface_tsp_logo_margin', function (value) {
		value.bind(function (newval) {
			var $logo = $('.si-tsp-header .business-interface-logo');

			if (!$logo.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_tsp_logo_margin');

			var style_css = business_interface_spacing_field_css('.si-tsp-header .business-interface-logo .logo-inner', 'margin', newval, true);
			$style_tag.html(style_css);
		});
	});

	/**
	 * Transparent header - Main Header & Topbar background.
	 */
	api('business_interface_tsp_header_background', function (value) {
		value.bind(function (newval) {
			var $tsp_header = $('.si-tsp-header');

			if (!$tsp_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_tsp_header_background');

			var style_css = '';
			style_css += business_interface_design_options_css('.si-tsp-header #business-interface-header-inner', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Transparent header - Main Header & Topbar font color.
	 */
	api('business_interface_tsp_header_font_color', function (value) {
		value.bind(function (newval) {
			var $tsp_header = $('.si-tsp-header');

			if (!$tsp_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_tsp_header_font_color');

			var style_css = '';

			newval['text-color'] = newval['text-color'] ? newval['text-color'] : 'inherit';
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : 'inherit';

			/** Header **/

			// Text color.
			style_css += '.si-tsp-header .business-interface-logo .site-description { color: ' + newval['text-color'] + '; }';

			// Link color.
			if (newval['link-color']) {
				style_css += '.si-tsp-header #business-interface-header, ' + '.si-tsp-header .si-header-widgets a:not(.interface-button), ' + '.si-tsp-header .business-interface-logo a,' + '.si-tsp-header .si-hamburger, ' + '.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li > a { color: ' + newval['link-color'] + '; }';
				style_css += '.si-tsp-header .hamburger-inner,' + '.si-tsp-header .hamburger-inner::before,' + '.si-tsp-header .hamburger-inner::after { background-color: ' + newval['link-color'] + '; }';
			}

			// Link hover color.
			if (newval['link-hover-color']) {
				style_css +=
					'.si-tsp-header .si-header-widgets a:not(.interface-button):hover, ' +
					'.si-tsp-header #business-interface-header-inner .si-header-widgets .business-interface-active,' +
					'.si-tsp-header .business-interface-logo .site-title a:hover, ' +
					'.si-tsp-header .si-hamburger:hover .hamburger-label, ' +
					'.is-mobile-menu-active .si-tsp-header .si-hamburger .hamburger-label,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li > a:hover,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.menu-item-has-children:hover > a,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.current-menu-item > a,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.current-menu-ancestor > a,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.page_item_has_children:hover > a,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.current_page_item > a,' +
					'.si-tsp-header #business-interface-header-inner .business-interface-nav > ul > li.current_page_ancestor > a { color: ' +
					newval['link-hover-color'] +
					'; }';

				style_css +=
					'.si-tsp-header .si-hamburger:hover .hamburger-inner,' +
					'.si-tsp-header .si-hamburger:hover .hamburger-inner::before,' +
					'.si-tsp-header .si-hamburger:hover .hamburger-inner::after,' +
					'.is-mobile-menu-active .si-tsp-header .si-hamburger .hamburger-inner,' +
					'.is-mobile-menu-active .si-tsp-header .si-hamburger .hamburger-inner::before,' +
					'.is-mobile-menu-active .si-tsp-header .si-hamburger .hamburger-inner::after { background-color: ' +
					newval['link-hover-color'] +
					'; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Transparent header - Main Header & Topbar border.
	 */
	api('business_interface_tsp_header_border', function (value) {
		value.bind(function (newval) {
			var $tsp_header = $('.si-tsp-header');

			if (!$tsp_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_tsp_header_border');

			var style_css = '';

			style_css += business_interface_design_options_css('.si-tsp-header #business-interface-header-inner', newval, 'border');

			// Separator color.
			newval['separator-color'] = newval['separator-color'] ? newval['separator-color'] : 'inherit';
			style_css += '.si-tsp-header .si-header-widget:after { background-color: ' + newval['separator-color'] + '; }';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Page Header layout.
	 */
	api('business_interface_page_header_alignment', function (value) {
		value.bind(function (newval) {
			if ($body.hasClass('single-post')) {
				return;
			}

			$body.removeClass(function (index, className) {
				return (className.match(/(^|\s)si-page-title-align-\S+/g) || []).join(' ');
			});

			$body.addClass('si-page-title-align-' + newval);
		});
	});

	/**
	 * Page Header spacing.
	 */
	api('business_interface_page_header_spacing', function (value) {
		value.bind(function (newval) {
			var $page_header = $('.page-header');

			if (!$page_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_page_header_spacing');

			var style_css = business_interface_spacing_field_css('.si-page-title-align-left .page-header.si-has-page-title, .si-page-title-align-right .page-header.si-has-page-title, .si-page-title-align-center .page-header .si-page-header-wrapper', 'padding', newval, true);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Page Header background.
	 */
	api('business_interface_page_header_background', function (value) {
		value.bind(function (newval) {
			var $page_header = $('.page-header');

			if (!$page_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_page_header_background');

			var style_css = '';
			style_css += business_interface_design_options_css('.page-header', newval, 'background');
			style_css += business_interface_design_options_css('.si-tsp-header:not(.si-tsp-absolute) #masthead', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Header Text color.
	 */
	api('business_interface_page_header_text_color', function (value) {
		value.bind(function (newval) {
			var $page_header = $('.page-header');

			if (!$page_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_page_header_text_color');
			var style_css = '';

			newval['text-color'] = newval['text-color'] ? newval['text-color'] : 'inherit';
			newval['link-color'] = newval['link-color'] ? newval['link-color'] : 'inherit';
			newval['link-hover-color'] = newval['link-hover-color'] ? newval['link-hover-color'] : 'inherit';

			// Text color.
			style_css += '.page-header .page-title { color: ' + newval['text-color'] + '; }';
			style_css += '.page-header .si-page-header-description' + '{ color: ' + business_interface_hex2rgba(newval['text-color'], 0.75) + '}';

			// Link color.
			style_css += '.page-header .si-breadcrumbs a' + '{ color: ' + newval['link-color'] + '; }';

			style_css += '.page-header .si-breadcrumbs span,' + '.page-header .breadcrumb-trail .trail-items li::after, .page-header .si-breadcrumbs .separator' + '{ color: ' + business_interface_hex2rgba(newval['link-color'], 0.75) + '}';

			$style_tag.html(style_css);
		});
	});

	/**
	 * Page Header border.
	 */
	api('business_interface_page_header_border', function (value) {
		value.bind(function (newval) {
			var $page_header = $('.page-header');

			if (!$page_header.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_page_header_border');
			var style_css = business_interface_design_options_css('.page-header', newval, 'border');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Breadcrumbs alignment.
	 */
	api('business_interface_breadcrumbs_alignment', function (value) {
		value.bind(function (newval) {
			var $breadcrumbs = $('#main > .si-breadcrumbs > .interface-container');

			if (!$breadcrumbs.length) {
				return;
			}

			$breadcrumbs.removeClass(function (index, className) {
				return (className.match(/(^|\s)si-text-align\S+/g) || []).join(' ');
			});

			$breadcrumbs.addClass('si-text-align-' + newval);
		});
	});

	/**
	 * Breadcrumbs spacing.
	 */
	api('business_interface_breadcrumbs_spacing', function (value) {
		value.bind(function (newval) {
			var $breadcrumbs = $('.si-breadcrumbs');

			if (!$breadcrumbs.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_breadcrumbs_spacing');

			var style_css = business_interface_spacing_field_css('.si-breadcrumbs', 'padding', newval, true);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Breadcrumbs Background.
	 */
	api('business_interface_breadcrumbs_background', function (value) {
		value.bind(function (newval) {
			var $breadcrumbs = $('.si-breadcrumbs');

			if (!$breadcrumbs.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_breadcrumbs_background');
			var style_css = business_interface_design_options_css('.si-breadcrumbs', newval, 'background');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Breadcrumbs Text Color.
	 */
	api('business_interface_breadcrumbs_text_color', function (value) {
		value.bind(function (newval) {
			var $breadcrumbs = $('.si-breadcrumbs');

			if (!$breadcrumbs.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_breadcrumbs_text_color');
			var style_css = business_interface_design_options_css('.si-breadcrumbs', newval, 'color');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Breadcrumbs Border.
	 */
	api('business_interface_breadcrumbs_border', function (value) {
		value.bind(function (newval) {
			var $breadcrumbs = $('.si-breadcrumbs');

			if (!$breadcrumbs.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_breadcrumbs_border');
			var style_css = business_interface_design_options_css('.si-breadcrumbs', newval, 'border');

			$style_tag.html(style_css);
		});
	});

	/**
	 * Base HTML font size.
	 */
	api('business_interface_html_base_font_size', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_html_base_font_size');
			var style_css = business_interface_range_field_css('html', 'font-size', newval, true, 'px');
			$style_tag.html(style_css);
		});
	});

	/**
	 * Font smoothing.
	 */
	api('business_interface_font_smoothing', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_font_smoothing');

			if (newval) {
				$style_tag.html('*,' + '*::before,' + '*::after {' + '-moz-osx-font-smoothing: grayscale;' + '-webkit-font-smoothing: antialiased;' + '}');
			} else {
				$style_tag.html('*,' + '*::before,' + '*::after {' + '-moz-osx-font-smoothing: auto;' + '-webkit-font-smoothing: auto;' + '}');
			}

			$style_tag = business_interface_get_style_tag('business_interface_html_base_font_size');
			var style_css = business_interface_range_field_css('html', 'font-size', newval, true, 'px');
			$style_tag.html(style_css);
		});
	});

	/**
	 * Body font.
	 */
	api('business_interface_body_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_body_font');
			var style_css = business_interface_typography_field_css('body', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Headings font.
	 */
	api('business_interface_headings_font', function (value) {
		var style_css, selector;
		value.bind(function (newval) {
			selector = 'h1, .h1, .business-interface-logo .site-title, .page-header h1.page-title';
			selector += ', h2, .h2, .woocommerce div.product h1.product_title';
			selector += ', h3, .h3, .woocommerce #reviews #comments h2';
			selector += ', h4, .h4, .woocommerce .cart_totals h2, .woocommerce .cross-sells > h4, .woocommerce #reviews #respond .comment-reply-title';
			selector += ', h5, h6';

			style_css = business_interface_typography_field_css(selector, newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag = business_interface_get_style_tag('business_interface_headings_font');
			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 1 font.
	 */
	api('business_interface_h1_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h1_font');

			var style_css = business_interface_typography_field_css('h1, .h1, .business-interface-logo .site-title, .page-header h1.page-title', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 2 font.
	 */
	api('business_interface_h2_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h2_font');

			var style_css = business_interface_typography_field_css('h2, .h2, .woocommerce div.product h1.product_title', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 3 font.
	 */
	api('business_interface_h3_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h3_font');

			var style_css = business_interface_typography_field_css('h3, .h3, .woocommerce #reviews #comments h2', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 4 font.
	 */
	api('business_interface_h4_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h4_font');

			var style_css = business_interface_typography_field_css('h4, .h4, .woocommerce .cart_totals h2, .woocommerce .cross-sells > h4, .woocommerce #reviews #respond .comment-reply-title', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 5 font.
	 */
	api('business_interface_h5_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h5_font');
			var style_css = business_interface_typography_field_css('h5', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading 6 font.
	 */
	api('business_interface_h6_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_h6_font');
			var style_css = business_interface_typography_field_css('h6', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Heading emphasized font.
	 */
	api('business_interface_heading_em_font', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_heading_em_font');
			var style_css = business_interface_typography_field_css('h1 em, h2 em, h3 em, h4 em, h5 em, h6 em, .h1 em, .h2 em, .h3 em, .h4 em, .business-interface-logo .site-title em, .error-404 .page-header h1 em', newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Sidebar widget title font size.
	 */
	api('business_interface_sidebar_widget_title_font_size', function (value) {
		value.bind(function (newval) {
			var $widget_title = $('#main .widget-title, #main .wp-block-heading');

			if (!$widget_title.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_sidebar_widget_title_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css('#main .widget-title, #main .wp-block-heading', 'font-size', newval, true, newval.unit);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Footer widget title font size.
	 */
	api('business_interface_footer_widget_title_font_size', function (value) {
		value.bind(function (newval) {
			var $widget_title = $('#colophon .widget-title, #colophon .wp-block-heading');

			if (!$widget_title.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_footer_widget_title_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css(
				'#colophon .widget-title, #colophon .wp-block-heading',
				'font-size',
				newval,
				true,
				newval.unit
			);

			$style_tag.html(style_css);
		});
	});

	/**
	 * Page title font size.
	 */
	api('business_interface_page_header_font_size', function (value) {
		value.bind(function (newval) {
			var $page_title = $('.page-header .page-title');

			if (!$page_title.length) {
				return;
			}

			$style_tag = business_interface_get_style_tag('business_interface_page_header_font_size');
			var style_css = '';

			style_css += business_interface_range_field_css('#page .page-header .page-title', 'font-size', newval, true, newval.unit);

			$style_tag.html(style_css);
		});
	});

	var $btn_selectors =
		'.interface-button, ' +
		'body:not(.wp-customizer) input[type=submit], ' +
		'.site-main .woocommerce #respond input#submit, ' +
		'.site-main .woocommerce a.button, ' +
		'.site-main .woocommerce button.button, ' +
		'.site-main .woocommerce input.button, ' +
		'.woocommerce ul.products li.product .added_to_cart, ' +
		'.woocommerce ul.products li.product .button, ' +
		'.woocommerce div.product form.cart .button, ' +
		'.woocommerce #review_form #respond .form-submit input, ' +
		'#infinite-handle span';

	var $btn_hover_selectors =
		'.interface-button:hover, ' +
		'.interface-button:focus, ' +
		'body:not(.wp-customizer) input[type=submit]:hover, ' +
		'body:not(.wp-customizer) input[type=submit]:focus, ' +
		'.site-main .woocommerce #respond input#submit:hover, ' +
		'.site-main .woocommerce #respond input#submit:focus, ' +
		'.site-main .woocommerce a.button:hover, ' +
		'.site-main .woocommerce a.button:focus, ' +
		'.site-main .woocommerce button.button:hover, ' +
		'.site-main .woocommerce button.button:focus, ' +
		'.site-main .woocommerce input.button:hover, ' +
		'.site-main .woocommerce input.button:focus, ' +
		'.woocommerce ul.products li.product .added_to_cart:hover, ' +
		'.woocommerce ul.products li.product .added_to_cart:focus, ' +
		'.woocommerce ul.products li.product .button:hover, ' +
		'.woocommerce ul.products li.product .button:focus, ' +
		'.woocommerce div.product form.cart .button:hover, ' +
		'.woocommerce div.product form.cart .button:focus, ' +
		'.woocommerce #review_form #respond .form-submit input:hover, ' +
		'.woocommerce #review_form #respond .form-submit input:focus, ' +
		'#infinite-handle span:hover';

	/**
	 * Primary button background color.
	 */
	api('business_interface_primary_button_bg_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_bg_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_selectors + '{ background-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button hover background color.
	 */
	api('business_interface_primary_button_hover_bg_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_hover_bg_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_hover_selectors + ' { background-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button text color.
	 */
	api('business_interface_primary_button_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_selectors + ' { color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button hover text color.
	 */
	api('business_interface_primary_button_hover_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_hover_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_hover_selectors + ' { color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button border width.
	 */
	api('business_interface_primary_button_border_width', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_border_width');
			var style_css = '';

			if (newval) {
				style_css = $btn_selectors + ' { border-width: ' + newval.value + 'px; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button border radius.
	 */
	api('business_interface_primary_button_border_radius', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_border_radius');
			var style_css = '';

			if (newval) {
				style_css = $btn_selectors + ' { ' + 'border-top-left-radius: ' + newval['top-left'] + 'px;' + 'border-top-right-radius: ' + newval['top-right'] + 'px;' + 'border-bottom-left-radius: ' + newval['bottom-left'] + 'px;' + 'border-bottom-right-radius: ' + newval['bottom-right'] + 'px; }';

				console.log(style_css);
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button border color.
	 */
	api('business_interface_primary_button_border_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_border_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_selectors + ' { border-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button hover border color.
	 */
	api('business_interface_primary_button_hover_border_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_hover_border_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_hover_selectors + ' { border-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Primary button typography.
	 */
	api('business_interface_primary_button_typography', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_primary_button_typography');
			var style_css = business_interface_typography_field_css($btn_selectors, newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	// Secondary button.
	var $btn_sec_selectors = '.button-secondary, .interface-button.button-secondary';

	var $btn_sec_hover_selectors = '.button-secondary:hover, ' + '.button-secondary:focus, ' + '.interface-button.button-secondary:hover, ' + '.interface-button.button-secondary:focus';

	/**
	 * Secondary button background color.
	 */
	api('business_interface_secondary_button_bg_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_bg_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_selectors + '{ background-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button hover background color.
	 */
	api('business_interface_secondary_button_hover_bg_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_hover_bg_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_hover_selectors + '{ background-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button text color.
	 */
	api('business_interface_secondary_button_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_selectors + '{ color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button hover text color.
	 */
	api('business_interface_secondary_button_hover_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_hover_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_hover_selectors + '{ color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button border width.
	 */
	api('business_interface_secondary_button_border_width', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_border_width');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_selectors + ' { border-width: ' + newval.value + 'px; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button border radius.
	 */
	api('business_interface_secondary_button_border_radius', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_border_radius');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_selectors + ' { ' + 'border-top-left-radius: ' + newval['top-left'] + 'px;' + 'border-top-right-radius: ' + newval['top-right'] + 'px;' + 'border-bottom-left-radius: ' + newval['bottom-left'] + 'px;' + 'border-bottom-right-radius: ' + newval['bottom-right'] + 'px; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button border color.
	 */
	api('business_interface_secondary_button_border_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_border_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_selectors + ' { border-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button hover border color.
	 */
	api('business_interface_secondary_button_hover_border_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_hover_border_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_sec_hover_selectors + ' { border-color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Secondary button typography.
	 */
	api('business_interface_secondary_button_typography', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_secondary_button_typography');
			var style_css = business_interface_typography_field_css($btn_sec_selectors, newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	// Text button.
	var $btn_text_selectors = '.interface-button.btn-text-1, .btn-text-1';

	var $btn_text_hover_selectors = '.interface-button.btn-text-1:hover, .interface-button.btn-text-1:focus, .btn-text-1:hover, .btn-text-1:focus';

	/**
	 * Text button text color.
	 */
	api('business_interface_text_button_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_text_button_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_text_selectors + '{ color: ' + newval + '; }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Text button hover text color.
	 */
	api('business_interface_text_button_hover_text_color', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_text_button_hover_text_color');
			var style_css = '';

			if (newval) {
				style_css = $btn_text_hover_selectors + '{ color: ' + newval + '; }';
				style_css += '.interface-button.btn-text-1 > span::before { background-color: ' + newval + ' }';
			}

			$style_tag.html(style_css);
		});
	});

	/**
	 * Text button typography.
	 */
	api('business_interface_text_button_typography', function (value) {
		value.bind(function (newval) {
			$style_tag = business_interface_get_style_tag('business_interface_text_button_typography');
			var style_css = business_interface_typography_field_css($btn_text_selectors, newval);

			business_interface_enqueue_google_font(newval['font-family']);

			$style_tag.html(style_css);
		});
	});

	// Selective refresh.
	if (api.selectiveRefresh) {
		// Bind partial content rendered event.
		api.selectiveRefresh.bind('partial-content-rendered', function (placement) {
			// Hero Hover Slider.
			if ('business_interface_hero_hover_slider_post_number' === placement.partial.id || 'business_interface_hero_hover_slider_elements' === placement.partial.id) {
				document.querySelectorAll(placement.partial.params.selector).forEach((item) => {
					interfaceHoverSlider(item);
				});

				// Force refresh height.
				api('business_interface_hero_hover_slider_height', function (newval) {
					newval.callbacks.fireWith(newval, [newval.get()]);
				});
			}

			// Preloader style.
			if ('business_interface_preloader_style' === placement.partial.id) {
				$body.removeClass('si-loaded');

				setTimeout(function () {
					window.businessInterface.preloader();
				}, 300);
			}
		});
	}

	// Custom Customizer Preview class (attached to the Customize API)
	api.businessInterfaceCustomizerPreview = {
		// Init
		init: function () {
			var self = this; // Store a reference to "this"
			var previewBody = self.preview.body;

			previewBody.on('click', '.business-interface-set-widget', function () {
				self.preview.send('set-footer-widget', $(this).data('sidebar-id'));
			});
		},
	};

	/**
	 * Capture the instance of the Preview since it is private (this has changed in WordPress 4.0)
	 *
	 * @see https://github.com/WordPress/WordPress/blob/5cab03ab29e6172a8473eb601203c9d3d8802f17/wp-admin/js/customize-controls.js#L1013
	 */
	var businessInterfaceOldPreview = api.Preview;
	api.Preview = businessInterfaceOldPreview.extend({
		initialize: function (params, options) {
			// Store a reference to the Preview
			api.businessInterfaceCustomizerPreview.preview = this;

			// Call the old Preview's initialize function
			businessInterfaceOldPreview.prototype.initialize.call(this, params, options);
		},
	});

	// Document ready
	$(function () {
		// Initialize our Preview
		api.businessInterfaceCustomizerPreview.init();
	});
})(jQuery);
