<?php
/**
* Stylesheet / skin style related function
*
* @package WordPress
* @subpackage Wokey Store
* @since Wokey Store 1.0
* @author WebInPixels
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

function wip_get_additional_css() {
$width = wip_get_logo_image_width();
ob_start();

if( get_option( WIP_THEME_SHORTNAME.'_site_boxed', 'no') == "yes" ){
wip_style_load_boxed_background();
}

?>
#top #logo img{
width: <?php echo $width; ?>px;
max-width: 100%;
height: auto;
zoom:1;
}
<?php

return ob_get_clean();
}

/**
* Default theme typography
*
* @since Wokey Store 1.0
* @return string
*/
function wip_style_load_default_typography () {
ob_start();
?>
/** Font Family, Font Size && Spacing */
@import url(https://fonts.googleapis.com/css?family=Glegoo:regular|Carrois+Gothic:regular);
body {
font-family : "Carrois Gothic", Arial, tahoma, sans-serif;
font-size: 12px;
font-weight: 400;
line-height: 1.65em;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family : "Glegoo", Arial, tahoma, sans-serif;
}
.price,
.amount{
font-family : "Glegoo", Arial, tahoma, sans-serif;
}
nav#menu {
font-family : "Glegoo", Arial, tahoma, sans-serif;
}
.mega-section{
font-family : "Carrois Gothic", Arial, tahoma, sans-serif;
}
p,
dl,
hr,
ol,
ul,
pre,
table,
address,
fieldset,
figure,
form {
margin-bottom: 1.65em;
}
dl {
margin: 0 1.65em;
}
dd {
margin: 0 0 1.65em;
}
blockquote {
margin: 1.65em 2em 1.65em 2em;
line-height: 1.65em;
}
pre {
margin: 1em 0 1.65em;
}

h1 {
font-size: 28px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 20px;
}
h4 {
font-size: 17.5px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 11.9px;
}

<?php
return ob_get_clean();
}






/**
* get google font that choosen from theme option
*
* @since Wokey Store 1.0
* @return link to embed the google font(s)
*/
function wip_style_get_choosen_google_fonts(){
$font_used = array(
get_option( WIP_THEME_SHORTNAME.'_heading_font', 'Helvetica' ),
get_option( WIP_THEME_SHORTNAME.'_body_font', 'Helvetica' ),
get_option( WIP_THEME_SHORTNAME.'_menu_font', 'Helvetica' ),
get_option( WIP_THEME_SHORTNAME.'_price_font', 'Helvetica' )
);
//remove if any duplicates
$fonts = array_unique($font_used);

$linkFont = array();

foreach( $fonts as $f ){
$fdata = wip_core_get_font_embed_css($f);
if( $fdata && is_array( $fdata ) ){
$linkthisFont = $fdata['css'];

if( isset($fdata['subset']) && !empty( $fdata['subset'] ) ){
$linkthisFont = $linkthisFont . '&subset='.trim($fdata['subset']);
}

$linkFont[] = $linkthisFont;
}
$fdata = null;
}
unset( $f );


$googleFont = "";

if( !empty($linkFont) ){
foreach( $linkFont as $fontdata ) {
$googleFont .= '@import url(https://fonts.googleapis.com/css?family='.$fontdata.');' . "\n";
}
unset( $fontdata );
}

return $googleFont;
unset( $linkFont );
}





