<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="content-ts">
 *
 * @package perfect-blog
 */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
  <meta charset="<?php bloginfo( 'charset' ); ?>">
  <meta name="viewport" content="width=device-width">
  <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
  <?php if ( function_exists( 'wp_body_open' ) ) {
    wp_body_open();
  } else {
    do_action( 'wp_body_open' );
  } ?>
  <div class="<?php if( get_theme_mod( 'perfect_blog_sticky_header', false) != '' || get_theme_mod( 'perfect_blog_responsive_sticky_header', false) != '') { ?> sticky-header"<?php } else { ?>close-sticky <?php } ?>">
    <header role="banner">
      <!-- preloader -->
      <?php if(get_theme_mod('perfect_blog_preloader_option', false)!= '' || get_theme_mod('perfect_blog_responsive_preloader', false) != ''){ ?>
        <?php if(get_theme_mod('perfect_blog_preloader_type_options', 'Preloader 1')  == 'Preloader 1') {?>
          <div id="loader-wrapper" class="w-100 h-100">
            <div id="loader" class="rounded-circle"></div>
            <div class="loader-section section-left"></div>
            <div class="loader-section section-right"></div>
          </div>
        <?php } else if(get_theme_mod('perfect_blog_preloader_type_options', 'Preloader 1') ==  'Preloader 2') {?>
          <div id="loader-wrapper" class="w-100 h-100">
            <div class="loader">
              <div></div>
              <div></div>
              <div></div>
            </div>
          </div>
        <?php }?>
      <?php }?>
    <!-- preloader end -->
      <a class="screen-reader-text skip-link" href="#maincontent"><?php esc_html_e( 'Skip to content', 'perfect-blog' ); ?></a>
      <div id="header" class="py-3">
        <div class="container">
          <div class="row">
            <div class="perfect-blog-logo col-lg-3 col-md-9 col-9 align-self-center">
              <?php if ( has_custom_logo() ) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
              <?php endif; ?>
              <?php $blog_info = get_bloginfo( 'name' ); ?>
              <?php if ( ! empty( $blog_info ) ) : ?>
                <?php if( get_theme_mod('perfect_blog_site_title',true) != ''){ ?>
                  <?php if ( is_front_page() && is_home() ) : ?>
                    <h1 class="site-title text-uppercase"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                  <?php else : ?>
                    <p class="site-title text-uppercase mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                  <?php endif; ?>
                <?php }?>
              <?php endif; ?>
              <?php
              $description = get_bloginfo( 'description', 'display' );
              if ( $description || is_customize_preview() ) :
                ?>
                <?php if( get_theme_mod('perfect_blog_tagline',false) != ''){ ?>
                  <p class="site-description mb-0">
                    <?php echo esc_html($description); ?>
                  </p>
                <?php }?>
              <?php endif; ?>
            </div>
            <div class="col-lg-7 col-md-3 col-3 align-self-center">
              <div class="toggle-menu responsive-menu">
                <button class="mobiletoggle"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_open_menu_icon','fas fa-bars')); ?>"></i><span class="screen-reader-text"><?php esc_html_e('Open Menu','perfect-blog'); ?></span></button>
              </div>
              <div id="menu-sidebar" class="nav sidebar text-center">
                <nav id="primary-site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'perfect-blog' ); ?>">
                  <?php
                    wp_nav_menu( array( 
                      'theme_location' => 'primary',
                      'container_class' => 'main-menu-navigation clearfix' ,
                      'menu_class' => 'main-menu-navigation clearfix',
                      'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav ps-lg-0 text-lg-start">%3$s</ul>',
                      'fallback_cb' => 'wp_page_menu',
                    ) );
                  ?>
                  <div id="contact-info">
                    <div class="social-icons align-self-center">
                      <?php if( get_theme_mod( 'perfect_blog_twitter_url') != '') { ?>
                        <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_twitter_url','' ) ); ?>" class="pe-3"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_twitter_icon','fab fa-twitter')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Twitter','perfect-blog' );?></span></a>
                      <?php } ?>
                      <?php if( get_theme_mod( 'perfect_blog_facebook_url') != '') { ?>
                        <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_facebook_url','' ) ); ?>" class="pe-3"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_facebook_icon','fab fa-facebook-f')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Facebook','perfect-blog' );?></span></a>
                      <?php } ?>                      
                      <?php if( get_theme_mod( 'perfect_blog_skipe_url' ) != '') { ?>
                        <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_skipe_url','' ) ); ?>" class="pe-3"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_skipe_icon','fab fa-skype')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Skype','perfect-blog' );?></span></a>
                      <?php } ?> 
                      <?php if( get_theme_mod( 'perfect_blog_pint_url') != '') { ?>
                        <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_pint_url','' ) ); ?>" class="pe-3"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_pint_icon','fab fa-pinterest-p')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Pinterest','perfect-blog' );?></span></a>
                      <?php } ?>
                      <?php if( get_theme_mod( 'perfect_blog_insta_url') != '') { ?>
                        <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_insta_url','' ) ); ?>" class="pe-3"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_insta_icon','fab fa-instagram')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Instagram','perfect-blog' );?></span></a>
                      <?php } ?>
                    </div>
                    <?php if(get_theme_mod('perfect_blog_mobile_search_option',true) != ''){ ?>
                      <?php get_search_form();?>
                    <?php }?>
                  </div>
                  <a href="javascript:void(0)" class="closebtn responsive-menu"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_close_menu_icon','far fa-times-circle')); ?>"></i><span class="screen-reader-text"><?php esc_html_e('Close Menu','perfect-blog'); ?></span></a>
                </nav>
              </div>
            </div>
            <div class="social-media col-lg-2 col-md-3 text-end mt-3 align-self-center">
              <?php if( get_theme_mod( 'perfect_blog_twitter_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_twitter_url','' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_twitter_icon','fab fa-twitter')); ?> py-0 px-2"></i><span class="screen-reader-text"><?php esc_html_e( 'Twitter','perfect-blog' );?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'perfect_blog_facebook_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_facebook_url','' ) ); ?>" ><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_facebook_icon','fab fa-facebook-f')); ?> py-0 px-2"></i><span class="screen-reader-text"><?php esc_html_e( 'Facebook','perfect-blog' );?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'perfect_blog_skipe_url' ) != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_skipe_url','' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_skipe_icon','fab fa-skype')); ?> py-0 px-2"></i><span class="screen-reader-text"><?php esc_html_e( 'Skype','perfect-blog' );?></span></a>
              <?php } ?> 
              <?php if( get_theme_mod( 'perfect_blog_pint_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_pint_url','' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_pint_icon','fab fa-pinterest-p')); ?> py-0 px-2"></i><span class="screen-reader-text"><?php esc_html_e( 'Pinterest','perfect-blog' );?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'perfect_blog_insta_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'perfect_blog_insta_url','' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('perfect_blog_insta_icon','fab fa-instagram')); ?> py-0 px-2"></i><span class="screen-reader-text"><?php esc_html_e( 'Instagram','perfect-blog' );?></span></a>
              <?php } ?>
            </div>
          </div>
        </div>
        <div class="clearfix"></div>
      </div>
    </header>
  </div>