header {
  position: sticky;
  top: 0;
  background-color: black;
  box-shadow: 0px 3px 6px 0px black;
  z-index: 10;
  color: var(--color-alt-white-l);

  svg {
    width: 1em; /* matches font size of parent */
    height: 1em; /* matches font size of parent */
    box-sizing: content-box;
  }
}

header input {
  display: none;
}

/* TITLE BAR */

nav:has(h1) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-purple);
  z-index: 6;
  background: linear-gradient(
    to right,
    var(--color-purple) 1%,
    var(--color-purple),
    transparent
  );
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

nav:has(h1) a {
  line-height: 1;
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  text-decoration: none;
  font-size: 2rem;
  color: var(--color-alt-white-l);
}

nav:has(h1) h1 {
  font-size: clamp(1.5rem, 2vw + 1rem, 2.5rem);
  letter-spacing: 0.05em;
  padding-top: 2px;
  margin: 0;
  font-weight: 100;
}

nav:has(h1) img {
  width: 1.4em;
  margin: 0.5rem 0.8rem 0.5rem 0.6rem;
  box-shadow: 0 0 10px 5px rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

@media (min-width: 600px) {
  nav:has(h1) {
    background: linear-gradient(
      to right,
      transparent,
      var(--color-purple) 1%,
      var(--color-purple),
      transparent
    );
  }

  nav:has(h1):hover,
  nav:has(h1):focus-visible {
    background: linear-gradient(
      to right,
      transparent,
      var(--color-purple-hover) 1%,
      var(--color-purple-hover),
      transparent
    );
  }

  nav:has(h1):hover::after,
  nav:has(h1):focus-visible::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 55px;
    width: 95vw;
    height: 20px;
    background: radial-gradient(
      ellipse 100% 80% at 25% 0,
      hsla(var(--color-purple-hover-a), 0.7) 0%,
      transparent 80%
    );
    pointer-events: none;
    z-index: 5;
    border-top-left-radius: 10px;
  }

  nav:has(h1) img {
    width: 1em;
    margin: 0.5rem 0.8rem 0.5rem 1.6rem;
    border-radius: 10px;
  }
}

/* HAMBURGER MENU FOR MOBILE */

label[for="burger"] {
  margin: 1px;
  font-size: 40px;
  max-height: 40px;
  padding: 5px 10px;
  box-sizing: content-box;
}
header nav:has(ul) {
  display: none;
}
body:has(#burger:checked) {
  overflow: hidden;
}
#burger:checked ~ nav:has(ul) {
  display: block;
  position: fixed;
  top: 57px;
  left: 0;
  z-index: 99;
  width: 100%;
  height: calc(100vh - 55px);
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
}

header nav:has(ul) ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

#burger:checked ~ nav:has(ul) > ul li {
  padding-block: 1vh;
}

#burger:checked ~ nav:has(ul) > ul > li {
  font-weight: 100;
  font-size: 1.5rem;
  padding-block: 2vh;
  padding-inline: 10px;
  border-bottom: 1px solid hsla(0, 0%, 100%, 0.2);
}

#burger:checked ~ nav:has(ul) a {
  display: inline-block;
  padding-inline: 20px;
  width: 100%;
}

#burger:checked ~ nav:has(ul) li svg {
  padding-right: 2%;
  vertical-align: top;
}

header nav:has(ul) a {
  display: inline-block;
  height: 100%;
}

/* PC DROPDOWN MENU */

