.latest-posts {
  width: 100%;
  padding: 0 $gutter;
  margin: 80px 0;

  @include sm {
    padding: 0 $gutter-mobile;
    margin: 50px 0;

    &.js-sticky-filter {
      .latest-posts__filter-container {
        position: fixed;
        width: 100%;
        top: calc(#{$header-height-mobile} - 1px);
        left: 0;
        z-index: 9900;
        background: $white;
        box-shadow: 0 7px 7px -5px rgba(21, 38, 68, 0.25);
      }
    }
  }

  &__wrapper {
    width: 100%;
    max-width: $projects-content-width;
    margin: 0 auto;
  }

  &__container {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  &__filter-holder {
    @include sm {
      position: absolute;
      opacity: 0;
      pointer-events: none;

      .js-sticky-filter & {
        opacity: 1;
        pointer-events: all;
      }
    }
  }

  &__filter-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    top: 0;
    transition: top 0.3s ease-out;
  }

  &__filter {
    width: 100%;
    max-width: 400px;
    align-self: flex-end;
    margin-bottom: 100px;

    @include sm {
      max-width: 100%;
      margin-bottom: 0px;
      align-self: unset;
    }
  }

  &__filter-actions {
    @include sm {
      display: flex;
      padding: 0 $gutter-mobile;
      min-height: $header-height-mobile;
    }
  }

  &__search {
    max-width: 324px;
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid $gray-bluish;

    @include sm {
      flex: 1;
      border-bottom: 0;
      border-right: 1px solid $gray-bluish;
    }
  }

  &__icon-search {
    width: 17px;
    height: 17px;

    svg,
    g,
    path {
      fill: $primary-color;
    }
  }

  &__search-input {
    flex: 1;
    height: 44px;
    padding-left: 10px;
    color: $primary-color;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 2rem;
    letter-spacing: -0.01em;

    &::placeholder {
      color: $primary-color;
    }
  }

  &__category-container {
    margin-top: 32px;

    @include sm {
      width: 100%;
      max-width: 45%;
      margin-top: 0;
    }
  }

  &__filter-label-mobile {
    display: none;
    color: $primary-color;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 2rem;
    letter-spacing: -0.01em;
    align-items: center;
    justify-content: center;

    @include sm {
      display: flex;
      height: 100%;
    }
  }

  &__category-title {
    color: $primary-color;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 2rem;
    letter-spacing: -0.01em;

    @include sm {
      display: none;
    }
  }

  &__categories-container {
    @include sm {
      overflow: hidden;
      opacity: 0;
      height: 0;
      transition: all 0.25s ease-out;

      .js-open & {
        opacity: 1;
      }
    }
  }

  &__categories {
    display: flex;
    flex-wrap: wrap;
    margin-top: 12px;

    @include sm {
      margin-top: 0;
      flex-direction: column;
      align-items: flex-start;
      padding: 10px $gutter-mobile;
      border-top: 1px solid $gray-bluish;
    }
  }

  &__category {
    background: rgba(1, 156, 219, 0.1);
    color: $blue;
    padding: 8px;
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.8rem;
    letter-spacing: -0.01em;
    margin-right: 4px;
    margin-bottom: 4px;

    @include sm {
      margin-bottom: 8px;
    }

    &:last-child {
      margin-right: 0;
    }
  }

  &__row {
    width: 100%;
    margin-bottom: 100px;
    padding-right: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    @include mdx {
      padding-right: 0px;
    }

    @include sm {
      margin-bottom: 0;
      flex-direction: column;
    }

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

    &.latest-posts--second-row {
      padding-right: 0;
      margin-left: -40px;

      @include mdx {
        margin-left: 0;
      }
    }
  }

  &__big-posts {
    width: 100%;
    max-width: 678px;
    margin-top: 40px;

    .latest-posts--first-row & {
      margin-right: 40px;

      @include sm {
        margin-right: 0;
        margin-top: 0;
      }
    }

    .latest-posts--second-row & {
      margin-right: 40px;
      margin-left: 40px;

      @include sm {
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
      }
    }

    @include sm {
      margin-bottom: 50px;
      max-width: 100%;
      margin-left: 0;
      margin-right: 0;
    }

    &:hover {
      .latest-posts__big-posts-title {
        text-decoration: underline;

        @include sm {
          text-decoration: none;
        }

        &::after {
          display: block;

          @include sm {
            display: none;
          }
        }
      }
    }
  }

  &__big-posts-image {
    @include image-aspect-ratio(100%, 72%);
  }

  &__posts-info {
    margin-top: 32px;
  }

  &__posts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;

    .latest-posts__small-posts & {
      align-items: flex-start;
    }
  }

  &__posts-author-container {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
  }

  &__posts-author-images {
    display: flex;
  }

  &__posts-author-names {
    display: flex;
  }

  &__posts-author {
    display: flex;
    align-items: center;

    &:last-child {
      margin-right: 0;
    }

    .latest-posts__small-posts & {
      margin-bottom: 8px;

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

    &:not(&:first-child)::before {
      content: ", ";
    }

    .latest-posts__small-posts & {
      &:not(&:first-child) {
        display: none;
      }

      &:after {
        content: attr(data-count);
        display: inline-block;
        margin-left: 4px;
        font-weight: 700;
        font-size: 1.4rem;
        line-height: 1.8rem;
        letter-spacing: -0.01em;
        color: $primary-color;
      }
    }
  }

  &__photo {
    border-radius: 100%;
    overflow: hidden;
    width: 32px;
    height: 32px;

    &:not(&:first-child) {
      margin-left: -15px;
    }

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &__name {
    display: inline-block;
    margin-left: 8px;
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1.8rem;
    letter-spacing: -0.01em;
    color: $primary-color;
  }

  &__posts-date {
    color: $primary-color;
    display: inline-block;
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.8rem;
    text-align: right;
    letter-spacing: -0.01em;

    &.latest-posts--desktop {
      display: inline-block;
      margin-top: 2px;

      @include sm {
        display: none;
      }
    }

    &.latest-posts--mobile {
      display: none;

      @include sm {
        display: inline-block;
      }
    }
  }

  &__big-posts-title {
    font-size: 2.6rem;
    line-height: 3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: $primary-color;
    margin: 0;

    @include chevron-right-blog;

    &::after {
      display: none;
    }
  }

  &__tags {
    display: flex;
    flex-wrap: wrap;
    margin-top: 24px;
  }

  &__tag {
    background: rgba(1, 156, 219, 0.1);
    color: $blue;
    padding: 8px;
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.8rem;
    letter-spacing: -0.01em;
    margin-right: 4px;
    margin-bottom: 4px;

    &:last-child {
      margin-right: 0;
    }
  }

  &__small-posts {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background-color: rgba($secondary-color, 0.1);

    @include sm {
      margin-bottom: 50px;
      max-width: 100%;
    }

    .latest-posts--second-row & {
      max-width: 460px;

      @include sm {
        max-width: 100%;
      }
    }

    &:hover {
      .latest-posts__small-posts-title {
        text-decoration: underline;

        @include sm {
          text-decoration: none;
        }

        &::after {
          display: block;

          @include sm {
            display: none;
          }
        }
      }
    }
  }

  &__small-posts-image {
    @include image-aspect-ratio(100%, 72%);
  }

  &__small-posts-title {
    font-weight: 700;
    font-size: 2.1rem;
    line-height: 2.5rem;
    letter-spacing: -0.01em;
    color: $primary-color;
    margin: 0;

    @include chevron-right-blog;

    &::after {
      display: none;
    }
  }

  &__posts-excerpt {
    font-weight: 400;
    color: $primary-color;
  }
}
