.header {
  padding: 1rem 1.4rem;
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 1001;
  min-height: 50px;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 1);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
  }
}

.logo {
  position: relative;
  z-index: 9;
  top: 7px;

  img {
    width: clamp(50px, -0.875rem + 8vw, 88px);
    height: auto;
    position: absolute;
    transition: all 0.3s ease;
  }
}

/* when scrolled */
.header.scrolled {
  transition: padding 0.4s ease;

  &::before {
    opacity: 1;
    top: 0;
    transition: top 0.4s ease;
  }

  /* &:not(:has(.side-menu.active)) .hamburger {
    transform: translateY(-15px) scale(0.6);
  } */

  /* when scrolled → switch logos */

  & .logo img.light {
    opacity: 0;
  }

  & .logo img.dark {
    opacity: 1;
  }
}

.hamburger {
  display: none;
}

/* desktop menu */

.side-menu {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.side-menu ul {
  list-style: none;
  display: flex;
  gap: 1.4rem;
  padding-block: 1rem;
}

.side-menu ul li {
  line-height: 1.1;
  text-transform: uppercase;
}

.side-menu ul li a {
  transition: 0.3s color;

  @media only screen and (min-width: 768.2px) {
    &:hover,
    &.active {
      color: var(--primary-color);
      font-weight: 600;
      border-color: var(--primary-color);
    }
  }
}

.side-menu .start_project {
  transition: 0.3s all;
  padding: 0.6rem 1.5rem;
  border: 1px solid #000;

  &:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #fff;
  }
}

@media only screen and (max-width: 767px) {
  body {
    overflow-x: hidden;

    &.nav-open {
      overflow: hidden;
    }
  }

  /* Hamburger Icon */
  .hamburger {
    display: block;
    width: 50px;
    height: 27px;
    position: absolute;
    top: 26px;
    right: 20px;
    cursor: pointer;
    z-index: 1001;
    transition: transform 0.3s ease;
  }

  .hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px; /* fixed thickness */
    background: #000;
    transition: all 0.3s ease;
  }

  /* top, middle, bottom bars */
  .hamburger span:nth-child(1) {
    top: 0;
  }

  .hamburger span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
  }

  .hamburger span:nth-child(3) {
    bottom: 0;
  }

  /* active (X state) */
  .hamburger.active span {
    outline: none;
  }

  .hamburger.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
  }

  .header {
    padding: 0.8rem 0.4rem;
    height: 60px;

    .logo {
      top: 9px;

      img {
        width: 80px;
      }
    }

    &.scrolled {
      height: 62px;

      .logo {
        top: 4px;
      }

      .hamburger {
        top: 20px;
      }
    }
  }

  /* Fullscreen Menu */
  .side-menu {
    position: fixed;
    top: 0;
    right: -105%;
    width: 100vw;
    height: 100vh;
    background: var(--primary-color);
    color: var(--text-color);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    transition: right 0.5s ease;
    z-index: 1000;

    & .logo {
      position: initial;
    }

    .start_project {
      font-size: 1.25rem;
      letter-spacing: 0;
      font-weight: 600;
      padding: 1.25rem 3rem;
      margin-top: 1rem;

      &.active {
        border-color: #fff;
      }
    }
  }

  .side-menu.active {
    right: 0;
  }

  /* Menu Links */
  .side-menu ul {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0 0 5rem;
    width: 100%;
    height: 100%;
    text-transform: uppercase;
    text-align: center;
  }

  .side-menu ul li a {
    color: var(--text-color);
    font-size: clamp(2rem, -0.875rem + 14vh, 3.5rem);
    letter-spacing: -4px;
    transition: color 0.3s;
    padding-right: 0;
    position: relative;
    overflow: hidden;
    display: block;
    text-shadow: none !important;

    &.active {
      color: #fff;
    }
  }
}

@media only screen and (max-width: 576px) {
  .side-menu ul li a {
    font-size: clamp(2rem, -0.875rem + 10vh, 4rem);

    &::after {
      height: 38px;
      width: 38px;
      background-size: 34px;
    }
  }
}
