.header {
  position: fixed;
  width: 100%;
  z-index: 3;
  display: flex;
  justify-content: center;
  background-color: var(--dark-100);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 64px;
  height: 80px;
  width: 100vw;
  max-width: 1640px;
}

.top-bar__logo {
  height: 48px;
  width: auto;
}

.menu-header-container {
  height: 100%;

  > ul {
    display: flex;
    align-items: center;
    font-family: "Inter", sans-serif;
    color: var(--white-primary);
    font-weight: 400;
    font-size: 16px;
    line-height: 20.8px;
    list-style: none;
    height: 100%;

    > .menu-item.current_page_item,
    > .menu-item.current-menu-parent {
      > a {
        font-weight: 700;
        color: var(--green-primary);
      }
    }
  }

  .menu-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding-inline: 20px;
    transition: color 300ms;
    cursor: pointer;
    height: 100%;

    a {
      text-decoration: none;
      color: inherit;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
    }

    &:hover {
      color: var(--green-primary);
    }
  }

  .menu-item.btn-borderless {
    height: auto;

    &:hover {
      color: var(--dark-100);
    }
  }

  .menu-item-has-children {
    > a {
      user-select: none;
      height: 100%;

      &::after {
        content: url(../../../images/icons/chevron-icon.svg);
        transition: transform 300ms;
        line-height: 0.4;
      }
    }
  }

  .menu-item-has-children.opened {
    .sub-menu {
      opacity: 1;
      pointer-events: all;
    }

    > a {
      color: var(--green-primary);

      &::after {
        transform: rotate(-180deg);
      }
    }
  }

  .menu-item:has(.sub-menu),
  .menu-item:has(.sub-menu) {
    .sub-menu {
      padding: 40px 128px;
      grid-gap: 24px;
      grid-template-columns: repeat(2, 1fr);
      grid-auto-rows: auto;
      justify-items: center;

      li:not(.btn-borderless):hover {
        a {
          color: var(--green-primary);
        }
      }
    }

    .sub-menu:has(> .menu-item:only-child) {
      grid-template-columns: 1fr;

      .menu-item {
        max-width: 616px;
      }
    }

    .menu-item:hover {
      .img-wrapper {
        border-color: var(--green-primary);
        background-color: var(--green-primary);

        img {
          filter: grayscale(1) brightness(3);
        }
      }

      h1 {
        border-color: var(--green-primary);
      }
    }

    .submenu__item-title {
      display: flex;
      align-items: center;
      gap: 12px;

      p {
        width: 100%;
        font-weight: 600;
        font-size: 18px;
        line-height: 24px;
        color: var(--dark-100);
        padding-block: 12px;
        border-bottom: 1px solid var(--blue-gray);
        transition: border-color 300ms;
      }
    }

    .img-wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 12px;
      border: 1.5px solid var(--blue-gray);
      border-radius: 50%;
      width: 48px;
      height: 48px;
      transition: background-color 300ms;
      flex-shrink: 0;
      flex-grow: 0;

      img {
        filter: none;
        transition: filter 300ms;
      }
    }

    .submenu__item-description {
      margin: 12px 0 0 60px;
      font-size: 14px;
      line-height: 19.6px;
      color: var(--dark-80);
      height: 60px;
      display: -webkit-box;
      line-clamp: 3;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .btn-borderless {
      margin-top: 32px;
      justify-content: center;
      grid-column: span 2;
    }
  }

  .sub-menu {
    opacity: 0;
    transition: opacity 300ms;
    position: absolute;
    display: grid;
    justify-content: center;
    grid-auto-flow: row;
    grid-gap: 24px 64px;
    padding-block: 40px;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1512px;
    background-color: var(--white-primary);
    list-style: none;
    cursor: default;
    pointer-events: none;
    box-shadow: 0px 4px 100px 0px #00000014;

    li:not(.btn-borderless) {
      padding: 0;

      a,
      button {
        color: var(--dark-100);
        text-decoration: none;
        display: block;
        background-color: transparent;
        border: none;
        cursor: pointer;
      }
    }

    li:not(.btn-borderless):hover {
      a,
      button {
        color: var(--green-primary);
      }
    }
  }
}

.top-bar__menu-btn {
  display: none;
  position: absolute;
  top: 20px;
  right: 16px;
  background-color: transparent;
  border: none;
  filter: grayscale(1) brightness(3);
  width: 38px;
  height: 38px;

  &::after {
    content: url(../../../images/icons/burger-menu-icon.svg);
    display: block;
  }

  &.mobile-menu-opened {
    justify-content: center;
    align-items: center;

    &::after {
      content: url(../../../images/icons/close-icon-big.svg);
    }
  }
}

