.ct-typography {
	position: relative;
}

// option first level
.ct-typohraphy-value {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	background: #fff;
	border-radius: 3px;
	border: 1px solid #ddd;
	padding-inline-end: 8px;
	transition: border-color 0.1s linear;

	&:hover {
		border-color: var(--ui-accent-color);

		a {
			opacity: 1;
			color: var(--ui-accent-color);
		}
	}

	> div {
		padding-block: 6px;
		padding-inline-start: 8px;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		width: 100%;
		box-sizing: border-box;

		i {
			margin: 0 7px;
			font-style: normal;
			font-size: 70%;
			opacity: 0.5;
			line-height: normal;
			position: relative;
			margin-top: -5px;
		}

		> span {
			position: relative;

			&:after {
				position: absolute;
				content: '';
				opacity: 0;
				display: block;
				inset-block: -1px;
				inset-inline: -3px;
				border-radius: 2px;
				background: var(--ui-accent-color);
			}

			&:hover {
				&:after {
					opacity: 0.2;
				}
			}
		}
	}

	.ct-font {
		display: inline-flex;
		align-items: center;

		span {
			text-overflow: ellipsis;
			white-space: nowrap;
			overflow: hidden;
			max-width: 100px;
			display: inline-block;
			text-transform: capitalize;
		}
	}

	a {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 16px;
		height: 16px;
		font-size: 8px;
		font-weight: 700;
		letter-spacing: 0.1em;
		opacity: 0.7;
		color: inherit;
		transition: color 0.1s linear;

		&:before {
			content: '\002022\002022\002022';
		}
	}
}

.ct-typography-modal {
	overflow: hidden;
}

.ct-typography-container {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 430px;
	position: relative;
}


.ct-typography-top {
	display: flex;
	align-items: center;
	gap: 12px;
	position: relative;
	height: 70px;
	padding: 0 20px;
	margin: 0;
	box-sizing: border-box;
	border-bottom: 1px dashed #eee;

	&.ct-static > * {
		transition: none !important;
	}

	~ * {
		top: 70px;
		inset-inline: 0;
	}

	li {
		display: flex;
		align-items: center;
		position: relative;
		z-index: 1;
		height: 28px;
		color: #555d66;
		cursor: pointer;
		border-radius: 3px;
		overflow: hidden;
		user-select: none;
		padding: 0 7px;
		margin-bottom: 0;
		background: #fff;
		box-sizing: border-box;
		border: 1px solid #d1d5d9;
		box-shadow: 0 0 0 0 transparent;
		transition: box-shadow 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955),
			border-color 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955);

		&.active {
			border-color: var(--ui-accent-color);
			box-shadow: 0 0 0 1px var(--ui-accent-color);
		}

		&:hover {
			border-color: var(--ui-accent-color);
		}
	}

	.ct-font {
		flex: 1;

		span {
			text-overflow: ellipsis;
			white-space: nowrap;
			overflow: hidden;
			width: 100%;
			text-transform: capitalize;
			transition: width 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
		}

		input {
			border: none;
			margin: 0;
			padding: 0;
			width: calc(100% - 12px);
			font: inherit;
			color: inherit;
			background: transparent;

			&:focus {
				outline: none;
			}
		}

		svg {
			position: absolute;
			top: calc(50% - 8px);
			inset-inline-end: 3px;
			cursor: pointer;
			fill: currentColor;
			opacity: 0;
			transition: opacity 0.15s cubic-bezier(0.455, 0.03, 0.515, 0.955);
		}

		&.active {
			svg {
				opacity: 1;
			}
		}
	}

	.ct-weight {
		justify-content: flex-end;
		width: 75px;
		transition: width 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955);

		&:before {
			position: absolute;
			z-index: 0;
			color: #727c88;
			content: 'A';
			inset-inline-start: 8px;
			font-size: 15px;
			opacity: 1;
			margin-inline-end: 10px;
			transition: font-weight 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955),
						opacity 0.15s cubic-bezier(0.455, 0.03, 0.515, 0.955);
		}

		&:hover {
			&:before {
				font-weight: 700;
			}
		}

		span {
			position: relative;
			z-index: 1;
			// width: 44px;
			text-align: end;
			line-height: normal;
			box-shadow: 0px 0px 10px 3px #fff;

			&[data-variation*='i'] {
				font-style: italic;
			}

			&[data-variation="Default"] {
				opacity: 0;
			}
		}
	}

	.ct-back {
		justify-content: center;
		z-index: 2;
		width: 28px;
		margin-inline-start: -40px;
		opacity: 0;
		transition: margin 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955),
					opacity 0.1s cubic-bezier(0.455, 0.03, 0.515, 0.955);

		svg {
			fill: currentColor;
		}
	}

	// switch panel
	&.ct-switch-panel {

		.ct-back {
			opacity: 1;
			margin-inline-start: 0;
		}

		.ct-font {
			span {
				width: calc(100% - 12px);
			}
		}

		.ct-weight {
			&:not(.active) {
				width: 40px;

				&:before {
					opacity: 0;
				}

				// span {
				// 	width: 100%;
				// }
			}
		}
	}
}


