@use "../kit-deps" as *;
@use "typography" as *;

.avatar {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: $control-height-md;
	height: $control-height-md;
	flex: 0 0 auto;
	overflow: hidden;
	border: $border-width-base solid $border-color-muted;
	color: $color-black;
	background: $color-primary;
	font-family: $font-family-base;
	font-size: $font-size-sm;
	font-weight: $font-weight-bold;
	line-height: $line-height-base;
	text-transform: uppercase;

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.ph,
	.ph-bold {
		font-size: $icon-size-md;
	}

	.avatar-status {
		position: absolute;
		right: -2px;
		bottom: -2px;
		width: 13px;
		height: 13px;
		border: $border-width-base solid $surface-page;
		background: $color-text-dark;
		transition-duration: $motion-base;
		transition-timing-function: $motion-ease;
		transition-property: background, box-shadow;
	}

	&.avatar-sm {
		width: $control-height-sm;
		height: $control-height-sm;
		font-size: $font-size-xs;

		.ph,
		.ph-bold {
			font-size: $icon-size-sm;
		}
	}

	&.avatar-lg {
		width: $control-height-lg;
		height: $control-height-lg;
		font-size: $font-size-md;

		.ph,
		.ph-bold {
			font-size: $icon-size-lg;
		}
	}

	&.avatar-secondary {
		background: $color-secondary;
	}

	&.avatar-success {
		background: $color-success;
	}

	&.avatar-warning {
		background: $color-warning;
	}

	&.avatar-danger,
	&.avatar-error {
		background: $color-error;
	}

	&.avatar-outline {
		color: $color-text-light;
		background: $surface-panel-muted;
		border-color: $color-text-light;
	}

	&.is-online .avatar-status {
		background: $color-success;
		animation: terminal_pulse 1.8s $motion-ease infinite;
	}

	&.is-busy .avatar-status {
		background: $color-warning;
	}

	&.is-offline .avatar-status {
		background: $color-text-dark;
	}
}

.identity {
	display: inline-flex;
	align-items: center;
	gap: $space-3;
	min-width: 0;
}

.identity-content {
	display: flex;
	flex-direction: column;
	gap: $space-1;
	min-width: 0;
}

.identity-title {
	color: $color-text-light;
	font-size: $font-size-base;
	font-weight: $font-weight-semibold;
	line-height: $line-height-base;
}

.identity-meta {
	color: $color-text-dark;
	font-size: $font-size-sm;
	line-height: $line-height-normal;
}

.avatar-stack {
	display: inline-flex;
	align-items: center;

	.avatar {
		margin-right: -$space-2;
		border-color: $surface-page;
	}

	.avatar-stack-count {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: $control-height-md;
		height: $control-height-md;
		padding: 0 $space-2;
		border: $border-width-base solid $surface-page;
		color: $color-black;
		background: $color-warning;
		font-size: $font-size-sm;
		font-weight: $font-weight-bold;
	}
}
