.#{prefix(null, 'header')} {
  $header: &;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-gap: 15px;
  position: sticky;
  top: 0;
  z-index: 1001;
  margin: 0 auto;
  background: color('white');

  /* Add a shadow to simulate that the flyouts are under the header */
  &:after {
    content: "";
    pointer-events: none;
    display: block;
    position: absolute;
    top: 100%;
    width: 100%;
    height: 8px;
    margin-bottom: 10px;
    background: linear-gradient(
      to bottom,
      fade_out(color('black'), 0.93) 0%,
      fade_out(color('black'), 1) 100%
    );
  }

  &-main {
    grid-column: 2/24;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    height: 50px;
    margin: 0 auto;

    @include respond-to('max') {
      grid-column: 4 / 22;
    }
  }

  &-home {
    display: flex;
    align-items: center;
    margin-right: auto;

    &-logo {
      min-width: 30px;
      max-width: 30px;
      height: 30px;
      margin-right: 10px;
    }

    &-title {
      font-family: $fontFamilyHeadline;
      font-weight: 700;
      font-size: 24px;
      color: color('blue-ribbon');

      @include respond-to('medium') {
        font-size: 18px;
      }
    }
  }

  &-nav {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: calc(100vh - 100%);
    padding: 30px;
    background: color('white');
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;

    @include respond-to('medium') {
      position: relative;
      top: 0;
      display: flex;
      align-items: center;
      flex: 1 1 auto;
      height: 100%;
      padding: 0 30px;
      opacity: 1;
      pointer-events: auto;
    }

    &-item {
      position: relative;
      display: flex;
      flex-direction: column;
      margin-bottom: 16px;

      @include respond-to('medium') {
        flex-direction: row;
        align-items: center;
        height: 100%;
        margin-bottom: 0;
      }
    }

    &-link {
      display: flex;
      align-items: center;
      height: 100%;
      border: 0;
      background: none;

      @include respond-to('medium') {
        padding: 0 18px;
      }

      &-icon {
        width: 8px;
        height: 8px;
        margin-left: 5px;
        transform: rotate(0deg);
        transition: transform 0.2s ease-in-out;
      }

      &:hover {
        #{$header}-nav-link-icon {
          transform: translateY(2px);
        }
      }
    }

    .--mainmenuopen & {
      opacity: 1;
      pointer-events: auto;
    }
  }

  &-flyout {
    display: none;
    margin: 0;
    padding: 15px 5px;
    border-radius: 0 0 4px 4px;
    list-style: none;
    background: color('white');
    transition: opacity 0.2s ease-in-out;

    @include respond-to('medium') {
      position: absolute;
      top: 100%;
      left: 18px;
      opacity: 0;
      pointer-events: none;
      box-shadow: 0 10px 25px 0 transparentize(color('black'), 0.8);
    }

    &-item {
      min-width: 200px;

      & + & {
        margin-top: 16px;
      }

      &-link {
        display: flex;
        align-items: center;
        border-radius: 4px;

        @include respond-to('medium') {
          padding: 10px;
          margin: 0 5px;
        }

        &-icon {
          @include ico;
          display: none;
          width: 32px;
          height: 32px;

          @include respond-to('medium') {
            display: block;
          }

          svg {
            width: 100%;
            height: 100%;

            .websites & {
              fill: url('#gradient-websites') color('black');
            }

            .stories & {
              fill: url('#gradient-stories') color('black');
            }

            .ads & {
              fill: url('#gradient-ads') color('black');
            }

            .email & {
              fill: url('#gradient-email') color('black');
            }
          }
        }

        &-info {
          @include respond-to('medium') {
            margin: 0 20px 0 15px;
          }
        }
      }

      &-title {
        font-size: 16px;
        font-weight: 400;
        color: color('river-bed');

        @include respond-to('medium') {
          font-size: 14px;
          font-weight: 700;
          color: color('black');
        }
      }

      &-description {
        display: none;
        font-size: 13px;
        font-weight: 400;
        line-height: 1.25;
        color: color('river-bed');

        @include respond-to('medium') {
          display: block;
        }
      }

      &.--secondary {
        @include respond-to('medium') {
          padding: 0 15px;
        }
      }

      &.--primary {
        width: 300px;
        border-radius: 4px;

        @include respond-to('medium') {
          margin-top: 0;
        }
      }

      @include respond-to('pointer-fine') {
        &:hover {
          &.--secondary a {
            color: color('blue-ribbon');
          }

          &.--primary {
            background: color('blue-ribbon');

            #{$header}-flyout-item-description,
            #{$header}-flyout-item-title {
              color: color('white');
            }

            svg {
              fill: color('white');
            }
          }

          &.websites {
            @include gradient-websites;
          }

          &.stories {
            @include gradient-stories;

            #{$header}-flyout-item-description,
            #{$header}-flyout-item-title {
              color: color('charade');
            }

            svg {
              fill: color('charade');
            }
          }

          &.ads {
            @include gradient-ads;
          }

          &.email {
            @include gradient-e-mails;

            #{$header}-flyout-item-description,
            #{$header}-flyout-item-title {
              color: color('charade');
            }

            svg {
              fill: color('charade');
            }
          }
        }
      }
    }
  }

  .amp-mode-mouse &, .amp-mode-keyboard & {
    &-flyout:hover,
    &-nav-link:focus ~ #{$header}-flyout,
    &-nav-link:hover ~ #{$header}-flyout {
      display: block;
      opacity: 1;
      pointer-events: auto;
    }
  }

  .amp-mode-touch & {
    &-flyout.active {
      display: block;
      opacity: 1;
      pointer-events: auto;
    }
  }

  &-flyout:focus-within {
    opacity: 1;
    pointer-events: auto;
  }

  &-burger {
    margin-left: 20px;

    @include respond-to('medium') {
      display: none;
    }

    &-icon {
      width: 30px;
      height: 30px;
    }
  }
}
