<?php
/**
 * Header type 3 template
 *
 * @package wpstream-theme
 */

?>

<header id="masthead" class="site-header header-3">
	<div class="fixed-top <?php echo esc_attr( wpstream_theme_transparent_header_class() ); ?>">
		<nav id="nav-main" class="navbar navbar-expand-lg">
			<div class="<?php echo esc_attr( wpstream_theme_header_container_class() ); ?>">

				<!-- Navbar Brand -->
				<?php
				$logo = $retina_logo ='';

				if (wpstream_theme_is_transparent_header()){
					$logo_id = get_theme_mod( 'wpstream_theme_transparent_header_logo' );
					$retina_logo_id = get_theme_mod('wpstream_theme_transparent_header_retina_logo');
				} else{
					$logo_id = get_theme_mod( 'custom_logo' );
					$retina_logo_id = get_theme_mod('wpstream_theme_header_retina_logo');
				}

				if ($retina_logo_id){
					$retina_logo = wp_get_attachment_image_src( $retina_logo_id, 'full' )[0];
				}

				if ( $logo_id ) {
					$logo = wp_get_attachment_image_src( $logo_id, 'full' )[0];
				}

				?>

                <a class="navbar-brand xs d-md-none" href="<?php echo esc_url( home_url() ); ?>">
                  
					<?php if (!empty($logo)): ?>
						<img src="<?php echo esc_url( $logo ); ?>" alt="logo" class="logo xs">
      	  			<?php endif; ?>


					<?php if (!empty($retina_logo)): ?>
                        <img src="<?php echo esc_url( $retina_logo ); ?>" alt="logo" class="logo logo-retina">
					<?php endif; ?>
                </a>
                <a class="navbar-brand md d-none d-md-block" href="<?php echo esc_url( home_url() ); ?>">
                   

					<?php if (!empty($logo)): ?>
						<img src="<?php echo esc_url( $logo ); ?>" alt="logo" class="logo md">
      	  			<?php endif; ?>

					<?php if (!empty($retina_logo)): ?>
                        <img src="<?php echo esc_url( $retina_logo ); ?>" alt="logo" class="logo logo-retina">
					<?php endif; ?>
                </a>

				<!-- Offcanvas Navbar --> 
				<?php require get_template_directory() . '/template-parts/header-templates/header-offcanvas-navigation-type3.php'; ?>

				<div class="header-actions d-flex align-items-center">
					
					<!-- Top Nav 2 Widget -->
					<?php if ( is_active_sidebar( 'top-nav-2' ) ) : ?>
						<?php dynamic_sidebar( 'top-nav-2' ); ?>
					<?php endif; ?>
					<!-- Search Toggler -->
					<?php
					$wpstream_theme_display_search_icon = get_theme_mod( 'wpstream_theme_display_search_icon', true);
					if( $wpstream_theme_display_search_icon ){
						require get_template_directory() . '/template-parts/header-templates/header-search-section.php';
					}
					?>



					<!-- Top Nav Widget -->
					<?php if ( is_active_sidebar( 'top-nav' ) ) : ?>
						<?php dynamic_sidebar( 'top-nav' ); ?>
					<?php endif; ?>

					<!-- Mini Cart Toggler -->
					<?php
					$wpstream_theme_display_cart_icon = get_theme_mod( 'wpstream_theme_display_cart_icon', true );
					if ( wpstream_check_woo_active() && $wpstream_theme_display_cart_icon ) {
						include get_template_directory() . '/template-parts/header-templates/header-cart-icon-section.php';
					}
					?>

					<!-- User Toggler -->
					<?php
					require get_template_directory() . '/template-parts/header-templates/header-user-icon-section.php';
					?>

					<!-- Navbar Toggler -->
					<button class="btn btn-outline-secondary d-lg-none wp-stream-toggle-btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-navbar" aria-controls="offcanvas-navbar">
						<?php echo wpstream_theme_get_svg_icon( 'menu-burger.svg' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
						<span class="visually-hidden-focusable"><?php esc_html_e( 'Menu', 'hello-wpstream' ); ?></span>
					</button>

				</div><!-- .header-actions -->

			</div><!-- wpstream_theme_container_class(); -->

		</nav><!-- .navbar -->



	</div><!-- .fixed-top .bg-light -->

			<!-- offcanvas user -->
	<?php
	require get_template_directory() . '/template-parts/header-templates/header-offcanvas-menu-container.php';

	if ( wpstream_check_woo_active() ) {
		include get_template_directory() . '/template-parts/header-templates/header-cart-template.php';
	}
	?>

</header><!-- #masthead -->