@keyframes slideOutUpAndFade {
  from {
    max-height: 1000px;
    opacity: 1;
  }

  to {
    max-height: 0;
    visibility: hidden;
    opacity: 0;
  }
}

@keyframes slideInDownAndFade {
  from {
    max-height: 0;
    visibility: hidden;
    opacity: 0;
  }

  to {
    max-height: 300px;
    opacity: 1;
  }
}

/*! purgecss start ignore */
.grecaptcha-badge {
  visibility: hidden;
}
/*! purgecss end ignore */

.site-newsletter-menu {
  max-height: 0;

  will-change: visibility, max-height;
  visibility: hidden;
  background: linear-gradient($gray-100, $white);

  transition: max-height .25s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .25s;

  &__container {
    position: relative;
    max-width: $marko-web-document-container-max-width;
    padding-top: 30px;
    padding-right: $marko-web-page-wrapper-padding;
    padding-left: $marko-web-page-wrapper-padding;
    margin-right: auto;
    margin-left: auto;

    @media (min-width: $marko-web-document-container-max-width) {
      padding-right: 0;
      padding-left: 0;
    }

    @include media-breakpoint-down(sm) {
      padding-top: 24px;
    }

    & .row {
      position: relative;
    }
  }

  &__form-wrapper {
    padding-bottom: 30px;
    max-width: 600px;
    margin-right: auto;
    form {
      display: flex;
      flex-wrap: wrap;
      label[for="newsletter-pushdown-email"] {
        display: none;
      }
      .form-group:only-of-type {
        flex: 1;
        flex-grow: 1;
        max-width: 318px;
         ~ .btn {
          align-self: flex-start;
         }
      }
      .btn {
        flex-shrink: 1;
        margin-left: map-get($spacers, 3);
        padding: 10px;
        font-weight: $font-weight-bolder;
        order: 2;
        align-self: center;
      }
      .form-group ~ .text-muted {
        order: 4;
        flex: 0 0 100%;
        font-size: 12px;
      }
      &__name {
        font-size: 28px;
      }
      @include media-breakpoint-down(sm) {
        &__name {
          font-size: 18px;
        }
      }
    }
    @include media-breakpoint-down(sm) {
      max-width: 450px;
      margin-right: auto;
      margin-left: auto;
    }
  }

  &__form-button {
    @include skin-button("primary");
  }

  &__image-wrapper {
    display: flex;
  }

  &__image {
    width: 170px;
    margin-top: auto;
    margin-right: auto;
    margin-left: auto;
    filter: drop-shadow(10px 10px 20px rgba(0, 0, 0, .4));
  }

  &__name {
    @include skin-typography($style: "section-header");
    margin-bottom: 6px;
    line-height: 1.25;
    text-transform: none;
  }

  &__description {
    @include skin-typography($style: "teaser-text-1");
    margin-bottom: 16px;
  }

  &__privacy-policy {
    @include skin-typography($style: "credit-disclaimer");
    margin-top: 10px;
    margin-bottom: 14px;

    line-height: 1.428;

    a {
      text-decoration: underline;
    }
  }

  &__form {
    input {
      max-width: 312px;
    }
  }

  &__close-container {
    right: 0;
    display: flex;
    flex-shrink: 1;
  }

  &__close {
    @include theme-toggle-button();
    width: 25px;
    height: 25px;
    padding: 0;
    margin-right: 0;
    margin-left: auto;

    > .marko-web-icon {
      position: relative;
      top: -1px;
      @include theme-navbar-link-color($theme-site-navbar-secondary-colors);
    }
  }

  .newsletter-name {
    font-weight: $font-weight-bold;
  }

  &--open {
    max-height: 1000px;
    visibility: visible;

    transition: max-height .25s cubic-bezier(.4, 0, .2, 1), visibility 0s linear 0s;
  }
}

// overrides for inbody content injections
.page-contents__content-body {
  .site-newsletter-menu {
    visibility: visible;
    max-height: initial;
    padding: map-get($spacers, block);
    padding-bottom: 0;
    margin-bottom: map-get($spacers, block);
    background: linear-gradient($gray-100, $gray-300);
    &__container {
      padding-top: 0;
    }
    &__image {
      max-width: 100%;
      filter: drop-shadow(-10px -10px 10px rgba(0,0,0,.24));
    }
    &__close-container,
    &__close-container {
      display: none !important;
    }
  }
}

