@import url('./var.css');

nav {
  position: fixed;
  top: calc(var(--side-margin) / 2 - 0.1rem);
  right: 0;
  left: 0;
  height: 28px;
  border: solid 1px color-mix(in srgb, var(--color-primary) 90%, var(--color-on-primary));
  border-radius: var(--nav-border-radius);
  display: flex;
  justify-content: start;
  flex-direction: column;
  align-items: start;
  background: color-mix(in srgb, var(--color-primary) 40%, transparent);
  backdrop-filter: blur(16px) saturate(180%) hue-rotate(180deg);
  -webkit-backdrop-filter: blur(16px) saturate(180%) hue-rotate(180deg);
  font-family: var(--font-family-base);
  overflow: hidden;
  margin: 0 calc(var(--side-margin) / 2 - 0.1rem) 0 calc(var(--side-margin) / 2 - 0.1rem);
  padding: 1rem calc(var(--side-margin) / 2) 1rem calc(var(--side-margin) / 2);
  transition: box-shadow 0.2s ease, height 0.4s ease, border 0.4s ease;
  z-index: 1050;
}

nav:hover {
  border: solid 1px color-mix(in srgb, var(--color-primary) 70%, var(--color-on-primary));
}

body::before {
  content: "";
  width: 100vw;
  height: 40px;
  background: color-mix(in srgb, var(--color-primary) 40%, transparent);
  backdrop-filter: blur(6px) saturate(180%);
  -webkit-backdrop-filter: blur(6px) saturate(180%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1049;
}

body.nav-expanded {
  pointer-events: visibleFill;
}

nav.expanded {
  height: 28px;
  border-top-right-radius: 30px;
  box-shadow: 10px 10px 200px 20px rgba(40, 40, 40, 0);
  pointer-events: visibleFill;
  transition: box-shadow 0.2s ease, height 0.4s ease;
}

.desktop-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.logo {
  position: relative;
  font-size: 1.5rem;
  margin-right: 15px;
  font-weight: thin;
  text-decoration: none;
  color: var(--color-on-primary);
  font-family: var(--font-family-base);
  transform: translateX(calc(-2px + -0.3rem)) translateY(calc(-2px + -0.25rem));
  border: solid 1px transparent;
  display: inline-block;
  font-weight: 600;
  text-transform: lowercase;
  opacity: 1;
  transition: all 0.3s ease;
}

.logo:active {
  color: var(--color-accent);
}

.logo.hide {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-right ul {
  list-style: none;
  transform: translateY(calc(-2px + -0.25rem)) translateX(0.5rem);
  display: flex;
  gap: 2.5rem;
  margin: 0;
  padding: 0;
}

.li-nav {
  text-decoration: none;
  color: var(--color-on-primary);
  font-family: var(--font-family-base);
  font-size: 1.2rem;
  position: relative;
  padding-bottom: 5px;
}

.li-nav.active::after {
  content: "";
  width: 3px;
  height: 3px;
  background-color: var(--color-on-primary);
  border-radius: 2.5px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.15rem;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--color-on-primary);
  transition: width 0.2s ease;
}

.li-nav.active:hover::after {
  width: 20%;
  height: 3px;
  background-color: var(--color-accent);
}

.li-nav:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* === BURGER ICON === */
.burger {
  cursor: pointer;
  display: none;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  background-color: transparent;
  border: none;
  width: 30px;
  height: 20px;
  transform: translateY(-17.5px);
  margin-left: auto;
  align-self: flex-end;
  justify-self: center;
}

.burger:active {
  background-color: transparent;
  size: 1;
}

.burger div {
  width: 25px;
  height: 1.7px;
  background-color: var(--color-on-primary);
  border-radius: 1px;
  transform-origin: center;
  transition: all 0.3s ease;
}

.burger.open div:nth-child(1) {
  animation: burger-top 0.3s forwards;
}
.burger.open div:nth-child(2) {
  animation: burger-bottom 0.3s forwards;
}

.burger.close div:nth-child(1) {
  animation: burger-top-reverse 0.3s forwards;
}
.burger.close div:nth-child(2) {
  animation: burger-bottom-reverse 0.3s forwards;
}

/* === MOBILE MENU === */
.mobile-menu {
  display: none;
  justify-content: space-between;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.mobile-menu.show {
  max-height: 500px;
  opacity: 1;
}

.mobile-nav {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mobile-nav ul {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  height: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu.show .mobile-nav li {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.mobile-menu.show .mobile-nav li:nth-child(1) {
  animation-delay: 0.1s;
}

.mobile-menu.show .mobile-nav li:nth-child(2) {
  animation-delay: 0.15s;
}

.mobile-menu.show .mobile-nav li:nth-child(3) {
  animation-delay: 0.2s;
}

.mobile-menu.show .mobile-nav li:nth-child(4) {
  animation-delay: 0.25s;
}


@media (max-width: 768px) {
  nav {
    height: 28px;
  }

  body.nav-expanded {
    pointer-events: none;
  }

  body.nav-expanded::before {
    background: none;
  }

  body.nav-expanded::after {
    content: "";
    position: fixed;
    pointer-events: none;
    inset: 0;
    backdrop-filter: blur(2px);
    background-color: rgba(0,0,0,0.2);
    z-index: 10;
  }

  nav.expanded {
    height: 80vh;
    box-shadow: 10px 10px 200px 20px rgba(40, 40, 40, 0.3);
  }

  .li-nav.active {
    text-decoration: underline;
    text-decoration-color: var(--color-on-primary);
    text-decoration-thickness: 1.5px;
  }

  .li-nav.active:hover {
    text-decoration-color: var(--color-accent);
  }

  .li-nav.active::after {
    display: none;
  }

  .li-nav {
    text-decoration: none;
    color: var(--color-on-primary);
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .desktop-nav ul {
    display: none;
  }

  .burger {
    display: flex;
  }

  .mobile-menu {
    margin-top: 10px;
    display: flex;
  }

  .mobile-nav ul {
    display: flex;
    
  }

  .mobile-nav li {
    font-size: 1.2rem;
  }

  .mobile-nav a {
    text-decoration: none;
    color: var(--color-on-primary);
  }
}



@keyframes burger-top {
  0% {
    transform: none;
  }
  25% {
    transform: translateY(5px);
  }
  100% {
    transform: translateY(3px) rotate(-45deg)
  }
}

@keyframes burger-bottom {
  0% {
    transform: none;
  }
  25% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(-7px) rotate(45deg);
  }
}

@keyframes burger-top-reverse {
  0% {
    transform: translateY(2px) rotate(-45deg);
  }
  50% {
    transform: translateY(5px);
  }
  100% {
    transform: none;
  }
}

@keyframes burger-bottom-reverse {
  0% {
    transform: translateY(-7px) rotate(45deg);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: none;
  }
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}