<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">

 */

?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="https://gmpg.org/xfn/11">

	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php wp_body_open(); ?>
<div id="page" class="site">
    <a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'bexplore' ); ?></a>
	<?php
	$container               = get_theme_mod( 'bexplore_container_type', 'container' );
	$header_top              = get_theme_mod( 'bexplore_header_top_on_off' );
	$site_description_on_off = get_theme_mod( 'be_site_description_on_off' );

	if ( 'show' === $header_top ):
		?>
        <div class="header-top-area">
            <div class="<?php echo esc_attr( $container ); ?>">
                <div class="row">
                    <div class="col-lg-6 col-md-8 col-sm-12">
                        <div class="bexplore-contact-info">
                            <ul>
								<?php
								$email = get_theme_mod( 'bexplore_email' );
								$phone = get_theme_mod( 'bexplore_phone' );
								if ( ! empty( $email ) ):?>
                                    <li><a href="mailto:<?php echo esc_html( $email ); ?>"><i
                                                    class="far fa-envelope"></i><?php echo esc_html( $email ); ?></a>
                                    </li>
								<?php endif; ?>
								<?php
								if ( ! empty( $phone ) ):?>
                                    <li><a href="tel:<?php echo esc_html( $phone ); ?>"><i
                                                    class="fas fa-phone-alt"></i><?php echo esc_html( $phone ); ?></a>
                                    </li>
								<?php endif; ?>
                            </ul>
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-4 col-sm-12">
                        <div class="bexplore-social-links">
                            <ul>
								<?php
								$facebook  = get_theme_mod( 'bexplore_facebook' );
								$twitter   = get_theme_mod( 'bexplore_twitter' );
								$instagram = get_theme_mod( 'bexplore_instagram' );
								$youtube   = get_theme_mod( 'bexplore_youtube' );
								if ( ! empty( $facebook ) ):?>
                                    <li><a href="<?php echo esc_url( $facebook ); ?>"><i class="fab fa-facebook-f"></i></a>
                                    </li>
								<?php endif; ?>
								<?php if ( ! empty( $twitter ) ): ?>
                                    <li><a href="<?php echo esc_url( $twitter ); ?>"><i class="fab fa-twitter"></i></a>
                                    </li>
								<?php endif; ?>
								<?php if ( ! empty( $instagram ) ): ?>
                                    <li><a href="<?php echo esc_url( $instagram ); ?>"><i class="fab fa-instagram"></i></a>
                                    </li>
								<?php endif; ?>
								<?php if ( ! empty( $youtube ) ): ?>
                                    <li><a href="<?php echo esc_url( $youtube ); ?>"><i class="fab fa-youtube"></i></a>
                                    </li>
								<?php endif; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
	<?php endif; ?>
    <header id="masthead" class="bexplore-header-area site-header">
        <div class="<?php echo esc_attr( $container ); ?>">
            <div class="row justify-content-between align-items-center" id="menu-toggle-area">
                <div class="col-lg-4 col-md-6 col-4">
                    <div class="site-branding">
						<?php
						the_custom_logo();
						if ( is_front_page() && is_home() ) :
							?>
                            <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"
                                                      rel="home"><?php bloginfo( 'name' ); ?></a></h1>
						<?php
						else :
							?>
                            <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"
                                                     rel="home"><?php bloginfo( 'name' ); ?></a></p>
						<?php
						endif;
						if ( 'show' === $site_description_on_off ):
							$wp_description = get_bloginfo( 'description', 'display' );
							if ( $wp_description || is_customize_preview() ) :
								?>
                                <p class="site-description"><?php echo $wp_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
									?></p>
							<?php
							endif;
						endif; ?>

                    </div><!-- .site-branding -->
                </div>
                <div class="col-lg-6 col-md-6 col-8 menu-toggle-area">
                    <!-- Search Icon -->
                    <div class="header-search-icon">
                        <button class="search-toggle" aria-label="<?php esc_attr_e( 'Search', 'bexplore' ); ?>">
                            <i class="fas fa-search"></i>
                        </button>
                    </div>
                    <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><i
                                class="bbm-open fas fa-bars"></i><i
                                class="bbm-close fas fa-times"></i></button>

                </div>
                <div class="col-lg-8 col-md-12 col-12 text-left site-search-icon">
                    <div id="site-header-menu" class="site-header-menu">
                        <nav id="site-navigation" class="main-navigation" role="navigation"
                             aria-label="<?php esc_attr_e( 'Primary Menu', 'bexplore' ); ?>">
							<?php
							wp_nav_menu(
								array(
									'theme_location' => 'primary',
									'menu_class'     => 'primary-menu',
								)
							);
							?>
                        </nav><!-- .main-navigation -->
                    </div><!-- .site-header-menu -->
                    <!-- Search Icon -->
                    <div class="header-search-icon">
                        <button class="search-toggle" aria-label="<?php esc_attr_e( 'Search', 'bexplore' ); ?>">
                            <i class="fas fa-search"></i>
                        </button>
                    </div>
                </div>

    </header><!-- #masthead -->

	<?php if ( bexplore_breadcrumb_show() && ! is_404() ): ?>
        <div class="bexplore-breadcrumbs-area">
            <div class="<?php echo esc_attr( $container ); ?>">
                <div class="row">
                    <div class="col-12">
                        <div class="bexplore-breadcrumbs">
							<?php if ( is_singular( 'post' ) ): ?>
                                <h1 class="bexplore-breadcrumbs-title"><?php echo bexplore_breadcrumb_title(); ?></h1>
                                <div class="bexplore-breadcrumbs-meta">
									<?php
									if ( ! ( is_home() && is_front_page() ) ) {
										printf( '<a class="active" href="%s"><i class="fas fa-home"></i>' . esc_html__( 'Home', 'bexplore' ) . '</a>', esc_url( home_url() ) );
									}
									echo bexplore_posted_by();
									echo bexplore_posted_on();
									?>
                                </div>
							<?php else: ?>
                                <h2 class="bexplore-breadcrumbs-title"><?php echo bexplore_breadcrumb_title(); ?></h2>
								<?php bexplore_breadcrumb(); ?>
							<?php endif ?>

                        </div>
                    </div>
                </div>
            </div>
        </div>
	<?php endif; ?>


    <!-- Search Overlay -->
    <div class="bexplore-search-overlay">
        <div class="bexplore-search-overlay-content">
            <button class="search-close" aria-label="<?php esc_attr_e( 'Close Search', 'bexplore' ); ?>">
                <i class="fas fa-times"></i>
            </button>
            <div class="search-form-wrapper">
				<?php get_search_form(); ?>
            </div>
        </div>
    </div>