.mainHeader {
  background: #fff;
  margin-bottom: 2.2rem;
  position: absolute;
  width: 100%;
  z-index: 10;

  .wide-container {
    background: #fff;

    @include media-breakpoint-down(sm) {
      padding: 0 divide($container-padding-x, 2);
    }
  }

  a:hover {
    .icon {
      filter: invert(1);
    }
  }
}

.mainHeaderInner {
  position: relative;
}

.headerFixed.headerScrolledBottom,
.headerFixed.headerScrolledTop {
  .mainLogo {
    height: 56px;

    img {
      height: 20px;
    }
  }
}

.headerFixed {
  position: fixed;
  top: 0;

  .fixed & {
    bottom: 0;
    margin-bottom: 0;
  }
}

.headerInner {
  align-items: center;
  background: #fff;
  border-bottom: 4px solid #000;
  flex-wrap: nowrap;
  justify-content: space-between;
  margin: 0;

  .fixed & {
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    padding: 0 divide($container-padding-x, 2);
    z-index: 9;

    @include media-breakpoint-up(sm) {
      padding: 0 $container-padding-x;
    }
  }
}

.mainLogo {
  align-items: center;
  display: inline-flex;
  height: 56px;
  padding: 0;
  position: relative;
  transition: height 0.2s;
  text-align: center;
  z-index: 9;

  @include media-breakpoint-up(sm) {
    padding: 0 6rem 0 0;
  }

  @include media-breakpoint-up(md) {
    height: 70px;
  }

  @include media-breakpoint-up(lg) {
    height: 80px;
  }

  img {
    height: 20px;
    object-fit: contain;
    object-position: left;
    transition: height 0.2s;
    vertical-align: middle;
    width: 100px;

    @include media-breakpoint-up(md) {
      height: 32px;
    }

    @include media-breakpoint-up(lg) {
      width: 175px;
    }
  }

  a {
    border: none;
    color: #000;

    &:hover {
      background: none;
    }
  }
}

.usernav {
  display: inline-flex;
  font-weight: 500;
  padding-right: 0;
  position: relative;
  width: auto;

  @include media-breakpoint-down(md) {
    flex: 1;
    padding-left: 0;
    padding-right: 0;
  }
}

.mainNavigationWrapper {
  padding-left: 0;
  position: relative;
  @include font-size(1.7rem);

  @include media-breakpoint-down(lg) {
    margin-right: 7rem;
  }

  @include media-breakpoint-down(md) {
    display: none;
  }

  .fixed & {
    display: block;
  }
}

.mainNavigation {
  display: inline-flex;
  font-weight: 500;
  list-style: none;
  margin: 0;
  opacity: 1;
  padding: 0;
  transition: opacity 0.3s;

  @include media-breakpoint-down(md) {
    background: #fff;
    bottom: 0;
    display: none;
    font-size: 2.6rem;
    font-weight: bold;
    left: 0;
    padding: $container-padding-x;
    position: fixed;
    top: 74px;
    width: 100%;
    z-index: 1;

    li {
      margin-bottom: 2.4rem;
    }
  }

  @include media-breakpoint-down(sm) {
    padding: divide($container-padding-x, 2);
  }

  .fixed & {
    display: inline-flex;

    @include media-breakpoint-down(lg) {
      display: block !important;
    }
  }

  li {
    margin-right: 2.4rem;
  }

  a {
    border: none;
  }

  .selected a {
    border-bottom: 2px solid;
    color: #000;
    cursor: default;
    pointer-events: none;
  }
}

.headerWithTitle.headerScrolledBottom {
  .mainNavigation,
  .userControl {
    opacity: 0;
  }
}

.burgerContainer {
  box-sizing: content-box;
  display: inline-flex;
  float: right;
  padding-left: 0;
  padding-right: 0;
  width: 2.2rem;

  @include media-breakpoint-up(sm) {
    padding-left: divide($container-padding-x, 2);
  }

  @include media-breakpoint-up(md) {
    display: none;
  }
}

