:root {
	color-scheme: light;
	--duration-1: 100ms;
	--duration-2: 150ms;
	--duration-3: 200ms;
	--duration-4: 300ms;
	--duration-5: 400ms;
	--duration-loop: 1s;
	--duration-spin: var(--duration-loop);
	--loop-count: infinite;
	--duration-theme-expand: 600ms;
	--duration-theme-collapse: 500ms;
	--duration-reveal: var(--duration-3);
	--stagger-step: 50ms;
	--scroll-idle: 600ms;
	--motion-distance: 10px;
	--spinner-size: 40px;
	--spinner-width: 4px;
	--ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
	--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
	--ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
	--ease-linear: linear;
	--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--ease-spring-soft: cubic-bezier(0.34, 1.3, 0.64, 1);
	--bg-color: light-dark(#fcfced, #1c1c1c);
	--sidebar-bg: light-dark(#e2f5f5, #161515);
	--text-color: light-dark(#0e141a, #f9f1d5e6);
	--text-muted: light-dark(rgb(14 20 26 / 0.4), rgb(249 241 213 / 0.4));
	--link-color: light-dark(#23d6e3, #74ceff);
	--link-glow: light-dark(
		color-mix(in srgb, var(--link-color) 20%, transparent),
		color-mix(in srgb, var(--link-color) 30%, transparent)
	);
	--accent-border: #a4d1c4;
	--hover-bg: light-dark(#dfe6e9, #2d3436);
	--sidebar-folder-hover-bg: light-dark(
		var(--hover-bg),
		rgb(255 255 255 / 0.1)
	);
	--button-bg: light-dark(#a1dcf5, #5d6687);
	--button-hover: light-dark(#faeaf4, rgb(201, 207, 159));
	--toggle-sun: #ffa82e;
	--toggle-moon: #6f86ff;

	--focus-ring-color: light-dark(#0a7f88, var(--link-color));
	--focus-ring-width: 2px;
	--focus-ring-offset: 2px;

	--shadow-color: light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.1));
	--shadow-color-strong: light-dark(rgb(0 0 0 / 0.2), rgb(255 255 255 / 0.2));
	--shadow-color-button: light-dark(rgb(0 0 0 / 0.25), rgb(255 255 255 / 0.15));
	--shadow-color-button-soft: light-dark(
		rgb(0 0 0 / 0.15),
		rgb(255 255 255 / 0.1)
	);
	--glow-color: light-dark(rgb(0 0 0 / 0.2), rgb(255 255 255 / 0.3));
	--highlight-color: rgb(255 255 255 / 0.5);
	--highlight-faint: rgb(255 255 255 / 0.1);
	--highlight-soft: light-dark(rgb(255 255 255 / 0.2), rgb(255 255 255 / 0.1));
	--highlight-strong: light-dark(
		rgb(255 255 255 / 0.3),
		rgb(255 255 255 / 0.2)
	);

	--shadow-sm: 0 2px 4px var(--shadow-color);
	--shadow-md: 2px 0 5px var(--shadow-color-strong);
	--button-shadow:
		3px 0 8px var(--shadow-color-button),
		0 2px 4px var(--shadow-color-button-soft);
	--theme-shadow-hover:
		0 0 10px light-dark(var(--glow-color), transparent),
		0 0 12px light-dark(transparent, var(--glow-color));
	--text-shadow: 1px 1px 2px var(--shadow-color);
	--sidebar-folder-hover-shadow:
		16px 6px 12px light-dark(rgb(0 0 0 / 0.3), transparent),
		0 6px 12px light-dark(transparent, rgb(255 255 255 / 0.2));

	--radius-1: 3px;
	--radius-2: 4px;
	--radius-3: 6px;
	--radius-4: 8px;
	--radius-5: 10px;
	--radius-6: 12px;
	--radius-7: 15px;
	--radius-8: 18px;
	--radius-round: 50%;
	--radius-full: 999px;

	--z-local-below: -1;
	--z-local-1: 1;
	--z-local-2: 2;
	--z-local-3: 3;
	--z-decor: 1;
	--z-content: 2;
	--z-top-bar: 5;
	--z-message: 10;
	--z-float: 999;
	--z-sidebar: 1000;
	--z-sidebar-raised: 1001;
	--z-sidebar-toggle: 1002;

	--desktop-base-offset: 110px;

	--top-row-inset: 20px;
	--top-row-height: calc(1rem + 22px);
	--top-bar-gap: 25px;
	--top-bar-content-start: calc(
		var(--top-row-inset) +
		var(--top-row-height) +
		var(--top-bar-gap)
	);

	--scrollbar-thumb-color: light-dark(
		rgb(20 70 80 / 0.22),
		rgb(255 255 255 / 0.16)
	);

	--home-button-bg-start: light-dark(#9ee9f4d8, #5d6687d8);
	--home-button-bg-end: light-dark(#d1d1f3a5, #3d4663a5);
	--home-button-text: light-dark(#333, #f9f1d5e6);
	--home-button-shadow:
		0 4px 6px var(--shadow-color), inset 0 0 0 1px var(--highlight-color);
	--home-button-shadow-hover:
		0 6px 8px var(--shadow-color-button-soft),
		inset 0 0 0 1px var(--highlight-color);
}

@media (prefers-contrast: more) {
	:root {
		--focus-ring-width: 4px;
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
}

* {
	-webkit-tap-highlight-color: transparent;
}

:focus-visible {
	outline: var(--focus-ring-width) solid var(--focus-ring-color);
	outline-offset: var(--focus-ring-offset);
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--duration-3: var(--duration-2);
		--duration-4: var(--duration-2);
		--duration-5: var(--duration-2);
		--duration-theme-expand: 0ms;
		--duration-theme-collapse: 0ms;
		--duration-reveal: 0ms;
		--stagger-step: 0ms;
		--motion-distance: 0px;
		--duration-spin: calc(var(--duration-loop) * 2);
		--loop-count: 1;
	}

	*,
	*::before,
	*::after {
		transition-delay: 0s !important;
		animation-delay: 0s !important;
		scroll-behavior: auto !important;
	}

	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation-duration: var(--duration-2);
	}
}

html {
	font-size: 13px;
	scroll-padding-top: calc(var(--top-bar-content-start) + 3.5rem);
}

body {
	font-family: "LXGW WenKai", Arial, sans-serif;
	background-color: var(--bg-color);
	position: relative;
	color: var(--text-color);
	margin: 0;
	padding: 0;
	width: 100%;
	min-height: 100dvh;
	overflow-x: hidden;
	overflow-y: auto;
}

body::after {
	content: "";
	position: fixed;
	bottom: 0;
	right: 0;
	width: 1000px;
	height: 1000px;
	background: url("../images/moecat.gif") no-repeat right bottom;
	background-size: contain;
	z-index: var(--z-decor);
	pointer-events: none;
}

.main-content,
.search-container,
.github-link,
#theme-toggle {
	position: relative;
	z-index: var(--z-content);
}

@property --scrollbar-thumb {
	syntax: "<color>";
	inherits: true;
	initial-value: transparent;
}

@property --edge-fade-start {
	syntax: "<length>";
	inherits: false;
	initial-value: 0px;
}

@property --edge-fade-end {
	syntax: "<length>";
	inherits: false;
	initial-value: 0px;
}

@keyframes edge-fade-start {
	to {
		--edge-fade-start: var(--edge-fade-size);
	}
}

@keyframes edge-fade-end {
	from {
		--edge-fade-end: var(--edge-fade-size);
	}
}

.autohide-scrollbar {
	--scrollbar-thumb: transparent;
	transition: --scrollbar-thumb var(--duration-3) var(--ease-linear);
}

/* 这两个属性会继承：在 <html> 的子元素处截断，页面滚动条渐变时不必逐帧重算整页样式 */
:root.autohide-scrollbar > * {
	--scrollbar-thumb: transparent;
	scrollbar-color: auto;
}

@media (pointer: fine) {
	:root.autohide-scrollbar {
		scrollbar-gutter: stable;
	}

	.autohide-scrollbar {
		scrollbar-width: thin;
		scrollbar-color: var(--scrollbar-thumb) transparent;
	}

	.autohide-scrollbar[data-scrolling] {
		--scrollbar-thumb: var(--scrollbar-thumb-color);
		transition: --scrollbar-thumb var(--duration-1) var(--ease-out);
	}

	/* 不支持 scrollbar-color 的浏览器（Safari）退回 ::-webkit-scrollbar */
	@supports not (scrollbar-color: auto) {
		.autohide-scrollbar::-webkit-scrollbar {
			width: 10px;
			height: 10px;
		}

		.autohide-scrollbar::-webkit-scrollbar-track,
		.autohide-scrollbar::-webkit-scrollbar-corner {
			background: transparent;
		}

		.autohide-scrollbar::-webkit-scrollbar-thumb {
			border: 3px solid transparent;
			border-radius: var(--radius-full);
			background: var(--scrollbar-thumb) padding-box;
		}
	}
}

@media (hover: hover) and (pointer: fine) {
	.autohide-scrollbar:not(:root):hover {
		--scrollbar-thumb: var(--scrollbar-thumb-color);
		transition: --scrollbar-thumb var(--duration-1) var(--ease-out);
	}
}