@media (max-width: 1280px) {
  .top-bar {
    padding-inline: 16px;
  }

  .menu-header-container {
    > ul {
      .menu-item {
        padding-inline: 12px;
      }
    }
  }
}

@media (max-width: 1024px) {
  .menu-header-container {
    display: none;
  }

  .top-bar__menu-btn {
    display: flex;
  }

  .mobile-menu-opened {
    .top-bar {
      padding: 0;
      height: 100vh;
      flex-direction: column;
      align-items: flex-start;
    }

    .top-bar__logo {
      margin: 16px;
    }

    .menu-header-container {
      display: block;
      padding-top: 24px;
      width: 100%;
      overflow-y: auto;
    }

    .menu-header-container > ul {
      flex-direction: column;
      align-items: flex-start;
      gap: 48px;

      .menu-item:not(.btn-borderless) {
        height: auto;
        font-size: 20px;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: baseline;
        gap: 0;
        transition: gap 300ms;

        > a {
          padding-left: 43.5vw;
        }

        &:first-child {
          a {
            padding-top: 8px !important;
          }
        }

        .sub-menu {
          opacity: 1;
          position: static;
          display: flex;
          flex-direction: column;
          justify-content: center;
          padding-block: 0;
          top: 100%;
          left: 50%;
          transform: none;
          width: 100%;
          max-width: 1512px;
          background-color: var(--white-primary);
          list-style: none;
          cursor: default;
          pointer-events: none;
          box-shadow: 0px 4px 100px 0px #00000014;
          overflow: hidden;
          max-height: 0px;
          width: 100vw;

          .menu-item:not(.btn-borderless) {
            margin-inline: 48px;
            border-bottom: 1px solid var(--blue-gray);

            a {
              width: 100%;
              padding: 0 0 8px 0;
            }
          }
        }

        .submenu__item-title {
          p {
            border-bottom: none !important;
          }
        }

        .submenu__item-description {
          display: none;
        }
      }

      .menu-item.btn-borderless:hover {
        color: var(--dark-100);
      }

      > .menu-item:last-child {
        a {
          margin-bottom: 80px;
        }
      }

      .menu-item.industry,
      .menu-item.service {
        &:first-child {
          a {
            padding-top: 32px !important;
          }
        }
      }

      .menu-item:not(.industry):not(.service):not(.btn-borderless):first-child {
        padding-top: 8px;
      }

      .menu-item:not(.industry):not(.service):not(.btn-borderless):last-child {
        padding-bottom: 8px;
      }

      .menu-item:hover {
        color: inherit;
      }

      .menu-item.opened {
        color: var(--green-primary);
        gap: 24px;

        .sub-menu {
          max-height: 400px;
          pointer-events: all;
          gap: 8px;
        }
      }

      .menu-item:has(.sub-menu),
      .menu-item:has(.sub-menu) {
        .sub-menu {
          padding: 0;
        }

        .btn-borderless {
          display: flex;
          margin: 16px auto;
          justify-content: center;
          grid-column: span 2;
        }
      }

      .menu-item-has-children {
        > a {
          height: auto;

          &::after {
            transform: none;
          }
        }
      }

      .menu-item-has-children.opened {
        a {
          &::after {
            transform: rotate(-180deg);
          }
        }
      }
    }
  }
}

@media (max-width: 768px) {
  .menu-header-container {
    .menu-item:has(.sub-menu),
    .menu-item:has(.sub-menu) {
      .menu-item:hover {
        .img-wrapper {
          border-color: var(--blue-gray);
          background-color: transparent;

          img {
            filter: none;
          }
        }
      }
    }
  }
}

@media (max-width: 560px) {
  .mobile-menu-opened {
    .top-bar {
      padding: 0;
      height: 100vh;
      flex-direction: column;
      align-items: flex-start;
    }

    .top-bar__logo {
      margin: 16px;
    }

    .menu-header-container {
      display: block;
      margin-top: 0;
      width: 100%;
      overflow-y: auto;
    }

    .menu-header-container > ul {
      flex-direction: column;
      align-items: flex-start;
      gap: 32px;

      .menu-item:not(.btn-borderless) {
        height: auto;
        font-size: 16px;
        padding: 0;

        > a {
          padding-left: 24px;
        }

        .sub-menu {
          .menu-item {
            margin-inline: 16px;
          }
        }
      }
    }
  }
}
