/* Category pages read like a table of contents, not a product grid. */
.post-list {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-line);
}

.post-list__item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2) var(--space-6);
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--color-line);

  /* With a cover, the image leads on the left and the text takes the rest of the row. */
  &:has(.post-list__image) {
    grid-template-columns: auto 1fr;
  }
}

.post-list__title {
  grid-column: -2;
  font-size: var(--text-xl);
  text-wrap: wrap; /* fill the line; the global balance breaks short titles too early */

  a {
    text-decoration: none;

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

    &:hover {
      text-decoration: underline;
      text-decoration-color: var(--color-ochre);
    }
  }
}

.post-list__text {
  grid-column: -2;
  max-width: 60ch;
  color: var(--color-text-muted);
}

.post-list__meta {
  grid-column: -2;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.post-list__image {
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 9rem;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}

@media (max-width: 40rem) {
  .post-list__item:has(.post-list__image) {
    grid-template-columns: 1fr;
  }

  .post-list__image {
    grid-row: 1;
    width: 100%;
  }
}

.empty-state {
  padding-block: var(--space-7);
  color: var(--color-text-muted);
  font-style: italic;
}
