/* Navigation items, tags and avatars: small squircles that take the surface's fill. */
@layer components {
  .nav-item {
    display: inline-flex;
    gap: var(--space-2);
    align-items: center;
    min-height: var(--control-height-sm);
    padding: 0 var(--space-4);
    border-radius: var(--radius-md);
    color: inherit;
    font-weight: var(--weight-medium);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--duration-fast) var(--ease);

    &:hover { background: var(--fill-hover); }
    &[aria-current] { background: var(--color-surface); font-weight: var(--weight-bold); }
  }

  /* On phones a shelf's items tighten so more fit before it scrolls. */
  @media (max-width: 767px) {
    .shelf .nav-item { padding: 0 var(--space-3); }
  }

  .tag {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    min-height: 1.75rem;
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--fill);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    white-space: nowrap;
  }

  .tag--strong { background: var(--color-button); color: var(--color-on-button); }
  /* Waiting on someone, such as an invitation not yet accepted: butter, as a condition is. */
  .tag--pending { background: var(--color-butter); }
  /* Beside a small control, such as the role select, a tag is as tall as it. */
  form:has(.select--small) ~ .tag { min-height: var(--control-height-sm); }

  .avatar {
    display: inline-grid;
    flex: none;
    place-content: center;
    width: var(--control-height);
    height: var(--control-height);
    border-radius: var(--radius-md);
    background: var(--fill);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    letter-spacing: 0.02em;
  }

  button.avatar { border: 0; color: inherit; cursor: pointer; &:hover { background: var(--fill-hover); } }

  .avatar--small { width: var(--control-height-sm); height: var(--control-height-sm); font-size: var(--text-xs); border-radius: var(--radius-sm); }
  /* A name over a line of detail, as in the team, access and guest lists */
  .person { display: grid; min-width: 0; }
  .person__name, .person__detail { overflow-wrap: anywhere; }
  .person__name { color: inherit; font-weight: var(--weight-bold); text-decoration: none; }
  a.person__name:hover { text-decoration: underline; }
  .person__detail { overflow: hidden; font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }

  .avatar--large { width: 4rem; height: 4rem; font-size: var(--text-xl); border-radius: var(--radius-lg); }
}
