{% load lyric_extras %}
<nav class="navbar">
    <div class="container-fluid">
        <a href="/" class="navbar-brand">
            <h1><span id="id_greeting_prefix">{% if user.active_title %}{{ user.active_title.display_greeting|safe }}{% else %}Welcome,{% endif %}</span><br><span id="id_greeting_name">{% if user.active_title %}{{ user.active_title.display_title }}{% else %}Earthman{% endif %}</span></h1>
        </a>
        {% if user.email %}
            <div class="navbar-user">
                <div class="navbar-text">
                    <span class="navbar-label">
                        Logged in as
                    </span>
                    <span class="navbar-identity">
                        {{ user|at_handle }}
                    </span>
                </div>
                <form method="POST" action="{% url "logout" %}">
                    {% csrf_token %}
                    <button id="id_logout" class="btn btn-abandon" type="submit" data-confirm="Log out?">
                        BYE
                    </button>
                </form>
            </div>
            {% if 'page-my-sea' in page_class %}
                {# Sprint 6 iter 6b — on any my-sea page (landing/picker or  #}
                {# the gatekeeper itself), CONT GAME swaps for GATE VIEW so  #}
                {# the user can always reach the token-deposit gatekeeper    #}
                {# (regardless of quota state). `<button>` (not `<a>`)       #}
                {# because UA-default fonts differ + `.btn` doesn't reset    #}
                {# font-family — anchors render serif, buttons stay sans-    #}
                {# serif (locked via the in-hex GATE VIEW fix in iter 4c).   #}
                {# Direct child of `.container-fluid` (no form wrapper) so  #}
                {# the `> #id_navbar_gate_view_btn` SCSS pin (top-center in #}
                {# landscape) matches; inline onclick handles navigation —  #}
                {# no confirm guard since GATE VIEW is non-destructive nav. #}
                <button
                    id="id_navbar_gate_view_btn"
                    class="btn btn-primary"
                    type="button"
                    onclick="window.location.href='{% url 'my_sea_gate' %}'"
                >
                    GATE<br>VIEW
                </button>
            {% elif navbar_recent_room_url %}
                <button
                    id="id_cont_game"
                    class="btn btn-primary"
                    type="button"
                    data-confirm="Continue game?"
                    data-href="{{ navbar_recent_room_url }}"
                >
                    CONT<br>GAME
                </button>
            {% endif %}
        {% else %}
            <form method="POST" action="{% url "send_login_email" %}">
                <div class="input-group">
                    <label for="id_email_input" class="navbar-text me-2">
                        enter email for login:
                    </label>
                    <input
                        id="id_email_input"
                        name="email"
                        class="form-control"
                        placeholder="your@email.here"
                    >
                    {% csrf_token %}
                    <button type="submit" class="btn btn-confirm">OK</button>
                </div>
            </form>
        {% endif %}
    </div>
</nav>
