<?php
if (! defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}
$header_height = get_theme_mod('welding_for_elementor_header_height', '72px');
$sticky_header = get_theme_mod('welding_for_elementor_header_sticky', 'on');
$button_switch = get_theme_mod('welding_for_elementor_button_switch', 'on');
$button_text = get_theme_mod('welding_for_elementor_button_text',  esc_html__('CONTACT US', 'welding-for-elementor'));
$button_url = get_theme_mod('welding_for_elementor_button_url');
?>
<!-- Header start here -->
<header>
    <div class="tr-header-area" style="height: <?php echo esc_attr($header_height); ?>; <?php if (!$sticky_header) : ?>position: relative;   <?php endif; ?>;">
        <div class="container tr-header-container">
            <div class="row align-items-center tr-header-row justify-content-between">
                <div class="col-6 col-sm-6 col-md-4 col-lg-3">
                    <div class="tr-header-logo">
                        <?php if (function_exists('the_custom_logo') && has_custom_logo()) : ?>
                            <div class="site-logo"><?php the_custom_logo(); ?></div>
                        <?php else : ?>
                            <a class="site-title" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
                        <?php endif; ?>
                    </div>
                </div>
                <?php if ($button_switch): ?>
                    <div class="col-lg-6 d-none d-lg-block">
                        <div class="tr-header-menu d-flex justify-content-center">
                        <?php else: ?>
                            <div class="col-lg-9 d-none d-lg-block">
                                <div class="tr-header-menu d-flex justify-content-end">
                                <?php endif; ?>
                                <nav>
                                    <?php welding_for_elementor_main_menu() ?>
                                </nav>
                                </div>
                            </div>
                            <?php if ($button_switch): ?>
                                <div class="col-lg-3 d-none d-lg-block">
                                    <div class="tr-header-btn text-lg-end mt-16 mb-16">
                                        <a href="<?php echo esc_url($button_url); ?>" class="tr-btn"><?php echo esc_html($button_text) ?></a>
                                    </div>
                                </div>
                            <?php endif; ?>
                            <div class="tr-nav-toogle col-2 d-flex justify-content-center d-lg-none">
                                <button class="tr-nav-toogle-btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#tr-offcanvas" aria-controls="tr-offcanvas" aria-label="<?php echo esc_attr__('Open menu', 'welding-for-elementor'); ?>"><i class="fa fa-bars"></i></button>
                            </div>
                        </div>
                    </div>


            </div>
</header>
<!-- Header end here -->

<!-- Offcanvas menu start here -->
<div class="offcanvas offcanvas-end tr-offcanvas-menu-wrapper" tabindex="-1" id="tr-offcanvas">
    <div class="offcanvas-header tr-offcanvas-menu-header mb-40">
        <div class="tr-offcanvas-menu-header-logo">
            <?php if (function_exists('the_custom_logo') && has_custom_logo()) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
            <?php else : ?>
                <a class="site-title" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
            <?php endif; ?>
        </div>
        <div class="tr-offcanvas-menu-header-close">
            <button type="button" class="tr-offcanvas-menu-header-close-btn" data-bs-dismiss="offcanvas" aria-label="<?php echo esc_attr__('Close', 'welding-for-elementor'); ?>"><i class="fa fa-times"></i></button>
        </div>
    </div>
    <div class="offcanvas-body tr-offcanvas-menu-body">
        <nav>
            <?php welding_for_elementor_mobile_menu() ?>
        </nav>
    </div>
</div>
<!-- Offcanvas menu end here  -->
<?php
