@import "@automattic/typography/styles/variables";
@import "../../assets/stylesheets/shared/mixins/long-content-fade";
@import "../../assets/stylesheets/shared/mixins/breakpoints";
/**
 * Site
 *
 */

.site {
	box-sizing: border-box;
	display: flex;
	flex: 1 0 auto;
	justify-content: space-between;
	padding: 0;
	position: relative;
	.site-icon {
		position: relative;
		height: 30px;
		width: 30px;
		overflow: hidden;
		align-self: flex-start;
		margin-right: 8px;
		flex: 0 0 auto;
		background-color: var(--color-neutral-10);
		svg {
			transform: scale(0.65);
			fill: var(--color-neutral-0);
		}
	}

	.site__domain.is-loading {
		animation: pulse-light 1.8s ease-in-out infinite;
		background-color: var( --color-neutral-10 );
		color: transparent;
		width: 50%;
		height: 12px;
		margin-top: 3px;
		display: block;

		&::after {
			display: none;
		}
	}

	&.is-loading {
		pointer-events: none;

		.site-icon {
			animation: pulse-light 1.8s ease-in-out infinite;
			background-color: var(--color-neutral-10);
		}

		.site__title,
		.site__domain {
			animation: pulse-light 1.8s ease-in-out infinite;
			background-color: var(--color-neutral-10);
			color: transparent;
			width: 95%;

			&::after {
				display: none;
			}
		}
	}
}

// Wraps the anchor element
.site__content {
	display: flex;
	justify-content: space-between;
	overflow: hidden;
	padding: 16px;
	position: relative;
	width: 100%;

	.accessible-focus &:focus {
		outline: none;
		box-shadow: inset 0 0 0 2px var(--color-primary-light);

		// Temporarily hides fade out effect on right
		// which is there for extra long domains and titles
		// Else the focus box-shadow is only partially shown
		.site__domain::after,
		.site__title::after {
			display: none;
		}
	}
}


// The group of site title and domain
.site__info {
	width: 0; // Firefox needs explicit width (even 0)
	flex: 1 0 auto;
	text-align: initial;
	margin-top: -2px;
}

.site__title {
	color: var(--color-text);
	display: block;
	font-size: $font-body-small;
	font-weight: 400;
	line-height: 1.3;
}

.site__domain {
	color: var(--color-text-subtle);
	display: block;
	max-width: 95%;
	font-size: $font-body-extra-small;
	line-height: 1.4;
	margin-top: -1px;
}

.site__title-with-chevron-icon {
	display: flex;
	align-items: center;

	.site__title {
		position: relative;
	}

	.site__title-chevron-icon {
		color: var(--color-text);
		margin-inline-start: 12px;
		display: inline-flex;
	}
}

.site__title,
.site__domain {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;

	&::after {
		@include long-content-fade();
	}
}

.site__badge {
	color: var(--color-neutral-60);
	background-color: var(--color-neutral-5);
	font-size: $font-body-extra-small;
	border-radius: 12px; /* stylelint-disable-line scales/radii */
	clear: both;
	display: inline-block;
	margin-top: 6px;
	margin-right: 3px;
	padding: 0 10px;

	&.is-p2,
	&.is-p2-workspace {
		background: var(--p2-color-link);
		color: var(--p2-color-white);
	}

	&.site__badge-private,
	&.site__badge-coming-soon {
		background-color: transparent;
		color: var(--color-neutral-60);
		border: solid 1px color-mix( in srgb, currentColor 50%, transparent );
	}
}

.purchases-site .site:hover .site__badge {
	background: var(--color-sidebar-menu-hover-background);
	color: var(--color-sidebar-menu-hover-text);

	&.is-p2,
	&.is-p2-workspace {
		background: var(--p2-color-link-dark);
		color: var(--p2-color-white);
	}

	&.site__badge-private,
	&.site__badge-coming-soon {
		background-color: transparent;
		color: var(--color-sidebar-text);
		border: solid 1px color-mix( in srgb, currentColor 50%, transparent );
	}
}

.layout__secondary {
	.site__badge {
		background: var(--color-sidebar-menu-hover-background);
		color: var(--color-sidebar-menu-hover-text);

		&.is-p2,
		&.is-p2-workspace {
			background: var(--p2-color-link);
			color: var(--p2-color-white);
		}

		&.site__badge-private,
		&.site__badge-coming-soon {
			background-color: transparent;
			color: var(--color-sidebar-text);
			border: solid 1px color-mix( in srgb, currentColor 50%, transparent );
		}
	}
}
