*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	scrollbar-width: none;
}

*::-webkit-scrollbar {
	display: none;
}

:root {
	--color-background: #f0eee6;
	--color-text: #333;
	--color-muted: #59636e;
	--color-border: #d0cec4;
	--color-border-muted: #d0cec4b3;
	--color-link: #0969da;
	--color-code-bg: #818b981f;
	--color-pre-bg: #ebe8dc;
	--color-table-stripe: #ebe8dc;
	--color-mark-bg: #fff8c5;
	--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
		Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
		sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
		"Liberation Mono", monospace;
	color-scheme: light;
}

.dark-mode-on {
	--color-background: #1a1a1a;
	--color-text: #f0eee6;
	--color-muted: #a8a29a;
	--color-border: #3d444d;
	--color-border-muted: #3d444db3;
	--color-link: #4493f8;
	--color-code-bg: #656c7633;
	--color-pre-bg: #0f0f0f;
	--color-table-stripe: #222;
	--color-mark-bg: #3d2e00;
	color-scheme: dark;
}

.dark-mode-off {
	--color-background: #f0eee6;
	--color-text: #333;
	--color-muted: #59636e;
	--color-border: #d0cec4;
	--color-border-muted: #d0cec4b3;
	--color-link: #0969da;
	--color-code-bg: #818b981f;
	--color-pre-bg: #ebe8dc;
	--color-table-stripe: #ebe8dc;
	--color-mark-bg: #fff8c5;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not(.dark-mode-on):not(.dark-mode-off) {
		--color-background: #1a1a1a;
		--color-text: #f0eee6;
		--color-muted: #a8a29a;
		--color-border: #3d444d;
		--color-border-muted: #3d444db3;
		--color-link: #4493f8;
		--color-code-bg: #656c7633;
		--color-pre-bg: #0f0f0f;
		--color-table-stripe: #222;
		--color-mark-bg: #3d2e00;
		color-scheme: dark;
	}
}

body {
	background: var(--color-background);
	color: var(--color-text);
	transition: background-color 0.2s ease;
	font-family: var(--font-sans);
	font-size: 17px;
	line-height: 1.5;
	word-wrap: break-word;
}

#app {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	padding: 1.25rem 31vw;
}

@media (max-width: 1200px) {
	#app {
		padding: 1.25rem 20vw;
	}
}

@media (max-width: 600px) {
	#app {
		padding: 1.25rem 1rem;
	}
}

/* Header */

header {
	height: 60px;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	background: var(--color-background);
	transition: background-color 0.2s ease;
}

.title {
	font-weight: bolder;
	font-size: 1.6rem;
	font-family: 'Times New Roman', Times, 'Songti SC', serif;
	color: inherit;
	text-decoration: none;
}

.title:hover {
	opacity: 1;
}

.toolbar {
	display: flex;
	align-items: center;
	margin-left: auto;
}

.toggle-switch {
	position: relative;
	width: 40px;
	height: 20px;
	flex-shrink: 0;
	visibility: hidden;
}

.toggle-switch.is-visible {
	visibility: visible;
}

.toggle-input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-label {
	position: absolute;
	inset: 0;
	cursor: pointer;
	border: 1px solid var(--color-text);
	border-radius: 34px;
	background: var(--color-background);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.toggle-slider {
	position: absolute;
	bottom: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--color-text);
	transition: left 0.2s ease, background-color 0.2s ease;
}

.toggle-input:checked + .toggle-label {
	background: var(--color-text);
}

.toggle-input:checked + .toggle-label .toggle-slider {
	left: 22px;
	background: var(--color-background);
}

.toggle-input:focus-visible + .toggle-label {
	outline: 2px solid var(--color-text);
	outline-offset: 2px;
}

/* Home */

.home {
	flex: 1;
}

/* Essay */

.essay {
	flex: 1;
}

.essay-content time {
	display: block;
	margin-bottom: 0.5rem;
	color: var(--color-muted);
	font-size: 0.9em;
}

.essay-content .post-body > :first-child {
	margin-top: 0;
}

.more-actions {
	position: fixed;
	top: 1rem;
	left: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.2rem;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 100%;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: all 0.2s ease;
}

.more-actions.is-visible {
	opacity: 1;
	pointer-events: auto;
}

.more-actions:hover {
	background: #0002;
	box-shadow: 0 0 0 0.2rem #0002;
}

.more-actions:active {
	background: #0003;
	box-shadow: 0 0 0 0 #0003;
}

.more-actions__dot {
	width: 0.28rem;
	height: 0.28rem;
	border-radius: 100%;
	background: var(--color-text);
}

.dark-mode-on .more-actions:hover {
	background: #fff2;
	box-shadow: 0 0 0 0.2rem #fff2;
}

.dark-mode-on .more-actions:active {
	background: #fff3;
	box-shadow: 0 0 0 0 #fff3;
}

@media (prefers-color-scheme: dark) {
	:root:not(.dark-mode-off) .more-actions:hover {
		background: #fff2;
		box-shadow: 0 0 0 0.2rem #fff2;
	}

	:root:not(.dark-mode-off) .more-actions:active {
		background: #fff3;
		box-shadow: 0 0 0 0 #fff3;
	}
}

