%svg-white {
  path {
    fill: white;
  }
}

.masthead--white-ghost {
  @extend .masthead--white;
}

/* @masthead */
.masthead {
  background-color: rgba(30, 55, 73, 0.6);
  backdrop-filter: blur(2px);
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 650 !important;
  transition: background-color 0.3s;
  
  @media screen and (min-width: 770px) {
    // height: 120px;
    display: flex;
    flex-direction: column;
    overflow: initial;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .admin-bar & {
    top: 32px !important;

    @media screen and (max-width: 782px) {
      top: 46px !important;
    }
  }

  @include themify($themes) {
    background-color: themed('mastheadBackgroundColor');
  }

  &--white {
    background-color: white !important;
  }

  &__widget-area {

  @media screen and (min-width: 768px) {
    &--left {
      // margin-right: auto;
    }

    &--right {
      margin-left: auto;
    }
  }

    .menu {
      list-style: none;
      padding: 0;
      margin: 0;

      li {
        a {
          color: white;
        }
      }
    }
  }


  @media screen and (max-width: 769px) {
    .lang-switcher-container {
      width: 100%;
      height: 100%;
      background-color: white;
      display: flex !important;
      align-items: center;
    
      ul {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 100%;

        a {              
          font-size: 14px;
          padding: 10px 30px 10px 10px;
          text-align: center;
        }
      }

      .mobile-back-button {
        align-self: stretch;
        width: 100%;
      }
    }
  }

  &__inner {
    @media screen and (max-width: 769px ) {
      height: 30px;
      width: 30px;
      overflow: scroll;
      right: -110%;
      top: 60px;
      // display: flex;
      width: 100%;
      // flex-flow: column-reverse nowrap;
      // justify-content: flex-end;
      position: absolute;
      z-index: 1000;
      transition: all 200ms cubic-bezier(0.000, 0.995, 0.990, 1.000);	

      .masthead__mobile--scroll-wrapper {
        display: flex;
        flex-flow: column-reverse nowrap;
        justify-content: flex-end;
        overflow: auto;
        min-height: min-content;
      }

      .masthead__nav ul li,
      .masthead__middle div,
      .masthead__dropdown,
      .masthead__widget-area,
      .help-trigger  {
        opacity: 0;
        transform: scale(0.9);
        transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);	
      }
     
      &.mobile-nav--is-open {
        height: auto;
        min-height: 100%;
        width: 100%;
        right: 0;

        .masthead__nav {
          ul li {
            opacity: 1;
            transform: scale(1);

            @for $i from 1 to 10 {
              &:nth-child(#{$i}) { transition-delay: #{$i*0.1s + 0.3s} }
            }

            // this is the search bar thats visually first thanks to flexbox
            &.search__trigger {
              transition-delay: 0.3s !important;	  
            }
          }
        }

        .masthead__upper {
          .masthead__dropdown,
          .masthead__widget-area,
          .help-trigger {
            opacity: 1;
            transform: scale(1);

            &:nth-of-type(1) {
              transition-delay: 1s;	  
            }
            &:nth-of-type(2) {
              transition-delay: 1.15s;	  
            }
            &:last-child {
              transition-delay: 1.45s;	  
            }

            .hasMiddle & {
              &:nth-of-type(1) {
                transition-delay: 1.4s;	  
              }
              &:nth-of-type(2) {
                transition-delay: 1.5s;	  
              }
              &:last-child {
                transition-delay: 1.6s;	  
              }
            }

            .header-cta {
              width: 100%;
              min-height: 30px;

              a {
                display: block;
                height: 100%;
              
                span {
                  height: 100%;
                  padding-right: 2rem;
              
                  &:after {
                    position: absolute;
                    right: 0;
                  }
                }
              }
            }
          }
        }

        .masthead__middle div {
          opacity: 1;
          transform: scale(1);

          @for $i from 1 to 8 {
            &:nth-child(#{$i}) { transition-delay: #{$i*0.1s + 1s} }
          }
        }
      } 

      .masthead__logo {
        display: none;
      }

      .animate {
        transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);	
      }

      &.fadeout {

        .animate {
          opacity: 0 !important;
          transition-delay: 0s !important;
          transform: scale(0.9) !important;
        }
      }

      &.fadein {
        .animate {
          transition-delay: 300ms !important;
        }
      } 
    }

    @media screen and (min-width: 770px) {
      height: auto !important;
      .masthead__widget-area--left {
        .masthead-country-widget {
          .mobile-header {
            display: none !important;
          }
        }
      }
    }

    .mobile-text {
      @media screen and (min-width: 770px) {
        display: none;
      }
    }
  }

  &__middle {
    height: 40px;
    background: #f2f2f2;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 1.5rem;

    span, a {
      @include themify($themes) {
        font-family: themed('ctaFont');
        font-size: themed('ctaFontSize');
      }
    }

    a {
      @include themify($themes) {
          color: themed('middleNavColor');
          font-weight: normal;
      }
    }

    @media screen and (max-width: 769px) {
      flex-direction: column;
      height: auto;
      padding: 0;
      background: #ffffff;

      > div {
        padding: .7rem 3rem;
        background: #f2f2f2;
        width: 100%;
        margin: 0;

        &:first-child {
          padding-top: 1.7rem;
        }

        &:last-child {
          padding-bottom: 1.7rem;
        }
      }
    }
  }

  &__upper {
    display: flex;
    flex-flow: column;
    align-items: center;
    justify-content: flex-start;
    transition: background-color 0.3s;

    .masthead__widget-area--right {
      justify-self: flex-end;
    }

    @media screen and (min-width: 770px) {
      flex-flow: row;
      height: 40px;

      .theme-corporate .masthead--white & {
        background-color: #003c68;
      }

      @include themify($themes) {
        background-color: themed('mastheadUpperBackgroundColor');
      }

      // @include poly-padding-x--large;
    }

    @media screen and (max-width: 769px) {
      .header-cta {
        padding: 0;
      }
    }
  }

  &__main {
    display: flex;
    align-items: stretch;
    justify-content: space-between;

    @media screen and (min-width: 770px) {
      height: 80px;
      padding-bottom: 0;
    }
  }

  &__logo {
    padding: 14px 25px 14px 1.5rem;
    // flex: 1;
    flex-shrink: 0;
    min-width: 200px;
    max-width: 250px;

    @media screen and (min-width: 770px) and (max-width:1024px) {
      min-width: 150px;
    }

    @media screen and (min-width: $monster-screen) {
      margin-left: 1.5rem;
    }

    > a {
      display: block;
    }

    img, svg {
      max-height: 50px;

    }
  }

  &__nav {
    display: flex;
    justify-content: flex-end;
    position: relative;
    flex: 1;

    @media screen and (max-width: 769px ) {
      flex-flow: column;
      padding-bottom: $base-spacing;
      outline: none;
      flex: 1;
    }

    ul {
      width: 100%;
      margin: 0;
      padding: 0;
      list-style: none;
      display: flex;
      justify-content: space-around;
      z-index: 10;

      // @media screen and (min-width: 770px) {
      //   padding-right: 1.5rem;
      // }

      // @media screen and (min-width: $x-large-screen) {
      //   @include poly-padding-right--large;
      // }

      @media screen and (max-width: 769px ) {
        flex-flow: column;
      }

      li {
        // display: inline-block;
        display: flex;
        margin: 0;

        @media screen and (max-width: 769px) {
          width: 100%;

          &:first-child {
            padding-top: $base-spacing;
          }
        }

        a {
          font: 900 12px "Biryani", sans-serif;
          display: flex;
          align-items: center;
          padding: $small-spacing $large-spacing;
          color: $white;
          height: 55px;
          position: relative;
          transition: color 0.3s;
          letter-spacing: normal;
          z-index: 350;
          text-align: left;

          @media screen and (min-width: 770px) {
            height: 100%;
            padding: 1rem;
          }

          @media screen and (min-width: $x-large-screen) {
            padding: $base-spacing;
          }

          @media screen and (max-width: 769px) {
            display: flex;
            transition-delay: 0.2s;
            padding: .75rem 4.5rem .75rem 3rem;
            width: 100%;

            sup {
              margin-left: 2px;
            }

            &::after {
              content: '';
              display: block;
              height: 17px;
              width: 18px;
              background-image: $arrow-blue-svg;
              background-repeat: no-repeat;
              background-size: contain;
              right: 3rem;
              position: absolute;
              top: 50%;
              transform: translateY(-50%);

              @include themify($themes) {
                $escapeArrowColor: str-replace(quote(#{themed('ctaColor')}), '#', '');
                background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpolygon  fill='%23#{$escapeArrowColor}' points='14.54 7.63 13.04 8.76 13.71 10.97 5.18 10.97 5.18 12.97 13.71 12.97 13.04 15.17 14.54 16.3 19.86 12.8 19.86 11.13 14.54 7.63'/%3E%3C/svg%3E");
              }
            }
          }

          @include themify($themes) {
            color: themed('navColor');
            font-family: themed('ctaFont');
            font-size: themed('ctaFontSize');

            svg {
              path {
                fill: themed('ctaColor');
              }
            }
          }

          .theme-corporate & {
            color: white;

            svg {
              @extend %svg-white;
            }
          }

          .masthead--white & {
            @include themify($themes) {
            color: themed('navColor') !important;

            svg {
              path {
                fill: themed('ctaColor') !important;
              }
            }
            }
          }

          @media screen and (min-width: 770px) {
            &::after {
              content: '';
              width: 100%;
              background-color: rgba(0, 111, 238, 1);
              display: block;
              height: 8px;
              position: absolute;
              bottom: -4px;
              left: 0;
              transform: scaleX(0);
              transition: transform 0.12s;

              @include themify($themes) {
                background-color: themed('navUnderline');
              }
            }

            &:hover,
            &:focus {
              &::after {
                transform: scaleX(1);
              }
            }
          }
        }

        @media screen and (min-width: 770px) {
          &.current-menu-item a,
          &.current-menu-parent a {
            &::after {
              transform: scaleX(1);
            }
          }
        }   

        &.search__trigger {
          @media screen and (max-width: 769px) {
            background-color: $concrete;
            order: -1;
          }

          @media screen and (min-width: 770px) {
            width: 80px;
          }
        
          a {
            @media screen and (max-width: 769px) {
              padding: .75rem 3rem .75rem 3rem;
              justify-content: space-between;
              
              &::after {
                display: none;
              }
            }
          }

          &.open {
            z-index: 6;
            background-color: transparent;

            @media screen and (min-width: 770px) {
              &:hover {
                background-color: darken($blue-ribbon, 10%);
              }
            }

            a {
              &:hover,
              &:focus {
                &::after {
                  display: none;
                }
              }

            }
            .masthead--white & {  
              svg {
                path {
                  @include themify($themes) {
                    fill: themed('ctaGradient');
                  }
                }
              }
            }
          }
        }
      }
    }

    .search {
      position: absolute;
      top: 0;
      width: 0;
      right: 0;
      transition: 0.3s;
      background-color: $blue-ribbon;
      height: 55px;

      @include themify($themes) {
        background-color: themed('mastheadSearchColor');
      }

      @media screen and (min-width: 770px) {
        bottom: 0;
        height: auto;
      }

      &__field {
        width: 0;
        overflow: hidden;

        form {
          width: 100%;
          height: 100%;
          display: flex;
          justify-content: space-between;

          input {
            background-color: $blue-ribbon;
            border: none;
            height: 87%;
            width: 80%;
            color: white;
            font: 200 20px "Biryani", sans-serif;
            position: relative;
            top: 10%;  
            left: 20px;

            @include themify($themes) {
              font: 200 20px themed('ctaFont');
              background-color: themed('mastheadSearchColor');
            }

            @media screen and (min-width: 770px) {
              left: 80px;
              right: 80px;
            }  

            &::placeholder {
              color: white;
              font-weight: 900;
            }
            &:focus {
              &::placeholder {
                color: transparent;
              }
            }
          }

          button {
            width: 50px;
            height: 55px;
            transform: translateX(30%);
            @include poly-margin-right--large;

            @media screen and (min-width: 770px) {
              width: 80px;
              height: 80px;

              &:hover {
                background-color: darken($blue-ribbon, 10%);

                @include themify($themes) {
                  background-color: themed('mastheadSearchColor');
                }
              }  
            }  

            svg {
              @extend %svg-white;
            }
          }
        }

        .icon-toggle {
          position: absolute;
          width: 80px;
          height: 100%;
          text-align: center;
          cursor: pointer;
          display: none;

          @media screen and (min-width: 770px) {
            display: block;
          }

          svg {
            margin-top: 50%;
            transform: translateY(-50%);

            path {
              fill: white;

              &:nth-of-type(2) {
                visibility: hidden;
              }
            }
          }
        }
      }

      &.open {
        width: 100%;
        z-index: 999;

        .search__field {
          width: 100%;
          height: 100%;
          background-color: $blue-ribbon;
          @include themify($themes) {
            background-color: themed('mastheadSearchColor');
          }
        }
      }
    }
  }

  &__mobile {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    height: 60px;
    position: relative;

    &__twolayer {
      flex-flow: column wrap;
      height: auto;
      min-height: 110px;
      justify-content: flex-start;
    }

    &__middle {
      height: auto;
      min-height: 50px;
      display: flex;
      padding: 0 1rem 0;
      flex-flow: row nowrap;
      width: 100%;
      background: #f2f2f2;
      align-items: center;
      z-index: 500;

      &--left,
      &--right {
        display: flex;
        flex-flow: column wrap;
        align-items: flex-start;
        flex-basis: 50%;

        > div {
          width: 100%;
        }

        .header-secondary-cta {
          margin-right: 0;
          margin-bottom: 10px;
        }

        span, a {
          @include themify($themes) {
            font-family: themed('ctaFont');
            font-size: themed('ctaFontSize');
          }
          font-size: 80% !important;
        }
    
        a {
          @include themify($themes) {
              color: themed('middleNavColor');
          }
        }

      }

      &--right {
        text-align: right;
        padding-top: 5px;
      }
    }

    &__main {
      height: 60px;
      display: flex;
    }

    .masthead__logo {
      width: 133px;
      padding: 12px;
      z-index: 15;
      position: relative;
    
        img, svg {
          height: 36px;
        }
    }

    .snowball {	
      border-radius: 50%;
      width: 0px;
      height: 0px; 
      position:absolute;
      top: -35px;
      right: -36px;
      background:#fff;
      opacity:1;
      transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);	
    }

    .mobile-nav__toggle {
      height: 60px;
      width: 60px;
      color: $white;
      overflow: hidden;
      position: absolute;
      z-index: 10;
      outline: 0;
      right: 0;

  
      @media (min-width: 770px) {
        height: 70px;
        width: 70px;
      }
  
      @include themify($themes) {
        svg {
          path {
            fill: themed('navColor');
          }
        }
      }

      .theme-corporate & {
        svg {
          path {
            fill: white;
          }
        }
      }

      .masthead--white & {
        @include themify($themes) {
          svg {
            path {
              fill: themed('navColor');
            }
          }
        }
      }

      .nav-trigger {
        path:nth-of-type(2) {
          visibility: hidden;
        }
      }
    }

    &.active {
      .mobile-nav__toggle {
        @include themify($themes) {
          svg {
            path {
              fill: themed('ctaGradient');
            }
          }
        }
      }

      .snowball {	
        width: 2500px;
        height: 2500px;
        top: -1060px;
        right: -1065px; 	
        transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);					
      }
    }

    @media screen and (min-width: 770px) {
      display: none;
    }
  }

  &:not(.masthead--white) {
    .masthead__logo {
      svg {
        @extend %svg-white;
      }

      .logo-outline {
        stroke: rgba(#fff, 0.5);
      }
    }
  }

  .disable-pointer-events {
    pointer-events: none;
  }
}

.global-subnav {
  position: fixed;
  top: 160px;
  width: 100%;
  z-index: 200;
  background-color: rgba(#fff, 0.5);
  display: flex;
  transition: 0.3s;
  opacity: 0;
  pointer-events: none;

  &__item-image {
    max-height: 140px;
    margin: 0 auto;
  }

  &.on-load {
    display: none;
  }

  @media screen and (min-width: 770px) {
    transform: scale(0.95);
    transform-origin: top;
    height: auto !important;

    .theme-corporate & {
      top: 120px;
    }

    .admin-bar & {
      top: 152px !important;
    }
  }

  @media screen and (max-width: 769px) {
    position: absolute;
    top: 60px;
    bottom: 0;
    left: 110%;
    opacity: 1;
    flex-direction: column;
    background-color: white;
    z-index: 2005;
    box-shadow: rgba(15, 128, 238, 0.6) 9px 8px 33px;
    transition: left 500ms 100ms cubic-bezier(0.000, 0.995, 0.990, 1.000);	 	
    overflow: scroll;
    padding-top: 50px;
  }

  &--is-open {
    opacity: 1;
    transform: scale(1);
    transition: 0.3s;
    pointer-events: initial;
    // display: flex;
    // transition: left 500ms 200ms cubic-bezier(0.000, 0.995, 0.990, 1.000);

    @media screen and (max-width: 769px) {
      left: 0;
    }
  }

  &--fadeout {
    opacity: 0 !important;
    transition-delay: 0s !important;
    transform: scale(0.9) !important;
  }

  &__section-title {
    height: 50px;
    color: white;
    font: 900 12px "Biryani", sans-serif;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    line-height: 50px;
    position: absolute;
    top: 0;
    width: 100%;
    @include poly-padding-x--large;


    @include themify($themes) {
      background-color: themed('navColor');
    }

    span:first-child {
      display: block;
      height: 50px;
      width: 15px;
      background-image: $arrow-white-svg-left;
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;
      transform: rotate(180deg);
      margin-right: $base-spacing;
      float: left;
    }

    @media screen and (min-width: 770px) {
      display: none;
    }
  }

  &__intro {
    @include poly-padding--large;

    background-color: $white;
    flex: 1;
    flex-basis: 25%;

    @media screen and (max-width: 769px) {
      display: none;
    }

    &__inner {
      width: fit-content;
      max-width: 55%;
      margin: 0 auto;
    }

    &__text {
      margin-top: $base-spacing;
      font-size: 14px;
      font-weight: 300;
      line-height: 2.14;
      letter-spacing: 1px;
      color: $black;
    }
  }

  &__links {
    flex: 2;
    
    @media screen and (min-width: 770px) {
      flex-basis: 50%;
      background-color: $light-grey;
    }

    ul {
      margin: 0;
      padding: 0;
      list-style: none;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      flex-wrap: wrap;
      height: 100%;

      @media screen and (min-width: 770px) {
        flex-direction: row;
        align-items: stretch;
      }

      li {
        margin: 0;
        width: 100%;
        border-bottom: 2px solid #f2f2f2;

        @media screen and (min-width: 770px) {
          flex-basis: 50%;
          border-bottom: none;
        }

        a {
          @include poly-padding-x--large;

          padding-top: $base-spacing;
          padding-bottom: $base-spacing;
          height: auto;
          display: flex;
          flex-direction: column;
          transition: background-color 0.3s;
          justify-content: center;

          @media screen and (min-width: 770px) {
            height: 100%;
          }

          &:hover,
          &:focus {
            background-color: $white;
            
            background-position: 90% center;
            background-repeat: no-repeat;
            background-size: 20px;
            @include themify($themes) {
              $escapeArrowColor: str-replace(quote(#{themed('ctaColor')}), '#', '');
              background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpolygon  fill='%23#{$escapeArrowColor}' points='14.54 7.63 13.04 8.76 13.71 10.97 5.18 10.97 5.18 12.97 13.71 12.97 13.04 15.17 14.54 16.3 19.86 12.8 19.86 11.13 14.54 7.63'/%3E%3C/svg%3E");
            }
          }

          .global-subnav__primary-link__title {
            font-weight: bold;
            margin-bottom: $small-spacing;

            @include themify($themes) {
              // font-family: themed('headingFont');
              font-family: themed('ctaFont');
              color: themed('navColor');
              font-size: themed('ctaFontSize');
            }
          }

          .global-subnav__primary-link__excerpt {
            font-size: 12px;
            font-weight: 300;
            line-height: 1.58;
            letter-spacing: 0.9px;
          }
          
          @media screen and (max-width: 769px) {
            background-color: $white;
            background-image: $arrow-blue-svg;
            background-position: 90% center;
            background-repeat: no-repeat;
            background-size: 20px;

            @include themify($themes) {
              $escapeArrowColor: str-replace(quote(#{themed('navColor')}), '#', '');
              background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpolygon  fill='%23#{$escapeArrowColor}' points='14.54 7.63 13.04 8.76 13.71 10.97 5.18 10.97 5.18 12.97 13.71 12.97 13.04 15.17 14.54 16.3 19.86 12.8 19.86 11.13 14.54 7.63'/%3E%3C/svg%3E");
            }

            p,
            span {
              padding-right: $large-spacing;
            }
          }
        }

        @media screen and (min-width: 770px) {
          &.current-menu-item a {
            background-color: $white;
              
            background-position: 90% center;
            background-repeat: no-repeat;
            background-size: 20px;
          }
        }
      }
    }
  }

  &__cta {
    @include poly-padding--large;

    flex: 1;
    flex-basis: 25%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;

    @media screen and (max-width: 769px) {
      display: none;
    }

    h3 {
      line-height: 1.3;
      font-size: 20px;
      color: $white;
    }

    .cta {
      margin-top: $base-spacing;
    }

    @include themify($themes) {
      background-color: themed('highlightColor');
      font-family: themed('ctaFontFamily');
    }
  }
}

.masthead__primary-link {
  text-align: center;
}

.navigation-page-cover {
  position: fixed;
  z-index: 300;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: cyan;
  opacity: 0;

  &--is-visible {
    background-color: cyan;
    opacity: 1;
  }
}

.theme-corporate .masthead__nav ul li a svg path {
    fill: #fff;
}