/* NOVO UI 3.6 · Avatar consistency (2026-11-15)
 * Styling only. Does not replace photos, avatars, online/presence logic or
 * any of the chat, channel, story, calls, or administration handlers.
 * Loaded AFTER NOVO UI 3.6 Stage 1 to resolve legacy 68px !important rules.
 */

/* Every avatar uses the same circular crop and centred fallback text. Keep
 * feature-owned dimensions (stories, group threads, calls, profiles) intact. */
#app .shell .avatar {
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Fit uploaded photographs inside their intended circle, with no implicit
 * enlargement. Explicit --avatar-zoom customisations still work. */
#app .shell .avatar > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 50%;
  transform: scale(var(--avatar-zoom, 1));
  transform-origin: center;
}
/* A channel logo may contain lettering. Do not crop it like a portrait. */
#app .shell .avatar.channel-avatar > img {
  object-fit: contain;
  transform: none;
}
/* Online indicator lives outside the circle; the actual photo remains clipped. */
#app .shell .avatar.online > img {
  clip-path: circle(50% at 50% 50%);
}

/* Main desktop chat list: old delivery-ui.css forces 68px !important, while
 * UI 3.6 Stage 1 expects 46px. Use a single measured 48px footprint. */
@media (min-width: 761px) {
  #app .shell .sidebar #chat-list .chat-item > .avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    inline-size: 48px !important;
    block-size: 48px !important;
    min-inline-size: 48px !important;
    min-block-size: 48px !important;
    max-inline-size: 48px !important;
    max-block-size: 48px !important;
    flex: 0 0 48px !important;
    align-self: center;
    padding: 0;
    font-size: 19px !important;
  }
}

/* Mobile keeps its own layout, but all chat avatars have the same footprint. */
@media (max-width: 760px) {
  #app .shell .sidebar #chat-list .chat-item > .avatar {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    inline-size: 46px !important;
    block-size: 46px !important;
    flex: 0 0 46px !important;
    align-self: center;
    padding: 0;
    font-size: 18px !important;
  }
}

/* Reduce empty inset for channel logos, but preserve the owner's whole icon. */
#app .shell .sidebar #chat-list .chat-item > .avatar.channel-avatar {
  padding: 2px !important;
}
/* Charity, saved-message and system icons have their own visual identity. */
#app .shell .sidebar #chat-list .chat-item > .avatar:is(.charity-avatar, .saved-avatar, .system-avatar) {
  padding: 0 !important;
}
#app .shell .sidebar #chat-list .chat-item > .avatar > img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-position: center !important;
  border-radius: 50% !important;
  transform: scale(var(--avatar-zoom, 1)) !important;
}
#app .shell .sidebar #chat-list .chat-item > .avatar.channel-avatar > img {
  object-fit: contain !important;
  transform: none !important;
}
#app .shell .sidebar #chat-list .chat-item > .avatar.system-avatar > img {
  object-fit: cover !important;
  transform: none !important;
}

/* Search entries don't inherit list dimensions or display oversized initials. */
#app .shell .global-search-results .chat-item > .avatar {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  flex: 0 0 44px !important;
  font-size: 17px !important;
}
/* Header consistent with the ref, without affecting call-screen avatars. */
#app .shell .chathead > .avatar {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  flex: 0 0 40px !important;
  font-size: 16px !important;
}
#app .shell .chathead > .avatar.online > img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Other person lists: contacts, calls, member search and share dialogs. */
#app .shell .contact-row > .avatar,
#app .shell .call-row > .avatar,
#app .shell .channel-user-choice > .avatar,
#app .shell .reel-share-row > .avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  font-size: 17px;
}
#app .shell .channel-member-row > .avatar,
#app .shell .settings-profile .avatar {
  flex-shrink: 0;
}
/* Tiny metadata avatars must never get enlarged to chat-list size. */
#app .shell .chat-preview-sender-avatar {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  flex: 0 0 22px !important;
  font-size: 10px !important;
}

/* Preserve the owner story ring: changes here are only optical centring. */
#app .shell .novo-story-strip .story-avatar-ring .avatar > img,
#app .shell .story-thumb .avatar > img {
  object-position: center;
  border-radius: 50%;
}
/* Profiles keep their feature-specific large sizes (80–90px) and their
 * original avatar-viewer interaction; no blur or enlargement added. */
#app .shell .profile-header .avatar.big > img,
#app .shell .profile-edit-head .avatar.big > img,
#app .shell .channel-settings-avatar .avatar.big > img {
  object-position: center;
}
