<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$light_logo = get_theme_mod('logo_light');
$dark_logo = get_theme_mod('logo_dark');
$footer_socials_on_menu = get_theme_mod('footer_socials_on_menu', true);
?>
<!DOCTYPE html>
<html <?php language_attributes() ?>>

<head>
	<meta charset="<?php bloginfo('charset') ?>">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="theme-color" content="<?php echo maxo_get_option('theme_color', '#42d9e4') ?>" />
	<?php wp_head() ?>
</head>


<body <?php body_class() ?> data-spy="scroll" data-target=".navbar" data-offset="50">

	<?php if( is_front_page() && get_theme_mod('show_loading', true) ){ ?>
	<div class="loader">
		<div class="spinner">
			<div class="dot1"></div>
			<div class="dot2"></div>
		</div>
	</div>
	<?php } ?>


	<!--Header Starts-->
	<header class="default">
		<nav class="navbar navbar-default navbar-fixed bootsnav">
			<div class="container">

				<div class="menu-icon">
					<span></span>
				</div>

				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
						<i class="fa fa-bars"></i>
					</button>
					<?php
					if($light_logo){
						$light_url = wp_get_attachment_url($light_logo);
					}
					if($dark_logo){
						$dark_url = wp_get_attachment_url($dark_logo);
					}

					if($light_logo || $dark_logo){
						echo '<a class="navbar-brand" href="'.esc_url(home_url()).'">';

						if($light_logo && $dark_logo){
							echo '<img class="logo logo-display" src="'.$light_url.'" alt="'.esc_attr__('Logo', 'maxo-fa').'">';
							echo '<img class="logo logo-scrolled" src="'.$dark_url.'" alt="'.esc_attr__('Logo', 'maxo-fa').'">';
						}
						else{
							echo '<img class="logo" src="'.($light_logo ? $light_url : $dark_url).'" alt="'.esc_attr__('Logo', 'maxo-fa').'">';
						}

						echo '</a>';
					}
					?>
				</div>

				<div class="collapse navbar-collapse" id="navbar-menu">
					<?php
					wp_nav_menu(array(
						'theme_location' => 'header_menu',
						'menu_id' => 'header_menu',
						'menu_class' => 'nav navbar-nav navbar-right',
						'items_wrap' => '<ul id="%1$s" class="%2$s" data-in="fadeInDown" data-out="fadeOutUp">%3$s</ul>',
						'container' => '',
						'depth' => 1,
						'fallback_cb' => false
					));
					?>
				</div>

			</div>
		</nav>
	</header>
	<!--Header ends-->


	<!--Full Menu-->
	<section class="overlay-menu">

		<div class="menu-icon active">
			<span></span>
		</div>

		<div class="centered-block">
			<div class="container">
				<div class="row">

					<?php if($light_logo || $dark_logo){ ?>
					<div class="col-sm-12 columns half text-center">
						<a href="<?php echo esc_url(home_url()) ?>" class="logo-full heading_space"><img src="<?php echo $dark_logo ? $dark_url : $light_url ?>" alt="<?php esc_attr_e('Logo', 'maxo-fa') ?>"></a>
					</div>
					<?php } ?>

					<div class="col-sm-12 columns half text-right">
						<?php
						wp_nav_menu(array(
							'theme_location' => 'header_menu',
							'menu_id' => 'header_menu_mobile',
							'menu_class' => 'full-nav top20 heading_space',
							'container' => '',
							'depth' => 1,
							'fallback_cb' => false
						));
						?>
					</div>

					<?php
					if($footer_socials_on_menu){
						$footer_socials = get_theme_mod('footer_socials', array());
						if($footer_socials){
					?>
					<div class="col-sm-12">
						<ul class="social">
							<?php
							foreach($footer_socials as $social){
								echo '<li><a href="'.$social['link'].'" title="'.$social['title'].'"><i class="'.$social['icon'].'"></i></a></li> ';
							}
							?>
						</ul>
					</div>
					<?php
						}
					}
					?>

				</div>
			</div>
		</div>

	</section>
	<!--Full Menu-->
