<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Classic Fashion Blog
 */
?>
<!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('classic_fashion_blog_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', 'classic-fashion-blog' ); ?></a>

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

<div class="mainhead <?php if( get_theme_mod( 'classic_fashion_blog_sticky_header', false) == 1 ) { ?> header-sticky"<?php } else { ?>close-sticky <?php } ?>">
  <div class="top-image-sec py-2 ps-2">
    <div class="container">
      <div class="classic-fashion-blog-logo">
        <?php if (get_theme_mod('classic_fashion_blog_logo_enable', true)) { ?>
          <?php classic_fashion_blog_the_custom_logo(); ?>
        <?php } ?>
        <div class="site-branding-text">
          <?php if (get_theme_mod('classic_fashion_blog_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 $classic_fashion_blog_description = get_bloginfo('description', 'display');
          if ($classic_fashion_blog_description || is_customize_preview()) : ?>
            <?php if (get_theme_mod('classic_fashion_blog_tagline_enable', false)) { ?>
              <span class="site-description"><?php echo esc_html($classic_fashion_blog_description); ?></span>
            <?php } ?>
          <?php endif; ?>
        </div>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="menu-sec">
      <div class="row">
        <div class="col-xxl-1 col-xl-1 col-lg-1 col-md-2 col-sm-2 col-2 align-self-center text-start toggle-btn">
          <a href="#" id="sidebar-pop"><i class="fa-solid fa-bars-staggered"></i></a>
        </div>
        <div class="header-sidebar">
          <div class="close-pop"><a href="#maincontent"><i class="fa-solid fa-xmark"></i></a>
          </div>
          <div class="menu-drawer">
            <div class="classic-fashion-blog-logo">
              <?php if ( has_custom_logo() ) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
                  <?php endif; ?>
                  <?php $classic_fashion_blog_blog_info = get_bloginfo( 'name' ); ?>
                    <?php if ( ! empty( $classic_fashion_blog_blog_info ) ) : ?>
                      <?php if ( is_front_page() && is_home() ) : ?>
                        <?php if( get_theme_mod('classic_fashion_blog_logo_title_hide_show',true) == 1){ ?>
                          <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                        <?php } ?>
                      <?php else : ?>
                        <?php if( get_theme_mod('classic_fashion_blog_logo_title_hide_show',true) == 1){ ?>
                          <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                        <?php } ?>
                      <?php endif; ?>
                    <?php endif; ?>
                    <?php
                      $classic_fashion_blog_description = get_bloginfo( 'description', 'display' );
                      if ( $classic_fashion_blog_description || is_customize_preview() ) :
                    ?>
                    <?php if( get_theme_mod('classic_fashion_blog_tagline_hide_show',false) == 1){ ?>
                      <p class="site-description mb-0">
                        <?php echo esc_html($classic_fashion_blog_description); ?>
                      </p>
                    <?php } ?>
                <?php endif; ?>
            </div>
            <?php if (get_theme_mod('classic_fashion_blog_sidebar_text') != "") { ?>
              <p class="sidebar-text my-4 text-start"><?php echo esc_html(get_theme_mod('classic_fashion_blog_sidebar_text', 'classic-fashion-blog')); ?></p>
            <?php } ?>
            <div class="social-icons d-flex gap-2">
              <?php if ( get_theme_mod('classic_fashion_blog_facebook_link') != "") { ?>
                <a title="<?php echo esc_attr('facebook', 'classic-fashion-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_fashion_blog_facebook_link')); ?>"><i class="fa-brands fa-facebook-f"></i></a> 
              <?php } ?>
              <?php if ( get_theme_mod('classic_fashion_blog_twitter_link') != "") { ?> 
                <a title="<?php echo esc_attr('twitter', 'classic-fashion-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_fashion_blog_twitter_link')); ?>"><i class="fa-brands fa-x-twitter"></i></a>
              <?php } ?>
              <?php if ( get_theme_mod('classic_fashion_blog_instagram_link') != "") { ?> 
                <a title="<?php echo esc_attr('instagram', 'classic-fashion-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_fashion_blog_instagram_link')); ?>"><i class="fa-brands fa-instagram"></i></a>
              <?php } ?>
              <?php if ( get_theme_mod('classic_fashion_blog_youtube_link') != "") { ?>
                <a title="<?php echo esc_attr('youtube', 'classic-fashion-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_fashion_blog_youtube_link')); ?>"><i class="fa-brands fa-youtube"></i></a>
              <?php } ?>
            </div>
          </div>
        </div>
        <div class="col-xxl-10 col-xl-10 col-lg-10 col-md-8 col-sm-8 col-8 align-self-center">
          <div class="toggle-nav text-center">
            <?php if (has_nav_menu('primary')) { ?>
              <button role="tab"><?php esc_html_e('Menu', 'classic-fashion-blog'); ?></button>
            <?php } ?>
          </div>
          <div id="mySidenav" class="nav sidenav">
            <nav id="site-navigation" class="main-nav" role="navigation" aria-label="<?php esc_attr_e('Top Menu', 'classic-fashion-blog'); ?>">
              <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', 'classic-fashion-blog'); ?></a>
            </nav>
          </div>
        </div>
        <div class="col-xxl-1 col-xl-1 col-lg-1 col-md-2 col-sm-2 col-2 align-self-center">
          <?php if(class_exists('woocommerce')){ ?> 
            <div class="product-account text-center">
              <?php if ( is_user_logged_in() ) { ?>
                <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('My Account','classic-fashion-blog'); ?>"><i class="fa-solid fa-user"></i></a>
              <?php } 
              else { ?>
                <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','classic-fashion-blog'); ?>"><i class="fa-solid fa-user"></i></a>
              <?php } ?>
            </div>
          <?php }?> 
        </div>
      </div>
    </div>
  </div>
</div>