<?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 WordPress
 * @subpackage NeatNote
 * @since 1.0.0
 */
?>
<!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(); ?>
	<header id="masthead">
		<a class="screen-reader-text skip-link" href="#neatnote-main-content"><?php esc_html_e('Skip to content', 'neatnote'); ?><span class="screen-reader-text"><?php esc_html_e('Skip to content', 'neatnote'); ?></span></a>
		<?php
		$neatnote_header_logo = get_theme_mod('neatnote_header_logo');
		$sticky_header_enabled = get_theme_mod('neatnote_sticky_header_enable', false);
		?>
		<div class="NeatNote-headerSection NeatNote-altBg NeatNote-uppercase <?php echo $sticky_header_enabled ? __("neatnote-fixedheader", 'neatnote') : ''; ?>" <?php echo wp_kses(get_header_image(), 'neatnote') ? 'style="background-image: url(' . esc_url(get_header_image(), 'neatnote') . ');background-position: center top; background-size: cover;"' : "" ?>>
			<div class="NeatNote-wrapper">
				<div class="NeatNote-LogoMenuMain">
					<?php if ($neatnote_header_logo): ?>
						<div class="NeatNote-headerlogo NeatNote-ib">
							<a href="<?php echo esc_url(home_url('/')); ?>">
								<img src='<?php echo esc_url($neatnote_header_logo); ?>' alt='<?php echo esc_attr(get_bloginfo('name')); ?>'>
							</a>
						</div>
					<?php elseif (has_custom_logo()): ?>
						<div class="NeatNote-headerlogo NeatNote-ib">
							<a href="<?php echo esc_url(home_url('/')); ?>"><?php the_custom_logo(); ?></a>
						</div>
					<?php else: ?>
						<div class="NeatNote-headerlogo NeatNote-ib">
							<h4><a href="<?php echo esc_url(home_url('/')); ?>"><?php echo esc_html__(get_bloginfo('name')); ?></a></h4>
						</div>
					<?php endif; ?>

					<div class="NeatNote-MenuMain NeatNote-text-right NeatNote-ib">
						<div class="NeatNote-menubar NeatNote-custom-menu-primary">
							<div class="NeatNote-menuParent">
								<div class="neatnote_navbar neatnote_noListStyle" aria-label="<?php esc_attr_e('Top Menu', 'neatnote'); ?>">
									<?php
									$menu_name = 'neatnote-header-menu';
									$locations = get_nav_menu_locations();
									$menu_exists = isset($locations[$menu_name]) && $locations[$menu_name] != 0;
									if ($menu_exists) {
										wp_nav_menu(
											array(
												'theme_location' => $menu_name,
												'menu_class' => 'NeatNote-header-menu-main',
												'container' => false,
												'items_wrap' => '<ul id="neatnote-%1$s" class="%2$s">%3$s</ul>',
												'walker' => new Neatnote_main_menu_Walker_Nav_Menu(),
											)
										);
									} else {
										echo '<ul class="NeatNote-header-menu-main">';
										$pages = get_pages();
										foreach ($pages as $page) {
											$page_title = $page->post_title;
											$page_url = get_permalink($page->ID);
									?>
											<li>
												<a href="<?php echo esc_url($page_url); ?>">
													<?php echo esc_html(sprintf(__('%s', 'neatnote'), $page_title)); ?>
												</a>
											</li>
									<?php
										}
										echo '</ul>';
									}
									?>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</header>
	<div id="neatnote-main-content" class="main-contnet ">