/*
 * The People overview: a search above a list of cards (PersonRowComponent),
 * each the person's avatar beside their name and hours -- the same card as an
 * objective's row on the strategic plan.
 */
@layer components {
  .people-search {
    max-inline-size: var(--width-reading);
    margin-block-end: var(--space-7);
  }

  .person-list {
    display: grid;
    gap: var(--space-3);
    list-style: none;
    padding: 0;

    & > li + li {
      margin-block-start: 0;
    }
  }

  .person-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border: var(--border);
    border-radius: var(--radius-m);
    background: var(--color-paper);

    &:hover {
      border-color: var(--color-text);
    }

    & > * {
      margin: 0;
    }
  }

  .person-row__body > * {
    margin: 0;
    max-inline-size: none;
  }

  .person-row__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  /* The name links to the person's page; it reads as a heading. */
  .person-row__open {
    color: var(--color-ink);
    text-decoration: none;

    &:hover {
      color: var(--color-ink);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 0.2em;
    }
  }

  .person-row__summary {
    font: var(--text-small);
    color: var(--color-muted);
  }

  /* Inactive: listed after everyone active, faded, still opens their page. */
  .person-row--inactive {
    background: var(--color-surface-2);

    & .avatar,
    & .person-row__summary {
      opacity: 0.6;
    }

    & .person-row__open {
      color: var(--color-muted);
    }
  }
}

/*
 * The new person card at the top of the list (people/_new_form). Showing and
 * hiding it is the shared .reveal rule (reveal.css); this block only styles
 * the card. It shows as a block, not as the two-column grid .person-row is.
 */
@layer components {
  .person-row--new {
    display: block;
    /* The cards below are list items at reading width; the card matches them. */
    max-inline-size: var(--width-reading);
    margin-block-end: var(--space-3);
    padding-block: var(--space-5);
    border-style: dashed;
    border-color: var(--color-text);
  }

  .person-new-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
    align-items: start;

    & > p {
      margin: 0;
      max-inline-size: none;
    }

    & :is(input, select) {
      inline-size: 100%;
      max-inline-size: 100%;
    }

    & input[type="submit"] {
      inline-size: auto;
    }
  }

  .person-new-form__wide {
    grid-column: 1 / -1;
  }
}

/*
 * The Categories page (026): a table of categories, each name and rate an
 * inline form (person-facts__form, so Save shows only while editing). A
 * name needs more room than the inline form's short controls.
 */
@layer components {
  .person-categories__name {
    inline-size: 16rem;
  }
}
