<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">

<?php
?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://cdn-ru.bitrix24.ru">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="//api-maps.yandex.ru">
<link rel="dns-prefetch" href="//mod.gudok.tel">
<?php
// ─────────────────────────────────────────────────────────────────────
// PRELOAD 
// ─────────────────────────────────────────────────────────────────────
?>
<link rel="preload" as="image"
    href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/logo-svg.svg"
    type="image/svg+xml">

<?php
// ─────────────────────────────────────────────────────────────────────
// PRELOAD LCP
// ─────────────────────────────────────────────────────────────────────
if ( is_front_page() ) {
    $post_id     = get_the_ID();
    $foto_id     = carbon_get_post_meta( $post_id, 'banner_img_desktop' );
    $foto_mob_id = carbon_get_post_meta( $post_id, 'banner_img_mobile' );
    if ( ! $foto_mob_id ) $foto_mob_id = $foto_id;

    $banner_desk = $foto_id     ? wp_get_attachment_url( $foto_id )     : '';
    $banner_mob  = $foto_mob_id ? wp_get_attachment_url( $foto_mob_id ) : '';

    if ( $banner_desk ) {
        echo '<link rel="preload" as="image" href="' . esc_url( $banner_desk ) . '" media="(min-width: 860px)" fetchpriority="high">' . "\n";
    }
    if ( $banner_mob && $banner_mob !== $banner_desk ) {
        echo '<link rel="preload" as="image" href="' . esc_url( $banner_mob ) . '" media="(max-width: 859px)" fetchpriority="high">' . "\n";
    }
}
?>

<?php
// ─────────────────────────────────────────────────────────────────────
// CSS12
// ─────────────────────────────────────────────────────────────────────
?>
<link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/reset.css" media="all">
<link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/css/main.css" media="all">

<link rel="preload" as="style"
    href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css"
    onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css"></noscript>

<?php
// Google Fonts 
?>
<link rel="preload" as="style"
    href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Oswald:wght@300;400;700&family=Fredoka:wght@400;500;600;700&family=Manrope:wght@700;800&family=Montserrat:wght@800&family=Poppins:wght@500;600;900&display=swap"
    onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Oswald:wght@300;400;700&family=Fredoka:wght@400;500;600;700&family=Manrope:wght@700;800&family=Montserrat:wght@800&family=Poppins:wght@500;600;900&display=swap"></noscript>

<?php

?>


<script src="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js" defer></script>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/js/add.js" defer></script>

<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<?php if (function_exists('wp_body_open')) wp_body_open(); ?>

<header class="header">
    <nav class="header-nav" aria-label="Основная навигация">
        <div class="top-header-row">

            <a class="header-logo" href="<?php echo esc_url( home_url('/') ); ?>">
                <img width="136" height="40"
                    src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/logo-svg.svg"
                    alt="<?php esc_attr_e('Декарт — частная школа в Щелково', 'dekart'); ?>"
                    loading="eager"
                    fetchpriority="high">
            </a>

            <div class="mobile icon-links">
                <a href="<?php echo esc_url( carbon_get_theme_option('social_header_wt') ); ?>"
                   target="_blank" rel="noopener noreferrer"
                   aria-label="Написать в WhatsApp">
                    <img width="18" height="18"
                        src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/icon-whatsapp-w.svg"
                        alt="WhatsApp" loading="lazy">
                </a>
                <a href="tel:<?php echo preg_replace('/[^0-9+]/', '', carbon_get_theme_option('site_phone')); ?>"
                   aria-label="Позвонить нам">
                    <img width="18" height="18"
                        src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/phone-volume.svg"
                        alt="Телефон" loading="lazy">
                </a>
                <a href="<?php echo esc_url( carbon_get_theme_option( 'site_lk_url' ) ?: 'https://lk.dekart-school.ru/' ); ?>" target="_blank" rel="noopener noreferrer"
                   aria-label="Личный кабинет">
                    <img width="18" height="18"
                        src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/icon-user-w.svg"
                        alt="Личный кабинет" loading="lazy">
                </a>
                <button class="burger-btn"
                    aria-label="<?php esc_attr_e('Открыть меню', 'dekart'); ?>"
                    aria-expanded="false"
                    aria-controls="main-menu">
                    <span></span><span></span><span></span>
                </button>
            </div>

            <div class="add-menu desktop">
                <div class="add-menu_item">
<img width="15" height="25"
    src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/icon-location.svg"
    alt="Адрес" loading="lazy">
                    <span><?php echo esc_html( carbon_get_theme_option('site_address') ); ?></span>
                </div>
                <a target="_blank" rel="noopener noreferrer"
                   href="<?php echo esc_url( carbon_get_theme_option('social_header_wt') ); ?>"
                   style="margin-right:-15px"
                   aria-label="Написать в WhatsApp">
                    <img width="19" height="21"
                        src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/icon-whatsap.svg"
                        alt="WhatsApp" loading="lazy">
                </a>
                <a class="add-menu_item header-tel"
                   href="tel:<?php echo preg_replace('/[^0-9+]/', '', carbon_get_theme_option('site_phone')); ?>">
                    <span><?php echo esc_html( carbon_get_theme_option('site_phone') ); ?></span>
                </a>
                <button class="btn-free-lesson-header btn-primary desktop btn-write">
                    <?php esc_html_e('Записаться на бесплатное', 'dekart'); ?>
                </button>
            </div>

        </div>

        <div class="bottom-header-row">
            <div class="menu-wrapper" id="main-menu" role="navigation">
                <img width="42" height="42"
                    class="icon-close-menu btn-close-header-menu mobile"
                    src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/btn-close-modal_.svg"
                    alt="<?php esc_attr_e('Закрыть меню', 'dekart'); ?>"
                    loading="lazy">
                <?php
                wp_nav_menu( array(
                    'menu'           => 'Основное меню',
                    'menu_class'     => 'header-menu',
                    'theme_location' => 'top',
                ) );
                ?>
                <button class="btn-free-lesson-header btn-primary mobile btn-write">
                    <?php esc_html_e('Записаться на бесплатное', 'dekart'); ?>
                </button>
                <button class="btn-close-menu btn-close-header-menu mobile">
                    <?php esc_html_e('ЗАКРЫТЬ МЕНЮ', 'dekart'); ?>
                </button>
            </div>
            <a class="inter-lk desktop" href="<?php echo esc_url( carbon_get_theme_option( 'site_lk_url' ) ?: 'https://lk.dekart-school.ru/' ); ?>" target="_blank" rel="noopener noreferrer">
<img width="18" height="23"
    src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/icon-user.svg"
    alt="Личный кабинет" loading="lazy">
                <span><?php esc_html_e('Личный кабинет', 'dekart'); ?></span>
            </a>
        </div>

    </nav>
</header>