<?php
/**
 * @package Mobile Accessories Shop
 * Setup the WordPress core custom header feature.
 *
 * @uses mobile_accessories_shop_header_style()
 */
function mobile_accessories_shop_custom_header_setup() {
	add_theme_support( 'custom-header', apply_filters( 'mobile_accessories_shop_custom_header_args', array(
		'default-text-color'     => 'fff',
		'width'                  => 2500,
		'height'                 => 300,
		'wp-head-callback'       => 'mobile_accessories_shop_header_style',
	) ) );
}
add_action( 'after_setup_theme', 'mobile_accessories_shop_custom_header_setup' );

if ( ! function_exists( 'mobile_accessories_shop_header_style' ) ) :
/**
 * Styles the header image and text displayed on the blog
 *
 * @see mobile_accessories_shop_custom_header_setup().
 */
function mobile_accessories_shop_header_style() {
    $mobile_accessories_shop_header_image = get_header_image() ?: get_template_directory_uri() . '/images/headerimg.png';

    $mobile_accessories_shop_custom_css = "
        .box-image .single-page-img {
            background-image: url('{$mobile_accessories_shop_header_image}');
            background-repeat: no-repeat;
            background-position: center bottom;
            background-size: cover !important;
            height: 300px;
        }

        h1.site-title a, p.site-title a {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_sitetitle_color')) . " !important;
        }

        .site-description {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_sitetagline_color')) . " !important;
        }

        .main-nav ul li a {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_menu_color')) . " !important;
        }

        .main-nav a:hover {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_menuhrv_color')) . " !important;
        }

        .main-nav ul ul a {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_submenu_color')) . " !important;
        }

        .main-nav ul ul a:hover {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_submenuhrv_color')) . " !important;
        }

        .copywrap, .copywrap a {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_footercoypright_color')) . " !important;
        }

        #footer h3 {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_footertitle_color')) . " !important;
        }

        #footer p {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_footerdescription_color')) . ";
        }

        #footer ul li a {
            color: " . esc_attr(get_theme_mod('mobile_accessories_shop_footerlist_color')) . ";
        }

        #footer {
            background-color: " . esc_attr(get_theme_mod('mobile_accessories_shop_footerbg_color')) . ";
        }
    ";

    // Attach to your main stylesheet (make sure this handle matches the one you registered)
    wp_add_inline_style('mobile-accessories-shop-style', $mobile_accessories_shop_custom_css);
}
endif;
add_action('wp_enqueue_scripts', 'mobile_accessories_shop_header_style');