@import './var.less';

:root {
  --avatar-default-size: 20px;
  --avatar-border-radius: 50%;
}

.@{prefix}-avatar {
  font-size: var(--avatar-default-size);
  width: 2em;
  height: 2em;
  border-radius: var(--avatar-border-radius);
  overflow: hidden;
  display: inline-flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  vertical-align: middle;

  img {
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    object-fit: cover; // 非1:1图形按1:1裁切展示
  }

  // 两个头像的布局
  &_2 {
    flex-wrap: nowrap;

    img {
      transform: translateX(-50%);
    }
  }

  // 三个头像的布局
  &_3 {
    position: relative;

    img {
      &:first-child {
        width: 100%;
        height: 100%;
        transform: translateX(-50%);
      }

      &:nth-child(2),
      &:last-child {
        width: 50%;
        height: 50%;
        position: absolute;
        right: 0;
      }

      &:last-child {
        bottom: 0;
      }
    }
  }

  // 四个头像的布局
  &_4 {
    img {
      width: 50%;
      height: 50%;
    }
  }

  &_carousel {
    position: relative;
    overflow: visible;
    background: none;

    img {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      border-radius: 50%;
    }
  }
}
