<!DOCTYPE html>
<html lang="en">

<head>
  <title>{% block title %}{{ SITENAME }}{% endblock title %}</title>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/style.css"/>
  <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/prism.css"/>

  {% if FEED_ATOM %}
    <link href="/{{ FEED_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" />
  {% endif %}
  {% if FEED_RSS %}
    <link href="/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
  {% endif %}

  {% block head %}
  {% endblock head %}
</head>

<body class="page">
  <div class="page__container">

    <div class="header">
      <div class="header__container">

        <div class="header__brand">
          <div class="brand">
            <a href="{{ SITEURL }}/" class="brand__link">
              <div class="brand__logo">
                <img src="{{ PROFILE_IMAGE_URL }}" alt="{{ SITENAME }} Logo" class="brand__image">
              </div>
              <div class="brand__text">
                <div class="brand__title">{{ SITENAME }}</div>
                <div class="brand__subtitle">{{ SITESUBTITLE }}</div>
              </div>
            </a>
          </div>
        </div>

        <nav class="nav">
          <ul class="nav__list">
            {% for title, link in MENUITEMS %}
              <li class="nav__item">
                <a href="{{ link }}" class="nav__link">{{ title }}</a>
              </li>
            {% endfor %}
            {% if DISPLAY_PAGES_ON_MENU %}
              {% for p in PAGES %}
                <li class="nav__item{% if p == page %} nav__item--active{% endif %}">
                  <a href="{{ SITEURL }}/{{ p.url }}" class="nav__link">{{ p.title }}</a>
                </li>
              {% endfor %}
            {% endif %}
          </ul>
        </nav>

      </div>
    </div>

    <div class="main">
      <div class="main__container">
        {% block content %}
        {% endblock %}
      </div>
    </div>

    <div class="footer">
      <div class="footer__container">
        <div class="footer__content">
          <span class="footer__text"></span>
        </div>
      </div>
    </div>

  </div>

  <script>
    // Make article cards clickable
    document.addEventListener('DOMContentLoaded', function() {
      const articleCards = document.querySelectorAll('.article-card[data-url]');

      articleCards.forEach(function(card) {
        card.style.cursor = 'pointer';

        card.addEventListener('click', function(event) {
          const url = this.getAttribute('data-url');
          if (event.metaKey) {
            window.open(url, '_blank');
          } else {
            window.location.href = url;
          }
        });
      });
    });
  </script>

  <script src="{{ SITEURL }}/theme/prism.js"></script>
</body>
</html>
