$illustration-box-margin-right: 2px;

.home {
  .home-section {
    &:nth-child(2) {
      .container-fluid {
        background-color: $page-bkg-grey;
      }
    }

    &:nth-child(3) {
      .container-fluid {
        background-color: $page-bkg-light;
      }
    }

    &:nth-child(4) {
      .container-fluid {
        background-color: $page-bkg-grey;
      }
    }

    &:nth-child(5) {
      .container-fluid {
        background-color: $page-bkg-light;
      }
    }

    &:nth-child(6) {
      .container-fluid {
        background-color: $page-bkg-grey;
      }
    }

    &:nth-child(7) {
      .container-fluid {
        background-color: $page-bkg-light;
      }
    }

    &:nth-child(8) {
      .container-fluid {
        background-color: $page-bkg-grey;
      }
    }

    &:nth-child(9) {
      .container-fluid {
        background-color: $page-bkg-light;
      }
    }

    &:nth-child(10) {
      .container-fluid {
        background-color: $page-bkg-grey;
      }
    }
  }

  .header-section {
    min-height: 380px;
    height: auto; // override the 500px from common header component
    overflow: hidden;
    position: relative;

    .header-content {
      position: relative;
      text-align: center;
      z-index: 2;

      .max-text-width {
        margin-top: -5px;
        margin-bottom: 0;
        max-width: 1000px;
      }

      .header-logo {
        filter: brightness(0) invert(1);
        max-height: 110px;
        padding: 10px;
        width: auto;
      }
    }

    .header-bkg {
      background-position: left;
      background-repeat: no-repeat;
      background-size: cover;
      height: 100%;
      opacity: 0.5;
      position: absolute;
      top: 0;
      width: 100%;
    }
  }

  .synthesis-section {
    .insert-box {
      height: auto;
      width: 100%;
    }

    .synthesis-container {
      padding: 0 0 0 14px;
    }
  }

  .center-content {
    display: flex;
    justify-content: center;
  }

  .objectives-section-1 {
    .container-objectives-img {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      overflow: hidden;
    }

    .objectives-img {
      background-size: cover;
      background-position-x: 50%;
      height: 480px;
      margin: 20px 0 0;

      &.size-single-img {
        width: 100%;
      }
    }
  }

  .themes-section {
    .theme {
      &:nth-child(1) {
        margin: 80px 0 0;
      }

      &:nth-child(2) {
        margin: 0;
      }

      &:nth-child(3) {
        margin: 80px 0 0;
      }

      &:nth-child(4) {
        margin: 40px 0 0;
      }
    }

    .top-idea {
      .dark-title-2 {
        padding: 30px 40px 0;
      }

      .idea-link {
        cursor: pointer;
        height: 125px;
        letter-spacing: $text-letter-spacing;
        padding: 25px 40px;

        .idea-link-title {
          display: block;
          text-align: center;
        }

        .stats {
          color: $grey;
          text-align: center;
        }

        .black-icon {
          margin: 0 0 0 5px;
        }

        &:nth-child(3) {
          background-color: $light-grey;
        }

        &:hover {
          .idea-link-title {
            color: $white;
          }

          .inline {
            color: $white;
          }

          span {
            color: $white;
          }
        }
      }
    }
  }

  .phases-section {
    .phases-container {
      display: flex;
      flex-wrap: wrap;
      padding-bottom: 80px;
      width: 100%;

      .illustration-box {
        background-color: $grey;
        background-position: top center;
        background-repeat: no-repeat;
        background-size: cover;
        height: 300px;
        margin-bottom: 2px;
        margin-right: 1px;
        width: 100%;

        .content-box {
          background-color: rgba($black, 0.5);
          position: relative;
          width: 100%;
          display: flex;
          flex-direction: column;
        }
      }
    }

    .bar {
      &:nth-child(1) {
        margin-top: 80px;
      }

      &:nth-child(2) {
        margin-top: 70px;
      }

      &:nth-child(3) {
        margin-top: 60px;
      }

      &:nth-child(4) {
        margin-top: 50px;
      }

      &:nth-child(5) {
        margin-top: 40px;
      }

      &:nth-child(6) {
        margin-top: 30px;
      }

      &:nth-child(7) {
        margin-top: 20px;
      }

      &:nth-child(8) {
        margin-top: 10px;
      }
    }
  }

  .twitter-section {
    .tweet-container {
      background-color: $white;
      max-width: 650px;
    }

    .title-section {
      margin: 0;
      padding: 75px 0 0;
    }
  }

  .partners-section {
    text-align: center;

    .partner-logo {
      display: inline-block;
      margin: 70px;
    }

    img {
      height: auto;
      max-height: $partner-logo-height;
      max-width: $partner-logo-width;
      width: auto;
    }
  }

  .synthesis-container {
    a {
      .insert-content {
        color: $black;
      }

      &:hover {
        .insert-content {
          color: $black;
        }
      }
    }
  }
}

