/* Posts (docs/design-system.md, Layout; Preview cards). Under the tabs a
   toolbar: the grid and list switch at the left, the sort select at the
   right. The grid of preview cards, or the list of rows in one panel. */

.posts__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.posts__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-note);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.posts__grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* The trash of a card appears at its top-right corner on hover and on
   keyboard focus. */
.posts__delete {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 4;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.preview-card:hover .posts__delete,
.preview-card:focus-within .posts__delete {
  opacity: 1;
}

/* The list view: the panel's rows (.card__row), each a post that opens on
   click. */
.posts__row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
}

.posts__row-thumb {
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-thumb);
}

.posts__row-thumb--empty {
  aspect-ratio: 9 / 16;
  background: var(--color-bg-page);
}

.posts__row-text {
  flex: 1;
  min-width: 0;
}

.posts__row-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.posts__row-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.posts__row-note {
  margin: 0;
  font-size: var(--text-note);
  color: var(--color-text-muted);
}

.posts__row-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.posts__pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
  font-size: var(--text-note);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

/* The spinner and the empty states, centred in the content area. */
.posts__placeholder {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Phone: the grid goes two across; a row puts its actions under its text. */
@media (max-width: 860px) {
  .posts__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .posts__row {
    flex-wrap: wrap;
  }

  .posts__row-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .posts__placeholder {
    min-height: 0;
  }
}
