<!DOCTYPE html>
<html lang="<?= ICL_LANGUAGE_CODE ?>">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <meta name="google" content="notranslate" />
    <?php wp_head(); ?>
</head>

<?php 
    $main_bg_color = '#fff';
    if ( is_singular( 'events' ) || is_singular( 'museum' ) ) {
        $main_bg_color = get_field( 'page_background_color' );
    } else {
        $main_bg_color = get_field( 'background_color' );
    }
?>

<body <?php body_class(); ?> data-bg-color="<?php echo $main_bg_color; ?>">

<?php $page_id = get_queried_object_id();?>

<div class="site-main">

    <div class="sticky-sidebar">
        <div class="nav">
            <?php mpwbpk_menu( 'menu-default' ); ?>
            <?php 

                //Back to parent page
            
                if ( is_singular( 'events' ) || is_singular( 'museum' ) ) {


                    $page = get_page_by_path( 'notikumi' );

                    if ( is_singular( 'museum' ) ) {
                        $page = get_page_by_path( 'muzejs' );
                    }

                    $title = get_the_title( $page );
                    $link = get_the_permalink( $page );

                    echo '<a href="' . $link . '" class="back">' . __( 'Atpakaļ uz', 'mpwbpk' ) . ' <em>' . $title . '</em></a>';
                }
            
            ?>

        </div>
        <?php 
            $hide_lang_menu = get_field( 'hide_language_menu', 'option' )[0];
            if ( ! $hide_lang_menu || $hide_lang_menu != 'yes' ): 
        ?>
            <div class="nav nav__lang">
                <?php echo mpwbpk_language(); ?>
            </div>
        <?php endif; ?>
    </div>

    <div class="site-main__content">
        <header>
            <div class="container">
                <div class="header-brand <?php echo is_front_page() ? '' : 'mb-med' ?>">
                    <div class="logo">
                        <a href="<?php echo home_url(); ?>">
                            <?php 
                                $logo = get_field( 'opt__logo', 'option' );
                                if ( $logo !== '' ) {
                                    echo '<img src="' . $logo . '" alt="' . get_bloginfo( 'name' ) . '">';
                                }
                            ?>
                            <div class="site-name <?php echo get_field( 'page_tagline' ) == '' || is_single() ? 'no-tagline' : '' ?>">
                                <?php bloginfo( 'name' ); ?>
                                <?php the_field( 'page_tagline', $page_id ); ?>
                            </div>
                        </a>
                    </div>

                    <div class="header-text">
                        <?php 
                            $header_text = get_field( 'header_text', 'option' );
                            if ( $header_text !== '' ) {
                                echo $header_text;
                            }
                        ?>
                    </div>

                    <div class="hamburger-menu">
                        <span></span>
                        <span></span>
                        <span></span>
                        <span></span>
                        <span></span>
                        <span></span>
                    </div>
                    
                </div>

                <div class="mobile-menu">
                    <div class="mobile-menu-top">
                        <div class="logo">
                            <a href="<?php echo home_url(); ?>">
                                <?php 
                                    $logo = get_field( 'opt__logo', 'option' );
                                    if ( $logo !== '' ) {
                                        echo '<img src="' . $logo . '" alt="' . get_bloginfo( 'name' ) . '">';
                                    }
                                ?>
                                <div class="site-name">
                                    <?php bloginfo( 'name' ); ?>
                                </div>
                            </a>
                        </div>
                        <?php mpwbpk_menu( 'menu-default' ); ?>
                    </div>
                    <div class="mobile-menu-bottom">
                        <div class="header-text">
                            <?php 
                                $header_text = get_field( 'header_text', 'option' );
                                if ( $header_text !== '' ) {
                                    echo $header_text;
                                }
                            ?>
                        </div>
                        <?php 
                            $hide_lang_menu = get_field( 'hide_language_menu', 'option' )[0];
                            if ( ! $hide_lang_menu || $hide_lang_menu != 'yes' ): 
                        ?>
                            <div class="nav nav__lang">
                                <?php echo mpwbpk_language(); ?>
                            </div>
                        <?php endif; ?>
                    </div>
                    
                </div>
            </div>
        </header>


        <div class="main-content" data-bg-color="">
            <div class="container">
