<?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 Photo Gallery
 */
?>

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>

<meta http-equiv="Content-Type" content="<?php echo esc_attr(get_bloginfo('html_type')); ?>; charset=<?php echo esc_attr(get_bloginfo('charset')); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.2, user-scalable=yes" />

<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>

<?php
	if ( function_exists( 'wp_body_open' ) )
	{
		wp_body_open();
	}else{
		do_action('wp_body_open');
	}
?>
<?php 
if( get_theme_mod('photo_gallery_preloader_hide', false ) == true ){ 

	$photo_gallery_type = get_theme_mod('photo_gallery_preloader_type','diamond');
?>
<div class="frame">
	<div class="loader preloader-types">

		<?php if($photo_gallery_type == 'diamond'){ ?>

			<div class="preloader">
				<div class="diamond">
					<span></span>
					<span></span>
					<span></span>
				</div>
			</div>

		<?php } elseif($photo_gallery_type == 'orbit'){ ?>

			<div class="orbit-loader">
				<div class="orbit-center"></div>
				<div class="orbit-ring">
					<span></span>
					<span></span>
					<span></span>
				</div>
			</div>

		<?php } elseif($photo_gallery_type == 'liquid'){ ?>

			<div class="liquid-loader">
				<div class="liquid-blob"></div>
			</div>

		<?php } ?>

	</div>
</div>
<?php } ?>

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

<header id="site-navigation" class="header py-2 <?php if( get_theme_mod( 'photo_gallery_sticky_header','on') != '') { ?>sticky-header<?php } else { ?>close-sticky <?php } ?>">
	<div class="container">
		<div class="row">
			<div class="col-lg-3 col-md-3 col-sm-4 col-12 align-self-center">
				<div class="logo text-center text-sm-start mb-3 mb-md-0">
					<div class="logo-image text-center text-sm-start">
						<?php the_custom_logo(); ?>
					</div>
					<div class="logo-content text-center text-sm-start">
						<?php
							if ( get_theme_mod('photo_gallery_display_header_title', true) == true ) :
								echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name')) . '">';
								echo esc_attr(get_bloginfo('name'));
								echo '</a>';
							endif;
							if ( get_theme_mod('photo_gallery_display_header_text', false) == true ) :
								echo '<span>'. esc_attr(get_bloginfo('description')) . '</span>';
							endif;
						?>
					</div>
				</div>
			</div>
			<div class="col-lg-9 col-md-9 col-sm-8 col-12 align-self-center">
				<div class="row bottom-header py-2">
					<div class="col-lg-10 col-md-10 col-sm-6 col-6 align-self-center text-center">
						<button class="menu-toggle" aria-controls="top-menu" aria-expanded="false" type="button">
							<span aria-hidden="true"><i class="fa-solid fa-bars"></i></span>
						</button>
						<nav id="main-menu" class="close-panal">
							<?php
								wp_nav_menu( array(
									'theme_location' => 'main-menu',
									'container' => false
								));
							?>
							<button class="close-menu my-2 p-2" type="button">
								<span aria-hidden="true"><i class="fa fa-times"></i></span>
							</button>
						</nav>
					</div>
					<div class="col-lg-2 col-md-2 col-sm-6 col-6 align-self-center text-center px-2">
						<div class="toggle-btn">
							<a class="sidebar-toggle" id="sidebar-pop" href="#"><i class="fas fa-bars"></i></a>
						</div>
					</div>
					<div class="header-sidebar">
						<div class="close-pop"><a href="#content"><i class="fas fa-window-close"></i></a></div>
						<div class="menu-drawer">
							<div class="logo-collapse">
								<div class="logo-sidebar text-start mb-3 mb-md-0">
									<div class="logo-image text-start">
										<?php the_custom_logo(); ?>
									</div>
									<div class="logo-content text-start">
										<?php
											if ( get_theme_mod('photo_gallery_display_header_title', true) == true ) :
												echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name')) . '">';
												echo esc_attr(get_bloginfo('name'));
												echo '</a>';
											endif;
											if ( get_theme_mod('photo_gallery_display_header_text', false) == true ) :
												echo '<span>'. esc_attr(get_bloginfo('description')) . '</span>';
											endif;
										?>
									</div>
								</div>
							</div>
							<div class="row">
								<?php if ( get_theme_mod('photo_gallery_header_text')) : ?>
									<p><?php echo esc_html( get_theme_mod('photo_gallery_header_text' ) ); ?></p>
								<?php endif; ?>
							</div>
							<div class="row">
								<?php if ( get_theme_mod('photo_gallery_header_location_text')) : ?>
									<p class="topheader-location"><a href="<?php echo esc_url( get_theme_mod('photo_gallery_header_location'));?>" target="_blank"><i class="fas fa-map-marker-alt me-2"></i><?php echo esc_html( get_theme_mod('photo_gallery_header_location_text' ) ); ?></a></p>
								<?php endif; ?>
							</div>
							<div class="row">
								<?php if (get_theme_mod('photo_gallery_header_email_address') ) : ?>
									<p class="topheader-email" ><a href="mailto:<?php echo esc_html( get_theme_mod('photo_gallery_header_email_address' ) ); ?>"><i class="fa-solid fa-envelope-open-text me-2"></i><?php echo esc_html( get_theme_mod('photo_gallery_header_email_address' ) ); ?></a></p>
								<?php endif; ?>
							</div>
							<div class="row">
								<?php if ( get_theme_mod('photo_gallery_header_phone_number') ) : ?>
									<p class="topheader-phone"><a href="tel:<?php echo esc_attr( get_theme_mod('photo_gallery_header_phone_number' ) ); ?>"><i class="fas fa-phone me-2"></i><?php echo esc_html( get_theme_mod('photo_gallery_header_phone_number' ) ); ?></a></p>
								<?php endif; ?>
							</div>
							<div class="row media-div">
								<?php $photo_gallery_settings = get_theme_mod( 'photo_gallery_social_links_settings' ); ?>
								<div class="social-links">
									<?php if ( is_array($photo_gallery_settings) || is_object($photo_gallery_settings) ){ ?>
										<?php foreach( $photo_gallery_settings as $photo_gallery_setting ) { ?>
											<a href="<?php echo esc_url( $photo_gallery_setting['link_url'] ); ?>" target="_blank">
												<i class="<?php echo esc_attr( $photo_gallery_setting['link_text'] ); ?> me-2"></i>
											</a>
										<?php } ?>
									<?php } ?>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</header>