@import "settings.colors";
@import "settings.fonts";
@import "settings.z-index";

@import "mixins/tools.functions";
@import "mixins/tools.mixins";

.c-site-header {
  // Prevent article dropdown (static position) from overlapping
  position: relative;
  z-index: $z-index-site-header;

  // A mask to cover the buttons so that you won't be able to see them
  // when they animate past the top boundary of the viewport and you're
  // using an iOS device with bouncy, "elastic" scrolling
  &::before {
    content: "";
    width: 100%;
    height: rem(200);
    background-color: $color-white;
    position: absolute;
    top: rem(-200);
    left: 0;
    z-index: 9999;
  }
}
.c-site-header__top {
  background-color: $color-grey-700;
}
.c-site-header__benefits {
  display: none; // hidden on mobile
  overflow: hidden;
  background-color: #724b3f;
  height: rem(102);
  border-bottom: rem(2) solid #412016;
  transition: height 0.4s ease, padding 0.4s ease;

  .c-spinner {
    margin-top: rem(20);
  }
}
// prevent the TGAM logo from overlapping onto the first card
.c-site-header--article {
  .c-site-header__benefits {
    height: rem(112);
  }
}
.c-site-header {
  .c-site-header__benefits--hiding {
    height: 0; // collapsed by default
    border-bottom: none;
  }
}
.c-site-header__bottom {
  background-color: $color-grey-800;
}
.c-site-header__top-content,
.c-site-header__bottom-content {
  margin-left: auto;
  margin-right: auto;
}
.c-site-header__top-content {
  padding-left: rem(2);
  padding-right: rem(2);
  color: $color-white;
  display: flex;
  align-items: center;
  justify-content: stretch;
}
.c-site-header__logo-link {
  min-width: rem(60);
  width: rem(60);
  height: rem(60);
  display: block;
}
.c-site-header__logo-art {
  width: 100%;
  height: 100%;
}
.c-site-header__buttons {
  flex: 1 1 auto;
}
.c-site-header__button-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.c-site-header__button {
  margin-right: rem(10);
  &:first-child {
    margin-left: rem(20);
  }
  &:last-child {
    margin-right: 0;
  }
  > .c-button {
    white-space: nowrap;
  }
  // Special display requirements for this particular button
  > .c-button--adchoices {
    padding-left: rem(9);
    padding-right: rem(9);
    .c-button__icon {
      margin-right: 0;
    }
    .c-button__text {
      @include visually-hidden;
    }
  }

  // Unread stories indicator
  .c-button--unread {
    @include flex-display;
    align-items: center;
    &:hover, &:focus {
      color: $color-grey-900;
      background-color: $color-stone-300;
      .c-button__icon {
        fill: $color-grey-900;
      }
      .c-button__unread-indicator {
        background-color: $color-utility-green-900;
        border-color: $color-utility-green-900;
        color: $color-white;
      }
    }
    &:active {
      color: $color-grey-900;
      background-color: $color-stone-150;
      .c-button__icon {
        fill: $color-grey-900;
      }
      .c-button__unread-indicator {
        background-color: $color-utility-green-900;
        border-color: $color-utility-green-900;
        color: $color-white;
      }
    }
  }

  .c-button__unread-indicator {
    color: $color-grey-900;
    font-size: rem(10);
    text-align: center;
    padding-top: rem(5);
    margin-left: rem(10);
    width: rem(22);
    height: rem(22);
    border: 1px solid $color-stone-200;
    background-color: $color-utility-green-200;
    border-radius: 50%;
    flex-shrink: 0;
  }
}

// Sticky/pinned header styles

.c-site-header__placeholder {
  display: none;
}
.c-site-header--sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  + .c-site-header__placeholder {
    display: block;
  }
}

// Menu panel

.c-site-header__menu-panel {
  width: 100%;
  margin: 0 auto;
  position: fixed;
  left: 0;
  right: 0;
  z-index: $z-index-site-header-menu-panel;
}
.c-site-header__menu-panel--hiding {
  @include animation(c-site-header-hide-menu-panel, 0.25s, linear, 0s, 1, normal, forwards, running);
}
.c-site-header__menu-panel--revealing {
  @include animation(c-site-header-reveal-menu-panel, 0.25s, linear, 0s, 1, normal, forwards, running);
}
@keyframes c-site-header-hide-menu-panel {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes c-site-header-reveal-menu-panel {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
