/* ─────────────────────────────────────────────────────────────────────────
   PERSON FACE — a person's face beside their name (METIS-pub#822).

   The markup is one partial, crm/partials/_person_face_name.html:

     .person-face                the face and the name, one line
     .person-face--sm / --md     24px (a table cell, a chip) / 32px
     .person-face--lg            64px, a page's own person (Home's head)
     .person-face__pic           the photo's small copy, or …
     .person-face__pic--initials … the name's initials on a quiet ground
     .person-face__name          the name; "…" when it does not fit
     .person-faces               a row of overlapping faces, then
                                 .person-faces__more ("+n")

   Round, as the place strip's own picture is (place-strip.css). Platform
   tier: every app's lists use it. Tokens only.
   ───────────────────────────────────────────────────────────────────────── */

@layer components {
  .person-face {
    --person-face-size: 24px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    max-width: 100%;
    vertical-align: middle;
    color: inherit;
    text-decoration: none;
  }

  .person-face--md { --person-face-size: 32px; }
  /* A page's own person, named large at its top (Home, METIS-pub#826). */
  .person-face--lg { --person-face-size: var(--space-16); gap: var(--space-3); }
  .person-face--lg .person-face__name { font-size: var(--text-xl); font-weight: 600; }

  .person-face__pic {
    flex: none;
    width: var(--person-face-size);
    min-width: var(--person-face-size);
    height: var(--person-face-size);
    border-radius: var(--radius-full);
    object-fit: cover;
  }

  .person-face__pic--initials {
    display: inline-grid;
    place-items: center;
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1;
  }

  .person-face--md .person-face__pic--initials { font-size: var(--text-sm); }
  .person-face--lg .person-face__pic--initials { font-size: var(--text-xl); }

  .person-face__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A list's name column clips names rather than ending them in "…": a cut
     name must not read as the name itself (the reason is in table.css, at
     `.data-table td:has(.person-name-cell)`). */
  .person-name-cell .person-face__name { text-overflow: clip; }

  /* Inside a chip (the Organisations list's People column), the face is a
     little smaller than the chip's own height, so the chip keeps its size. */
  .chip .person-face { --person-face-size: 16px; gap: var(--space-1); }

  /* A row of faces, each overlapping the one before, then "+n"
     (crm/partials/_person_faces.html: the holon list's Team column,
     METIS-pub#826). The ring in the surface colour keeps each face whole
     where the next one covers it, as Audax's team faces do. */
  .person-faces {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
  }

  .person-faces__face {
    display: inline-flex;
    margin-left: calc(var(--space-2) * -1);
  }

  .person-faces__face:first-child { margin-left: 0; }

  .person-faces__face .person-face__pic { outline: 2px solid var(--color-surface); }

  .person-faces__more {
    margin-left: var(--space-1);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
  }
}
