<?php    
/**
 * The header for our theme.
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package luzuk Premium
 */
?><!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="http://gmpg.org/xfn/11">
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
	<script src="https://use.fontawesome.com/18a9c36ed1.js"></script>
	<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet">
		
	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/bootstrap.min.css">
	<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/animate.css" />
	
	<link rel="preconnect" href="https://fonts.googleapis.com">
	<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
	<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">

	<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>

    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery-3.1.1.slim.min.js" crossorigin="anonymous"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/bootstrap.min.js" type="text/javascript"  ></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/wow.js" ></script>

    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery-3.1.1.slim.min.js" type="text/javascript"  ></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/swiper.min.js" type="text/javascript"  ></script>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript">
		
var resizeElements;

$(document).ready(function() {

  // Set up common variables
  // --------------------------------------------------

  var bar = ".search_bar";
  var input = bar + " input[type='text']";
  var button = bar + " button[type='submit']";
  var dropdown = bar + " .search_dropdown";
  var dropdownLabel = dropdown + " > span";
  var dropdownList = dropdown + " ul";
  var dropdownListItems = dropdownList + " li";


  // Set up common functions
  // --------------------------------------------------

  resizeElements = function() {
    var barWidth = $(bar).outerWidth();

    var labelWidth = $(dropdownLabel).outerWidth();
    $(dropdown).width(labelWidth);

    var dropdownWidth = $(dropdown).outerWidth();
    var buttonWidth	= $(button).outerWidth();
    var inputWidth = barWidth - dropdownWidth - buttonWidth;
    var inputWidthPercent = inputWidth / barWidth * 100 + "%";

    $(input).css({ 'margin-left': dropdownWidth, 'width': inputWidthPercent });
  }

  function dropdownOn() {
    $(dropdownList).fadeIn(25);
    $(dropdown).addClass("active");
  }

  function dropdownOff() {
    $(dropdownList).fadeOut(25);
    $(dropdown).removeClass("active");
  }


  // Initialize initial resize of initial elements 
  // --------------------------------------------------
  resizeElements();


  // Toggle new dropdown menu on click
  // --------------------------------------------------

  $(dropdown).click(function(event) {
    if ($(dropdown).hasClass("active")) {
      dropdownOff();
    } else {
      dropdownOn();
    }

    event.stopPropagation();
    return false;
  });

  $("html").click(dropdownOff);


  // Activate new dropdown option and show tray if applicable
  // --------------------------------------------------

  $(dropdownListItems).click(function() {
    $(this).siblings("li.selected").removeClass("selected");
    $(this).addClass("selected");

    // Focus the input
    $(this).parents("form.search_bar:first").find("input[type=text]").focus();

    var labelText = $(this).text();
    $(dropdownLabel).text(labelText);

    resizeElements();

  });


  // Resize all elements when the window resizes
  // --------------------------------------------------

  $(window).resize(function() {
    resizeElements();
  });
});
</script>
<script type="text/javascript">
		$(document).ready(function(){
			$("#formButton").click(function(){
				$("#form1").toggle();
			});
		});
</script>

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