.ct-typography-options {
	margin: 0;

	> li {
		&:not(.ct-typography-variant) {
			display: flex;
		}

		align-items: center;
		padding: 0 20px 0 22px;
		margin: 0;
		box-sizing: border-box;

		&:not(.ct-typography-variant) {
			height: 95px;
		}

		&:not(:last-child) {
			border-bottom: 1px dashed #eee;
		}
	}

	.ct-control {
		margin: 0 !important;
		padding: 0 !important;
		width: 100%;

		--revert-button-translate-x: -19px;
	}

	.ct-slider:before {
		--backgroundColor: #e3e6e8;
	}

	.ct-value-changer {
		ul {
			box-shadow: 0 10px 20px 3px rgba(0, 0, 0, 0.07),
				0 1px 3px 0px rgba(0, 0, 0, 0.03);
		}
	}

	.ct-disabled-notification {
		background: rgba(243, 243, 245, 0.5);
	}
}

.ct-typography-variant {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-column-gap: 12px;
	height: 75px;

	ul {
		display: flex;

		li {
			flex: 1;
			display: flex;
			justify-content: center;
			position: relative;
			margin: 0;
			padding: 5px 0;
			cursor: pointer;
			border: 1px solid #dfe1e4;

			&:before {
				font-size: 13px;
				font-weight: 700;
				letter-spacing: 0.04em;
			}

			+ li {
				margin-inline-start: -1px;
			}

			&:first-child {
				border-start-start-radius: 3px;
				border-end-start-radius: 3px;
			}

			&:last-child {
				border-start-end-radius: 3px;
				border-end-end-radius: 3px;
			}

			&:not(.active) {
				color: #727c88;

				&:hover {
					color: var(--ui-accent-color);
				}
			}

			&.active {
				z-index: 2;
				color: #fff;
				background: var(--ui-accent-color);
				border-color: var(--ui-accent-color);
			}

			&[data-variant='capitalize']:before {
				content: 'Aa';
			}

			&[data-variant='uppercase']:before {
				content: 'AA';
			}

			&[data-variant='underline']:before {
				content: 'Aa';
			}

			&[data-variant='line-through']:before {
				content: 'Aa';
			}
		}
	}
}

.ct-text-decoration li {
	&:after {
		position: absolute;
		content: '';
		inset-inline: 0;
		width: 50%;
		height: 1px;
		opacity: 0.7;
		background: currentColor;
		margin: auto;
		border-radius: 2px;
	}

	&[data-variant='underline']:after {
		bottom: 6px;
	}

	&[data-variant='line-through']:after {
		top: 3px;
		bottom: 0;
	}
}

// fonts & variations
.ct-typography-single-font,
.ct-typography-variations li {
	cursor: pointer;
	position: relative;

	&:not(:first-child) {
		border-top: 1px dashed #eee;
	}

	&:hover,
	&.active {
		color: #fff;
		background: var(--ui-accent-color);
		border-color: var(--ui-accent-color);

		&:after {
			box-shadow: -5px 0px 15px 10px var(--ui-accent-color);
		}

		+ * {
			border-top-color: rgba(255, 255, 255, 0.3);
		}
	}

	&.active {
		&:before {
			position: absolute;
			font: 400 17px/17px dashicons;
			content: '\f147';
			top: 16px;
			inset-inline-end: 20px;
		}
	}
}

// fonts
.ct-typography-fonts {
	overflow-x: scroll;
	max-height: 360px;
}

.ct-typography-single-font {
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow: hidden;
	height: 85px;
	padding: 0 20px;
	box-sizing: border-box;

	&:after {
		position: absolute;
		content: '';
		top: 0;
		inset-inline-end: 0;
		width: 10px;
		height: 100%;
		background: #fff;
		transform: translateX(100%);
		box-shadow: -5px 0px 15px 10px #fff;
	}

	.ct-font-name {
		display: flex;
		align-items: center;
		opacity: 0.7;

		i {
			font-style: normal;
			margin-inline-start: 0.5em;
		}
	}

	.ct-font-preview {
		font-size: 20px;
		line-height: 1.3;
		margin-top: 10px;
		font-weight: normal;
		white-space: nowrap;
	}

	&:hover,
	&.active {
		.ct-font-name {
			opacity: 1;
		}
	}


	// font type badge
	[class*="ct-font-type"] {
		width: 12px;
		height: 12px;
		font-size: 12px;
		font-weight: 500;
		text-align: center;
		line-height: 1;
		padding: 2px;
		border-radius: 2px;
		opacity: inherit;
		margin-inline-end: 0.6em;
		background: rgba(0, 0, 0, 0.1);
	}
}

// variations
.ct-typography-variations {
	overflow-x: auto;
	max-height: 360px;
	margin: 0;

	li {
		display: flex;
		align-items: center;
		height: 50px;
		margin-bottom: 0;
		padding: 0 20px;
		box-sizing: border-box;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	.ct-variation-name {
		font-size: 14px;
		line-height: 1.3;
	}

	[data-variation*='1'] {
		font-weight: 100;
	}

	[data-variation*='2'] {
		font-weight: 200;
	}

	[data-variation*='3'] {
		font-weight: 300;
	}

	[data-variation*='4'] {
		font-weight: 400;
	}

	[data-variation*='5'] {
		font-weight: 500;
	}

	[data-variation*='6'] {
		font-weight: 600;
	}

	[data-variation*='7'] {
		font-weight: 700;
	}

	[data-variation*='8'] {
		font-weight: 800;
	}

	[data-variation*='9'] {
		font-weight: 900;
	}

	[data-variation*='i'] {
		font-style: italic;
	}
}