.burger {
  background: #fff;
  cursor: pointer;
  height: 1.8rem;
  display: inline-block;
  position: relative;
  vertical-align: middle;
  width: 2.2rem;

  > div,
  &::after,
  &::before {
    background: #000;
    content: '';
    display: block;
    height: 2px;
    left: 0;
    position: absolute;
    width: 100%;
  }

  > div {
    margin-top: -1px;
    opacity: 1;
    top: 50%;
    transition: opacity 0.2s 0.1s;
  }

  &::after,
  &::before {
    transform-origin: center !important;
    transition: top 0.3s, transform 0.3s;
  }

  &::after {
    bottom: 0;
  }

  &::before {
    top: 0;
  }

  .fixed & {
    > div {
      opacity: 0;
      transition: opacity 0s;
    }

    &::after {
      bottom: 0.8rem;
      transform: rotate(-45deg);
    }

    &::before {
      transform: rotate(45deg);
      top: 0.8rem;
    }
  }
}

.articleHeader,
.articleControls {
  opacity: 0;
  transition: opacity 0.3s, z-index 0s 0.3s;
  z-index: -1;

  .headerScrolledBottom & {
    transition: opacity 0.3s;
    opacity: 1;
    z-index: 1;
  }
}

.articleHeader {
  @include font-size(1.4rem);

  left: 0;
  margin: 0.2em 0;
  overflow: hidden;
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;

  @include media-breakpoint-down(md) {
    display: none;
  }
}

.headerSearch {
  text-transform: lowercase;

  .icon {
    display: inline-block;
    height: 1em;
    margin-right: 0.3em;
    transition: filter 0.3s;
    vertical-align: middle;
    width: 1em;
  }
}

.articleControls {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  right: 5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;

  @include media-breakpoint-up(sm) {
    right: 6rem;
  }

  @include media-breakpoint-up(md) {
    right: 1.5rem;
  }

  @include media-breakpoint-up(lg) {
    right: 1.5rem;
  }

  .control {
    cursor: pointer;
    border: 0;

    .icon {
      opacity: 0.6;
      transition: opacity 0.3s;
    }

    &:hover {
      background: none;

      .icon {
        filter: none;
        opacity: 1;
      }
    }
  }

  .control + .control {
    margin-left: 1.2rem;

    @include media-breakpoint-up(sm) {
      margin-left: 2rem;
    }
  }

  img {
    vertical-align: middle;
  }
}

.userControl {
  align-items: baseline;
  display: flex;
  opacity: 1;
  transition: opacity 0.3s;
  z-index: 1;

  .headerWithTitle.headerScrolledBottom & {
    transition: opacity 0.3s, z-index 0s 0.3s;
    opacity: 0;
    z-index: -1;
  }

  @include font-size(1.7rem);

  justify-content: flex-end;

  @include media-breakpoint-down(md) {
    padding: divide($container-padding-x, 2);
  }

  .userpic {
    margin-right: 0;

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

.userControlItem {
  align-items: center;
  border-radius: 100%;
  display: flex;
  height: 2.4em;
  justify-content: center;
  position: relative;
  transition: margin-left 0.3s;
  width: 2.4em;

  @include media-breakpoint-down(sm) {
    margin-left: 0.4rem !important;
  }

  .headerScrolledTop &,
  .headerScrolledBottom & {
    transition: none;
  }

  .circlewrap {
    height: 23px;
    min-width: 23px;
    width: 23px;
  }

  .button,
  a {
    border: none;
    height: auto;
    margin: 0;
    padding: 0;

    &:hover {
      background: none;

      &::before {
        background-color: #000;
      }

      img {
        filter: invert(1);
      }
    }

    img {
      filter: invert(0);
      transition: filter 0.3s;
    }

    &::before {
      background-color: #fff;
      border-radius: 100%;
      content: '';
      height: 100%;
      left: 0;
      position: absolute;
      top: 0;
      transition: background-color 0.3s;
      width: 100%;
    }
  }

  img {
    height: 20px;
    vertical-align: middle;
    width: auto;
  }

  .textLabel {
    display: none;
  }
}

.userControlItemInbox,
.userControlItemSearch {
  @include media-breakpoint-down(sm) {
    display: none;
  }
}

.userControlItemVerbose {
  @include media-breakpoint-up(lg) {
    width: auto;

    .icon {
      display: none;
    }

    .textLabel {
      display: inline;
      padding: 0 1.2rem;
      position: relative;
      z-index: 1;
    }
  }

  &,
  a::before {
    border-radius: 1.2em;
  }
}
