/** 清空重设滚动条 */
@mixin clearScrollbar($name) {
	#{$name} {
		scrollbar-width: auto !important;
		scrollbar-color: unset !important;
	}
}

// 滚动条宽度默认值
$defScrollbarWidth: 0.9rem;

/** 设置滚动条 */
@mixin setScrollbar($scrollbarThumbColor, $scrollbarTrackColor, $scrollbarWidth: $defScrollbarWidth) {
	// 滚动条样式
	::-webkit-scrollbar {
		width: $scrollbarWidth;
		height: $scrollbarWidth;
		border-radius: 0;
	}
	// 滚动条的可拖拽部分（滑块）
	::-webkit-scrollbar-thumb {
		width: $scrollbarWidth;
		border-radius: calc($scrollbarWidth * 0.5);
		background-color: $scrollbarThumbColor;
		&:hover {
			cursor: pointer;
		}
		&:active {
			cursor: grabbing;
			background-color: $scrollbarThumbColor;
		}
	}
	// 滚动条的滚动区域（轨道）
	::-webkit-scrollbar-track {
		width: $scrollbarWidth;
		border-radius: calc($scrollbarWidth * 0.5);
		background-color: $scrollbarTrackColor;
	}
	::-webkit-scrollbar-track-piece {
		width: $scrollbarWidth;
		background-color: $scrollbarTrackColor;
	}
	::-webkit-scrollbar-button {
		display: none;
	}
}

@mixin before($counterName) {
	&::before {
		display: inline-block;
		min-width: 1rem;
		margin-right: 0.8rem;
		counter-increment: $counterName;
		content: counters($counterName, ".") ".";
	}
}

/** 设置侧边栏 标题序号 */
@mixin setSidebarOrder() {
	// 左侧边栏
	aside.vp-sidebar {
		// 标题序号
		// https://zhuanlan.zhihu.com/p/321430614
		ul.vp-sidebar-links {
			counter-reset: list-number 0;

			li {
				section.vp-sidebar-group {
					// span.vp-sidebar-title {
					// 	@include before(list-number);
					// }
					// 将其他情况也考虑进来
					.vp-sidebar-title {
						@include before(list-number);
					}
				}

				a.vp-sidebar-link {
					@include before(list-number);
				}
			}
		}
	}
}

/** 设置侧边栏 标识线 */
@mixin setSidebarIndicatrix($lineColor: gray) {
	aside.vp-sidebar {
		// 间距 和 标识线
		ul.vp-sidebar-links {
			margin: 0 0 0 1.4rem;
			border-left: 0.08rem solid $lineColor;
		}
	}
}
