.site-header {
  background-color: $at-main-color;

  .at-container{
    overflow: visible;
    @media screen and (min-width: 880px) {
      position:relative;
    }
  }

  .site-header__logowrap {
    padding: 15px 0;
    margin: 0 auto;
    text-align: left;
    display: inline-block;
    img {
      max-height: 85px;
      width: auto;
    }
  }
}

.site-header__nav {
  @extend %at-clearfix;
  font-size: 80%;
  font-family: $at-heading-family;
  float: right;
  @media screen and (min-width: 880px) {
      position: absolute;
      right: 3%;
      bottom:0; 
    }

  // Global Styles
  ul {
    list-style: none;
    margin: 0;
    padding: 0;
    @media screen and (min-width: 880px) {
      text-align: center; 
    }
    

    li {
      display: block;
      position: relative;

      a {
        display: block;
        text-decoration: none;   
        text-transform: uppercase;
        transition: background, .2s, ease-in-out;
      }
    }
  }

  // Mobile Nav
  @media screen and (max-width: 879px) {
    > ul {
      transition: all, .5s, ease-in-out;
      opacity: 0;
      max-height: 0;
      visibility: hidden;
      overflow: hidden;
      width: 100%;
      z-index: 99999;
      clear: both;
      background: #fff;
      font-size: 15px;
      line-height: 1.3;
      position: absolute;
      left: 0;
      right: 0;
      li {
        border-bottom: 1px solid #eaeaea;

        &:last-child {
          border-bottom: 0;
        }

        &.menu-item-has-children {

          > a::after {
            display: inline-block;
            margin: 0 0 0 8px;
            background-image: url('../img/caret-down-dark.svg');
            background-position: center center;
            background-repeat: no-repeat;
            background-size: 10px;
            content: '';
            height: 10px;
            width: 10px;
          }
        }

        &:hover {
          > ul {
            opacity: 1;
            max-height: 500px;
            visibility: visible;
          }

          > a {
            background: rgba(0, 0, 0, .05);
          }
        }

        a {
          color: #1a1a1a !important;
          padding: 15px 20px;
        }

        > ul {
          transition: all, .5s, ease-in-out;
          opacity: 0;
          max-height: 0;
          visibility: hidden;

          a {
            padding-left: 35px;
          }
        }
      }
    }
  }
  // Desktop Nav
  @media screen and (min-width: 880px) {
    > ul {
      margin: 0 auto;

      display: table;

      > li {

        display: inline-block;
        margin: 0;
        padding: 0;

        &:first-child {
          margin-left: 0;
        }

        &:last-child {
          ul  {
            &::before {
              right: 20px;
              left: auto;
            }
          }
        }

        &:hover {
          > ul {
            opacity: 1;
            max-height: 500px;
            visibility: visible;
            left: 0;
            right: auto;
          }

          > a {
            background: rgba(0, 0, 0, .2);
          }
        }

        &:last-child {
          &:hover,
          > ul {
            right: 0;
            left: auto !important;
          }
        }

        &.menu-item-has-children {

          > a::after {
            display: inline-block;
            margin: 0 0 0 8px;
            background-image: url('../img/caret-down.svg');
            background-position: center center;
            background-repeat: no-repeat;
            background-size: 10px;
            content: '';
            height: 10px;
            width: 10px;
          }
        }

        > a {
          font-size: 15px;
          line-height: 1;
          font-weight: normal;
          padding: $at-vertspace ($at-vertspace / 2);
          transition: all, .1s, ease-in-out;
          @media screen and (max-width: 990px) {
            font-size: 14px;
            padding: 25px 10px;

          }
        }

        ul {
          transition: all, .5s, ease-in-out;
          opacity: 0;
          max-height: 0;
          visibility: hidden;

          z-index: 99999;
          position: absolute;
          top: 66px;
          width: 300px;
          background: #fff;
          box-shadow: 0 6px 12px rgba(0, 0, 0, .18);

          li {
            display: block;

            a {
              color: #000;
              padding: 15px 20px;
              font-size: 18px;
              font-weight: normal;

              &:hover {
                background: #fafafa;
              }
            }

            &:first-child a {
              padding-top: 20px;
            }

            &:last-child a {
              padding-bottom: 20px;
            }
          }
        }
      }
    }
  }

  .nav-header__mtoggle {
    margin: 0 auto;
    display: table;
    border: 0;
    text-indent: -99999px;
    background: none;
    outline: none;
    cursor: pointer;
    padding: 35px 30px 35px;
    margin: 0 auto;
    @media screen and (min-width: 880px) {
      display: none;
    }

    &.active +.nav-header__menuwrapper {
      opacity: 1;
      max-height: 999px;
      visibility: visible;
    }

    &.active {
      span {
        background-color: transparent;

        &::before,
        &::after {
          top: 0;
        }

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

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

    span {
      &,
      &::before,
      &::after {
        transition: all, .5s, ease-in-out;
        cursor: pointer;
        height: 4px;
        width: 25px;
        background: #fff;
        position: absolute;
        display: block;
        content: '';
        border-radius: 3px;
      }

      &::before {
        top: -8px;
      }

      &::after {
        bottom: -8px;
      }
    }
  }
}

body.home:not(.blog) .site-header__nav {
 margin-bottom: 0;
}