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

?>
<header id="masthead" class="site-header header-1">
	<div class="fixed-top <?php echo esc_attr( wpstream_theme_transparent_header_class() ); ?>">
		<nav id="nav-main" class="navbar navbar-expand-xl">
			<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' );
	                if ( $retina_logo ) {
		                $retina_logo = $retina_logo[0];
	                }
                }

				if ( $logo_id ) {
                    $logo = wp_get_attachment_image_src( $logo_id, 'full' );
					if ( $logo ) {
                        $logo = $logo[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.php'; ?>

				<div class="header-actions d-flex align-items-center">

					<!-- 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-xl-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';
	?>


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

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