@use './components/utilities_partial.scss' as utilities;

.post-list {
  user-select: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  max-width: 980px;
  margin: auto;
  margin-bottom: 32px;

  @media (max-width: 600px) {
    grid-template-columns: 1fr;
    max-width: 366px;
  }

  &.not-index {
    margin-top: 100px;
  }
}

.post-list-item {
  overflow: hidden;
  border-radius: var(--radius-large);
  @include utilities.corner-squircle;
  background-color: var(--color-background-secondary);

  & > a {
    color: var(--color-text-primary);
    text-decoration: none;
    display: block;
    height: 100%;

    .cover-img {
      overflow: hidden;
      height: 266px;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        filter: brightness(1);
        transition:
          scale 400ms cubic-bezier(0.4, 0, 0.25, 1),
          filter 400ms cubic-bezier(0.4, 0, 0.25, 1);
      }
    }

    &:hover .cover-img img,
    &:focus-visible .cover-img img {
      scale: 1.03;
      filter: brightness(0.85);
    }

    &:active .cover-img img {
      scale: 1;
      filter: brightness(0.65);
    }

    .title {
      font-size: 24px;
      line-height: 1.16667;
      font-weight: 700;
      max-height: 7em;
      overflow: hidden;
    }

    .content {
      padding: 32px;
    }

    .categories {
      color: var(--color-text-accent);
      margin-bottom: 6px;
      font-weight: 600;

      span {
        display: block;
        font-size: 11px;
        margin-right: 6px;
        text-decoration: none;
      }
    }

    .excerpt {
      margin-top: 12px;
      font-weight: normal;
      font-size: 15px;
      color: var(--color-text-tertiary);

      & > * {
        margin-top: 8px;
        margin-bottom: 8px;
        padding-left: 0;
        padding-right: 0;
      }
    }

    @media (max-width: 800px) {
      .content {
        font-size: 12px;
      }
    }

    .time {
      font-size: 14px;
      line-height: 1.28577;
      font-weight: 600;
      display: block;
      margin-top: 12px;
      color: var(--color-text-secondary);
    }
  }
}
