<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width">
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">

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


<?php
echo(get_field( 'yandex_metrics', 'option' ));
$room = get_current_room();
$base_classes = 'bg-[#f9f9f9] dark:bg-[#f4f4f4] text-[#222]';

if ($room === 'gym') {
    $body_classes = $base_classes . ' dark';
} else {
    $body_classes = $base_classes;
}
?>

<body <?php body_class($body_classes); ?>>

<?php do_action('tailpress_site_before'); ?>

<div id="page" class="min-h-screen flex flex-col">
    <?php do_action('tailpress_header'); ?>

    <header class="container mx-auto absolute left-0 right-0 z-[49] <?php echo is_admin_bar_showing() ? 'top-[32px]' : 'top-0'; ?>"
            id="site-header">
        <div class="pt-[24px] max-[768px]:pb-[22px] dark:text-[#f8f8f8]">

            <div>
                <div class="max-[768px]:flex-wrap max-[768px]:gap-[16px] max-[1200px]:justify-start max-[1200px]:gap-[12px] flex justify-between items-center">
                    <a href="<?php echo esc_url(home_url('/')); ?>">
                        <?php display_icon(get_current_room() === 'gym' ? 'dark_logo' : 'light_logo'); ?>
                    </a>
                    <div class="max-[768px]:flex-col max-[768px]:items-start max-[768px]:gap-0 max-[768px]:w-full max-[768px]:order-1 flex items-center gap-[6px] dark:text-[#fff]">
                        <?php get_template_part('template-parts/la-components/language-switcher'); ?>
                        <span class="max-[768px]:mx-auto max-[768px]:max-w-full text-[12px] font-[500] max-[768px]:text-[14px] max-w-[60px] max-[768px]:[&>br]:hidden">Переключайте <br> формат</span>
                    </div>
                    <div class="max-[1200px]:hidden flex items-center gap-[12px]">
                        <div class="w-[8px] h-[8px] rounded-full bg-[#e21e24]"></div>
                        <div class="leading-[125%] text-[14px] font-[600]">
                            <p>г. Томск, </p>
                            <p>ул. Красноармейская, 120</p>
                        </div>
                    </div>
                    <div class="max-[1200px]:hidden flex items-center gap-[12px]">
                        <div class="w-[8px] h-[8px] rounded-full bg-[#e21e24]"></div>
                        <div class="leading-[125%] text-[14px] font-[600]">
                            <p>Пн–Пт: 7:00 – 23:00</p>
                            <p>Сб–Вс: 9:00 – 22:00</p>
                        </div>
                    </div>
                    <div class="max-[1200px]:ml-auto flex gap-[4px]">
                        <a class="max-[1250px]:w-[30px] max-[1250px]:h-[30px] dark:hover:[&>img]:brightness-90 hover:[&>img]:brightness-150 transition"
                           href="https://t.me/FakelGym_bot">
                            <?php display_icon(get_current_room() === 'gym' ? 'tg_dark' : 'tg'); ?>
                        </a>
                        <a class="max-[1250px]:w-[30px] max-[1250px]:h-[30px] dark:hover:[&>img]:brightness-90 hover:[&>img]:brightness-150 transition"
                           href="https://wa.me/79832321319">
                            <?php display_icon(get_current_room() === 'gym' ? 'whatsapp_dark' : 'whatsapp'); ?>
                        </a>
                        <a class="hidden max-[1250px]:block dark:hover:[&>img]:brightness-90 hover:[&>img]:brightness-150 transition"
                           href="tel:+783822990019">
                            <?php display_icon(get_current_room() === 'gym' ? 'phone_dark' : 'phone'); ?>
                        </a>
                        <a class="[&>img]:w-[36px] max-[1250px]:hidden dark:hover:text-[#c7c7c7] font-[700] text-[24px] !decoration-transparent hover:text-[#555] transition-colors dark:hover:[&>img]:brightness-90 hover:[&>img]:brightness-150"
                           href="tel:+783822990019">
                            <?php display_icon(get_current_room() === 'gym' ? 'phone_dark' : 'phone'); ?>
                        </a>
                    </div>

                    <div class="max-[850px]:hidden">
                        <?php
                        $page = get_page_by_path('prices');
                        ?>
                        <a href="
                    <?php
                        echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                        ?>
                    "
                           class="max-[768px]:h-[36px] !no-underline items-center red-gradient-hover cursor-pointer flex text-[#f8f8f8] text-[16px] font-[600] justify-center h-[45px] w-[136px] rounded-[90px] flex items-center">
                            Записаться
                        </a>
                    </div>
                    <div id="burger"
                         class="hidden max-[1200px]:block cursor-pointer w-[36px] h-[36px] relative focus:outline-none bg-[linear-gradient(90deg,_#e21e24_39.42%,_#ff2f35_92.9%)] rounded-[90px] z-[20]">
                        <div class="flex items-center justify-center w-full h-full absolute left-[50%] top-[50%] transform -translate-x-[50%] -translate-y-[50%]">
                            <span class="line-1 block absolute h-[2px] w-[20px] bg-white transform transition -translate-y-[6px]"></span>
                            <span class="line-2 block absolute h-[2px] w-[20px] bg-white transform transition"></span>
                            <span class="line-3 block absolute h-[2px] w-[20px] bg-white transform transition translate-y-[6px]"></span>
                        </div>
                    </div>
                </div>


            </div>
        </div>
        <div class="py-[24px] max-[768px]:hidden">
            <div class="flex items-center justify-between gap-[6px]">
                <div class="
                group
                dark:border dark:border-white/[0.05]
                dark:text-[#f8f8f8]
                dark:bg-inherit
                dark:backdrop-blur-[20px]
                dark:bg-[linear-gradient(90deg,rgba(248,248,248,0.04)_65.8%,rgba(255,255,255,0.12)_100%)]
                dark:border-[rgba(248,_248,_248,_0.5)] bg-white text-[16px] text-[#222] font-[600] rounded-[90px] h-[44px] px-[28px] flex items-center">
                    <?php get_template_part('template-parts/la-components/navigation-menu'); ?>
                </div>
                <div class="max-[1200px]:hidden flex gap-[12px]">
                    <?php
                    $page = get_page_by_path('time');
                    ?>
                    <a href="<?php
                    echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                    ?>"
                       class="dark:hidden !no-underline dark:text-[#f8f8f8] dark:border-[rgba(248,_248,_248,_0.2)] font-[600] flex gap-[8px] h-[44px] px-[20px] items-center cursor-pointer border border-[#e0e0e0] rounded-[90px]"
                    >
                        <span class="dark:bg-[#f8f8f8] w-[8px] h-[8px] rounded-full bg-[#e21e24]"></span>
                        Расписание
                    </a>
                    <?php
                    $page = get_page_by_path('lk');
                    ?>
                    <a href="
                    <?php
                    echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                    ?>"
                       class="!no-underline font-[600] text-[#f8f8f8] dark-gradient-hover flex gap-[8px] h-[44px] px-[20px] items-center cursor-pointer rounded-[90px]"
                    >
                        <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M8 0.5C9.06087 0.5 10.0783 0.921427 10.8284 1.67157C11.5786 2.42172 12 3.43913 12 4.5C12 5.56087 11.5786 6.57828 10.8284 7.32843C10.0783 8.07857 9.06087 8.5 8 8.5C6.93913 8.5 5.92172 8.07857 5.17157 7.32843C4.42143 6.57828 4 5.56087 4 4.5C4 3.43913 4.42143 2.42172 5.17157 1.67157C5.92172 0.921427 6.93913 0.5 8 0.5ZM8 10.5C12.42 10.5 16 12.29 16 14.5V16.5H0V14.5C0 12.29 3.58 10.5 8 10.5Z"
                                  fill="#F8F8F8"/>
                        </svg>
                        Личный кабинет
                    </a>
                </div>
            </div>
        </div>
        <div id="menu-overlay"
             class="max-[768px]:h-[calc(100vh-141px)] max-[768px]:top-[141px] fixed h-[calc(100vh-161px)] top-[161px] left-0 right-0 bg-[rgba(0,0,0,0.5)] backdrop-blur-sm z-[9999] opacity-[0] invisible transition-[opacity,visibility] ease-in-out">
            <div id="menu-container"
                 class="fixed right-[0] top-[0] h-full w-[327px] bg-[#f9f9f9] dark:bg-[#151419] transform translate-x-full transition-[transform] flex flex-col">

                <nav class="p-[20px] pr-[10px] flex-1 overflow-y-auto">
                    <ul class="flex flex-col gap-[4px]">
                        <?php
                        $menu_items = get_simple_menu_items();
                        foreach ($menu_items as $item):
                            ?>
                            <li class="w-full h-[35px]">
                                <a class="!no-underline w-full h-full text-[#222] dark:text-[#f8f8f8] dark:hover:text-[#c7c7c7] hover:text-[#555] hover:text-[#555] font-[600] leading-[125%] text-[16px]"
                                   href="<?php echo esc_url($item['url']); ?>">
                                    <?php echo esc_html($item['title']); ?>
                                </a>
                            </li>
                        <?php endforeach; ?>
                    </ul>

                    <div class="max-[1200px]:flex hidden text-[14px] justify-between flex-wrap gap-[6px] mt-[16px]">
                        <?php
                        $page = get_page_by_path('time');
                        ?>
                        <a href="<?php
                        echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                        ?>"
                           class="dark:hidden !no-underline max-w-[135px] px-[12px] dark:text-[#f8f8f8] dark:border-[rgba(248,_248,_248,_0.2)] font-[600] flex gap-[6px] h-[41px] items-center cursor-pointer border border-[#e0e0e0] rounded-[90px]"
                        >
                            <span class="dark:bg-[#f8f8f8] w-[8px] h-[8px] rounded-full bg-[#e21e24]"></span>
                            Расписание
                        </a>
                        <?php
                        $page = get_page_by_path('lk');
                        ?>
                        <a href="
                    <?php
                        echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                        ?>"
                           class="!no-underline max-w-[176px] px-[12px] font-[600] text-[#f8f8f8] dark-gradient-hover flex gap-[6px] h-[41px] items-center cursor-pointer rounded-[90px]"
                        >
                            <svg class="min-w-fit" width="12" height="12" viewBox="0 0 16 17" fill="none"
                                 xmlns="http://www.w3.org/2000/svg">
                                <path d="M8 0.5C9.06087 0.5 10.0783 0.921427 10.8284 1.67157C11.5786 2.42172 12 3.43913 12 4.5C12 5.56087 11.5786 6.57828 10.8284 7.32843C10.0783 8.07857 9.06087 8.5 8 8.5C6.93913 8.5 5.92172 8.07857 5.17157 7.32843C4.42143 6.57828 4 5.56087 4 4.5C4 3.43913 4.42143 2.42172 5.17157 1.67157C5.92172 0.921427 6.93913 0.5 8 0.5ZM8 10.5C12.42 10.5 16 12.29 16 14.5V16.5H0V14.5C0 12.29 3.58 10.5 8 10.5Z"
                                      fill="#F8F8F8"/>
                            </svg>
                            Личный кабинет
                        </a>
                    </div>

                    <div class="pt-[16px] mt-[16px] border-t border-[#e0e0e0] text-[#222] dark:text-[#f8f8f8]">
                        <div class="text-[14px]">
                            <a class="dark:hover:text-[#c7c7c7] font-[700] text-[24px] !decoration-transparent hover:text-[#555] transition-colors"
                               href="tel:+783822990019">
                                <span>+7 (3822) 99-00-19</span>
                            </a>
                            <div class="mt-[16px] flex items-center gap-[12px]">
                                <div class="w-[8px] h-[8px] rounded-full bg-[#e21e24]"></div>
                                <div class="leading-[125%] text-[14px] font-[600]">
                                    <p>г. Томск, </p>
                                    <p>ул. Красноармейская, 120</p>
                                </div>
                            </div>
                            <div class="mt-[12px] flex items-center gap-[12px]">
                                <div class="w-[8px] h-[8px] rounded-full bg-[#e21e24]"></div>
                                <div class="leading-[125%] text-[14px] font-[600]">
                                    <p>Пн–Пт: 7:00 – 23:00</p>
                                    <p>Сб–Вс: 9:00 – 22:00</p>
                                </div>
                            </div>
                            <div>
                                <?php
                                $page = get_page_by_path('prices');
                                ?>
                                <a href="
                    <?php
                                echo get_permalink(pll_get_post($page->ID, pll_current_language()) ?: $page->ID);
                                ?>
                    "
                                   class="!no-underline w-full mt-[16px] items-center red-gradient-hover cursor-pointer flex text-[#f8f8f8] text-[16px] font-[600] justify-center h-[45px] w-[136px] rounded-[90px] flex items-center">
                                    Записаться
                                </a>
                            </div>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
    </header>
    <?php
    if (!is_front_page()) {
        ?>
        <?php
        if ($room === 'fitness') {
            $body_classes = 'header-gradient';
        } else {
            $base_classes = 'bg-cover bg-center bg-no-repeat';
            $bg_image = 'data:image/webp;base64,UklGRlYGAABXRUJQVlA4IEoGAAAwhQCdASqgBY8BPpFIoU0lpCMiIAgAsBIJaW7hcROkzhv8UWwDwWUuse5nyAKzdrxcnIe+2TkPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ychwKadSWOI62mG14uTkPfbJyHvtk5D32ych77rmy6qWlQLJdrx7l/S7Xi7HKqlrtcaZUgu0qBZLteLk5D32ych77ZOQ9/QZ8cbzbm2DjOqxp3a8XZmOcK/p9PqmRfS7Xi5OQ99snIe+2TkPfbJyHvtrm2snpIfB+sLXnT1Q45Rp50VJesOEPOFrp7ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZORIZOs8o09I8i7HKaWyXa8XJyHvtk4/0MgPJyHvtk5D32ych77ZOQ99snLewor1HAnIe+78B0WPEnIe+2TkPfb2Yr0aUu14uTkPfbJyHv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AAAfDjb2mxSBRuIvqTV+ehuwXpgyFSGym8AAAAG8jp2azhrweGCPKA2vAAABLQ1AV8XezdxCrUWql+rj0p9B3pFePQAQ1+KNqfpcRhJRMAoZpxwgA5j1nYLRusklBegBUKRzEIVy4/wsBY03xliWb+re0NO/aqmpZv6r6AALroFk4+y3tSh6PXFSZarBYdZp1gAAh8JcRnXXWCks10vTEaRo7Nzm9ae9KNPcgZOo305nAFLCYj0PskctdiboDQSSy41PkVM3rQ6B7U1oGZuA3+cgAQzy31FXiL9zk48QLKmifmggACQPgJzdAV7KlGbFrqW1VIBdVO16EAAABM8S5BkK8EzKIHagIdzgACK4lx3scuwdaZ8/Smpzy6ttIMbFegAazB8HiL9tj6ltosVbuzNZ2db1/GCzalijwEd+wX7DaTp9bSVPUvmw2kG18DKK3sie5M+gQAAQgICIt0lv0wndyBgHpcADwCAr3vyjSxyZ9AsK7WEJOAqAgJvh30TVGMIHG4CxCBKW8FlC1DRT4WXx4RTgLkIC0M4TNmUvrITfYAYoQHYTIXY0mpzl2AAMUIFrlaXLE7aaiMT3dcBchAzC5duPMegAAAAA==';

            $style_attr = 'style="background-image: url(' . esc_attr($bg_image) . ')"';
        }
        ?>
        <div class="<?php echo $base_classes . '  ' . $body_classes . ' ' ?> pt-[161px] max-[768px]:pt-[141px]"
            <?php echo $style_attr ?>
        >

            <div class="max-[768px]:pt-[20px] max-[768px]:pb-[32px] container mx-auto pt-[32px] pb-[60px]">
                <?php display_yandex_breadcrumbs(); ?>
                <?php if (!is_front_page()) : ?>
                    <?php

                    $current_post_type = get_post_type();

                    if (is_post_type_archive() || ($current_post_type !== 'training' && $current_post_type !== 'trainer')) : ?>
                        <div class="mt-[24px]">
                            <?php
                            $h1_text = '';
                            $subtitle = '';
                            $show_layout = false;

                            if (is_post_type_archive()) {
                                $post_type = get_queried_object()->name;
                                $h1_text = get_archive_field($post_type, 'h1_text');
                                $subtitle = get_archive_field($post_type, 'subtitle');
                                if ($h1_text) {
                                    $show_layout = true;
                                }
                            } elseif (get_field('h1_text')) {
                                $h1_text = get_field('h1_text');
                                $show_layout = true;
                            }

                            if ($show_layout): ?>
                                <div class="max-[768px]:gap-[16px] max-[768px]:[&>_img]:hidden flex justify-between flex-wrap gap-[12px]">
                                    <div class="flex flex-col">
                                        <h1 class="dark:text-[#f8f8f8] max-w-[900px] w-full text-[222] leading-[110%] max-[1330px]:text-[36px] max-[768px]:text-[32px] text-[48px] font-[500]">
                                            <?php echo $h1_text; ?>
                                        </h1>

                                        <?php if ($subtitle): ?>
                                            <p class="font-[500] w-full max-w-[687px] text-[24px] leading-[125%] text-[#222] dark:text-[#f8f8f8] mt-[12px]">
                                                <?php echo esc_html($subtitle); ?>
                                            </p>
                                        <?php endif; ?>

                                        <?php
                                        if (is_page('thank-you')) {
                                            ?>
                                            <p class="font-[600] w-full max-w-[687px] text-[24px] leading-[125%] text-[#222] dark:text-[#f8f8f8] mt-[12px]">
                                                Очень скоро с вами свяжется наш отдел заботы, чтобы ответить на все
                                                интересующие
                                                вопросы.</p>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                    <?php
                                    if (!is_page('policy')) {
                                        if (is_post_type_archive('training')) {
                                            ?>
                                            <div class="max-[768px]:flex-row max-[768px]:ml-0 ml-auto flex flex-col gap-[12px]">
                                                <div class="max-[768px]:min-w-[144px] max-[768px]:ml-0 max-[768px]:text-[24px] ml-auto flex gap-[10px] items-center">
                                                    <div class="max-[768px]:text-[24px] font-[700] text-[48px] leading-[110%]"> 45+</div>
                                                    <img class="max-[768px]:h-[32px] max-[768px]:w-[93px]" alt="decoration"
                                                         src="<?php echo get_template_directory_uri() . '/assets/images/masonry-decor.png'; ?>">
                                                </div>
                                                <div class="max-[768px]:text-[14px] font-[500] text-[20px] leading-[140%]">
                                                    групповых и персональных тренировок
                                                </div>
                                            </div>
                                            <?php
                                        } else {
                                            display_icon(get_current_room() === 'gym' ? 'dark_logo_name' : 'light_logo_name');
                                        }
                                    }
                                    ?>
                                </div>
                            <?php else:
                                $title = '';

                                if (is_post_type_archive()) {
                                    $post_type = get_queried_object()->name;
                                    $title = get_archive_field($post_type, 'h1_text');


                                    if (!$title) {
                                        $post_type_obj = get_queried_object();
                                        $title = $post_type_obj->labels->name;
                                    }
                                } else {
                                    $title = trim(preg_replace('/\s*\([^)]*\)/', '', get_the_title()));
                                }
                                ?>
                                <h1 class="dark:text-[#f8f8f8] text-[222] leading-[110%] max-[1330px]:text-[36px] max-[768px]:text-[24px] text-[48px] font-[700]">
                                    <?php echo esc_html($title); ?>
                                </h1>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                <?php endif; ?>
            </div>

        </div>
        <?php
    }
    ?>

    <div id="content" class="site-content grow">

        <?php do_action('tailpress_content_start'); ?>

        <main id="main-content">
            <div class="hidden">
                <button class="cursor-pointer p-[10px] rounded border" data-modal="example">Пример модалки</button>
                <button class="cursor-pointer p-[10px] rounded border" data-modal="room">Выбор зала</button>
                <button class="cursor-pointer p-[10px] rounded border" data-modal="form">Форма</button>
            </div>


<?php

            