<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Shipping Company
 */
?>
<!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('shipping_company_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', 'shipping-company' ); ?></a>

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

<div class="mainhead">
  <div class="main-header">
    <div class="container">
      <div class="row">
        <div class="col-xl-2 col-lg-2 col-md-2 col-12 align-self-center">
          <div class="shipping-company-logo">
            <?php if (get_theme_mod('shipping_company_logo_enable', true)) { ?>
              <?php shipping_company_the_custom_logo(); ?>
            <?php } ?>
            <div class="site-branding-text">
              <?php if (get_theme_mod('shipping_company_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 $shipping_company_description = get_bloginfo('description', 'display');
              if ($shipping_company_description || is_customize_preview()) : ?>
                <?php if (get_theme_mod('shipping_company_tagline_enable', false)) { ?>
                  <span class="site-description"><?php echo esc_html($shipping_company_description); ?></span>
                <?php } ?>
              <?php endif; ?>
            </div>
          </div>
        </div>
        <div class="col-xl-8 col-lg-8 col-md-8 col-12 align-self-center">
          <?php if ( get_theme_mod('shipping_company_header_location_text') || get_theme_mod('shipping_company_header_location_url') || get_theme_mod('shipping_company_header_track_order_text') || get_theme_mod('shipping_company_header_track_order_url') || get_theme_mod('shipping_company_header_time_text')) { ?>
            <div class="topbar-box p-2">
              <div class="row">
                <div class="col-xl-4 col-lg-4 col-md-4 col-12 mb-lg-0 mb-md-0 mb-3">
                  <div class="header-location text-center">
                    <a href="<?php echo esc_url(get_theme_mod ('shipping_company_header_location_url','')); ?>" class="text-capitalize"><i class="fa-solid fa-location-dot"></i><?php echo esc_html(get_theme_mod ('shipping_company_header_location_text')); ?></a>
                  </div>
                </div>
                <div class="col-xl-4 col-lg-4 col-md-4 col-12 mb-lg-0 mb-md-0 mb-3">
                  <div class="header-order text-center">
                    <a href="<?php echo esc_url(get_theme_mod ('shipping_company_header_track_order_url','')); ?>" class="text-capitalize"><i class="fa-solid fa-location-crosshairs"></i><?php echo esc_html(get_theme_mod ('shipping_company_header_track_order_text')); ?></a>
                  </div>
                </div>
                <div class="col-xl-4 col-lg-4 col-md-4 col-12 mb-lg-0 mb-md-0 mb-2">
                  <div class="header-time text-center">
                    <p class="text-capitalize mb-0"><i class="fa-regular fa-calendar"></i><?php echo esc_html(get_theme_mod ('shipping_company_header_time_text')); ?></p>
                  </div>
                </div>
              </div>
            </div>
          <?php }?>
          <div class="menu-sec <?php echo ( get_theme_mod( 'shipping_company_sticky_header', false ) == 1 ) ? 'header-sticky' : 'close-sticky'; ?>">
            <div class="toggle-nav text-center">
              <?php if (has_nav_menu('primary')) { ?>
                <button role="tab"><?php esc_html_e('Menu', 'shipping-company'); ?></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', 'shipping-company'); ?>">
                <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', 'shipping-company'); ?></a>
              </nav>
            </div>
          </div>
        </div>
        <div class="col-xl-2 col-lg-2 col-md-2 col-12 align-self-center">
          <?php if ( get_theme_mod('shipping_company_header_btn_text') || get_theme_mod('shipping_company_header_btn_url')) { ?>
            <div class="header-btn text-end">
              <a href="<?php echo esc_url(get_theme_mod ('shipping_company_header_btn_url','')); ?>" class="text-capitalize"><?php echo esc_html(get_theme_mod ('shipping_company_header_btn_text','shipping-company')); ?></a>
            </div>
          <?php }?>
        </div>
      </div>
    </div>
  </div>
</div>