<?php
/**
 * The Header for our theme.
 * Displays all of the <head> section and everything up till <div id="wrap">
 *
 * @package Organic Startup
 * @since Organic Startup 1.0
 */

?><!DOCTYPE html>

<html class="no-js" <?php language_attributes(); ?>>

<head>

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

	<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>

<?php wp_body_open(); ?>

<!-- BEGIN #wrapper -->
<div id="wrapper">

	<!-- BEGIN #header -->
	<header id="header">

		<!-- BEGIN #nav-bar -->
		<div id="nav-bar">

			<!-- BEGIN .flex-row -->
			<div class="flex-row">

			<?php if ( has_custom_logo() || '1' == get_theme_mod( 'organic_startup_site_title', '1' ) ) { ?>

				<!-- BEGIN .site-logo -->
				<div class="site-logo">

					<?php if ( has_custom_logo() && get_theme_mod( 'organic_startup_logo_dark' ) ) { ?>
						<?php the_custom_logo(); ?>
						<a class="custom-logo-link dark-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
							<img class="custom-logo" src="<?php echo esc_url( get_theme_mod( 'organic_startup_logo_dark' ) ); ?>" alt="<?php esc_html_e( 'Logo', 'organic-startup' ); ?>" />
						</a>
					<?php } elseif ( ! has_custom_logo() && get_theme_mod( 'organic_startup_logo_dark' ) ) { ?>
						<a class="custom-logo-link dark-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
							<img class="custom-logo" src="<?php echo esc_url( get_theme_mod( 'organic_startup_logo_dark' ) ); ?>" alt="<?php esc_html_e( 'Logo', 'organic-startup' ); ?>" />
						</a>
					<?php } else { ?>
						<?php the_custom_logo(); ?>
					<?php } ?>

					<?php if ( is_front_page() && is_home() || is_front_page() ) { ?>
						<h1 class="site-title">
							<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo wp_kses_post( get_bloginfo( 'name' ) ); ?></a>
						</h1>
					<?php } else { ?>
						<h6 class="site-title">
							<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo wp_kses_post( get_bloginfo( 'name' ) ); ?></a>
						</h6>
					<?php } ?>

				<!-- END .site-logo -->
				</div>

			<?php } ?>

			<?php if ( has_nav_menu( 'main-menu' ) ) { ?>

				<!-- BEGIN .site-nav -->
				<div class="site-nav">

				<?php if ( has_nav_menu( 'top-menu' ) ) { ?>

				<nav id="nav-top" role="navigation" aria-label="<?php esc_attr_e( 'Top Navigation', 'organic-startup' ); ?>">

					<?php
						wp_nav_menu( array(
							'theme_location'  => 'top-menu',
							'title_li'        => '',
							'depth'           => 1,
							'fallback_cb'     => 'wp_page_menu',
							'container_class' => 'top-menu',
							'menu_class'      => 'menu',
							'link_before'     => '<span>',
							'link_after'      => '</span>',
						) );
					?>

				</nav>

				<?php } ?>

				<?php if ( wp_is_mobile() && has_nav_menu( 'mobile-menu' ) ) { ?>

					<!-- BEGIN #navigation -->
					<nav id="navigation" class="navigation-main" role="navigation" aria-label="<?php esc_attr_e( 'Primary Navigation', 'organic-origin' ); ?>">

						<?php
							wp_nav_menu(
								array(
									'theme_location' => 'mobile-menu',
									'title_li'       => '',
									'depth'          => 4,
									'fallback_cb'    => 'wp_page_menu',
									'container'      => false,
									'menu_class'     => 'menu',
									'walker'         => new Aria_Walker_Nav_Menu(),
									'items_wrap'     => '<ul id="%1$s" class="%2$s" role="menubar">%3$s</ul>',
									'link_before'    => '<span role="menuitem">',
									'link_after'     => '</span>',
								)
							);
						?>

						<?php
						if ( function_exists( 'organic_startup_woocommerce_header_cart' ) ) {
							organic_startup_woocommerce_header_cart();
						}
						?>

					<!-- END #navigation -->
					</nav>

				<?php } elseif ( has_nav_menu( 'main-menu' ) ) { ?>

				<!-- BEGIN #navigation -->
				<nav id="navigation" class="navigation-main" role="navigation" aria-label="<?php esc_attr_e( 'Primary Navigation', 'organic-startup' ); ?>">

					<?php
						wp_nav_menu( array(
							'theme_location' => 'main-menu',
							'title_li'       => '',
							'depth'          => 4,
							'fallback_cb'    => 'wp_page_menu',
							'container'      => false,
							'menu_class'     => 'menu',
							'walker'         => new Aria_Walker_Nav_Menu(),
							'items_wrap'     => '<ul id="%1$s" class="%2$s" role="menubar">%3$s</ul>',
							'link_before'    => '<span>',
							'link_after'     => '</span>',
						) );
					?>

					<?php
					if ( function_exists( 'organic_startup_woocommerce_header_cart' ) ) {
						organic_startup_woocommerce_header_cart();
					}
					?>

				<!-- END #navigation -->
				</nav>

				<?php } ?>

				<a id="menu-toggle" class="menu-toggle" href="#sidr">
					<svg class="icon-menu-open" version="1.1" id="icon-open" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
						width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
						<rect y="2" width="24" height="2"/>
						<rect y="11" width="24" height="2"/>
						<rect y="20" width="24" height="2"/>
					</svg>
					<svg class="icon-menu-close" version="1.1" id="icon-close" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
						<rect x="0" y="11" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 12 28.9706)" width="24" height="2"/>
						<rect x="0" y="11" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 28.9706 12)" width="24" height="2"/>
					</svg>
				</a>

				<!-- END .site-nav -->
				</div>

			<?php } ?>

			<!-- END .flex-row -->
			</div>

		<!-- END #nav-bar -->
		</div>

	<!-- END #header -->
	</header>
		<div class="banner">
			<?php echo do_shortcode('[smartslider3 slider="2"]'); ?> 
		</div>
	<!-- BEGIN #body -->
	<main id="body" class="container">

		<?php if ( is_home() || is_archive() || is_search() || is_attachment() ) { ?>

		<!-- BEGIN #custom-header -->
		<div id="custom-header">

			<!-- BEGIN .row -->
			<div class="row">

				<div id="masthead" class="absolute-center">

					<?php if ( is_front_page() && is_home() || is_front_page() ) { ?>
						<h2 class="site-description"><?php echo wp_kses_post( get_bloginfo( 'description' ) ); ?></h2>
					<?php } elseif ( class_exists( 'Woocommerce' ) && is_shop() ) { ?>
						<h2 class="site-description"><?php woocommerce_page_title(); ?></h2>
						<?php $page_id = get_option( 'woocommerce_shop_page_id' ); ?>
						<?php $excerpt = apply_filters( 'the_excerpt', get_post_field( 'post_excerpt', $page_id ) ); ?>
						<?php if ( ! empty( $excerpt ) ) { ?>
							<div class="archive-description"><?php echo wp_kses_post( $excerpt ); ?></div>
						<?php } ?>
					<?php } elseif ( class_exists( 'Woocommerce' ) && is_product_category() ) { ?>
						<h2 class="site-description"><?php single_term_title(); ?></h2>
						<div class="archive-description"><?php the_archive_description(); ?></div>
					<?php } elseif ( is_archive() || is_category() || is_search() ) { ?>
						<h2 class="site-description"><?php the_archive_title(); ?></h2>
						<div class="archive-description"><?php the_archive_description(); ?></div>
					<?php } else { ?>
						<h6 class="site-description"><?php echo wp_kses_post( get_bloginfo( 'description' ) ); ?></h6>
					<?php } ?>

				</div>

				<?php the_custom_header_markup(); ?>

			<!-- END .row -->
			</div>

		<!-- END #custom-header -->
		</div>

		<?php } ?>