@media screen and (min-width: 1101px) {
  .synthesis-section {
    display: none;
  }
}

@media screen and (max-width: 1100px) {
  .home .header-section {
    .insert-box {
      display: none;
    }
  }

  .synthesis-section {
    display: block;
  }
}

@media screen and (min-width: 1100px) {
  .home .header-section {
    /* synthesis block */
    .insert-box {
      position: absolute;
      right: 0;
      top: 120px;
      width: 270px;
    }

    /* synthesis block content */
    .insert-content {
      -webkit-box-orient: vertical;
      -webkit-line-clamp: $lines-to-show;
      display: -webkit-box;
      font-size: $font-size-xs;
      height: $font-size-xs * $line-height * $lines-to-show;
      line-height: $line-height;
      max-width: 250px;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  .container-objectives-img {
    .objectives-img {
      &.size-single-img {
        width: 100%;
      }
    }
  }
}

/* Landscape phones and portrait tablets */
@media screen and (max-width: $screen-xs-max) {
  .home {
    .header-section {
      min-height: 500px;

      .header-content {
        padding: 60px 5px 120px;
      }
    }

    .synthesis-section {
      .insert-content {
        -webkit-box-orient: vertical;
        -webkit-line-clamp: $lines-to-show;
        display: -webkit-box;
        font-size: $font-size-xs;
        line-height: $line-height;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
}

@media screen and (max-width: $screen-sm-max) {
  .home {
    .objectives-section-1 {
      .objectives-img {
        &.margin-right {
          margin-right: 0;
        }

        &.size-single-img {
          width: 50%;
        }

        &.size-two-img {
          width: 100%;
        }
      }
    }
  }

  .themes-section {
    .theme {
      &:nth-child(1) {
        margin: 2px 0 0;
      }

      &:nth-child(2) {
        margin: 2px 0 0;
      }

      &:nth-child(3) {
        margin: 2px 0 0;
      }

      &:nth-child(4) {
        margin: 2px 0 0;
      }
    }
  }
}

@media screen and (min-width: $screen-sm-min) {
  .home {
    .header-section {
      .header-content {
        padding: 75px 40px 150px;
      }
    }
  }

  @media screen and (max-width: $screen-sm-min) {
    .home {
      .padding-sm {
        padding: 40px 0;
      }

      .partners-section {
        .partner-logo {
          margin: 20px;
        }

        img {
          height: 60%;
          width: 60%;
        }
      }
    }
  }

  @media screen and (min-width: $screen-md-min) {
    .home {
      .header-section {
        .header-content {
          max-width: 100%;
        }
      }
    }
  }

  @media screen and (min-width: $screen-lg-min) {
    .home {
      .phases-section {
        .phases-container {
          padding-bottom: 0;

          @for $i from 1 through 8 {
            div:first-child:nth-last-child(#{$i}),
            div:first-child:nth-last-child(#{$i}) ~ div {
              height: 500px;
              width: 100% / $i;
              flex: 0 0 100% / $i - 0.1;
              min-width: 24%;
            }
          }
        }
      }
    }
  }

  @media screen and (max-width: $screen-xxs-max) {
    .home {
      .header-section {
        .header-content {
          padding: 10px 5px 170px;
        }
      }

      .objectives-section-1 {
        .objectives-img.size-single-img {
          width: 100%;
        }
      }

      .twitter-section {
        .tweet-section {
          padding: 10px 20px $margin-section-tiny 20px;
        }

        .title-section {
          padding: $margin-section-tiny 0 0;

          h1 {
            padding: 0 0 0 20px;
          }
        }
      }
    }

    .objectives-section-1 {
      .objectives {
        &:nth-child(3) {
          display: none;
        }
      }
    }
  }

  @media screen and (min-width: $screen-xxs-max) {
    .home {
      .objectives-section-1 {
        .container-objectives-img {
          flex-direction: row;
          overflow: hidden;

          .objectives-img {
            &.margin-right {
              margin-right: 20px;
            }

            &.size-two-img {
              width: 100%;
            }
          }
        }
      }
    }
  }

  .twitter-section {
    .tweet-section {
      padding: 45px 75px 65px;
    }
  }
}
