/* ==========================================================================
   COMPONENT: Articles (recent-articles view and articles-reel view)
   ========================================================================== */

.recent-articles {
  padding-block: var(--section-space);
  background: white;
}

.article-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-auto-rows: auto;
  gap: 16px 28px;

  /* First article is featured; the others stack beside it */
  .article-card:first-child {
    grid-row: span 3;
    flex-direction: column;
    background: var(--surface-color);
    border: 0;

    img {
      flex: 1 1 auto;
      width: 100%;
      min-height: 260px;
    }

    .article-card-body {
      flex: 0 0 auto;
      padding: 28px;
    }

    h3 {
      font-size: 1.6rem;
    }

    p {
      -webkit-line-clamp: 3;
    }
  }
}

.article-card {
  position: relative;
  display: flex;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s ease;

  &:hover {
    border-color: var(--primary-color);
  }

  img {
    flex: 0 0 160px;
    width: 160px;
    min-height: 130px;
    object-fit: cover;
  }

  .article-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 20px;
  }

  h3 {
    margin-bottom: 6px;
    font-size: 1.12rem;

    a {
      text-decoration: none;

      &::after {
        content: "";
        position: absolute;
        inset: 0;
      }
    }
  }

  p {
    display: -webkit-box;
    margin: 0 0 10px;
    overflow: hidden;
    font-size: 0.93rem;
    color: var(--text-muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .link-arrow {
    font-size: 0.92rem;
  }
}

/* Full grid used on the Tips page */
.articles-reel {
  padding-block: 0 var(--section-space);
}

.reel-grid--articles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;

  .article-card {
    flex-direction: column;

    img {
      width: 100%;
      flex-basis: auto;
      aspect-ratio: 16 / 10;
    }

    .article-card-body {
      flex: 1;
      justify-content: flex-start;
      padding: 22px;
    }

    .link-arrow {
      margin-top: auto;
    }
  }
}

@media (max-width: 1000px) {
  .article-grid {
    grid-template-columns: 1fr;

    .article-card:first-child {
      grid-row: auto;
    }
  }

  .reel-grid--articles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .article-card img {
    flex-basis: 110px;
    width: 110px;
  }

  .reel-grid--articles {
    grid-template-columns: 1fr;
  }
}
