/* list-table.css: a filterable table that becomes one card per row on a phone. Used by articles.html and projects.html. Colours come only from theme variables. */

.list-table__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.list-table__filter {
  flex: 1 1 16rem;
  padding: 0.5rem 1rem;
  border: 0.0625rem solid var(--border-color);
  border-radius: 0.375rem;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.list-table__count {
  color: var(--text-secondary);
}

.list-table__wrap {
  overflow-x: auto;
}

.list-table__table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary);
}

.list-table__table th,
.list-table__table td {
  border-bottom: 0.0625rem solid var(--border-color);
  padding: 1rem;
  text-align: left;
  vertical-align: top;
}

.list-table__table th {
  background: var(--bg-tertiary);
}

.list-table__table td:nth-child(n + 4) {
  white-space: nowrap;
}

.list-table__table td:nth-child(2) {
  white-space: nowrap;
}

.list-table__table td:nth-child(3) {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.list-table__error {
  color: var(--danger-color);
}

/* One card per row on a phone. */
@media (max-width: 47.5rem) {
  .list-table__table thead {
    display: none;
  }

  .list-table__wrap table.list-table__table,
  .list-table__table tbody,
  .list-table__table tr,
  .list-table__table td {
    display: block;
    width: 100%;
  }

  .list-table__table tr {
    padding: 0.5rem 0;
    border-bottom: 0.0625rem solid var(--border-color);
  }

  .list-table__table tr[hidden] {
    display: none;
  }

  .list-table__table td {
    border: 0;
    padding: 0.25rem 1rem;
    white-space: normal;
  }

  .list-table__table td:first-child {
    font-weight: 600;
  }

  .list-table__table td:nth-child(n + 4) {
    display: inline-block;
    width: auto;
    margin-right: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
  }

  #articles-table td:nth-child(4)::after { content: " reactions"; }
  #articles-table td:nth-child(5)::after { content: " comments"; }
  #projects-table td:nth-child(5)::after { content: " stars"; }
}