<body <?php body_class(); ?>>
	<div class="main-container">
		<!-- <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'luzuk' ); ?></a> -->
	   <div id="loading-area"><div class="la-anim-10"></div></div>
		
		<header class="site-header header-transparent header header-seo">
		    <div class="top-bar-head">
					<div class="row mr-0">	
						<div class="person">	
								<?php
						
									$personlink = get_theme_mod('personlink', '#');
								?>
								<div class="person-imgbx">	
									<a href="<?php echo ($personlink);  ?>" > 		
			    					<?php 
											$pers_image = get_theme_mod('pers_image');
											if(!empty($pers_image)){
												echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($pers_image).'" class="img-responsive secondry-bg-img" />';
											}else{
												echo '<img src="'.get_template_directory_uri().'/images/per_logo.jpg" class="img-responsive" />';
											}
										?>	
										</a>
			    			</div>

			    			<?php
			    				$p_degi = get_theme_mod('p_degi', 'UI / UX DESIGNER');
			    				$p_name = get_theme_mod('p_name', "I’m John");	
								?>
		    				<div class="pers-data">
		    					<p><?php echo ($p_degi); ?></p>
		    					<h2><?php echo ($p_name); ?></h2>
		    				</div>
						</div>					
	        	<div class=" head-menubx">		
        			<div class="head-menu ">
        					<div class="site-navigation ">
				              <div class="nav-menus">                 
													<a href="#" class="js-nav-toggle">
															<span></span>
													</a>
									    		<div class="nav-wrapper">
															<nav role="navigation">
																	<div class="nav-toggle">
																			<span class="nav-back"></span>
																			<span class="nav-title">Menu</span>
																			<span class="nav-close"></span>
																	</div>
																	<?php
                                      if( get_post_meta( get_the_ID(), 'intrinsic_header_page_menu', true) !=='0') {
                                          wp_nav_menu ( array(
                                              'menu_class' => 'mainm ht-clearfix',
                                              'container'=> 'ul',
                                              'menu' => get_post_meta( get_the_ID(), 'intrinsic_header_page_menu', true),
                                              'theme_location' => 'primary',  
                                          )); 
                                      } else {
                                          wp_nav_menu ( array(
                                              'menu_class' => 'mainm ht-clearfix',
                                              'container'=> 'ul',
                                              'theme_location' => 'primary',  
                                          )); 
                                      }
                                  ?>
															</nav>
													</div>
											</div>
			                <nav class="navigation">
			                    <div class="overlaybg"></div><!--  /.overlaybg -->
			                            <!-- Main Menu -->
	                        <div class="menu-wrapper">
	                            <div class="menu-content">
                                 <!--  </?php
                                      if( get_post_meta( get_the_ID(), 'intrinsic_header_page_menu', true) !=='0') {
                                          wp_nav_menu ( array(
                                              'menu_class' => 'mainmenu ht-clearfix',
                                              'container'=> 'ul',
                                              'menu' => get_post_meta( get_the_ID(), 'intrinsic_header_page_menu', true),
                                              'theme_location' => 'primary',  
                                          )); 
                                      } else {
                                          wp_nav_menu ( array(
                                              'menu_class' => 'mainmenu ht-clearfix',
                                              'container'=> 'ul',
                                              'theme_location' => 'primary',  
                                          )); 
                                      }
                                  ?/> -->
                                <?php
																	// Get the current post or page ID
																	$page_id = get_the_ID();

																	// Check if the page is a single post
																	if (is_single()) {
																	    // Get the custom menu ID from the post's meta field
																	    $menu_id = get_post_meta($page_id, 'intrinsic_header_page_menu', true);
																	    
																	    // Check if a custom menu is assigned to the post
																	    if ($menu_id !== '0' && !empty($menu_id)) {
																	        // Display the custom menu for the post
																	        wp_nav_menu(array(
																	            'menu_class' => 'mainmenu ht-clearfix',
																	            'container' => 'ul',
																	            'menu' => $menu_id, // Use the custom menu ID from the meta field
																	            'theme_location' => 'primary',
																	        ));
																	    } else {
																	        // Display the default menu if no custom menu is assigned to the post
																	        wp_nav_menu(array(
																	            'menu_class' => 'mainmenu ht-clearfix',
																	            'container' => 'ul',
																	            'theme_location' => 'primary',
																	        ));
																	    }
																	} else {
																	    // If it's not a single post (fallback for pages or other templates)
																	    wp_nav_menu(array(
																	        'menu_class' => 'mainmenu ht-clearfix',
																	        'container' => 'ul',
																	        'theme_location' => 'primary',
																	    ));
																	}
																?>
	                            </div> <!-- /.hours-content-->
					            				<div class="clearfix"></div>
	                        </div><!-- /.menu-wrapper --> 
	                		</nav>
        				      <div class="clearfix"></div>
        				      </div><!--  /.site-navigation -->
        				</div>
        				<div class="clearfix"></div>			
	        	</div>
				</div>
				<?php
					$hbtn_text = get_theme_mod('hbtntext', 'Download CV');
					$hbtn_link = get_theme_mod('hbtnlink', 'add link here');

				?>
				<?php if($hbtn_text ){ ?>
				<div class="h-btn">			
							<a href="<?php echo $hbtn_link ?>" data-hover="/f01d" target="_blank">
                <?php echo($hbtn_text); ?> 
						</a>
				</div>
				<?php }?>
				<?php									
						$twitter = get_theme_mod('head_twitt', '//twitter.com/');
						$facebook = get_theme_mod('head_fb', '//facebook.com/');
						$linkedin = get_theme_mod('head_lin', '//linkedin.com/');				
						$instagram = get_theme_mod('head_insta', '//instagram.com/');	
				?>
				<?php if(  $twitter ||  $facebook || $linkedin || $instagram ){ ?>
				<div class="mediabx">
					<?php if($twitter ||  $facebook || $linkedin || $instagram ){ ?>
					<div class="h_social">
							<div class="soci-icn">	
								<ul>
								<?php if(!empty($twitter)){ ?>
									<li><a href="<?php echo $twitter ?>" title="twitter" class="site-button sharp" target="_blank"><i class="fa-brands fa-x-twitter"></i></a></li>
								<?php }?>

								<?php if(!empty($facebook)){ ?>
									<li><a href="<?php echo $facebook ?>" title="Facebook" class="site-button sharp" target="_blank"><i class="fa fa-facebook"></i></a></li>
								<?php }?>

								<?php if(!empty($linkedin)){ ?>
									<li><a href="<?php echo $linkedin ?>" title="Linkedin" class="site-button sharp" target="_blank"><i class="fa fa-linkedin"></i></a></li>
								<?php }?>
										
								<?php if(!empty($instagram)){ ?>
									<li><a href="<?php echo $instagram ?>" title="Instagram" class="site-button sharp" target="_blank"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
								<?php }?>			
						 	</ul>
						</div>
					</div>
					<?php }?>
				</div>
				<?php }?>
    		<div class="clearfix"></div>
		    </div>			
			<div class="clearfix"></div>
		</header>
	</div>
<script type="text/javascript">
    $( document ).ready(function() {
     $( "header .share-icn" ).click(function(e) {
         $('header .soci-icn').not($(this).next( "header .soci-icn" )).each(function(){
            $(this).removeClass("active");
         });
     
            $(this).next( "header .soci-icn" ).toggleClass( "active" );
    });   
});
</script>