<?php

/*************************************************************************************************************************
 * Enqueue all CSS and JS
 ************************************************************************************************************************/

if ( ! function_exists( 'prime_business_enqueue_cs_js' ) ) :

function prime_business_enqueue_cs_js() {

    $prime_business_primary_color       = esc_attr( get_theme_mod( 'prime_business_primary_color_setting', '#43c6ac' ) );
    $prime_business_secondary_color     = esc_attr( get_theme_mod( 'prime_business_secondary_color_setting', '#43c6ac' ) );
    $prime_business_intro_bg_color      = esc_attr( get_theme_mod( 'prime_business_introduction_background_color_setting', '#fff' ) );
    $prime_business_services_bg_color   = esc_attr( get_theme_mod( 'prime_business_services_background_color_setting', '#fff' ) );
    $prime_business_member_bg_color   = esc_attr( get_theme_mod( 'prime_business_team_member_background_color_setting', '#fff' ) );
    $prime_business_feature_bg_color   = esc_attr( get_theme_mod( 'prime_business_feature_background_color_setting', '#fff' ) );

    $prime_business_custom_css     = "
    h4,
    .long-blurb .long-blurb-title,
    .main-nav li a:hover,
    a,
    a:hover,
    .post-details a:hover,
    .next-post-wrap a:hover,
    .previous-post-wrap a:hover,
    .next-post-wrap::before,
    .previous-post-wrap::before,
    .skip-link,
    .slider-button-1,
    .slider-button-2:hover {
        color: {$prime_business_primary_color};
    }

    .sticky {
        border: 1px solid {$prime_business_primary_color};
    }

    .ct-footer a:hover,
    .ct-footer-credits a {
        color: {$prime_business_secondary_color};
    }

    .underline,
    .ct-color-mask,
    .top-bar,
    .read-more,
    .site-header .main-nav .menu-button a {
        background-color: {$prime_business_primary_color};
    }

    .read-more {
        border: 2px solid {$prime_business_primary_color};
    }

    .menu-item::after,
    .excerpt-author::after,
    .excerpt-category::after,
    .single .post-date::after,
    .edit-link::before,
    .post-loop .post-date span::after,
    .ct-footer {
        border-top: 0.3rem solid {$prime_business_primary_color};
    }

    input:hover,
    input[type=\"text\"]:hover,
    input[type=\"email\"]:hover,
    input[type=\"url\"]:hover,
    textarea:hover,
    .form-submit #submit,
    .post-wrap {
        border-bottom-color: {$prime_business_primary_color};
    }

    .fa-gradient::before {
        background: -webkit-linear-gradient(left, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 70%);
        background: -moz-linear-gradient(45deg, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 70%);
        background: -ms-linear-gradient(left, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 70%);
        background: -o-linear-gradient(left, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 70%);
        background: linear-gradient(left, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 70%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .ct-slick-slide .ct-color-mask {
        background: linear-gradient(45deg, {$prime_business_secondary_color} 0%, {$prime_business_primary_color} 100%);
    }

    /* Mozilla based browser */
    ::-moz-selection {
        background-color: {$prime_business_primary_color};
        color: #fff;
    }

    /* Opera browser */
    ::-o-selection {
        background-color: {$prime_business_primary_color};
        color: #fff;
    }

    /* Internet Explorer browser*/
    ::-ms-selection {
        background-color: {$prime_business_primary_color};
        color: #fff;
    }

    /* Chrome and safari browser */
    ::-webkit-selection {
        background-color: {$prime_business_primary_color};
        color: #fff;
    }

    /* Default */
    ::selection {
        background-color: {$prime_business_primary_color};
        color: #fff;
    }
    .ct-about-2-col {
        background-color: {$prime_business_intro_bg_color};
    }
    .ct-about,
    .ct-info-box {
        background-color: {$prime_business_services_bg_color};
    }
    .ct-team-members-section {
        background-color: {$prime_business_member_bg_color};
    }
    .ct-long-blurb {
        background-color: {$prime_business_feature_bg_color};
    }";

    wp_enqueue_style( 'prime-business-gfonts', prime_business_fonts_url(), array(), '1.0.0' );
    wp_enqueue_style( 'slick', get_template_directory_uri() . '/assets/css/slick.css', array(), '1.9.0', 'all' );
    wp_enqueue_style( 'slick-theme', get_template_directory_uri() . '/assets/css/slick-theme.css', array(), '1.9.0', 'all' );
    wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css', array(), '4.7.0', 'all' );
    wp_enqueue_style( 'normalize', get_template_directory_uri() . '/assets/css/normalize.css', array(), '3.0.2', 'all' );
    wp_enqueue_style( 'skeleton', get_template_directory_uri() . '/assets/css/skeleton.css', array(), '2.0.4', 'all' );
    wp_enqueue_style( 'prime-business-main-style', get_template_directory_uri() . '/assets/css/main.css', array(), '1.0.0', 'all' );
    wp_enqueue_style( 'prime-business-style-css', get_template_directory_uri() . '/style.css', array(), '1.0.0', 'all' );

    $prime_business_check_color = get_theme_mod( 'prime_business_primary_color_setting' );
    if ( !empty( $prime_business_check_color ) ) {
        wp_add_inline_style( 'prime-business-style-css', $prime_business_custom_css );
    }

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}

    wp_enqueue_script( 'jquery-slick', get_template_directory_uri() . '/assets/js/jquery-slick.js', array( 'jquery' ), '1.9.0', true );
    wp_enqueue_script( 'prime-business-jquery-custom', get_template_directory_uri() . '/assets/js/jquery-custom.js', array( 'jquery' ), '1.0.0', true );
}

endif;

add_action( 'wp_enqueue_scripts', 'prime_business_enqueue_cs_js' );

if ( ! function_exists( 'prime_business_admin_scripts' ) ) :
function prime_business_admin_scripts() {
    wp_enqueue_media();
    wp_enqueue_script( 'prime-business-jquery-admin-script', get_template_directory_uri() . '/assets/js/jquery-admin-script.js', array( 'jquery' ), '', true );
    wp_localize_script( 'prime-business-jquery-admin-script', 'ct_ajax_object',
        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
    );
}
endif;
add_action( 'admin_enqueue_scripts', 'prime_business_admin_scripts' );
add_action( 'customize_controls_enqueue_scripts', 'prime_business_admin_scripts' );
