<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Classic Attorney
 */
?>
<!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_attorney_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-attorney' ); ?></a>

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

<div class="mainhead<?php if( get_theme_mod( 'classic_attorney_stickyheader', false) == 1) { ?> is-sticky-on"<?php } else { ?>close-sticky <?php } ?>">
  <div class="main-header">
    <?php if (get_theme_mod('classic_attorney_show_topbar', false)) { ?>
      <div class="topbar ms-lg-5 ms-md-4 ms-0 p-1 mb-4">
        <div class="container-fluid">
          <div class="row">
            <div class="col-xl-2 col-lg-2 col-md-3 col-sm-6 col-12 align-self-center">
              <div class="social-icons d-flex gap-2">
                <?php if ( get_theme_mod('classic_attorney_instagram_link') != "") { ?> 
                  <a title="<?php echo esc_attr('instagram', 'classic-attorney'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_attorney_instagram_link')); ?>"><i class="fa-brands fa-instagram"></i></a>
                <?php } ?>
                <?php if ( get_theme_mod('classic_attorney_facebook_link') != "") { ?>
                  <a title="<?php echo esc_attr('facebook', 'classic-attorney'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_attorney_facebook_link')); ?>"><i class="fa-brands fa-facebook-f"></i></a> 
                <?php } ?>
                <?php if ( get_theme_mod('classic_attorney_youtube_link') != "") { ?>
                  <a title="<?php echo esc_attr('youtube', 'classic-attorney'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_attorney_youtube_link')); ?>"><i class="fa-brands fa-youtube"></i></a>
                <?php } ?>
                <?php if ( get_theme_mod('classic_attorney_twitter_link') != "") { ?> 
                  <a title="<?php echo esc_attr('twitter', 'classic-attorney'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('classic_attorney_twitter_link')); ?>"><i class="fa-brands fa-twitter"></i></a>
                <?php } ?>
              </div>
            </div>
            <div class="col-xl-7 col-lg-6 col-md-5 col-sm-6 col-12 align-self-center">
              <?php if ( get_theme_mod('classic_attorney_topbar_text_title')) { ?>
                <p class="top-text mb-0"><?php echo esc_html(get_theme_mod('classic_attorney_topbar_text_title')); ?></p>
              <?php } ?>
            </div>
            <div class="col-xl-3 col-lg-4 col-md-4 col-sm-12 col-12 align-self-center">
              <?php if ( get_theme_mod('classic_attorney_phone_number') || get_theme_mod('classic_attorney_phone_text_title')) { ?>
                <div class="phone-box d-flex flex-wrap">
                  <p class="phone-text mb-0"><?php echo esc_html(get_theme_mod('classic_attorney_phone_text_title')); ?></p>
                  <a class="phone-no ps-1" href="tel:<?php echo esc_attr( get_theme_mod('classic_attorney_phone_number')); ?>"><?php echo esc_html(get_theme_mod ('classic_attorney_phone_number')); ?></a>
                </div>
              <?php } ?>
            </div>
          </div>
        </div>
      </div>
    <?php } ?>
    <div class="menu-header">
      <div class="container">
        <div class="row">
          <div class="col-xxl-2 col-xl-2 col-lg-2 col-md-2 col-sm-6 col-6">
            <div class="classic-attorney-logo">
              <?php if (get_theme_mod('classic_attorney_logo_enable', true)) { ?>
                <?php classic_attorney_the_custom_logo(); ?>
              <?php } ?>
              <div class="site-branding-text">
                <?php if (get_theme_mod('classic_attorney_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_attorney_description = get_bloginfo('description', 'display');
                if ($classic_attorney_description || is_customize_preview()) : ?>
                  <?php if (get_theme_mod('classic_attorney_tagline_enable', false)) { ?>
                    <span class="site-description"><?php echo esc_html($classic_attorney_description); ?></span>
                  <?php } ?>
                <?php endif; ?>
              </div>
            </div>
          </div>
          <div class="col-xxl-5 col-xl-5 col-lg-5 col-md-3 col-sm-6 col-6 align-self-center">
            <div class="menu-sec">
              <div class="toggle-nav text-end">
                <?php if (has_nav_menu('primary')) { ?>
                  <button role="tab"><?php esc_html_e('Menu', 'classic-attorney'); ?></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-attorney'); ?>">
                  <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-attorney'); ?></a>
                </nav>
              </div>
            </div>
          </div>
          <div class="col-xxl-5 col-xl-5 col-lg-5 col-md-7 col-sm-12 col-12 align-items-center d-flex justify-content-end gap-3 my-2 top-btns">
            <div class="top-search">
              <?php get_search_form(); ?>
            </div>
            <div class="header-btns d-flex gap-1 justify-content-end">
              <?php if ( get_theme_mod('classic_attorney_header_contact_btn') || get_theme_mod('classic_attorney_header_contact_btn_url')) { ?>
                <div class="contact-btn">
                  <a href="<?php echo esc_url(get_theme_mod ('classic_attorney_header_contact_btn_url')); ?>" class="text-capitalize position-relative"><?php echo esc_html(get_theme_mod ('classic_attorney_header_contact_btn')); ?></a>
                </div>
              <?php }?>
              <?php if ( get_theme_mod('classic_attorney_header_login_btn') || get_theme_mod('classic_attorney_header_login_btn_url')) { ?>
                <div class="login-btn">
                  <a href="<?php echo esc_url(get_theme_mod ('classic_attorney_header_login_btn_url')); ?>" class="text-capitalize position-relative"><?php echo esc_html(get_theme_mod ('classic_attorney_header_login_btn')); ?></a>
                </div>
              <?php }?>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>