@import "mixins";

.ftm_blog_hub_content_wrapper {
  .content_panel {
    > h1 {
      width: auto;
    }
  }
}

.top_posts {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: center;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 30px;
}

.top_posts > article {
  margin-bottom: 30px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  padding: 0px;
  position: relative;

  &.main-post {
    margin-bottom: -40px;

    > .post-thumbnail {
      > a {
        > img {
          max-width: unset;
          max-height: unset;
        }
      }
    }

    > .article-info {
      background-color: #fff;
      max-width: 85%;
      position: relative;
      top: -90px;
      padding-right: 25px;
      min-height: 90px;
      width: 100%;

      > .post_excerpt {
        display: none;
      }
    }
  }

  > .post-thumbnail {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: flex-start;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    min-height: 190px;

    > a {
      display: flex;
      width: 100%;
      flex-direction: row;
      flex-wrap: nowrap;
      align-content: center;
      justify-content: center;
      align-items: center;

      > img {
        width: 100%;
        -o-object-fit: cover;
        object-fit: cover;
        max-width: 100%;
        max-height: 192px;
      }
    }
  }

  > .article-info {
    > h3 {
      margin: 0px;
      color: #27292e;
      line-height: 1.5;
      padding: 10px 0px;

      > a {
        color: inherit;
        text-decoration: none;
        cursor: pointer;
        transition: color 0.3s ease-in-out, opacity 0.3s ease-in-out,
          background-color 0.3s ease-in-out;

        &:hover {
          color: #ff7917;
        }
      }
    }

    > .post_meta {
      box-sizing: border-box;
      color: #ff7917;
      font-size: 0.8rem;
      letter-spacing: -0.3px;
      margin-top: auto;
      display: flex;
      flex-direction: row;
      align-content: center;
      justify-content: flex-start;
      align-items: center;
      -moz-column-gap: 6px;
      column-gap: 4px;
      flex-wrap: wrap;

      > span {
        color: #27292e;
        white-space: nowrap;
      }

      > i {
        font-size: 19px;
        font-family: monospace;
        display: flex;
        max-height: 24px;
        flex-direction: row;
        flex-wrap: nowrap;
        align-content: center;
        justify-content: center;
        align-items: center;
      }
    }
  }
}

.most_popular {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: center;
  justify-content: flex-start;
  align-items: center;
  background-color: #f7f7f7;
  padding: 10px 0px 40px 0px;
  margin: 10px auto;

  > h2 {
    width: auto;
  }

  > .posts_wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    align-items: flex-start;
    column-gap: 24px;
    row-gap: 24px;

    > article {
      display: flex;
      flex-direction: column;
      flex-wrap: nowrap;
      align-content: center;
      justify-content: center;
      align-items: center;
      text-align: center;
      position: relative;

      > .post-thumbnail {
        width: 100%;
        max-width: 100%;
        height: 400px;
        overflow: hidden;

        > a {
          > img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            filter: brightness(0.7);
          }
        }
      }

      > .post-info {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        align-content: center;
        justify-content: center;
        align-items: center;
        position: absolute;
        padding: 10px 20px;

        &:hover {
          > h4 {
            > a {
              color: #ff7917;
            }
          }
          > .post_meta {
            color: #ff7917;
          }
        }

        > h4 {
          text-align: center;
          font-size: 1.875rem;
          line-height: 1.35;
          margin-bottom: 10px;
          width: 100%;

          > a {
            text-decoration: none;
            color: #fff;
            text-shadow: 1px 1px black;
            transition: color 0.3s ease-in-out, opacity 0.3s ease-in-out,
              background-color 0.3s ease-in-out;
          }
        }

        > .post_meta {
          display: flex;
          flex-direction: row;
          flex-wrap: wrap;
          align-content: center;
          justify-content: center;
          align-items: center;
          color: #fff;
          letter-spacing: 0.5px;
          font-weight: 700;
          font-size: 0.76rem;
          transition: color 0.3s ease-in-out, opacity 0.3s ease-in-out,
            background-color 0.3s ease-in-out;
        }
      }
    }
  }
}