.complete-newsletter-signup {
  $self: &;
  max-width: 652px;
  margin-right: auto;
  margin-left: auto;

  &__slide-out {
    animation-name: slideOutUpAndFade;
    animation-duration: 500ms;
    animation-fill-mode: both;
  }

  &__slide-in {
    animation-name: slideInDownAndFade;
    animation-duration: 500ms;
    animation-fill-mode: both;
  }

  &__card-header {
    display: inline-flex;
    align-items: center;
    padding: 15px 17px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: $gray-800;
    background-color: $skin-newsletter-signup-bg-color;

    @include media-breakpoint-up(md) {
      font-size: 20px;
    }
  }

  &__card-body {
    max-width: 652px;
    overflow: hidden;
  }

  &__check-icon {
    margin-right: 12px;

    svg {
      width: 20px;
      height: 20px;
      fill: $gray-800;
    }
  }

  &__header {
    margin-bottom: 19px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.14;

    @include media-breakpoint-up(md) {
      margin-bottom: 24px;
    }
  }

  &__thank-you-header {
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.14;
  }

  &__about-you {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.14;

    @include media-breakpoint-up(md) {
      margin-bottom: 12px;
    }
  }

  &__form {
    display: flex;
    flex-direction: column;
    margin-bottom: 13px;

    @include media-breakpoint-up(md) {
      flex-direction: row;
      margin-bottom: 36px;
    }
  }

  &__form-group {
    margin-bottom: 19px;
    @include media-breakpoint-up(md) {
      margin-bottom: 0;
    }

    &--company-name {
      max-width: 250px;
      @include media-breakpoint-up(md) {
        margin-right: 12px;
      }
    }
    &--primary-role {
      max-width: 250px;
      @include media-breakpoint-up(md) {
        max-width: 238px;
        margin-right: 12px;
      }
    }
    &--postal-code {
      max-width: 140px;
    }
  }

  &__form-label {
    margin-bottom: 9px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.13;
  }

  &__form-button {
    @include skin-button("primary");
  }

  &__subscriptions-header {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.14;

    @include media-breakpoint-up(md) {
      margin-bottom: 15px;
    }
  }

  &__subscriptions {
    margin-bottom: 15px;
  }

  &__signup {
    display: flex;
    flex-direction: column-reverse;

    @include media-breakpoint-up(md) {
      flex-direction: row;
      align-items: center;
    }

    .btn {
      white-space: nowrap;
    }
  }

  &__privacy-policy {
    @include skin-typography($style: "credit-disclaimer");
    margin-bottom: 15px;

    @include media-breakpoint-up(md) {
      max-width: 100%;
      margin-bottom: 0;
      margin-left: 17px;
    }
  }

  &--as-card {
    background-color: $gray-100;
    border-radius: 4px;

    #{ $self } {
      &__card-header {
        display: flex;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
      }
      &__card-body {
        padding-right: 15px;
        padding-bottom: 24px;
        padding-left: 15px;
      }
    }
  }

  &--in-pushdown {
    padding-bottom: 24px;
    margin-left: 0;
    @include media-breakpoint-up(md) {
      padding-bottom: 30px;
      margin-left: 64px;
    }
  }
}

.newsletter-checkbox-group {
  &__name {
    display: inline-block;
    margin-bottom: 2px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.22;
  }

  &__description {
    display: inline-block;
    max-width: 250px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.38;
  }

  .custom-control-label {
    margin-bottom: 9px;
  }
}

.inline-newsletter-form {
  margin-bottom: 24px;
  background-color: $skin-newsletter-signup-bg-color;
}

.inline-newsletter-form-step1 {
  display: flex;
  align-items: center;
  padding: 22px 16px;
  margin-right: auto;
  margin-left: auto;
  max-width: 652px;
  border-radius: 4px;

  &__left-col {
    display: none;
    @include media-breakpoint-up(md) {
      display: block;
      width: 100px;
      margin-top: auto;
      margin-right: 20px;
      margin-bottom: auto;
    }

    img {
      width: 100px;
    }
  }

  &__title {
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.14;
    color: $gray-800;
  }

  &__description {
    max-width: 525px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.38;
    color: $gray-800;
  }

  &__form {
    display: flex;
    max-width: 435px;
  }

  &__email-group {
    flex-grow: 1;
  }

  &__email-input {
    background-color: #fff;
    border-color: $skin-newsletter-signup-bg-color;
    &:hover:not(:focus) {
      border-color: $skin-newsletter-signup-inline-btn-color;
    }
    &:focus {
      border-color: $skin-newsletter-signup-inline-btn-color;
      box-shadow: 0 0 0 1px $skin-newsletter-signup-inline-btn-color;
    }
  }

  &__form-button {
    margin-left: 10px;
    @include skin-button("inline-newsletter-signup");
  }

  &__privacy-policy {
    max-width: 525px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.28;
    color: $gray-700;

    a {
      color: $gray-700;
      text-decoration: underline;
    }
  }
}

.site-newsletter-menu {
  $self: &;
  &__form-wrapper {
    max-width: 600px;
    margin-right: auto;

    form {
      display: flex;
      flex-wrap: wrap;
      label[for="newsletter-pushdown-email"] {
        display: none;
      }
      #newsletter-menu-email {
        flex: 1;
        flex-grow: 1;
      }
      .form-group:only-of-type {
        ~ .btn {
          align-self: flex-start;
         }
      }
      .btn {
        flex-shrink: 1;
        margin-left: map-get($spacers, 3);
        padding: 10px;
        order: 2;
        align-self: center;
      }
      .form-group ~ .text-muted {
        order: 4;
        flex: 0 0 100%;
        font-size: 12px;
      }
    }
    &__name {
      font-size: 28px;
    }
    @include media-breakpoint-down(sm) {
      &__name {
        font-size: 18px;
      }
    }
  }
  &__close-container{
    flex-shrink: 1;
  }
}
