<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<?php get_template_part( 'template-parts/head' ); ?>
</head>

<body <?php body_class("page-body"); ?>>
    <div class="wrapper" id="app">
        <div class="content">
            <?php
            //Header check templates
            $tpl_arrays = array('tpl-about.php');

            if (is_page_template($tpl_arrays) || is_singular('post')) {
                $header_type = 'header-light';
            } else {
                $header_type = 'header-default';
            }
            ?>

            <header class="page-header <?php echo $header_type; ?> js-header">
                <div class="page-header__wrap">

                    <div id="nav-icon" class="page-header__nav-icon js-menu-btn">
                        <span></span>
                        <span></span>
                        <span></span>
                        <span></span>
                    </div>

                    <div class="page-header__logo">
                        <?php if($header_type == 'header-default'): ?>
                            <a class="light" href="<?php echo esc_url(home_url('/')); ?>" rel="home">
                                <?php $logo = get_field('header_logo_light', 'option');
                                if (!empty($logo)): ?>
                                    <img src="<?php echo esc_url($logo['url']); ?>"
                                         alt="<?php echo esc_attr($logo['alt']); ?>"/>
                                <?php endif; ?>
                            </a>
                        <?php endif; ?>
                        <?php if($header_type == 'header-light'): ?>
                            <a class="dark" href="<?php echo esc_url(home_url('/')); ?>" rel="home">
                                <?php $logo_dark = get_field('header_logo', 'option');
                                if (!empty($logo_dark)): ?>
                                    <img src="<?php echo esc_url($logo_dark['url']); ?>"
                                         alt="<?php echo esc_attr($logo_dark['alt']); ?>"/>
                                <?php endif; ?>
                            </a>
                            <a class="light" href="<?php echo esc_url(home_url('/')); ?>" rel="home">
                                <?php $logo_light = get_field('header_logo_light', 'option');
                                if (!empty($logo_light)): ?>
                                    <img src="<?php echo esc_url($logo_light['url']); ?>"
                                         alt="<?php echo esc_attr($logo_light['alt']); ?>"/>
                                <?php endif; ?>
                            </a>
                        <?php endif; ?>
                    </div>

                    <div class="empty-block"></div>

                    <div class="page-header__links js-main-nav">
                        <div class="page-header__links-wrap ">
                            <nav class="main-nav" role="navigation">
                                <?php wp_nav_menu( array( 'theme_location' => 'menu-1', 'menu_class' => 'main-nav__list', 'container' => false, 'link_before'     => '<div class="menu-item-wrap">', 'link_after'      => '<div class="dropdown-btn js-dropdown-btn"></div></div>', 'walker' => new Custom_Walker_Nav_Menu) ); ?>
                            </nav>

                            <div class="page-header__buttons header-buttons">
                                <?php
                                $link = get_field('header_login_button', 'option');
                                if( $link ):
                                    $link_url = $link['url'];
                                    $link_title = $link['title'];
                                    $link_target = $link['target'] ? $link['target'] : '_self';
                                    ?>
                                    <a class="header-buttons__login" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>">
                                        <div class="custom-menu-item">
                                            <span><?php echo esc_html( $link_title ); ?></span>
                                            <span><?php echo esc_html( $link_title ); ?></span>
                                        </div>
                                    </a>
                                <?php endif; ?>

                                <?php
                                $link = get_field('header_contact_button', 'option');
                                if( $link ):
                                    $link_url = $link['url'];
                                    $link_title = $link['title'];
                                    $link_target = $link['target'] ? $link['target'] : '_self';
                                    ?>
                                    <a class="header-buttons__contact animated-button" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?></a>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>

                </div>
            </header>
