{% load static %}
{% load compress %}
{% load account %}
{% load analytical %}
<!DOCTYPE html>
<html>
<head>
    {% analytical_head_top %}
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="chrome=1" http-equiv="X-UA-Compatible">
    <title>{% block head_title %}{% endblock %} Port Townsend Roasting Co.</title>
    <meta name="author" content="Nathan Chapman">

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Vollkorn:wght@900&display=swap" rel="stylesheet">

    {% compress css %}
    <link rel="stylesheet" type="text/css" href="{% static 'styles/normalize.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'styles/main.css' %}">
    {% endcompress %}

    <script type="module" defer src="{% static 'scripts/initializers/timezone.js' %}"></script>
    <script type="module" defer src="{% static 'scripts/index.js' %}"></script>

    {% block head %}
    {% endblock %}
    {% analytical_head_bottom %}
</head>
<body>
{% analytical_body_top %}
<div class="modal-menu">
    <div class="modal-menu__content">
        <div class="modal-menu__header">
            <h4>Newsletter</h4>
            <span class="close-modal">&times;</span>
        </div>
        <div class="modal-menu__form">
            {% include "storefront/partials/_newsletter.html" %}
        </div>
    </div>
</div>

<header class="site__header">
    <nav class="site__nav">
        <a class="site__logo" href="{% url 'storefront:product-list' %}"><img src="{% static 'images/site_logo.svg' %}" alt="Port Townsend Roasting Co."></a>
        <ul class="nav__list nav__main">
            <li><a class="nav__link" href="{% url 'storefront:product-list' %}">Shop</a></li>
            <li><a class="nav__link" href="{% url 'storefront:subscriptions' %}">Subscriptions</a></li>
            <li><a class="nav__link" href="{% url 'storefront:fair-trade' %}">Fair trade</a></li>
            <li><a class="nav__link" href="{% url 'storefront:reviews' %}">Reviews</a></li>
            <li><a class="nav__link" href="{% url 'storefront:about' %}">About</a></li>
            <li><a class="nav__link" href="https://bltcoffee.com/">Cafe</a></li>
            <li><a class="nav__link" href="mailto:support@ptcoffee.com">Contact</a></li>
        </ul>
    {% if user.is_authenticated %}
        <div class="nav__menu nav__account">
            <a class="nav__link" href="{% url 'storefront:customer-detail' user.pk %}">Account ▼</a>
            <ul class="nav__dropdown">
            {% if user.is_staff %}
                <li><a class="nav__link" href="{% url 'dashboard:home' %}">Dashboard</a></li>
            {% endif %}
                <li><a class="nav__link" href="{% url 'storefront:customer-detail' user.pk %}">Orders</a></li>
                <li><a class="nav__link" href="{% url 'account_logout' %}">Logout</a></li>
            </ul>
        </div>
    {% else %}
        <ul class="nav__list nav__account">
            <li><a class="nav__link" href="{% url 'account_login' %}">Login</a></li>
            <li>/</li>
            <li><a class="nav__link" href="{% url 'account_signup' %}">Signup</a></li>
        </ul>
    {% endif %}
        <a class="site__cart" href="{% url 'storefront:cart-detail' %}">
            <span class="cart__count">{{cart|length}}</span>
            <img class="cart__icon" src="{% static 'images/shopping_cart.svg' %}" alt="Shopping cart">
        </a>
    </nav>
</header>
<main>
    {% if messages %}
    <section class="messages">
        {% for message in messages %}
        <p {% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</p>
        {% endfor %}
    </section>
    {% endif %}
{% block content %}
{% endblock content %}
</main>
<footer>
    <section>
        <p><button class="show-modal">Subscribe to our newsletter</button></p>
        <p>
            <strong>Problem with your online order or have a question?</strong><br>
            Please <a href="mailto:support@ptcoffee.com">contact us</a>, we’re happy to help you over the phone at <a href="tel:+13603855856">(360) 385-5856</a><br>
            Mon-Fri between 9:00 am and 5:00 pm Pacific Time.<br>
            <address>854 East Park Ave. Suite 1, Port Townsend, WA 98368</address>
        </p>
        <p>
            Better Living Food Company Inc.℠<br>
            <small><a href="mailto:support@ptcoffee.com">Contact</a>&nbsp;|&nbsp;Fair Trade&nbsp;|&nbsp;Organic</small>
            <br>
            <small>Website by <a href="https://nathanjchapman.com">Nathan Chapman</a></small>
            <br><br>
            <img class="site__ft-stamp" src="{% static 'images/fair_trade_stamp.png' %}" alt="Fair trade">
        </p>
    </section>
</footer>
{% analytical_body_bottom %}
</body>
</html>
