<?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 pixigo
 * phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
 */

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

	<?php $theme_color = sanitize_hex_color( get_theme_mod( 'pixigo_theme_color' ) ); ?>
	<!-- Chrome, Firefox OS and Opera -->
	<meta name="theme-color" content="<?php echo esc_html( $theme_color ); ?>">
	<!-- Windows Phone -->
	<meta name="msapplication-navbutton-color" content="<?php echo esc_html( $theme_color ); ?>">
	<!-- iOS Safari -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

	<?php if ( ! pixigo_is_amp() ) : ?>
		<script>document.documentElement.classList.remove("no-js");</script>
	<?php endif; ?>

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

<body <?php body_class(); ?>>
<div id="page" class="site">

	<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'pixigo' ); ?></a>

		<header id="masthead" class="site-header" itemscope itemtype="http://schema.org/WPHeader">

			<div class="site-branding">

				<?php
				if ( ! has_custom_logo() ) : // No custom logo? Show the site name.

					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 : ?>
						<h4 class="site-title">
							<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
								<?php bloginfo( 'name' ); ?>
							</a>
						</h4>
					<?php
					endif;

					$pixigo_description = get_bloginfo( 'description', 'display' );
					if ( '' !== $pixigo_description || is_customize_preview() ) :
						?>
						<p class="site-description"><?php echo esc_html( $pixigo_description ); ?></p>
						<?php
					endif;

				else :
					the_custom_logo();
				endif;
				?>

			</div><!-- .site-branding -->

			<nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Main menu', 'pixigo' ); ?>"
				<?php if ( pixigo_is_amp() ) : ?>
					[class]=" siteNavigationMenu.expanded ? 'main-navigation toggled-on' : 'main-navigation' "
				<?php endif; ?>
				itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation"
			>
				<?php if ( pixigo_is_amp() ) : ?>
					<amp-state id="siteNavigationMenu">
						<script type="application/json">
							{
								"expanded": false
							}
						</script>
					</amp-state>
				<?php endif; ?>

				<button class="menu-toggle" aria-label="<?php esc_attr_e( 'Open menu', 'pixigo' ); ?>" aria-controls="primary-menu" aria-expanded="false"
					<?php if ( pixigo_is_amp() ) : ?>
						on="tap:AMP.setState( { siteNavigationMenu: { expanded: ! siteNavigationMenu.expanded } } )"
						[aria-expanded]="siteNavigationMenu.expanded ? 'true' : 'false'"
					<?php endif; ?>
				>
					<?php esc_html_e( 'Menu', 'pixigo' ); ?>
				</button>

				<div class="primary-menu-container">
					<?php

					wp_nav_menu(
						array(
							'theme_location' => 'header',
							'menu_id'        => 'primary-menu',
							'container'      => 'ul',
							'depth'          => 3,
						)
					);

					?>
				</div>
			</nav><!-- #site-navigation -->
		</header><!-- #masthead -->