/**
* Custom fonts and font sizes
*
* @since Wokey Store 1.0
* return string
*/
if( ! function_exists('wip_style_load_custom_typography') ) {
function wip_style_load_custom_typography() {

if( get_option( WIP_THEME_SHORTNAME.'_font_weight' ) == "" ) return wip_style_load_default_typography();
$font_used = wip_style_get_choosen_google_fonts();
$line_height = trim(get_option(WIP_THEME_SHORTNAME.'_body_line_height')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_body_line_height_measure'));
ob_start();
?>
/** Font Family, Font Size && Spacing */
<?php if( "" != $font_used ) echo $font_used; ?>
body {
<?php echo wip_core_get_font_family_by_name( get_option( WIP_THEME_SHORTNAME.'_body_font', 'Helvetica' ) ) . "\n"; ?>
font-size: <?php echo trim( str_replace( 'px', '', get_option( WIP_THEME_SHORTNAME.'_body_fontsize' ) ) );?>px;
font-weight: <?php echo get_option( WIP_THEME_SHORTNAME.'_font_weight', '400' ); ?>;
line-height: <?php echo $line_height; ?>;
}
h1,
h2,
h3,
h4,
h5,
h6 {
<?php echo wip_core_get_font_family_by_name( get_option( WIP_THEME_SHORTNAME.'_heading_font', 'Helvetica' ) ) . "\n"; ?>
}
.price,
.amount{
<?php echo wip_core_get_font_family_by_name( get_option( WIP_THEME_SHORTNAME.'_price_font', 'Helvetica' ) ) . "\n"; ?>
}
nav#menu {
<?php echo wip_core_get_font_family_by_name( get_option( WIP_THEME_SHORTNAME.'_menu_font', 'Helvetica' ) ) . "\n"; ?>
}
.mega-section{
<?php echo wip_core_get_font_family_by_name( get_option( WIP_THEME_SHORTNAME.'_body_font', 'Helvetica' ) ) . "\n"; ?>
}
p,
dl,
hr,
ol,
ul,
pre,
table,
address,
fieldset,
figure,
form {
margin-bottom: <?php echo $line_height; ?>;
}
dl {
margin: 0 <?php echo $line_height; ?>;
}
dd {
margin: 0 0 <?php echo $line_height; ?>;
}
blockquote {
margin: <?php echo $line_height; ?> 2em <?php echo $line_height; ?> 2em;
line-height: <?php echo $line_height; ?>;
}
pre {
margin: 1em 0 <?php echo $line_height; ?>;
}

h1 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading1_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading1_measure')); ?>;
}
h2 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading2_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading2_measure')); ?>;
}
h3 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading3_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading3_measure')); ?>;
}
h4 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading4_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading4_measure')); ?>;
}
h5 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading5_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading5_measure')); ?>;
}
h6 {
font-size: <?php echo trim(get_option(WIP_THEME_SHORTNAME.'_heading6_fontsize')) . str_replace('pixel', 'px', get_option(WIP_THEME_SHORTNAME.'_heading6_measure')); ?>;
}


<?php
$typo = ob_get_clean();
$timeout = 31536000;
set_site_transient( 'wip_wokeystore_style_typography', $typo, $timeout );

return $typo;
}
}

/**
* Boxed layout background stylesheet
*
* @return string
*/
function wip_style_load_boxed_background() {
?>
body {
background-color: <?php echo get_option( WIP_THEME_SHORTNAME.'_boxed_bg_color', '#ffffff' ); ?>;
<?php if( get_option( WIP_THEME_SHORTNAME.'_boxed_bg_image' ) != "" ) { ?>
background-image: url(<?php echo wp_get_attachment_url( (int) get_option( WIP_THEME_SHORTNAME.'_boxed_bg_image' ) ); ?>);
background-position: <?php echo ( ( get_option( WIP_THEME_SHORTNAME.'_boxed_bg_fullscreen', "no" ) === "yes" ) ? 'center center' : get_option( WIP_THEME_SHORTNAME.'_boxed_bg_pos' ) ); ?>;
background-attachment: <?php echo get_option( WIP_THEME_SHORTNAME.'_boxed_bg_attachment' ); ?>;
background-repeat: <?php echo ( ( get_option( WIP_THEME_SHORTNAME.'_boxed_bg_fullscreen', "no" ) === "yes" ) ? 'no-repeat' : get_option( WIP_THEME_SHORTNAME.'_boxed_bg_repeat' ) ); ?>;
<?php if( get_option( WIP_THEME_SHORTNAME.'_boxed_bg_fullscreen', "no" ) === "yes" ) { ?>
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
<?php } ?>
<?php } ?>
}

<?php
}

function wip_style_load_custom_accent_color() {
$color = get_option( WIP_THEME_SHORTNAME.'_custom_color' );

ob_start();
?>


/*! ***********************************
----------- CUSTOM COLOR ------------
*********************************** !*/
a:hover{
color: <?php echo $color; ?>;
}
.button,
input[type="submit"],
.module-calltoact a.calltoaction-button{
background-color: <?php echo $color; ?>;
}
.blank-button:hover,
.nav-previous a:hover,
.nav-next a:hover{
background-color: transparent;
color: <?php echo $color; ?>;
}

/* `TOP SECTIONS
--------------------------------------------------------------------*/
#top-bar{
border-top: 3px solid <?php echo $color; ?>;
}

