<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Astronomy Store
 */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>

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

<?php if ( function_exists( 'wp_body_open' ) ) {
  wp_body_open();
} else {
  do_action( 'wp_body_open' );
} ?>

<?php if ( get_theme_mod('astronomy_store_preloader', false) != "") { ?>
  <div id="preloader">
    <div id="status">&nbsp;</div>
  </div>
<?php }?>

<a class="screen-reader-text skip-link" href="#content"><?php esc_html_e( 'Skip to content', 'astronomy-store' ); ?></a>

<div id="pageholder" <?php if( get_theme_mod( 'astronomy_store_box_layout', false) != "" ) { echo 'class="boxlayout"'; } ?>>

<header id="header" class="w-100 left-0">
  <div class="header-top">
    <div class="container">
      <div class="row">
        <div class="col-lg-3 col-md-3 align-self-center">
          <?php $blog_info = get_bloginfo( 'name' ); ?>
            <?php if ( ! empty( $blog_info ) ) : ?>
              <?php $astronomy_store_description = get_bloginfo( 'description', 'display' );
                if ( $astronomy_store_description || is_customize_preview() ) : ?>
                <?php if ( get_theme_mod('astronomy_store_tagline_enable',false) != "") { ?>
                <p class="site-tagline my-2"><?php echo esc_html( $astronomy_store_description ); ?></p>
                <?php } ?>
            <?php endif; ?>
          <?php endif; ?>
        </div>
        <div class="col-lg-9 col-md-9 menubox align-self-center">
          <div class="w-auto gap-3 social-icon my-2">
            <?php if ( get_theme_mod('astronomy_store_fb_link') != "") { ?>
              <a title="<?php echo esc_attr('facebook', 'astronomy-store'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('astronomy_store_fb_link')); ?>" class="text-decoration-none fs-5">
                <i class="fab fa-facebook" aria-hidden="true"></i>
              </a>
            <?php } ?>
            <?php if ( get_theme_mod('astronomy_store_twitt_link') != "") { ?>
              <a title="<?php echo esc_attr('twitter', 'astronomy-store'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('astronomy_store_twitt_link')); ?>" class="text-decoration-none fs-5">
                <i class="fab fa-twitter" aria-hidden="true"></i>
              </a>
            <?php } ?>
            <?php if ( get_theme_mod('astronomy_store_pinterst_link') != "") { ?>
              <a title="<?php echo esc_attr('Pinterest', 'astronomy-store'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('astronomy_store_pinterst_link')); ?>" class="text-decoration-none fs-5">
                <i class="fab fa-pinterest" aria-hidden="true"></i>
              </a>
            <?php } ?>
            <?php if ( get_theme_mod('astronomy_store_insta_link') != "") { ?>
              <a title="<?php echo esc_attr('instagram', 'astronomy-store'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('astronomy_store_insta_link')); ?>" class="text-decoration-none fs-5">
                <i class="fab fa-instagram" aria-hidden="true"></i>
              </a>
            <?php } ?>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="bg-inner">
    <div class="container">
      <div class="<?php echo esc_attr(astronomy_store_sticky_menu()); ?>">
        <div class="row">
          <div class="col-lg-3 col-md-5 align-self-center">
            <div class="astronomy-store-logo">
              <?php if (get_theme_mod('astronomy_store_logo_enable', true)) { ?>
                <?php astronomy_store_the_custom_logo(); ?>
              <?php } ?>
              <?php $blog_info = get_bloginfo( 'name' ); ?>
              <?php if ( ! empty( $blog_info ) ) : ?>
                <?php if ( get_theme_mod('astronomy_store_title_enable',false) != "") { ?>
                  <?php if ( is_front_page() && is_home() ) : ?>
                    <h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></h1>
                  <?php else : ?>
                    <p class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></p>
                  <?php endif; ?>
                <?php } ?>
              <?php endif; ?>
              
            </div>
          </div>
          <div class="col-lg-9 col-md-7 menubox align-self-center">
            <div class="toggle-nav text-center text-md-end py-2 my-2 align-self-center">
              <button role="tab"><?php esc_html_e('MENU','astronomy-store'); ?></button>
            </div>
            <div id="mySidenav" class="nav sidenav text-end">
              <nav id="site-navigation" class="main-nav" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu','astronomy-store' ); ?>">
                <ul class="mobile_nav">
                  <?php
                    wp_nav_menu( array( 
                      'theme_location' => 'primary',
                      'container_class' => 'main-menu' ,
                      'items_wrap' => '%3$s',
                      'fallback_cb' => 'wp_page_menu',
                    ) ); 
                  ?>
                </ul>
                <a href="javascript:void(0)" class="close-button"><?php esc_html_e('CLOSE','astronomy-store'); ?></a>
              </nav>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</header>