/* 404 */

.not-found {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.not-found h1 {
	font-size: 3rem;
	margin-bottom: 1rem;
}

.not-found p {
	font-size: 1.5rem;
	margin-bottom: 3rem;
}

.not-found a {
	display: block;
	text-decoration: none;
	background: var(--color-text);
	color: var(--color-background);
	padding: 1rem 2rem;
	margin-bottom: 12dvh;
	border-radius: 5px;
	font-size: 1.2rem;
	transition: all 0.3s ease;
}

.not-found a:hover {
	opacity: 0.8;
}

/* Markdown Theme */

.headerlink {
	display: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin-top: 1.5rem;
	margin-bottom: 1rem;
	font-weight: 600;
	line-height: 1.25;
}

h1 {
	margin: 0.67em 0;
	padding-bottom: 0.3em;
	font-size: 2em;
	border-bottom: 1px solid var(--color-border-muted);
}

h2 {
	padding-bottom: 0.3em;
	font-size: 1.5em;
	border-bottom: 1px solid var(--color-border-muted);
}

h3 {
	font-size: 1.25em;
}

h4 {
	font-size: 1em;
}

h5 {
	font-size: 0.875em;
}

h6 {
	font-size: 0.85em;
	color: var(--color-muted);
}

p,
blockquote,
ul,
ol,
dl,
table,
pre,
details {
	margin-top: 0;
	margin-bottom: 1rem;
}

a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.2rem;
	transition: opacity 0.2s ease;
}

a:hover {
	opacity: 0.55;
}

a:not([href]) {
	text-decoration: none;
}

strong,
b {
	font-weight: 600;
}

em,
dfn {
	font-style: italic;
}

small {
	font-size: 90%;
}

mark {
	background-color: var(--color-mark-bg);
	color: var(--color-text);
}

sub,
sup {
	position: relative;
	font-size: 75%;
	line-height: 0;
	vertical-align: baseline;
}

sub {
	bottom: -0.25em;
}

sup {
	top: -0.5em;
}

hr {
	height: 1px;
	padding: 0;
	margin: 1.5rem 0;
	border: 0;
	background-color: var(--color-border);
}

img {
	max-width: 100%;
	box-sizing: content-box;
	border-style: none;
	background-color: transparent;
}

blockquote {
	padding: 0 1em;
	color: var(--color-muted);
	border-left: 0.25em solid var(--color-border-muted);
}

blockquote > :first-child {
	margin-top: 0;
}

blockquote > :last-child {
	margin-bottom: 0;
}

ul,
ol {
	padding-left: 2em;
}

ul ul,
ul ol,
ol ol,
ol ul {
	margin-top: 0;
	margin-bottom: 0;
}

ol ol,
ul ol {
	list-style-type: lower-roman;
}

ul ul ol,
ul ol ol,
ol ul ol,
ol ol ol {
	list-style-type: lower-alpha;
}

li + li {
	margin-top: 0.25em;
}

li > p {
	margin-top: 1rem;
}

dl {
	padding: 0;
}

dl dt {
	padding: 0;
	margin-top: 1rem;
	font-size: 1em;
	font-style: italic;
	font-weight: 600;
}

dl dd {
	padding: 0 1rem;
	margin-bottom: 1rem;
}

table {
	display: block;
	width: max-content;
	max-width: 100%;
	overflow: auto;
	border-spacing: 0;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

table th {
	font-weight: 600;
}

table th,
table td {
	padding: 6px 13px;
	border: 1px solid var(--color-border);
}

table tr {
	background-color: var(--color-background);
	border-top: 1px solid var(--color-border-muted);
}

table tr:nth-child(2n) {
	background-color: var(--color-table-stripe);
}

table td > :last-child {
	margin-bottom: 0;
}

code,
kbd,
samp,
tt {
	font-family: var(--font-mono);
	font-size: 85%;
}

code,
tt {
	padding: 0.2em 0.4em;
	margin: 0;
	white-space: break-spaces;
	background-color: var(--color-code-bg);
	border-radius: 6px;
}

code br,
tt br {
	display: none;
}

pre {
	padding: 1rem;
	overflow: auto;
	font-family: var(--font-mono);
	font-size: 85%;
	line-height: 1.45;
	word-wrap: normal;
	background-color: var(--color-pre-bg);
	border-radius: 6px;
}

pre code,
pre tt {
	display: inline;
	padding: 0;
	margin: 0;
	overflow: visible;
	line-height: inherit;
	word-wrap: normal;
	white-space: pre;
	background: transparent;
	border: 0;
	font-size: 100%;
}

kbd {
	display: inline-block;
	padding: 0.25rem;
	font-size: 11px;
	line-height: 10px;
	color: var(--color-text);
	vertical-align: middle;
	background-color: var(--color-pre-bg);
	border: 1px solid var(--color-border-muted);
	border-radius: 6px;
	box-shadow: inset 0 -1px 0 var(--color-border-muted);
}

h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code,
h1 tt,
h2 tt,
h3 tt,
h4 tt,
h5 tt,
h6 tt {
	padding: 0 0.2em;
	font-size: inherit;
}
