/*
 * Aiden UI · avatar
 * CSS module de Arc (registry/components/avatar/avatar.module.css) traducido a clases .aui-avatar-<parte>, con las
 * MISMAS variables de kit/foundation.css.
 *
 * Correspondencia: .avatar → .aui-avatar · .sm/.md/.lg/.xl → .aui-avatar-sm/-md/-lg/-xl · .fallback →
 * -fallback · .status → -status · .online/.offline → -online/-offline · @keyframes avatar-fallback-in →
 * aui-avatar-fallback-in.
 * Añadido: la <img> ocupa el círculo entero (en Arc lo hace next/image con fill) y -initials para las iniciales.
 */
.aui-avatar {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  box-sizing: border-box;
  place-items: center;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  vertical-align: middle;
}

.aui-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
  border-radius: inherit;
  object-fit: cover;
  transition: opacity var(--duration-standard) var(--ease-enter), filter var(--duration-standard) var(--ease-enter);
}

/* Solo mientras una foto aún se descarga tras montarse, para que las que ya están en caché no hagan fundido. */
.aui-avatar img[data-loading] {
  opacity: 0;
  filter: blur(4px);
  transition: none;
}

.aui-avatar-fallback { animation: aui-avatar-fallback-in var(--duration-standard) var(--ease-enter) both; }

.aui-avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.aui-avatar-md { width: 36px; height: 36px; }
.aui-avatar-lg { width: 48px; height: 48px; font-size: var(--text-sm); }
.aui-avatar-xl { width: 88px; height: 88px; font-size: var(--text-xl); }

.aui-avatar-status {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);
}

.aui-avatar-sm .aui-avatar-status { width: 8px; height: 8px; border-width: 1.5px; }
.aui-avatar-lg .aui-avatar-status { width: 12px; height: 12px; }
.aui-avatar-xl .aui-avatar-status { width: 14px; height: 14px; right: 4px; bottom: 4px; }
.aui-avatar-online { background: var(--success); }
.aui-avatar-offline { background: var(--text-muted); }

@keyframes aui-avatar-fallback-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .aui-avatar img { transition: none; }
  .aui-avatar img[data-loading] { filter: none; }
  .aui-avatar-fallback { animation: none; }
}
