.header {
  position: sticky;
  top: 0;
  width: 100%;
  background: var(--light);
  padding: var(--spacer-1);
  border-bottom: 1px solid var(--primary-lighter);
  box-shadow: var(--box-shadow-sm);
  z-index: 900;

  @media (min-width: 576px) {
    border-width: 2px;
    padding: var(--spacer-2) var(--spacer-3);
  }

  &__container {
    max-width: var(--content-max-width);

    @media (min-width: 768px) {
      margin-top: var(--spacer-1);
      margin-bottom: var(--spacer-1);
    }
  }

  &__row {
    align-items: center;
    min-height: 45px;

    @media (min-width: 768px) {
      min-height: 60px;
      &--centralized-logo {
        .header__toggler-block {
          order: -2;
          flex-basis: 3%;
          max-width: 3%;
        }
        .header__logo-block {
          flex-basis: 33.33%;
          max-width: 33.33%;
          display: flex;
          justify-content: center;
        }
        .header__buttons-block {
          display: flex;
          flex-basis: 8%;
          max-width: 8%;
          justify-content: flex-end;
        }
        .header__nav-block {
          display: flex;
          flex: 1 1 25.33%;
        }
        #search-bar {
          flex-basis: 30.33%;
          max-width: 30.33%;
          order: -1;
          display: flex !important;
          justify-content: flex-start;
        }
      }
      &--full-width {
        .header__buttons-block {
          flex-basis: 33.33% !important;
          max-width: 33.33% !important;
        }
      }
    }
  }

  &__toggler {
    color: var(--text-muted);
    min-width: 32px;
    opacity: .85;
    padding: var(--spacer-2) var(--spacer-1);
    height: 100%;
    font-weight: var(--font-headings);
    text-transform: uppercase;
    transition: opacity .15s;
    margin-top: -.15rem;

    @media (hover: hover) {
      &:hover {
        opacity: 1;
      }
    }

    &:focus {
      box-shadow: none;
    }

    &-icon {
      color: var(--secondary);
      font-size: 1.3rem;
      margin-right: var(--spacer-1);
      margin-bottom: -.13rem;
    }
  }

  &__logo {
    max-width: 125px;
    max-height: calc(var(--font-size-lg) * var(--line-height-lg) + 2 * var(--spacer-2));
    width: auto;
    height: auto;

    @media (min-width: 576px) {
      max-width: 300px;
      max-height: 60px;
    }
  }

  &__nav {
    text-align: center;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-lg);
    text-transform: uppercase;

    a {
      font-weight: var(--font-headings);
      padding: 0 var(--spacer-1);
      border-radius: var(--border-radius-sm);
      display: inline-block;
      transition: background-color .15s;
    }

    &--full a {
      margin-top: var(--spacer-1);
      padding: 0 var(--spacer-2);
    }
  }

  &__category:hover {
    text-decoration: none;
    background: var(--primary-lightest);
  }

  &__links {
    list-style: none;
    padding-left: 0;
  }

  &__submenu {
    display: none;
    position: absolute;
    grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));
    margin-top: var(--spacer-4);
    gap: var(--spacer-2);
    padding: var(--spacer-3);
    background: var(--light);
    border-top: 1px solid var(--gray);
    box-shadow: var(--box-shadow-sm);
    min-width: 300px;
    max-width: 500px;
    text-align: left;
    overflow: auto;
  
    &::-webkit-scrollbar {
      width: 4px;
    }
  
    &::-webkit-scrollbar-thumb {
      background: var(--secondary);
    }
  
    &::-webkit-scrollbar-track {
      background: var(--primary-yiq);
    }

    &--full {
      width: 98%;
      max-width: 1200px;
      max-height: 400px;
      overflow-y: auto;
      left: 50%;
      transform: translateX(-50%);
      scrollbar-width: thin;
      scrollbar-color: var(--secondary) var(--primary-yiq);

      .header__submenu-subcategory {
        width: 180px;
      }

      a {
        display: block;
      }
      
      &::after {
        display: none;
      }
    }

    &::after {
      content: '';
      position: absolute;
      background: var(--secondary);
      left: 0;
      top: -4px;
      width: 20%;
      height: 4px;
    }

    &-subcategory {
      color: var(--gray);
      display: block;
      width: 100%;
      text-transform: none;

      &:hover {
        background: none;
      }
    }
  }

  &__buttons .btn {
    padding: var(--spacer-2);
    margin-left: var(--spacer-1);
    color: var(--secondary);
    transition: color .2s;
    box-shadow: none;
    position: relative;

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

    @media (min-width: 1200px) {
      font-size: var(--h4);
    }

    .badge {
      position: absolute;
      top: -3px;
      right: -3px;
      font-size: .75rem;
    }
  }

  &__search {
    position: relative;
    overflow: hidden;

    &-input {
      display: block !important;
      border: none;

      &:focus {
        box-shadow: none;
      }
    }

    &-btn {
      border: none;
      background: none;
      position: absolute;
      bottom: 50%;
      font-size: 1.3rem;
      line-height: 1;
      margin-bottom: calc(-1 * (var(--spacer-2) + .65rem));
      right: var(--spacer-1);
      padding: var(--spacer-2);
      color: var(--secondary-lighter);
      transition: color .125s;

      @media (hover: hover) {
        &:hover {
          color: var(--secondary-light);
        }
      }

      &:focus {
        outline: none;
      }
    }

    @media (min-width: 768px) {
      &-input {
        padding: 0 var(--spacer-3);
        border-radius: var(--border-radius-lg);
        font-size: var(--font-size-lg);
        line-height: var(--line-height-lg);
        height: calc(var(--line-height-lg) * var(--font-size-lg) + 2 * var(--spacer-2));
        &::-webkit-search-cancel-button {
          display: none;
        }
      }

      &-btn {
        font-size: 1.6rem;
        margin-bottom: calc(-1 * (var(--spacer-2) + .85rem));
      }
    }
  }
}
