/* Articles strip: ten article cards and a "See all articles" card in a
   horizontal slider, then a large "See all articles" button. Used on
   /knowledge/ and at the end of every article (templates/articles-strip.html).
   Cards follow Card/Content and Card/See all in the Fibbl Design System:
   382 x 404, image 223 high, 5 px corners, 1 px outline. At rest the image
   is black and white with the yellow tint; on hover it turns to colour,
   zooms in, the outline fades and the card lifts. */
.articles-strip {
  overflow-x: hidden;

  .articles-strip_slider {
    /* Let the cards run off the right edge of the page. */
    overflow: visible;
    margin-bottom: 40px;
  }

  .articles-strip_card {
    position: relative;
    width: 382px;
    height: 404px;
    border-radius: 5px;
    background-color: var(--c-gray-25);
    transition: box-shadow 0.3s ease;

    @media (max-width: 1024px) {
      width: 268px;
      height: auto;
      min-height: 320px;
    }

    /* The outline sits above the image, so fading it out on hover leaves
       no light gap around the image. */
    &::after {
      content: '';
      position: absolute;
      inset: 0;
      z-index: 3;
      border: 1px solid var(--c-gray-900);
      border-radius: inherit;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    @media (hover: hover) {
      &:hover {
        box-shadow:
          52.6425px 64.8282px 33.1453px rgba(0, 0, 0, 0.01),
          29.7332px 36.5573px 28.271px rgba(0, 0, 0, 0.03),
          13.1606px 16.0852px 20.9595px rgba(0, 0, 0, 0.04),
          3.41201px 3.89944px 11.6983px rgba(0, 0, 0, 0.05);

        &::after {
          opacity: 0;
        }
      }
    }
  }

  .articles-strip_link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
  }

  .articles-strip_media {
    position: relative;
    flex-shrink: 0;
    height: 223px;
    margin: 0;
    overflow: hidden;
    border-radius: 5px 5px 0 0;

    @media (max-width: 1024px) {
      height: 156px;
    }

    img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      filter: grayscale(100%);
      transition:
        filter 0.3s ease,
        transform 0.4s ease;
    }

    /* Yellow image tint at rest. */
    &::after {
      content: '';
      position: absolute;
      inset: 0;
      z-index: 2;
      background-color: #ffd672;
      opacity: 0.12;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }
  }

  @media (hover: hover) {
    .articles-strip_card:hover .articles-strip_media {
      img {
        filter: grayscale(0%);
      }

      &::after {
        opacity: 0;
      }
    }
  }

  @media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .articles-strip_card:hover .articles-strip_media img {
      transform: scale(1.08);
    }
  }

  .articles-strip_text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 13px 20px 30px;

    @media (max-width: 1024px) {
      padding: 8px 14px 18px;
    }
  }

  .articles-strip_title {
    color: #4e463f;
    font-family: var(--ff-secondary);
    font-size: var(--fs-lg);
    font-weight: 700;
    line-height: 1;
  }

  .articles-strip_desc {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    color: #7c7064;
    font-family: 'Inter';
    font-size: 14px;
    line-height: 1.5;

    @media (max-width: 768px) {
      font-size: 12px;
    }
  }

  /* Last card: same size and outline, with a small button in the middle. */
  .articles-strip_card--all {
    display: flex;
    align-items: center;
    justify-content: center;

    @media (max-width: 1024px) {
      height: auto;
      align-self: stretch;
    }

    .btn {
      position: relative;
      z-index: 4;
      width: auto;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .articles-strip_card,
    .articles-strip_card::after,
    .articles-strip_media img,
    .articles-strip_media::after {
      transition: none;
    }
  }
}
