<?php global $syrus; ?>
<?php do_action( 'head_theme_before_head' ); ?>

<style media="screen">
	#site-navigation .main-menu .nav-item.main-menu::after, #site-navigation .main-menu .nav-item.main-menu:hover::after{
		background-color: <?php echo $args['bg_color_after_main_menu']; ?> !important;
	}

	.contenitore-motto {
		background-color:<?php echo $args['background_color_motto']; ?>;
	}
</style>

<div class="container-fluid p-2 contenitore-motto">
	<div class="row w-100">
		<div class="col-12 text-center">
			<?php echo $args['set_motto'] ?>
		</div>
	</div>
</div>

<div class="container-fluid">
	<div class="row">
		<div class="col-12 text-center p-3">
			<?php do_action( 'head_theme_before_title' ); ?>
			<a href="/" title="Syrus #Blog">
				<img  class="img-fluid" src="<?php echo $args['set_image'] ?>" alt="Syrus Blog" width="289" height="48">
			</a>
			<?php do_action( 'head_theme_after_title' ); ?>
		</div>
	</div>
</div>

<?php do_action( 'head_theme_before_menu' ); ?>
<div class="main-menu-container">
	<nav id="site-navigation" class="navbar navbar-default navbar-center p-0" style="background-color:<?php echo $args['bg_color_main_menu']; ?>;">
		<div class="container justify-content-center">
			<div class="navbar-header w-75">
				<div class="row main-menu justify-content-center">
					<?php if($syrus->has_nav_menu('syrus-theme-main-menu')){
							$menu_items = wp_get_nav_menu_items($syrus->get_current_main_menu_name());
							$menu_items = wp_is_mobile() ? [$menu_items[0],$menu_items[1]] : $menu_items;
							$menu_items = is_array($menu_items) ? $menu_items : [];
							foreach($menu_items as $index => $menu_item){
								if($index == (int) (count($menu_items) / 2) && !wp_is_mobile() && $args['main_menu_img']){ ?>
									<div class="col-2 center-image nav-item main-menu d-flex justify-content-center position-relative">
										<a href="<?php echo get_home_url() ;?>">
											<img class="main-menu-img" src="<?php echo $args['main_menu_img']; ?>" alt="main-menu-img">
										</a>
									</div>
								<?php } ?>
							<div class="col-6 col-md-2 p-2 p-md-0 nav-item main-menu d-flex align-items-center justify-content-center position-relative">
								<a href="<?php echo $menu_item->url ;?>" style="color: <?php echo $args['text_color_main_menu']; ?>;">
									<?php echo $menu_item->title; ?>
								</a>
							</div>
					<?php } } else if(current_user_can( 'manage_options' )) { ?>
						<div class="col-4 d-flex p-2 p-md-0 nav-item main-menu d-flex align-items-center justify-content-center position-relative nav-item main-menu">
							<a href="<?php echo admin_url('nav-menus.php') ?>" class="text-white">
								<?php _e("Add a menu",'syrus') ?>
							</a>
						</div>
					<?php } ?>
				</div>
			</div>
		</div>
		<?php do_action( 'head_theme_menu' ); ?>
	</nav>
</div>
<?php do_action( 'head_theme_after_menu' ); ?>
