/*!
 * Copyright 2024 Adobe. All rights reserved.
 *
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at <http://www.apache.org/licenses/LICENSE-2.0>
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

.spectrum-Avatar {
	--spectrum-avatar-color-opacity: 1;

	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-100);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-100);

	--spectrum-avatar-border-radius: var(--spectrum-avatar-block-size);

	--spectrum-avatar-focus-indicator-thickness: var(--spectrum-focus-indicator-thickness);
	--spectrum-avatar-focus-indicator-gap: var(--spectrum-focus-indicator-gap);
	--spectrum-avatar-focus-indicator-color: var(--spectrum-focus-indicator-color);

	--spectrum-avatar-color-opacity-disabled: var(--spectrum-avatar-opacity-disabled);
}

.spectrum-Avatar--size50 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-50);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-50);
}

.spectrum-Avatar--size75 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-75);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-75);
}

.spectrum-Avatar--size100 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-100);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-100);
}

.spectrum-Avatar--size200 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-200);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-200);
}

.spectrum-Avatar--size300 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-300);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-300);
}

.spectrum-Avatar--size400 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-400);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-400);
}

.spectrum-Avatar--size500 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-500);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-500);
}

.spectrum-Avatar--size600 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-600);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-600);
}

.spectrum-Avatar--size700 {
	--spectrum-avatar-inline-size: var(--spectrum-avatar-size-700);
	--spectrum-avatar-block-size: var(--spectrum-avatar-size-700);
}

@media (forced-colors: active) {
	.spectrum-Avatar {
		--highcontrast-avatar-focus-indicator-color: CanvasText;
	}
}

.spectrum-Avatar {
	display: inline-block;
	position: relative;
	inline-size: var(--mod-avatar-inline-size, var(--spectrum-avatar-inline-size));
	block-size: var(--mod-avatar-block-size, var(--spectrum-avatar-block-size));

	border-radius: var(--mod-avatar-border-radius, var(--spectrum-avatar-border-radius));
	border-width: 0;

	outline: none;

	-webkit-user-drag: none;
	user-select: none;

	overflow: visible;

	opacity: var(--mod-avatar-color-opacity, var(--spectrum-avatar-color-opacity));

	&.is-disabled {
		opacity: var(--mod-avatar-color-opacity-disabled, var(--spectrum-avatar-color-opacity-disabled));
	}
}

.spectrum-Avatar.is-focused:not(.is-disabled),
.spectrum-Avatar:not(.is-disabled) .spectrum-Avatar-link:focus-visible {
	&::after {
		pointer-events: none;
		content: "";
		position: absolute;
		inset-block-start: calc((var(--mod-avatar-focus-indicator-gap, var(--spectrum-avatar-focus-indicator-gap)) + var(--mod-avatar-focus-indicator-thickness, var(--spectrum-avatar-focus-indicator-thickness))) * -1);
		inset-inline-start: calc((var(--mod-avatar-focus-indicator-gap, var(--spectrum-avatar-focus-indicator-gap)) + var(--mod-avatar-focus-indicator-thickness, var(--spectrum-avatar-focus-indicator-thickness))) * -1);

		inline-size: calc(var(--mod-avatar-inline-size, var(--spectrum-avatar-inline-size)) + (var(--mod-avatar-focus-indicator-gap, var(--spectrum-avatar-focus-indicator-gap)) * 2));
		block-size: calc(var(--mod-avatar-inline-size, var(--spectrum-avatar-inline-size)) + (var(--mod-avatar-focus-indicator-gap, var(--spectrum-avatar-focus-indicator-gap)) * 2));

		border-style: solid;
		border-width: var(--mod-avatar-focus-indicator-thickness, var(--spectrum-avatar-focus-indicator-thickness));
		border-color: var(--highcontrast-avatar-focus-indicator-color, var(--mod-avatar-focus-indicator-color, var(--spectrum-avatar-focus-indicator-color)));
		border-radius: var(--mod-avatar-border-radius, var(--spectrum-avatar-border-radius));
	}
}

.spectrum-Avatar-link {
	outline: 0;
}

.spectrum-Avatar-image {
	inline-size: var(--mod-avatar-inline-size, var(--spectrum-avatar-inline-size));
	block-size: var(--mod-avatar-block-size, var(--spectrum-avatar-block-size));

	border-radius: var(--mod-avatar-border-radius, var(--spectrum-avatar-border-radius));
}
