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

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{% block title %}Yan Lin{% endblock %}</title>
  <link rel="icon" href="/logo.webp" type="image/x-icon">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
  <link rel="stylesheet" href="/index.css">
  {% block extra_head %}{% endblock %}
</head>

<body>
  <main class="container">
    {% if is_home_page %}
      <header class="border-bottom lh-1 pt-3 pb-0 border-secondary">
    {% else %}
      <header class="border-bottom lh-1 py-3 border-secondary">
    {% endif %}
      <div class="row flex-nowrap justify-content-between align-items-center">
        <div class="col-2">
          {% block header_left %}
            {% if is_home_page %}
              <a class="link-secondary header-icon px-2 h4" href="mailto:s@yanlincs.com"><i class="bi bi-envelope-fill"></i></a>
            {% else %}
              <a class="link-secondary header-icon px-2 h4" href="/"><i class="bi bi-house-fill"></i></a>
            {% endif %}
          {% endblock %}
        </div>
        <div class="col-8 text-center">
          <div class="page-header-logo h2 m-0 fw-bold" style="font-family: 'Abril Fatface', serif;">{% block header_title %}Yan Lin's Homepage{% endblock %}</div>
        </div>
        <div class="col-2 text-end">
          {% block header_right %}
            {% if is_home_page %}
              <a class="link-secondary header-icon px-2 h4" href="https://lab.yanlincs.com"><i class="bi bi-stack"></i></a>
            {% endif %}
          {% endblock %}
        </div>
      </div>
      {% block navigation %}{% endblock %}
    </header>

    {% block content %}{% endblock %}
  </main>

  <footer>
    <div class="container">
        <p class="text-center text-secondary" style="font-size: 0.8rem; font-family: 'Lato', sans-serif;">
            <span class="dark-mode-text"><i class="bi bi-moon-fill"></i> ずっと真夜中でいいのに。</span>
            <span class="light-mode-text"><i class="bi bi-sun-fill"></i> ずっと正午でいいのに。</span>
            <span class="mx-1">|</span>
            Designed and implemented by Yan Lin.
            <span class="mx-1">|</span>
            <a class="link link-secondary" target="_blank" href="https://github.com/Logan-Lin/Homepage">Source Code</a>
        </p>
    </div>
  </footer>

  <button id="back-to-top" class="btn btn-light rounded-circle" style="position: fixed; bottom: 20px; right: 20px; display: none; z-index: 1000; width: 40px; height: 40px; padding: 0;"><i class="bi bi-chevron-up"></i></button>

  {% block extra_js %}
  <script>
    // Show or hide the back-to-top button
    window.addEventListener('scroll', function() {
      var backToTopButton = document.getElementById('back-to-top');
      if (window.scrollY > 100) {
        backToTopButton.style.display = 'block';
      } else {
        backToTopButton.style.display = 'none';
      }
    });

    // Scroll to top when the button is clicked
    document.getElementById('back-to-top').addEventListener('click', function(e) {
      e.preventDefault();
      window.scrollTo({
        top: 0,
        behavior: 'smooth'
      });
      window.location.href = '#';
      return false;
    });
  </script>
  {% endblock %}
</body>

</html> 