<?php
/**
 * The Header for our theme.
 * @package Multipurpose Lawyer
 */
?>
<!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' );
  }?>

  <?php if(get_theme_mod('multipurpose_lawyer_preloader',false) || get_theme_mod('multipurpose_lawyer_preloader_responsive',false)){ ?>
    <?php if(get_theme_mod( 'multipurpose_lawyer_preloader_type','Square') == 'Square'){ ?>
      <div id="overlayer"></div>
      <span class="tg-loader">
        <span class="tg-loader-inner"></span>
      </span>
    <?php }else if(get_theme_mod( 'multipurpose_lawyer_preloader_type') == 'Circle') {?>    
      <div class="preloader text-center">
        <div class="preloader-container">
          <span class="animated-preloader"></span>
        </div>
      </div>
    <?php }?>
  <?php }?>
  
  <header role="banner">
    <a class="screen-reader-text skip-link" href="#maincontent"><?php esc_html_e( 'Skip to content', 'multipurpose-lawyer' ); ?><span class="screen-reader-text"><?php esc_html_e('Skip to Content','multipurpose-lawyer'); ?></span></a>
    <?php  ?>
      <div class="toggle-menu responsive-menu p-2">
        <button role="tab"><i class="<?php echo esc_html(get_theme_mod('multipurpose_lawyer_menu_open_icon','fas fa-bars')); ?> me-2"></i><?php echo esc_html( get_theme_mod('multipurpose_lawyer_mobile_menu_label', __('Menu','multipurpose-lawyer'))); ?><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('multipurpose_lawyer_mobile_menu_label', __('Menu','multipurpose-lawyer'))); ?></span></button>
      </div>
      <div id="sidelong-menu" class="nav side-nav mobile-sidenav">
        <nav id="primary-site-navigation" class="nav-menu" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'multipurpose-lawyer' ); ?>">
          <?php 
            wp_nav_menu( array( 
              'theme_location' => 'primary',
              'container_class' => 'main-menu-navigation clearfix' ,
              'menu_class' => 'clearfix',
              'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
              'fallback_cb' => 'wp_page_menu',
            ) ); 
          ?>
          <a href="javascript:void(0)" class="closebtn responsive-menu"><?php echo esc_html( get_theme_mod('multipurpose_lawyer_close_menu_label', __('Close Menu','multipurpose-lawyer'))); ?><i class="<?php echo esc_html(get_theme_mod('multipurpose_lawyer_menu_close_icon','fas fa-times-circle')); ?> m-3"></i><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('multipurpose_lawyer_close_menu_label', __('Close Menu','multipurpose-lawyer'))); ?></span></a>
        </nav>
      </div>
    <?php ?>
    <div id="header">
      <?php if(get_theme_mod('multipurpose_lawyer_top_header',true) == true || get_theme_mod('multipurpose_lawyer_hide_topbar_responsive',true) == true){ ?>
        <div class="top-bar text-lg-start text-center">
          <div class="container">
            <div class="row">
              <div class="col-lg-4 col-md-6 align-self-center">
                <div class="welcome">
                  <?php if ( get_theme_mod('multipurpose_lawyer_welcome_text','') != "" ) {?>
                    <p class="py-2 m-0"><i class="<?php echo esc_html(get_theme_mod('multipurpose_lawyer_welcome_icon','fas fa-building')); ?> me-1"></i><?php echo esc_html( get_theme_mod('multipurpose_lawyer_welcome_text','')); ?></p>
                  <?php }?>
                </div>
              </div>
              <div class="col-lg-3 col-md-6 align-self-center">
                <?php if ( get_theme_mod('multipurpose_lawyer_email','') != "" ) {?>
                  <a href="mailto:<?php echo esc_attr( get_theme_mod('multipurpose_lawyer_email','')); ?>"><p class="py-2 m-0"><i class="<?php echo esc_html(get_theme_mod('multipurpose_lawyer_email_icon','fas fa-at')); ?> me-1"></i><?php echo esc_html( get_theme_mod('multipurpose_lawyer_email','')); ?></p><span class="screen-reader-text"><?php esc_html_e('Email','multipurpose-lawyer'); ?></span></a>
                <?php }?>
              </div>
              <div class="col-lg-2 col-md-6 pe-0 align-self-center">
                <div class="request">
                  <?php if ( get_theme_mod('multipurpose_lawyer_request_link','') != "" ) {?>
                    <a href="<?php echo esc_url(get_theme_mod('multipurpose_lawyer_request_link','')); ?>"><?php echo esc_html(get_theme_mod('multipurpose_lawyer_request_text','')); ?> <span class="screen-reader-text"><?php esc_html_e('Free A Request','multipurpose-lawyer'); ?></span></a>
                  <?php }?>
                </div>
              </div>
              <div class="col-lg-3 col-md-6 align-self-center">
                <!-- Social Icons -->
                <?php if (is_active_sidebar('social-icon')) : ?>
                    <?php dynamic_sidebar('social-icon'); ?>
                <?php else : ?>
                    <!-- Default Social Icons Widgets -->
                    <div id="social-icons" class="widget py-3 social_widget">
                        <ul class="custom-social-icons">
                            <li><a href="https://facebook.com" target="_blank"><i class="fab fa-facebook"></i></a></li>
                            <li><a href="https://twitter.com" target="_blank"><i class="fab fa-twitter"></i></a></li>
                            <li><a href="https://pinterest.com" target="_blank"><i class="fab fa-pinterest"></i></a></li>
                            <li><a href="https://linkedin.com" target="_blank"><i class="fab fa-linkedin"></i></a></li>
                        </ul>
                    </div>
                <?php endif; ?>
              </div>
            </div>
          </div>
        </div>
      <?php }?>
      <div class="top-header <?php if( get_theme_mod( 'multipurpose_lawyer_sticky_header') != '') { ?> sticky-header"<?php } else { ?>close-sticky <?php } ?>">
        <div class="container">
          <div class="row">
            <div class="col-lg-3 col-md-5 align-self-center">
              <div class="logo py-1 text-md-start text-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('multipurpose_lawyer_show_site_title',true) != ''){ ?>
                    <?php if ( is_front_page() && is_home() ) : ?>
                      <h1 class="site-title p-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                    <?php else : ?>
                      <p class="site-title m-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                    <?php endif; ?>
                  <?php }?>
                <?php endif; ?>
                <?php if( get_theme_mod('multipurpose_lawyer_show_tagline',false) != ''){ ?>
                  <?php
                  $description = get_bloginfo( 'description', 'display' );
                  if ( $description || is_customize_preview() ) :
                  ?>
                    <p class="site-description m-0">
                      <?php echo esc_html($description); ?>
                    </p>
                  <?php endif; ?>
                <?php }?>
              </div>
            </div>
            <div class="<?php if(get_theme_mod('multipurpose_lawyer_show_search',true)) { ?>col-lg-8 col-md-4 col-6 <?php } else { ?>col-lg-9 col-md-7 <?php } ?> align-self-center">
              <div id="sidelong-menu" class="nav side-nav">
                <nav id="primary-site-navigation" class="nav-menu" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'multipurpose-lawyer' ); ?>">
                  <?php 
                    wp_nav_menu( array( 
                      'theme_location' => 'primary',
                      'container_class' => 'main-menu-navigation clearfix' ,
                      'menu_class' => 'clearfix',
                      'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
                      'fallback_cb' => 'wp_page_menu',
                    ) ); 
                   ?>
                </nav>
              </div>
            </div><?php if(get_theme_mod('multipurpose_lawyer_show_search',true) ){ ?>
              <div class="search-box position-relative col-lg-1 col-md-3 col-6 align-self-center">
                <div class="wrap"><?php get_search_form(); ?></div>
              </div>
            <?php }?>
          </div>
        </div>
      </div>
    </div>
  </header>

  <?php if(get_theme_mod('multipurpose_lawyer_post_featured_image') == 'banner' ){
    if( is_singular() ) {?>
      <div id="page-site-header">
        <div class='page-header'> 
          <?php the_title( '<h1>', '</h1>' ); ?>
        </div>
      </div>
    <?php }
  }?>