<?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 Tamal_Portfolio
 */
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="https://gmpg.org/xfn/11">
	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
	<?php wp_body_open(); ?>
    <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'tamal-portfolio' ); ?></a>

    <!-- start header-->
    <section class="header w-25 d-flex align-content-center flex-column lazy">
        <div class="header__one mb-0 mb-lg-3">
            <div class="d-flex justify-content-center position-relative align-items-center flex-row flex-lg-column">
                <a class="header__button-menu d-inline-flex d-lg-none" href="#"></a>
                <?php if ( has_custom_logo() ) : ?>
                    <div class="site-logo">
                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
                            <?php the_custom_logo(); ?>
                        </a>
                    </div>
                <?php else : ?>
                    <?php
                        $logo_text = get_theme_mod( 'logo_text', 'T' );
                    ?>
                    <div class="site-identity">
                        <?php if ( is_front_page() || is_home() ) : ?>
                            <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><h1 class="site-title header__logo m-0"><?php echo esc_html($logo_text); ?></h1></a>
                        <?php else : ?>
                            <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><h2 class="site-title header__logo m-0"><?php echo esc_html($logo_text); ?></h2></a>
                        <?php endif;  ?>
                    </div>
                <?php endif; ?>
                <a class="button-dark-mode d-block d-lg-none"><i class="icofont-moon"></i></a>
            </div>
        </div>
        <div class="header__two d-flex flex-column justify-content-between flex-grow-1 flex-shrink-1">
            <div class="header__menu mt-auto mt-lg-0 d-flex flex-column justify-content-center align-items-center">
                <div class="header__nav">
                    <?php
                    if ( has_nav_menu( 'primary' ) ) {
                        wp_nav_menu(
                            array(
                                'theme_location' => 'primary',
                                'menu_class'     => 'header__navigation nav d-flex flex-column'
                            )
                        );
                    }
                    ?>
                </div>
                <a class="mt-3 mt-md-5 button-dark-mode" href=""><i class="icofont-moon"></i></a>
            </div>
            <div class="header__social mt-1 mt-md-auto mb-1 mb-md-5 mb-lg-0">
                <div class="container-xl">
                    <?php $social = json_to_array(get_theme_mod( 'tamal_portfolio_left_social' )); ?>
                    <?php if( !empty( $social ) ): ?>
                    <ul class="social d-flex justify-content-center pb-2">
                        <?php foreach ( $social as $item ): ?>
                            <li class="li-<?php echo esc_attr($item['icon_value']) ?>"> <a style="--hover-color: <?php echo esc_attr($item['color']) ?>" class="" href="<?php echo esc_attr($item['link']) ?>" target="_blank" rel="alternate" title="<?php echo esc_attr($item['icon_value']) ?>"> <i class="fa <?php echo esc_attr($item['icon_value']) ?>"></i></a></li>
                        <?php endforeach; ?>
                    </ul>
                    <?php endif; ?>
                    <?php
                        $left_below_text = get_theme_mod( 'tamal_portfolio_left_below_text', 'Copyright © 2022 All rights reserved.' );
                    ?>
                    <div class="header__copywriter text-center pb-4">
                        <?php echo esc_html($left_below_text); ?>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- end header-->