ul#top-menu>li>a:hover,
ul#top-menu>li.current-menu-item>a{
color: <?php echo $color; ?>;
}
ul#top-menu ul{
border-top: 1px solid <?php echo $color; ?>;
}
#top-bar.top-convert #regular-top-menu ul#top-menu li a:hover{
color: <?php echo $color; ?>
}

.top-cart-dropdowns-inner .button.checkout{
background-color: <?php echo $color; ?>;
border: 1px solid <?php echo $color; ?>;
color: #fff;
}
#shop-utility ul.user-auto-link>li>a:hover,
#shop-utility ul.user-auto-link>li>a:hover:after{
background-color: <?php echo $color; ?>;
color: #fff
}

/** menu */
#eqnav li a:hover,
#eqnav li:hover>a{
color: <?php echo $color; ?>;
}
#eqnav>li.has_ul>a:hover,
#eqnav>li.has_ul:hover>a{
color: <?php echo $color; ?>;
}
#eqnav>li.current-menu-item>a{
background-color: <?php echo $color; ?>;
color: #fff;
}
#eqnav>li.current-menu-item>a:before{
background-color: <?php echo $color; ?>
}
#eqnav>li.current-menu-item.has_ul:hover>a{
color: <?php echo $color; ?>
}
#eqnav li ul.standard-menu{
border-top: 2px solid <?php echo $color; ?>;
}
#eqnav ul.standard-menu ul.standard-menu{
border-left: 2px solid <?php echo $color; ?>;
}
#eqnav ul.standard-menu ul.standard-menu:before{
border-color: transparent <?php echo $color; ?> transparent transparent;
}

#eqnav ul.wip-mega-menu{
border-top: 2px solid <?php echo $color; ?>;
}
#eqnav ul.wip-mega-menu li.li-mega-menu .mega-col-slide .swipper-paginate-megamenu-arrows{
background-color: <?php echo $color; ?>;
color: #fff;
}

#menu.mobile-menu-ready #off-canvas-menu-trigger:hover{
color: <?php echo $color; ?>;
}
#menu.mobile-menu-ready #eqnav>li.current-menu-item>a,
#menu.mobile-menu-ready #eqnav li ul.standard-menu li.current-menu-item>a,
#menu.mobile-menu-ready #eqnav>li.has_ul>a:hover,
#menu.mobile-menu-ready #eqnav>li.has_ul:hover>a,
#menu.mobile-menu-ready #eqnav li ul.standard-menu a:hover,
#menu.mobile-menu-ready #eqnav li ul.standard-menu li:hover>a{
color: <?php echo $color; ?>;
}

.top-search-wrap #top-search-handle{
color: <?php echo $color; ?>;
}


/* `PROJECT / PORTFOLIO
--------------------------------------------------------------------*/
.project-columns:hover,
#eqnav ul.wip-mega-menu .mega-section .project-columns:hover{
border-color: <?php echo $color; ?>;
}
.wrap-gallery a.portfolio-gallery-arrows:hover{
background-color: <?php echo $color; ?>
}



/* `BLOG
--------------------------------------------------------------------*/
article.blog-default .article-meta .article-post-format-icon{
background-color: <?php echo $color; ?>;
}
article.blog-column .article-meta-column a:hover{
color: <?php echo $color; ?>
}
.blog-gallery .blog-swiper-arrow:hover,
.image-slider .swiper-arrow:hover{
background-color: <?php echo $color; ?>
}


/* `SIDEBAR
--------------------------------------------------------------------*/
[class*="sidebarbox widget_"] ul li.current-menu-item:after,
[class*="sidebarbox widget_"] ul li.current-cat:after{
background-color: <?php echo $color; ?>
}
[class*="sidebarbox widget_"] ul li.current-menu-item>a,
[class*="sidebarbox widget_"] ul li.current-cat>a{
color: <?php echo $color; ?>;
}
ul.product_list_widget li .quantity .amount{
background-color: <?php echo $color; ?>;
color: #fff
}
ul.product_list_widget li>.amount,
ul.product_list_widget li ins .amount{
background-color: <?php echo $color; ?>;
color: #fff
}
.widget_tag_cloud .tagcloud a:hover{
color: <?php echo $color; ?>;
}



