---
import HeaderLink from './HeaderLink.astro';
import Blazestar from './Blazestar.astro';
import NoteHierarchy from './NoteHierarchy.astro';
import NotchedBox from './NotchedBox.astro';
import SocialLinks from './SocialLinks.astro';
---

<header>
	<nav>
    <h1><Blazestar /></h1>
		<div class="internal-links">
			<HeaderLink href="/">Home</HeaderLink>
			<HeaderLink href="/blog">Blog</HeaderLink>
			<HeaderLink href="/about">About</HeaderLink>
      <div class="notes-menu">
        <label for="notes-menu-checkbox" id="notes-menu-button">
          Notes
        </label>
        <input type="checkbox" id="notes-menu-checkbox" name="notes-menu-checkbox"/>
        <div class="notes-menu-tree" id="notes-menu-tree">
          <NotchedBox fillNotches="left">
              <NoteHierarchy prefix="/notes" />
          </NotchedBox>
        </div>
      </div>
		</div>
	</nav>
  <div class="h-card">
    <img class="u-photo" src="/photos/Bingley Business.jpg" />
    <a class="p-name u-url" href="https://www.blazestar.net">Drew Haven</a>
    a.k.a. <span class="p-nickname">Periodic</span>
  </div>
</header>
<style>
	header {
    color: var(--color-light-text);
    margin: 0 1em;
    padding: 0;
	}

	h1 {
		margin-bottom: 0.5em;
    font-size: 2em;
	}

	h1 a,
	h1 a.active {
		text-decoration: none;
	}
	nav {
		display: flex;
		align-items: center;
		justify-content: space-between;
    flex-wrap: wrap;
	}
	nav a {
		padding: 1em 0.5em;
    color: var(--color-light-text);
		text-decoration: none;

    &:hover {
      color: var(--color-accent);
    }
    &.active {
      text-decoration: none;
      border-bottom-color: var(--color-accent);
    }
	}
	.social-links,
	.social-links a {
		display: flex;
	}

  .internal-links {
    display: flex;
    flex-direction: row;
    gap: 4px;
    font-size: 120%;
  }

  #notes-menu-checkbox {
    display: none;

    &:checked ~ #notes-menu-tree {
      display: flex;
    }
    &:checked ~ #notes-menu-button {
      color: var(--color-accent);
    }
  }

  .notes-menu {
    position: relative;
    margin: 1em 0.5em; /* Matches links above */

    .notes-menu-tree {
      position: absolute;
      top: 100%;
      z-index: 10;
      right: 0;
    }
  }

  .notes-menu-tree {
    display: none;
    overflow: scroll;
    flex-direction: column;
    width: 15em;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px;

    a {
      color: var(--color-light-text);
      text-decoration: none;

      &:hover {
        color: var(--color-accent);
      }

      &.active {
        text-decoration: none;
      }
    }
  }

  .h-card {
    display: none;
  }

</style>
