<?php
/**
 * Soma: Dynamic CSS Stylesheet
 * 
 */

function somalite_dynamic_css_stylesheet() { 
    $body_font_size= absint(get_theme_mod( 'sm_body_font_size','14' ));

    $body_font_family=  esc_html(get_theme_mod( 'sm_body_font_family' ));
    $heading_font_family= esc_html(get_theme_mod( 'sm_heading_font_family' ));

    $headings_color= sanitize_hex_color(get_theme_mod( 'sm_headings_color','#dd3333' ));
    $headings_hover_color= sanitize_hex_color(get_theme_mod( 'sm_headings_hover_color','#dd3333' ));

    $h1_font_size= absint(get_theme_mod( 'sm_h1_font_size','45' ));
    $h2_font_size= absint(get_theme_mod( 'sm_h2_font_size','30' ));
    $h3_font_size= absint(get_theme_mod( 'sm_h3_font_size','25' ));
    $h4_font_size= absint(get_theme_mod( 'sm_h4_font_size','18' ));
    $h5_font_size= absint(get_theme_mod( 'sm_h5_font_size','16' ));
    $h6_font_size= absint(get_theme_mod( 'sm_h6_font_size','14' ));

    $page_heading_color= sanitize_hex_color(get_theme_mod( 'sm_page_heading_color','#ffffff' ));
    $link_color= sanitize_hex_color(get_theme_mod( 'sm_link_color','#b5b4b4' ));
    $link_hover_color= sanitize_hex_color(get_theme_mod( 'sm_link_hover_color','#dd3333' ));
    $cta_btn_hover_color= sanitize_hex_color(get_theme_mod( 'sm_cta_btn_hover_color','#dd3333' ));
    $footer_heading_color= sanitize_hex_color(get_theme_mod( 'sm_footer_heading_color','#ffffff' ));
    $footer_content_color= sanitize_hex_color(get_theme_mod( 'sm_footer_content_color','#ffffff' ));  
    $cta_content_color=sanitize_hex_color(get_theme_mod( 'sm_cta_content_color','#555555' ));

    //buttons
    $button_bg_color= sanitize_hex_color(get_theme_mod( 'sm_button_bg_color','#fff' ));
    $button_text_color= sanitize_hex_color(get_theme_mod( 'sm_button_text_color','#555' ));
    $button_border_color= sanitize_hex_color(get_theme_mod( 'sm_button_border_color','#dedede' ));

    $button_hover_bg_color= sanitize_hex_color(get_theme_mod( 'sm_button_hover_bg_color','#dd3333' ));
    $button_hover_text_color= sanitize_hex_color(get_theme_mod( 'sm_button_hover_text_color','#fff' ));
    $button_hover_border_color= sanitize_hex_color(get_theme_mod( 'sm_button_hover_border_color','#dd3333' ));



    $preloader_image=esc_url(get_theme_mod( 'sm_preloader_image' ));    


    $css = '


    html, body {        
        font-size: ' . $body_font_size . 'px;
        font-family: ' . $body_font_family . ';
    }

    h1,h2,h3,h4,h5,h6 {
        font-family: ' . $heading_font_family . ';   
        color: ' . $headings_color . '; 
    }

    h1:hover,h2:hover,h3:hover,h4:hover,h5:hover,h6:hover {
    	color: ' . $headings_hover_color . '; 
    }

    .blog-post .content h3 > a,
    aside h4 {
    	color: ' . $headings_color . '; 
    }

    .blog-post .content h3 > a:hover,
    aside h4:hover {
    	color: ' . $headings_hover_color . '; 
    }

    h1 {
        font-size: ' . $h1_font_size . 'px;
    }

    h2 {
        font-size: ' . $h2_font_size . 'px;
    }

    h3 {
        font-size: ' . $h3_font_size . 'px;
    }

    h4 {
        font-size: ' . $h4_font_size . 'px;
    }

    h5 {
        font-size: ' . $h5_font_size . 'px;
    }

    h6 {
        font-size: ' . $h6_font_size . 'px;
    }

    #page-title h1,
    #page-title p,
    .bread-crumb span {
        color: ' . $page_heading_color . ';    
    }

    .blog-links li a:hover {
    	color: ' . $link_hover_color . ';
    }

    #slider .promo-text h1,
    #slider .caption h1,
    .section-heading-testimonial h2,
    .client-image h6,    
    .heading-counters h2,
    .hovereffects h4 {
        color: #fff;   
    }

    .cta-section .heading h4,
    .cta-section p {
        color: ' . $cta_content_color . ';    
    }

    .cta-section .read-more a {
        color: ' . $cta_content_color . '; 
        border: 1px solid ' . $cta_content_color . ';           
    }

    a {
        color: ' . $link_color . ';  
    }

    .isotope #filter li.selected a, 
    .isotope #filter li a:hover {
        color: ' . $link_hover_color . ';  
    }

    a.wcmenucart-contents span.badge,
    .woocommerce span.onsale,
    .woocommerce .widget_price_filter .ui-slider .ui-slider-handle,
    .hvr-underline-from-left:before {
        background: ' . $link_hover_color . ';    
    }

    [class^=\'imghvr-\'] a:hover, 
    [class*=\' imghvr-\'] a:hover {
        color: #fff;      
    }

    #navigation .navbar-nav > .active > a {
        box-shadow: inset 0 -2px 0 ' . $link_hover_color . ';       
    }

    .navbar-inverse .navbar-nav>li>a:focus, 
    .navbar-inverse .navbar-nav>li>a:hover {
        color: ' . $link_hover_color . ';     
    }

    .navbar-inverse .navbar-nav > .open > a,
    .navbar-inverse .navbar-nav > .open > a:hover, 
    .navbar-inverse .navbar-nav > .open > a:focus {
        color: ' . $link_hover_color . ';        
    }

    .woocommerce span.onsale,
    .woocommerce .widget_price_filter .ui-slider .ui-slider-handle {
        background: ' . $link_hover_color . ';          
    }

    .hvr-underline-from-left:before {
        background: ' . $link_hover_color . ' ;       
    }

    .teaminfo h5,.teaminfo h6 {
        color: #555;   
    }

    [class^=\'imghvr-shutter-in-\']:after, 
    [class^=\'imghvr-shutter-in-\']:before, 
    [class*=\'imghvr-shutter-in-\']:after, 
    [class*=\'imghvr-shutter-in-\']:before {
        background-color: ' . $link_hover_color . '; 
    }

    
    .contact-form form input[type=submit],
    #commentform input[type=submit], 
    .wpcf7 form input[type=submit],
    .blog-post .read-more a,
    .cta-section .read-more a,
    .wp-block-woocommerce-cart .wc-block-cart__submit-button,
    .wp-block-woocommerce-checkout .wc-block-components-checkout-place-order-button,
    .woocommerce a.button, 
    .woocommerce input.button,
    .blog .read-more a,
    .woocommerce #review_form #respond .form-submit input,
    .woocommerce .widget_price_filter .price_slider_amount .button,
    .woocommerce ul.products li.product .button,
    .woocommerce .cart .button, 
    .woocommerce .cart input.button,
    .woocommerce div.product form.cart .button,
    .wc-proceed-to-checkout a,
    .woocommerce button.button {
        color: ' . $button_text_color . '; 
        background: ' . $button_bg_color . '; 
        border: 1px solid ' . $button_border_color . ';
    }

    
    .contact-form form input[type=submit]:hover, 
    #commentform input[type=submit]:hover,
    .wpcf7 form input[type=submit]:hover,
    .blog-post .read-more a:hover,
    .cta-section .read-more a:hover,
    .wp-block-woocommerce-cart .wc-block-cart__submit-button:hover,
    .wp-block-woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
    .woocommerce a.button:hover, 
    .woocommerce input.button:hover,
    .blog .read-more a:hover,
    .woocommerce #review_form #respond .form-submit input:hover,
    .woocommerce .widget_price_filter .price_slider_amount .button:hover,
    .woocommerce ul.products li.product .button:hover,
    .woocommerce .cart .button:hover, 
    .woocommerce .cart input.button:hover,
    .woocommerce div.product form.cart .button:hover,
    .wc-proceed-to-checkout a:hover,
    .woocommerce button.button:hover {
       	background: ' . $button_hover_bg_color . '; 
        border: 1px solid ' . $button_hover_border_color . ';
        color: ' . $button_hover_text_color . ';  
    }

    .woocommerce ul.products li.product .button:hover {
        background: ' . $button_hover_bg_color . '; 
        border: 1px solid ' . $button_hover_border_color . ';
        color: ' . $button_hover_text_color . ';
    }

    html input[type=button]:hover, 
    input[type=reset]:hover, 
    input[type=submit]:hover,
    .btn-default:hover,
    #commentform input[type=submit]:hover,
    .woocommerce #respond input#submit.alt:hover, 
    .woocommerce a.button.alt:hover, 
    .woocommerce button.button.alt:hover, 
    .woocommerce input.button.alt:hover,
    .contact-form form input[type=submit]:hover,
    .woocommerce .widget_price_filter .price_slider_amount .button:hover {
        background: ' . $button_hover_bg_color . '; 
        border: 1px solid ' . $button_hover_border_color . ';
        color: ' . $button_hover_text_color . '; 
    }

    html input[type=button], 
    input[type=reset], 
    input[type=submit] {
        color: ' . $button_text_color . '; 
        background: ' . $button_bg_color . '; 
        border: 1px solid ' . $button_border_color . '; 
    }

    .pagination a.page-numbers {
        color: ' . $link_color . ';     
    }

    .pagination span.current,
    .pagination a.page-numbers:hover {
        background: ' . $link_hover_color . '; 
        border: 1px solid ' . $link_hover_color . '; 
    }

    .pagination a.next:hover, 
    .pagination a.prev:hover {
        color: ' . $link_hover_color . ';  
        background: none;
        border: 0;             
    }

    .woocommerce p.stars a {
        color: #fdb341;
    }

    .woocommerce div.product .woocommerce-tabs ul.tabs li.active {
        border-bottom: 3px solid ' . $link_hover_color . ';
    }

    .woocommerce div.product h1,
    .woocommerce ul.products li.product h2 {
        color: #555;
    }

    .woocommerce nav.woocommerce-pagination ul li a:focus, 
    .woocommerce nav.woocommerce-pagination ul li a:hover, 
    .woocommerce nav.woocommerce-pagination ul li span.current {
        background: ' . $link_hover_color . ';
        color: #fff;
    }

    .woocommerce-tabs #tab-description h2,
    .woocommerce #reviews #comments h2,
    .woocommerce-Tabs-panel--additional_information h2 {
        color: #555;
        font-size: 20px;    
    }

    .cta-section .read-more a:hover {
        background: ' . $cta_btn_hover_color . '; 
        border: 1px solid ' . $cta_btn_hover_color . ';
    }

    .bread-crumb a:hover {
        color: #fff;   
    }

    a:hover {
       color: ' . $link_hover_color . ';
    }

    footer a.post-edit-link {
        color: #555;
        padding: 0 10px;
    }

    footer .social-icons i:hover {
        color: #fff;   
    }

    footer h4 {
        color: ' . $footer_heading_color . ';
    }

    #soma-footer-section,
    footer .social-icons i,
    footer a {
        color: ' . $footer_content_color . ';
    }

';

if("" != esc_url(get_theme_mod( 'sm_preloader_image' ))) {
    $css .='        
        #pre-loader {
            background: url(' . $preloader_image . ') no-repeat;
        }
    ';  
}

// check if site title tagline disble
if(false===get_theme_mod( 'soma_display_site_title_tagline',true)) :
    $css .='
         h1.site-title,
         p.site-description {
            display: none;
        }
    ';
endif;

if(false===get_theme_mod( 'sm_sticky_menu',false )) {
    $css .='        
        .scroll-fix { 
            position: inherit;
            top:0;
            border:0;
        }

        #slider .inner-overlay {
            margin-top:0px;
        }
    ';  
}

if('center'===esc_html(get_theme_mod( 'sm_addcart_styles','center' ))) {
    $css .='        
        .woocommerce ul.products li.product .price {
            float: none;
            text-align: center;
        }
            
        .woocommerce-page.columns-3 ul.products li.product, 
        .woocommerce.columns-3 ul.products li.product,
        .woocommerce ul.products li.product, 
        .woocommerce-page ul.products li.product {
            text-align:center;
            
        }
    ';  
}
else{
    $css .='        
        .woocommerce ul.products li.product .price {
            float: right;
        }
    ';      
}

return apply_filters( 'somalite_dynamic_css_stylesheet', somalite_minimize_css($css));
}


?>