/* `video && audio skin
--------------------------------------------------------------------*/
#site .mejs-controls .mejs-time-rail .mejs-time-current,
#site .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
background: <?php echo $color; ?>;
}
#site .mejs-controls .mejs-button:hover:before{
color: <?php echo $color; ?>;
}


.swipper-paginate-arrows:hover{
color: <?php echo $color; ?>;
}
.pricetable .pricetable-featured .pricetable-header{
background-color: <?php echo $color; ?>;
}
.pricetable .pricetable-featured .pricetable-header h5{
color: #fff;
}
.pricetable .pricetable-column.pricetable-featured .pricetable-button-container a{
background-color: <?php echo $color; ?>;
border: 1px solid rgba(0,0,0, .2);
color: #fff;
}


/* `WOOCOMMERCE
--------------------------------------------------------------------*/
.products .product:hover{
border-color: <?php echo $color; ?>
}
.products .product .onsale,
.single-product .first-duty>.product.hentry>.onsale{
background-color: <?php echo $color; ?>;
color: #fff
}
.products .product .onsale:before,
.single-product .first-duty>.product.hentry>.onsale:before{
border-color: <?php echo $color; ?> transparent transparent transparent;
}
.products .product .onsale:after,
.single-product .first-duty>.product.hentry>.onsale:after{
border-color: transparent transparent transparent <?php echo $color; ?>;
}
.products .product span.price>ins .amount,
.products .product span.price>.amount{
color: <?php echo $color; ?>;
border: 1px solid <?php echo $color; ?>;
}
.products .product .button:hover,
.products .product .added_to_cart,
.products .product .added_to_cart:hover,
#eqnav ul.wip-mega-menu li.li-mega-menu .mega-section .product .button:hover,
#eqnav ul.wip-mega-menu li.li-mega-menu .mega-section .product .added_to_cart,
#eqnav ul.wip-mega-menu li.li-mega-menu .mega-section .product .added_to_cart:hover{
background-color: <?php echo $color; ?>;
border: 1px solid <?php echo $color; ?>;
color: #fff;
}
.mega-section .products .product>.star-rating span:before,
.woocommerce .products .product>.star-rating span:before,
.woocommerce-page .products .product>.star-rating span:before{
color: <?php echo $color; ?>;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce-page nav.woocommerce-pagination ul li a,
.woocommerce #content nav.woocommerce-pagination ul li a,
.woocommerce-page #content nav.woocommerce-pagination ul li a{
color: <?php echo $color; ?>;
}
.woocommerce nav.woocommerce-pagination ul li a:hover,
.woocommerce-page nav.woocommerce-pagination ul li a:hover,
.woocommerce #content nav.woocommerce-pagination ul li a:hover,
.woocommerce-page #content nav.woocommerce-pagination ul li a:hover,
.woocommerce nav.woocommerce-pagination ul li a:focus,
.woocommerce-page nav.woocommerce-pagination ul li a:focus,
.woocommerce #content nav.woocommerce-pagination ul li a:focus,
.woocommerce-page #content nav.woocommerce-pagination ul li a:focus{
background-color: <?php echo $color; ?>;
color: #fff;
}

.woocommerce .star-rating span:before,
.woocommerce-page .star-rating span:before{
color: <?php echo $color; ?>;
}

.wokeystore_cart .remove:hover{
background-color: <?php echo $color; ?>;
color: #fff;
}

.single-product .product .summary div[itemprop="offers"]>p.price>.amount,
.single-product .product .summary div[itemprop="offers"]>p.price ins>.amount,
.single_variation_wrap .single_variation span.price>.amount,
.single_variation_wrap .single_variation span.price ins>.amount{
color: <?php echo $color; ?>
}
.woocommerce .widget_price_filter .ui-slider .ui-slider-range,
.woocommerce-page .widget_price_filter .ui-slider .ui-slider-range,
#top-search-drop .wip_price_slider_wrapper .ui-slider-horizontal .ui-slider-range {
background: <?php echo $color; ?>;
}

<?php
$custom_color = ob_get_clean();
$timeout = 31536000;
set_site_transient( 'wip_wokeystore_style_color', $custom_color, $timeout );

return $custom_color;
}