<?php
/**
 * Equable Lite: Color Patterns
 *
 * @package Equable_Lite
 */

/**
 * Generate the CSS for the current custom color scheme.*/
function equable_lite_custom_colors_css() {
	$hue = absint( get_theme_mod( 'colorscheme_hue', 32 ) );

	/**
	 * Filter Equable Lite default saturation level.
	 * @since Equable Lite 1.0.0
	 * @param int $saturation Color saturation level.
	 */
	$saturation = absint( apply_filters( 'equable_lite_custom_colors_saturation', 50 ) );

	// lighter
	$reduced_saturation = ( .8 * $saturation ) . '%';
	
	// light 
	$reduced_saturation2 = ( .4 * $saturation ) . '%';
	
	// greys
	$reduced_saturation3 = ( 0 * $saturation ) . '%';
	
	$saturation = $saturation . '%';
	$css = '
	

.colors-custom .more-link, 
.colors-custom .solid-button, 
.colors-custom .link-button, 
.colors-custom .post-edit-link, 
.colors-custom .comment-reply-link, 
.colors-custom .page-numbers, 
.colors-custom .image-navigation a, 
.colors-custom button, 
.colors-custom input[type="button"], 
.colors-custom input[type="reset"], 
.colors-custom input[type="submit"] {
    color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 60% );
}

.colors-custom .featured-post,
.colors-custom .entry-meta, 
.colors-custom .entry-meta a, 
.colors-custom .entry-meta a:visited {
    color: hsl( ' . $hue . ', ' . $saturation . ', 45% );
}

.colors-custom .more-link, 
.colors-custom .solid-button, 
.colors-custom .link-button, 
.colors-custom .post-edit-link, 
.colors-custom .comment-reply-link, 
.colors-custom .page-numbers, 
.colors-custom .image-navigation a, 
.colors-custom button, 
.colors-custom input[type="button"], 
.colors-custom input[type="reset"], 
.colors-custom input[type="submit"] {
	border-color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 85% );
}

.colors-custom .solid-button,

.colors-custom .more-link:active,
.colors-custom .more-link:focus,
.colors-custom .link-button:active,
.colors-custom .link-button:focus,
.colors-custom .comment-reply-link:active,
.colors-custom .comment-reply-link:focus,
.colors-custom .page-numbers:active,
.colors-custom .page-numbers:focus,
.colors-custom .image-navigation a:active,
.colors-custom .image-navigation a:focus,
.colors-custom button:active, 
.colors-custom button:focus,
.colors-custom input[type="button"]:active,
.colors-custom input[type="button"]:focus,
.colors-custom input[type="reset"]:active,
.colors-custom input[type="reset"]:focus,
.colors-custom input[type="submit"]:active,
.colors-custom input[type="submit"]:focus,

.colors-custom .more-link:hover,
.colors-custom .link-button:hover,
.colors-custom .post-edit-link:hover,
.colors-custom .comment-reply-link:hover,
.colors-custom .page-numbers:hover,
.colors-custom .image-navigation a:hover,
.colors-custom button:hover,
.colors-custom input[type="button"]:hover,
.colors-custom input[type="reset"]:hover,
.colors-custom input[type="submit"]:hover {
	border-color: hsl( ' . $hue . ', ' . $saturation . ', 45% );
	color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 100% );
	background-color: hsl( ' . $hue . ', ' . $saturation . ', 45% );
}

abbr, acronym {
    border-color: hsl( ' . $hue . ', ' . $saturation . ', 45% );
}
.colors-custom blockquote,
.colors-custom a,
.colors-custom a:visited {
	color: hsl( ' . $hue . ', ' . $saturation . ', 45% );
}

.colors-custom .main-navigation a,
.colors-custom .main-navigation li li a {
	color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 20% );
}

.colors-custom #left-sidebar li a,
.colors-custom #right-sidebar li a {
	color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 55% );
}

.colors-custom .site-title a, 
.colors-custom .site-title a:visited {
	color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 0% );
}

.colors-custom .footer-social a,
.colors-custom .footer-social a:visited {
    color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 100% );
    background-color: hsl( ' . $hue . ', ' . $saturation . ', 50% );
}

.colors-custom .footer-copyright a {
    color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 50% );
}

.colors-custom .entry-title,
.colors-custom .entry-title a,
.colors-custom .entry-title a:visited {
	color: hsl( ' . $hue . ', ' . $saturation . ', 0% );	
}


@media screen and (min-width: 768px) {

	.colors-custom .main-navigation ul ul:before {
		border-color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 85% ) transparent;
	}
	.colors-custom .main-navigation ul ul:after {
		border-color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 100% ) transparent;
	}
	.colors-custom .main-navigation ul ul {
		background: hsl( ' . $hue . ', ' . $saturation . ', 100% ); 
		border-color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 85% );
	}

	.colors-custom .main-navigation a:before {
		color: hsl( ' . $hue . ', ' . $reduced_saturation3 . ', 65% );
	}
	
	.colors-custom .main-navigation li li.focus > a,
	.colors-custom .main-navigation li li:focus > a,
	.colors-custom .main-navigation li li:hover > a,
	.colors-custom .main-navigation li li a:hover,
	.colors-custom .main-navigation li li a:focus,
	.colors-custom .main-navigation li li.current_page_item a:hover,
	.colors-custom .main-navigation li li.current-menu-item a:hover,
	.colors-custom .main-navigation li li.current_page_item a:focus,
	.colors-custom .main-navigation li li.current-menu-item a:focus {
		color: hsl( ' . $hue . ', ' . $saturation . ', 25% );
	}	
}';

	/**
	 * Filters Equable Lite custom colors CSS.
	 *
	 * @since Equable Lite 1.0.0
	 *
	 * @param string $css        Base theme colors CSS.
	 * @param int    $hue        The user's selected color hue.
	 * @param string $saturation Filtered theme color saturation level.
	 */
	return apply_filters( 'equable_lite_custom_colors_css', $css, $hue, $saturation );
}
