{% set body_classes = body_class(['header-fixed', 'header-animated', 'header-dark', 'header-transparent', 'sticky-footer']) %}
{% set grid_size = theme_var('grid-size') %}
{% set compress = theme_var('production-mode') ? '.min.css' : '.css' %}
<!DOCTYPE html>
<html lang="{{ grav.language.getActive ?: grav.config.site.default_lang }}">
<head>
{% block head %}
    <meta charset="utf-8" />
    <title>{% if header.title %}{{ header.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {% include 'partials/metadata.html.twig' %}

    <link rel="icon" type="image/png" href="{{ url('theme://images/favicon.png') }}" />
    <link rel="canonical" href="{{ page.url(true, true) }}" />

    {% block stylesheets %}
        {% do assets.addCss('theme://css-compiled/spectre'~compress) %}
        {% if theme_var('spectre.exp') %}{% do assets.addCss('theme://css-compiled/spectre-exp'~compress)  %}{% endif %}
        {% if theme_var('spectre.icons') %}{%  do assets.addCss('theme://css-compiled/spectre-icons'~compress) %}{% endif %}
        {% do assets.addCss('theme://css-compiled/theme'~compress) %}
        {% do assets.addCss('theme://css/custom.css') %}
        {% do assets.addCss('theme://css/line-awesome.min.css') %}
    {% endblock %}
    {{ assets.css()|raw }}

    {% block javascripts %}
        {# TODO: ZEPTO JS PLEASE #}
{# Yes! We managed to remove all these crappy dependencies \o/ #}
{# … No we did not, not until we remake the language selector #}
{#        {% do assets.addJs('jquery', 101) %}#}
{#        {% do assets.addJs('theme://js/jquery.treemenu.js', {group:'bottom'}) %}#}
{#        {% do assets.addJs('theme://js/site.js', {group:'bottom'}) %}#}
    {% endblock %}
    {{ assets.js()|raw }}

{% endblock head %}
</head>
<body id="top" class="{% block body_classes %}{{ body_classes }}{% endblock %}">
    <div id="page-wrapper">
    {% block header %}
        <section id="header" class="section">
            <section class="container {{ grid_size }}">
                <nav class="navbar">
                    <section class="navbar-section logo">
                        {% include 'partials/logo.html.twig' %}
                    </section>

{# The old desktop menu, oh so buggy with big titles and going off-screen #}
{#                    <section class="navbar-section desktop-menu">#}
{#                        <nav class="dropmenu animated">#}
{#                        {% block header_navigation %}#}
{#                            {% include 'partials/navigation.html.twig' %}#}
{#                        {% endblock %}#}
{#                        </nav>#}
{#                        {% if config.plugins.login.enabled and grav.user.username %}#}
{#                            <span class="login-status-wrapper"><i class="fa fa-user"></i> {% include 'partials/login-status.html.twig' %}</span>#}
{#                        {% endif %}#}
{#                    </section>#}

                    {% block header_language_selection_section %}
                    {% if not disable_language_selector %}
                    <section class="navbar-section">
                        <div>{# Wrapper div to make centering vertically easy #}
                        {% block header_language_selection %}
                        {% include 'partials/language-selector.html.twig' %}
                        {% endblock %}
                        </div>
                    </section>
                    {% endif %}
                    {% endblock %}
                </nav>
            </section>
        </section>

        <input id="mobile-navigation-toggle" tabindex="1" type="checkbox">

        <div class="mobile-menu">
            <div class="button_container">
                <span class="top"></span>
                <span class="middle"></span>
                <span class="bottom"></span>


                <div class="mobile-container">
                    <div class="overlay" id="overlay">
                        <div class="mobile-logo">
                            {% include 'partials/logo.html.twig' with {mobile: true} %}
                        </div>
{#                        <div class="button_container mobile-close-nav" tabindex="1">#}
{#                            <span class="top"></span>#}
{#                            <span class="middle"></span>#}
{#                            <span class="bottom"></span>#}
{#                        </div>#}
                        <nav class="overlay-menu">
{#                            {% include 'partials/navigation.html.twig' with {tree: true} %}#}
                            {% include 'partials/navigation-as-details.html.twig' %}
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    {% endblock %}

    {% block hero %}{% endblock %}

        <section id="start">
        {% block body %}
            <section id="body-wrapper" class="section">
                <section class="container {{ grid_size }}">
                    {% block messages %}
                        {% include 'partials/messages.html.twig' ignore missing %}
                    {% endblock %}

{#                    page.url {{  page.url }}#}
{#                    <pre>#}
{#                        {{ page.frontmatter|var_dump }}#}
{#                    </pre>#}
{#                    <pre>#}
{#                        {{ page.header|var_dump }}#}
{#                    </pre>#}

                    {% block content %}{% endblock %}


                    {% if page.header %}
                    {% if page.header.lessons %}
                    <nav>
                        <h4>📚</h4>
                        <ul>
                            {% for lesson in page.header.lessons %}
                                <li>
                                    <a href="/{{ language_selector.current }}/lessons/{{ lesson.slug }}">
                                        {{ lesson.slug }}
                                    </a>
                                    {#                            {{ lesson.slug }}#}
                                </li>
                            {% endfor %}
                        </ul>
                    </nav>
                    {% endif %}
                    {% endif %}

                </section>
            </section>
        {% endblock %}
        </section>

    </div>

    {% block footer %}
        {% include 'partials/footer.html.twig' %}
    {% endblock %}


{% block bottom %}
    {{ assets.js('bottom')|raw }}
{% endblock %}

</body>
</html>
