<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package prato_store
 */

$prato_store_options = prato_store_theme_options();
$site_title_show = $prato_store_options['site_title_show'];
$add_to_cart = $prato_store_options['add_to_cart'];
$header_hover = $prato_store_options['header_hover'];

?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="https://gmpg.org/xfn/11">

	<?php wp_head(); ?>
</head>


<body <?php body_class(); ?>>
<?php if(get_option('prato-store_free_back_top_top_enable') && get_option('prato-store_free_back_top_top_enable') == "on" ){ ?>
<!-- Back to top -->
<div id="back-to-top" title="Go to top">
  <i class="fa fa-arrow-up" aria-hidden="true"></i>
</div>
<?php }?>

<?php wp_body_open(); ?>
<div id="page" class="site">
	<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'prato-store' ); ?></a>

	<?php if($add_to_cart=="belowprice"){ ?>
	<div class="main-wrap <?php esc_html_e(' belowprice ', 'prato-store') ?>">
<?php }
else{ ?>

<div class="main-wrap over-img">
<?php } ?>


<?php if($header_hover){ ?>

<header id="masthead" class="site-header no-hover">

<?php }
else{ ?>
<header id="masthead" class="site-header">

<?php } ?>

		<div class="container-fluid">
             <div class="row">
				<div class="site-branding">
					<?php
					the_custom_logo(); 

					if($site_title_show == 1) { ?>
					<div class="logo-wrap">

					<?php

					if ( is_front_page() && is_home() ) :
						?>
						<h2 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
						<?php
					else :
						?>
						<h2 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
						<?php
					endif;
					$prato_store_description = get_bloginfo( 'description', 'display' );
					if ( $prato_store_description || is_customize_preview() ) :
						?>
						<p class="site-description"><?php echo $prato_store_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
					<?php endif; ?>
					</div>
				<?php } ?>



					
	              

			
				</div><!-- .site-branding -->
				<div class="header-icons show-mobile">
				<?php if (class_exists('WooCommerce')) {
					?>		

						<span class="header-account">

								<a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>"  flow="down" tooltip="<?php esc_attr_e('My Account', 'prato-store'); ?>">
								<img class="user-white" src="<?php echo esc_url( get_template_directory_uri())?>/assets/img/user.png"><img class="user-dark" src="<?php echo esc_url( get_template_directory_uri()) ?>/assets/img/user-dark.png">
								</a>

						</span>

					<?php } 

					if (class_exists('WooCommerce')) {
					?>
					<div class="cart-tooltip" flow="down" tooltip="<?php echo esc_attr_e('Cart', 'prato-store') ;?> ">
					<span class="counter" id="cart-count"><?php
						global $woocommerce;
						$cart_url = wc_get_cart_url();
	
					$cart_count = WC()->cart->get_cart_contents_count();
					echo '<span class="header-cart-icon"><a  href="'. esc_url($cart_url) .'"><img class="cart-white" src="'. get_template_directory_uri() .'/assets/img/cart-white.png"><img class="cart-dark" src="'. get_template_directory_uri() .'/assets/img/cart.png"><span class="cart-count">' . $cart_count . '</span></a></span>';
					?></span>
					</div>
					<?php } ?>
				</div>

            <!-- Collect the nav links, forms, and other content for toggling -->
			<?php if (class_exists('WooCommerce')) { ?>
			<div id="mobile-menu-wrap">

			<?php } 
			else{ ?>
				<div id="mobile-menu-wrap" class="no-woo">
			<?php } ?>
				
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
	                        data-target="#navbar-collapse" aria-expanded="false">
	                    <span class="sr-only"><?php echo esc_html__('Toggle navigation','prato-store'); ?></span>
	                    <span class="icon-bar"></span>
	                    <span class="icon-bar"></span>
	                    <span class="icon-bar"></span>
	                </button>
	            <div class="collapse navbar-collapse" id="navbar-collapse">

	             <?php
	                if (has_nav_menu('primary')) { ?>
	                <?php
	                    wp_nav_menu(array(
	                        'theme_location' => 'primary',
	                        'container' => '',
	                        'menu_class' => 'nav navbar-nav navbar-right',
	                        'menu_id' => 'menu-main',
	                        'walker' => new prato_store_nav_walker(),
	                        'fallback_cb' => 'prato_store_nav_walker::fallback',
	                    ));

	                    ?>

	                <?php } else { ?>
	                    <nav id="site-navigation" class="main-navigation clearfix">
	                        <?php   wp_page_menu(array('menu_class' => 'menu','menu_id' => 'menu-main')); ?>
	                    </nav>
	                <?php } ?>

	            </div><!-- End navbar-collapse -->
					</div>		
				<div class="header-icons hide-mobile">
				<?php if (class_exists('WooCommerce')) {
					?>		

						<span class="header-account">

								<a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>"  flow="down" tooltip="<?php esc_attr_e('My Account', 'prato-store'); ?>">
								<img class="user-white" src="<?php echo esc_url( get_template_directory_uri())?>/assets/img/user.png"><img class="user-dark" src="<?php echo esc_url( get_template_directory_uri()) ?>/assets/img/user-dark.png">
								</a>

						</span>

					<?php } 

					if (class_exists('WooCommerce')) {
					?>
					<div class="cart-tooltip" flow="down" tooltip="<?php echo esc_attr_e('Cart', 'prato-store') ;?> ">
					<span class="counter" id="cart-count"><?php
						global $woocommerce;
						$cart_url = wc_get_cart_url();
	
					$cart_count = WC()->cart->get_cart_contents_count();
					echo '<span class="header-cart-icon main-cart-icon"><a  href="'. esc_url($cart_url) .'"><img class="cart-white" src="'. get_template_directory_uri() .'/assets/img/cart-white.png"><img class="cart-dark" src="'. get_template_directory_uri() .'/assets/img/cart.png"><span class="cart-count">' . $cart_count . '</span></a></span>';
					?></span>
					</div>
					<?php } ?>
				</div>

	            
			</div>
		</div>
	</header><!-- #masthead -->
	<div class="breadcrumbs ">
			<div class="container">
                <?php if (function_exists('check_breadcrumb')) check_breadcrumb();   ?>
            </div>
		</div>
	<!-- /main-wrap -->

