/*
 * Avatar — a round tile for a person: their uploaded photo, or their initials on a
 * deterministic colour (see AvatarsHelper#avatar_tag). Size + initials font-size come inline
 * from the helper so one component serves the sidebar user menu, the profile page, and the
 * approval-flow stepper. Plus the profile page's two-column layout and photo-edit overlay.
 */

@layer components {
  .avatar {
    flex: 0 0 auto;
    display: inline-flex;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
  }

  .avatar--initials {
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
  }

  /* Identity page — two clean columns: the photo, and everything written. */
  .identity__grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-6);
    align-items: start;
  }

  .identity__fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
  }

  .identity__photo {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .identity-photo-modal__title {
    margin: 0 0 var(--space-1);
  }

  .identity-photo-modal__hint {
    margin: 0 0 var(--space-3);
    font-size: var(--text-13);
    color: var(--color-text-body);
  }

  @media (max-width: 640px) {
    .identity__grid {
      grid-template-columns: 1fr;
    }
  }

  /* The photo with its hover overlay — dark, semi-transparent, white icon actions on top so
     they read against any picture. */
  .avatar-edit {
    position: relative;
    width: max-content;
    border-radius: 50%;
  }

  .avatar-edit__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    border-radius: 50%;
    background: oklch(0.2 0.03 260 / 55%);
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out);
  }

  .avatar-edit:hover .avatar-edit__overlay,
  .avatar-edit:focus-within .avatar-edit__overlay {
    opacity: 1;
  }

  .avatar-edit__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-white);
    cursor: pointer;
  }

  .avatar-edit__action:hover {
    background: oklch(1 0 0 / 20%);
  }

  .avatar-edit__action svg {
    width: 1.375rem;
    height: 1.375rem;
  }
}
