/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-nuetral-a);
  border-bottom: 1px solid var(--color-nuetral-a);
  color: var(--color-secondary-a);
  padding: 16px;
  position: relative;

  @media (--desktop) {
    padding: 20px 40px;
  }

  &.search-open {
    background-color: var(--color-white);
  }

  .header-logo {
    width: 153px;
    height: 32px;

    img {
      width: 100%;
      height: auto;
    }
  }

  a {
    color: var(--color-secondary-a);
    font-size: 1.4rem;
    line-height: 2.8rem;
    font-weight: 600;
    text-decoration: none;

    @media (--desktop) {
      padding: 0 14px;
      white-space: nowrap;
    }

    &:hover {
      text-decoration: underline;
    }
  }

  .header-mobile-btns {
    display: flex;

    @media (--desktop) {
      display: none;
    }

    .header-mobile-hamburger {
      @media (--desktop) {
        display: none;
      }

      .header-mobile-toggle {
          cursor: pointer;
          display: inline-block;
          height: 24px;
          line-height: 0;
          position: relative;
          width: 24px;

          .patty {
            background-color: var(--color-secondary-a);
            height: 2px;
            left: 0;
            position: absolute;
            transition: background-color 125ms ease, -webkit-transform 375ms ease;
            transition: transform 375ms ease, background-color 125ms ease;
            transition: transform 375ms ease, background-color 125ms ease, -webkit-transform 375ms ease;
            width: 100%;

            &:nth-of-type(1) {
              top: 15%;
              transform-origin: center;
            }

            &:nth-of-type(2) {
              top: 50%;
              transform: translateY(-50%);
              transform-origin: center right;
            }

            &:nth-of-type(3) {
              bottom: 15%;
              transform-origin: center;
            }
          }
      }

      &.open {
        .search--container {
          position: initial;
          padding: 20px;
          border-bottom: 1px solid var(--color-nuetral-a);
          z-index: 9;

          & > div {
            padding: 0;
          }

          h4 {
            display: none;
          }
        }

        .header-mobile-toggle {
          .patty {
            &:nth-of-type(1) {
              transform: translateY(7px) rotate(-45deg);
            }

            &:nth-of-type(2) {
              transform: rotateY(90deg);
            }

            &:nth-of-type(3) {
              transform: translateY(-7px) rotate(45deg);
            }
          }
        }

        .header-mobile-links {
          position: absolute;
          width: 100%;
          left: 0;
          top: 65px;
          background-color: var(--color-white);
          height: 100vh;
          padding: 0 0 24px;
          z-index: 999;

          @media (--desktop) {
            display: none;
          }

          &.open {
            display: initial;
          }

          li {
            background-color: var(--color-white);
            padding: 1.4rem 24px;
            margin-bottom: 0 !important;
            list-style-type: none;

            &.search {
              padding-left: 0;
              padding-right: 0;

              .search--container {
                display: flex;
              }

              button {
                width: initial !important;
              }
            }

            &.menus {
              margin-bottom: 0;
              padding: 0;
              border-bottom: 1px solid var(--color-nuetral-a);

              .menu-wrapper {
                background-color: var(--color-white);

                ul {
                  margin-bottom: 0;
                }

                .nav__menu__item--2 {
                  &.has-submenu {
                    display: none;
                  }
                }
              }

              .mc-nav-submenu {
                margin-top: 1.2rem;

                li {
                  padding-left: 0;
                  padding-right: 0;
                }
              }
            }

            &.header-item {
              margin-bottom: 0;
            }

            &.has-submenu,
            &.has-submenu > span,
            &.no-submenu > a {
              font-size: 16px;
              font-style: normal;
              font-weight: 700;
              line-height: 24px; /* 150% */
              display: inline-block;
              margin-bottom: 0;

              .mc-nav-submenu {
                display: none;
              }
            }

            &.has-submenu {
              width: 100%;
              cursor: pointer;

              & > span {
                display: flex;
                justify-content: space-between;

                &::after {
                  content: '';
                  background-image: url('../../dist/assets/images/expand.svg');
                  width: 2.4rem;
                  height: 2.4rem;
                  transition: transform 0.5s;
                }
              }

              .no-submenu {
                & > a,
                & > span {
                  font-weight: 500;
                  text-decoration: none;
                  font-size: 1.4rem;
                }
              }

              &.open {
                .mc-nav-submenu {
                  display: block;
                }

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

          a,
          li > span {
            font-weight: 500;
            text-decoration: none;
            font-size: 1.4rem;
          }
        }
      }
    }
  }

  ol {
    display: none;
    flex-flow: row;
    list-style: none;
    margin-bottom: 0;

    @media (--desktop) {
      display: flex;
      align-items: center;
    }
  }

  .search {
    &.hide {
      display: none;
    }

    & > button {
      background: transparent;
      border: 0;
      height: initial;
      padding: 0 14px;
      color: var(--color-secondary-a);
      font-size: 1.4rem;
      font-weight: 600;
      line-height: 2.8rem;
      text-decoration: none;
      margin: 0;
      display: flex;

      &:hover {
        text-decoration: underline;
      }

      span {
        display: flex;
        width: 100%;

        svg {
          width: 24px;
          height: 24px;
          margin-right: 8px;
        }
      }
    }

    .icon--close {
      display: none;
      margin-right: 8px;
    }

    .search--container {
      display: none;
    }

    &.open {
      .icon--search {
        display: none;
      }

      .icon--close {
        display: flex;
      }

      .search--container {
        display: initial;
      }
    }

    /* stylelint-disable-next-line no-duplicate-selectors */
    .search--container {
      width: 100%;
      position: absolute;
      top: 73px;
      left: 0;
      z-index: 1;

      & > div {
        display: flex;
        flex-direction: column;
        align-items: start;
        padding: 40px 15%;
        background-color: var(--color-white);

        .search--form {
          width: 100%;

          form {
            display: flex;
            width: 100%;
            margin-bottom: 0;

            & > span {
              width: 80%;
              margin-right: 12px;
              display: flex;

              /* Override existing JS beharior (applied at run-time outside of this theme) */
              .st-default-search-input {
                background-image: none;
                background-clip: border-box;
                background-color: var(--input-background);
                border: 1px solid var(--color-nuetral-a);
                border: var(--input-border, 1px solid var(--color-primary));
                border-radius: 6px;
                border-radius: var(--input-radius, 0);
                color: var(--input-color);
                font-family: inherit;
                font-family: var(--input-font-family, inherit);
                font-size: 1.6rem;
                font-size: var(--input-font-size, 1.6rem);
                font-weight: 400;
                font-weight: var(--input-font-weight, 300);
                height: var(--input-height, 5rem);
                margin: 0 0 1.2rem;
                margin: var(--input-margin, 0 0 1.6rem 0);
                max-width: var(--input-width, none);
                padding: 0 1.6rem;
                padding: var(--input-padding, 0 1em);
                width: 100%;
              }
            }

            & > button {
              width: 20%;
              height: initial;
            }
          }
        }
      }
    }
  }
}

.user-logged-in {
  .header {
    margin-top: 73px;
  }
}
