@layer components {

  .resource-list {
    margin-block: 1rem;
  }

  .resource-list__item {
    display: flex;
    align-items: center;
    border: 0;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    outline: none;

    &[aria-selected="true"] :is(.resource-list__link, .resource-list__row) {
      background-color: var(--accent-bg);
    }
  }

  /* Flex beats the [hidden] display: none the filter relies on. */
  .resource-list__item[hidden] {
    display: none;
  }

  .resource-list__link,
  .resource-list__row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--standard-border-radius);
    flex: 1 1 auto;
    min-width: 0;
  }

  .resource-list__link {
    text-decoration: none;
    color: inherit;

    &:hover {
      background-color: var(--accent-bg);
    }
  }

  /* The title and its status share the first line, the context runs under them,
     and snippets run the full width below. */
  .resource-list__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.125rem 1rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .resource-list__title,
  .resource-list__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .resource-list__title {
    grid-area: 1 / 1;
    font-weight: bold;
  }

  .resource-list__status {
    grid-area: 1 / 2;
    justify-self: end;
  }

  .resource-list__meta,
  .resource-list__date,
  .resource-list__snippet {
    color: var(--text-light);
  }

  .resource-list__meta {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .resource-list__snippet {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
  }

  .resource-list__date {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .resource-list__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-inline-end: 0.75rem;
  }

  .resource-list__item--shaded .resource-list__row {
    background-color: var(--accent-bg);
  }

  .resource-list__item--system {
    .resource-list__body {
      grid-template-columns: minmax(0, 1fr);
    }

    .resource-list__title {
      color: var(--text-light);
      font-weight: normal;
      text-align: center;
    }

    .resource-list__status,
    .resource-list__date {
      display: none;
    }
  }
}