.latest {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  align-items: flex-start;
  column-gap: 13px;

  &.narrow {
    article {
      width: 32%;
      .post-thumbnail {
        img {
          aspect-ratio: unset;
          min-height: 150px;
        }
      }
    }
  }

  > h2 {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: unset;
  }

  > div.related--posts-title {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: unset;
    font-weight: bold;
    font-size: var(--ftm_h2_font_size_setting);
    margin-bottom: 20px;
  }

  > article {
    width: 100%;
    max-width: none;
    margin-bottom: 20px;

    > .post-thumbnail {
      display: block;
      width: 100%;
      position: relative;

      > a {
        color: #fff;
        text-decoration: none;

        > img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          max-height: 234px;
          aspect-ratio: 1 / 1;
        }
      }
    }

    > h4 {
      font-size: 1.25rem;
      color: #27292e;
      margin: unset;

      > a {
        color: inherit;
        text-decoration: none;
        font-size: 1.25rem;
        transition: color 0.3s ease-in-out, opacity 0.3s ease-in-out,
          background-color 0.3s ease-in-out;

        &:hover {
          color: #ff7917;
        }
      }
    }

    .post_excerpt {
      color: #27292e;
    }

    .post_meta {
      letter-spacing: 0px;
      margin-top: auto;
      font-size: 0.8rem;
      font-family: helvetica;
      color: #fff;
      background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.33) 18%,
        rgba(0, 0, 0, 0.73) 56%,
        rgba(0, 0, 0, 1) 90%,
        rgba(0, 0, 0, 1) 100%
      );
      display: flex;
      flex-direction: row;
      align-content: center;
      justify-content: flex-start;
      align-items: flex-end;
      min-height: 58px;
      padding: 8px 10px;
      position: absolute;
      width: 100%;
      bottom: 9px;

      > span {
        color: #fff;
      }
    }
  }

  #no-more-posts {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 40px;
    margin-bottom: 25px;
    color: #6c6c6c;
    font-family: helvetica;
    font-size: 0.8em;
  }
}

.ftm_load_more {
  display: none;
  position: relative;
  height: 80px;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  column-gap: 4px;

  &.active {
    display: flex;
  }

  div {
    display: inline-block;
    width: 16px;
    background: #d1d1d1;
    animation: ftm-lm 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;

    &:nth-child(1) {
      animation-delay: -0.24s;
    }
    &:nth-child(2) {
      animation-delay: -0.12s;
    }
    &:nth-child(3) {
      animation-delay: 0;
    }
  }
}

@keyframes ftm-lm {
  0% {
    top: 8px;
    height: 64px;
  }
  50%,
  100% {
    top: 24px;
    height: 32px;
  }
}

@include xxs {
  .top_posts {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: flex-start;
    column-gap: 10px;

    > article {
      width: 44%;

      &.main-post {
        margin-bottom: 0px;
        grid-area: main;
        height: 100%;
        width: 100%;

        > .post-thumbnail {
          > a {
            > img {
              min-height: 482px;
            }
          }
        }
      }

      > .post-thumbnail {
        > a {
          > img {
            max-width: 270px;
          }
        }
      }

      > .article-info {
        > h3 {
          font-size: 1rem;
        }
      }
    }
  }

  .most_popular {
    > .posts_wrapper {
      > article {
        > .post-thumbnail {
          max-width: 270px;
        }
      }
    }
  }

  .latest {
    > article {
      max-width: 31%;
    }
  }
}

@include xs {
  .latest {
    > article {
      max-width: 32%;
    }
  }
}

@include sm {
  .top_posts {
    width: 100%;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-areas:
      "main tl tr"
      "main bl br";
    align-items: start;
    justify-items: start;
    justify-content: center;

    > article {
      margin-bottom: 30px;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      overflow: hidden;
      padding: 0px;
      position: relative;

      &.main-post {
        margin-bottom: 0px;
        grid-area: main;
        height: 100%;

        > .post-thumbnail {
          height: 100%;
          > a {
            > img {
              min-height: 482px;
            }
          }
        }

        > .article-info {
          > h3 {
            font-size: 1.25rem;
          }
        }
      }

      > .article-info {
        > h3 {
          font-size: 1rem;
        }
      }
    }
  }
}

@include md {
  .top_posts {
    > article {
      &.main-post {
        margin-bottom: 0px;
        grid-area: main;
        height: 100%;
        position: relative;
        box-sizing: border-box;

        > .article-info {
          position: absolute;
          bottom: 0px;
          top: unset;

          > .post_excerpt {
            display: initial;
          }
        }
      }
    }
  }

  .most_popular {
    > .posts_wrapper {
      > article {
        > .post-thumbnail {
          width: 100%;
          max-width: 348px;
          height: 550px;
          overflow: hidden;
        }

        > .post-info {
          > h4 {
            font-size: 2.5rem;
          }

          > .post_meta {
            font-size: 0.9rem;
          }
        }
      }
    }
  }
}

@include lg {
  .latest {
    > article {
      max-width: 32.5%;
    }
  }
}
