@import '../variables.less';
@import '../mixins.less';

.orion-avatar {
	transition: all 0.3s;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	border-radius: 100%;
	aspect-ratio: 1;

	&__image {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: inherit;
		aspect-ratio: 1;
	}

	&__initial {
		transition: font-size 0.3s;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		color: rgba(255, 255, 255, 0.7);
		line-height: 1;
		border-radius: inherit;

		[data-orion-theme='dark'] & {
			color: rgba(0, 0, 0, 0.7);
		}

		.orion-avatar--xl & {
			font-size: 4rem;
		}

		.orion-avatar--lg & {
			font-size: 3rem;
		}

		.orion-avatar--md & {
			font-size: 2rem;
		}

		.orion-avatar--sm & {
			font-size: 1.5rem;
		}

		each(@colors, {
			@color: ~"--@{value}";
			.orion-avatar--@{value} > & {
				background: var(@color);
			}
		});

		.orion-avatar--default > & {
			background: var(--grey-light);
			color: var(--grey-darker);
		}

		.orion-avatar--inverse > & {
			background: var(--grey-darker);
		}
	}

	&__picto {
		.circle(2.25rem); // 36px
		.flex-align();
		transition: transform 0.3s, opacity 0.3s;
		position: absolute;
		bottom: 0;
		right: 0;
		font-size: 1.25rem;
		color: var(--grey-dark);
		background: white;
		cursor: pointer;

		.orion-avatar--lg & {
			.circle(2.625rem); // 42px
			font-size: 1.5rem;
		}

		.orion-avatar--sm & {
			bottom: calc(var(--fluid-5px) * -1);
			right: calc(var(--fluid-5px) * -1);
		}

		.orion-avatar--xs & {
			.circle(2rem);
			opacity: 0;
		}

		.orion-avatar--xs:hover & {
			opacity: 1;
		}

		.orion-avatar--square & {
			transform: translate3d(
				calc(var(--fluid-5px) * -1),
				calc(var(--fluid-5px) * -1),
				0
			);
		}
	}

	&--xl {
		.circle(11rem);
	}

	&--lg {
		.circle(7.5rem);
	}

	&--md {
		.circle(5rem);
	}

	&--sm {
		.circle(4rem);
	}

	&--xs {
		.circle(2rem);
	}

	&--square {
		border-radius: 0;
	}

	&--contain {
		.orion-avatar__image {
			object-fit: contain;
		}
	}
}