@media (min-width: 600px) {
  header {
    padding: 5px 0 0 0;
  }

  label[for="burger"],
  header nav:has(ul) ul svg {
    display: none;
  }

  header nav:has(ul) {
    display: block;
  }

  /* Top-level menu container styling */
  header nav:has(ul) > ul {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(
      to right,
      var(--color-gray-750),
      var(--color-gray-800)
    );
    margin: 5px;
    border-radius: 10px;
    list-style: none;
    padding: 0;
  }

  header nav:has(ul) li {
    font-size: 1.5rem;
    font-weight: 100;
  }

  /* Top-level menu items */
  header nav:has(ul) > ul > li {
    display: flex;
    position: relative;
    width: 100%;
    align-items: center;
    text-align: left;
    border-radius: 15px 25px 25px 15px;
    padding: 2px 2px 2px 7px;
    border-right: 5px solid transparent;
    user-select: none;
    -webkit-user-select: none;
  }

  header nav:has(ul) > ul > li > svg {
    display: flex;
    font-size: 1.4rem;
    margin: 0 5px;
  }

  /* Hover/focus effects on top-level items */
  header nav:has(ul) > ul > li:hover,
  header nav:has(ul) > ul > li:focus-within {
    border-radius: 15px 25px 25px 15px;
    border-right: 5px solid white;
    background: linear-gradient(
      to right,
      var(--color-purple-hover),
      rgba(0, 0, 0)
    );
  }

  /* MOTE! DO NOT DELETE! */
  header nav:has(ul) > ul > li::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    height: 5px;
    width: 100%;
    z-index: 6;
  }

  /* Show dropdown on hover/focus */
  header nav:has(ul) > ul li:hover ul,
  header nav:has(ul) > ul li:focus-within ul {
    display: block;
    z-index: 45;
  }

  /* Dropdown menus */
  header nav:has(ul) > ul li ul {
    display: none;
    margin-top: 5px;
    position: absolute;
    width: 100%;
    top: 100%;
    left: 0;
    padding: 10px;
    border-radius: 10px;
    background: radial-gradient(
      ellipse 250% 100% at top left,
      hsl(var(--color-purple-a), 0.7),
      hsla(var(--color-gray-900-a), 0.4),
      hsla(var(--color-gray-900-a), 0.4),
      hsla(var(--color-gray-900-a), 0.7)
    );
    box-shadow: 20px 30px 25px rgba(10, 10, 10, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    list-style: none;
  }

  header nav:has(ul) > ul a {
    padding: 3px;
    padding-bottom: 3px;
    padding-left: 0.7rem;
    display: block;
    max-width: 100%;
    height: 100%;
  }

  header nav:has(ul) > ul li ul li:hover,
  header nav:has(ul) > ul li ul li:has(a:focus-visible) {
    border-radius: 5px;
    cursor: pointer;
    background: linear-gradient(
      to right,
      var(--color-purple-hover),
      rgba(0, 0, 0, 0)
    );
  }

  header nav:has(ul) > ul li ul li:hover a,
  header nav:has(ul) > ul li ul li a:focus-visible {
    color: white;
  }

  header nav:has(ul) > ul li ul li a:focus-visible {
    padding: 3px;
    padding-left: 0.7rem;
    padding-bottom: 0;
    margin-bottom: 3px;
  }
}

/* REGULAR ANCHOR TAGS */
article a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

article a:focus-visible {
  border-radius: 3px;
}

article a::selection {
  color: var(--color-link);
  background-color: var(--color-green-m);
}

article a:hover,
article a:focus-visible,
article a:hover::selection,
article a:focus-visible::selection {
  color: var(--color-link-hover);
}
article a:active,
article a:active::selection {
  color: var(--color-link-active);
}
/* --------------------- */
article a:visited {
  color: var(--color-link-visited);
}
article a:visited:hover,
article a:visited:focus-visible {
  color: var(--color-link-visited-hover);
}
article a:visited:active {
  color: var(--color-link-visited-active);
}
/* --------------------- */
article a:visited::selection {
  color: var(--color-link-light-visited);
}
article a:visited:hover::selection,
article a:visited:focus-visible::selection {
  color: var(--color-link-light-visited-hover);
}
article a:visited:active::selection {
  color: var(--color-link-light-visited-active);
}

/* Internal Links */

article a[href^="#"]:not(:has(img))::before {
  content: "#";
}
