:root {
	color-scheme: light;
	--paper: #f4f3ee;
	--sidebar: #e7e9e3;
	--ink: #242b27;
	--muted: #788078;
	--line: #d8dbd3;
	--green: #426e58;
	--green-soft: #d6e2d7;
	--serif: "Newsreader", Georgia, serif;
	--sans: "DM Sans", sans-serif;
	--mono: "DM Mono", monospace;
}

* {
	box-sizing: border-box;
}

body {
	min-width: 320px;
	min-height: 100vh;
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
}

button,
input {
	font: inherit;
}

.app-shell {
	display: grid;
	min-height: 100vh;
	grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	padding: 31px 22px 22px;
	background: var(--sidebar);
	border-right: 1px solid var(--line);
}

.wordmark {
	display: flex;
	align-items: center;
	gap: 10px;
	width: fit-content;
	color: var(--ink);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0;
	text-decoration: none;
}

.wordmark-mark {
	display: grid;
	width: 29px;
	height: 29px;
	place-items: center;
	border-radius: 50%;
	background: var(--green);
	color: #fff;
	font-family: var(--serif);
	font-size: 19px;
	font-weight: 500;
}

.sidebar-section {
	margin-top: 58px;
}

.section-label,
.sidebar-foot,
.library,
.format-label,
.note-date,
.reading-footer {
	font-family: var(--mono);
	font-size: 10px;
	font-weight: 400;
	letter-spacing: 0;
}

.section-label {
	display: flex;
	justify-content: space-between;
	margin: 0 2px 15px;
	color: #626d64;
}

.section-label span {
	color: #929a91;
}

.search-box {
	display: flex;
	height: 39px;
	align-items: center;
	gap: 9px;
	padding: 0 10px;
	border: 1px solid #d3d8cf;
	border-radius: 4px;
	background: rgb(255 255 255 / 44%);
}

.search-icon {
	position: relative;
	width: 13px;
	height: 13px;
	flex: 0 0 13px;
	border: 1.5px solid #68756a;
	border-radius: 50%;
}

.search-icon::after {
	position: absolute;
	right: -4px;
	bottom: -2px;
	width: 5px;
	height: 1.5px;
	transform: rotate(45deg);
	background: #68756a;
	content: "";
}

.search-box input {
	width: 100%;
	min-width: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--ink);
	font-size: 12px;
}

.search-box input::placeholder {
	color: #818a80;
}

.search-box kbd {
	padding: 2px 5px;
	border: 1px solid #d5d9d1;
	border-radius: 3px;
	color: #808980;
	font-family: var(--mono);
	font-size: 10px;
}

.notes-list {
	display: grid;
	gap: 4px;
	margin-top: 13px;
}

.subject-link {
	display: flex;
	min-height: 42px;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 11px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: transparent;
	color: #29342d;
	cursor: pointer;
	text-align: left;
}

.subject-link:hover,
.subject-link[aria-expanded="true"] {
	border-color: #d5ded4;
	background: var(--green-soft);
}

.subject-name {
	font-size: 13px;
	font-weight: 700;
}

.subject-count {
	color: #6e786f;
	font-family: var(--mono);
	font-size: 10px;
}

.lesson-list {
	display: grid;
	gap: 4px;
	margin: 1px 0 8px 10px;
	padding-left: 8px;
	border-left: 1px solid #c9d2c7;
}

.lesson-link {
	display: grid;
	gap: 5px;
	width: 100%;
	min-height: 58px;
	padding: 9px 10px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	text-align: left;
}

.lesson-link:hover {
	background: rgb(255 255 255 / 35%);
}

.lesson-link[aria-current="page"] {
	border-color: #d5ded4;
	background: rgb(255 255 255 / 52%);
}

.note-link {
	display: grid;
	gap: 5px;
	width: 100%;
	min-height: 66px;
	padding: 12px 11px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	text-align: left;
}

.note-link:hover {
	background: rgb(255 255 255 / 35%);
}

.note-link[aria-current="page"] {
	border-color: #d5ded4;
	background: var(--green-soft);
}

.note-link-title {
	overflow: hidden;
	color: #29342d;
	font-size: 13px;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.note-link-summary {
	display: -webkit-box;
	overflow: hidden;
	color: #6e786f;
	font-size: 11px;
	line-height: 1.45;
	-webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.empty-state {
	padding: 0 4px;
	color: var(--muted);
	font-size: 12px;
	line-height: 1.6;
}

.sidebar-foot {
	margin: auto 2px 0;
	color: #899188;
}

.reading-area {
	display: flex;
	min-width: 0;
	min-height: 100vh;
	flex-direction: column;
	padding: 0 7.2%;
	background-image: radial-gradient(#dfe0d8 0.65px, transparent 0.65px);
	background-position: 9px 9px;
	background-size: 18px 18px;
}

.topbar {
	display: flex;
	min-height: 73px;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--line);
}

.breadcrumb {
	color: #778078;
}

.breadcrumb span {
	padding: 0 7px;
	color: #b0b6ae;
}

.format-label {
	display: flex;
	align-items: center;
	gap: 7px;
	color: #68776a;
}

.format-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #6e9477;
}

.note-article {
	width: min(100%, 700px);
	margin: 0 auto;
	padding: clamp(55px, 9vh, 94px) 0 70px;
	flex: 1;
}

.note-date {
	margin: 0 0 17px;
	color: #849087;
}

.note-title {
	margin: 0;
	color: #26352c;
	font-family: var(--serif);
	font-size: clamp(36px, 5vw, 54px);
	font-weight: 400;
	line-height: 1.08;
}

.title-rule {
	width: 100%;
	height: 1px;
	margin: 29px 0 32px;
	background: var(--line);
}

.markdown-content {
	color: #434b45;
	font-size: 15px;
	line-height: 1.8;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
	margin: 1.7em 0 0.55em;
	color: #2a3930;
	font-family: var(--serif);
	font-weight: 500;
	line-height: 1.25;
}

.markdown-content h1 {
	font-size: 32px;
}

.markdown-content h2 {
	font-size: 25px;
}

.markdown-content h3 {
	font-size: 20px;
}

.markdown-content p {
	margin: 0 0 17px;
}

.markdown-content ul,
.markdown-content ol {
	margin: 0 0 20px;
	padding-left: 24px;
}

.markdown-content li {
	padding-left: 4px;
}

.markdown-content a {
	color: var(--green);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.markdown-content blockquote {
	margin: 22px 0;
	padding: 2px 0 2px 17px;
	border-left: 2px solid #8da590;
	color: #68756b;
}

.markdown-content code {
	padding: 2px 5px;
	border-radius: 3px;
	background: #e9eae4;
	color: #3a5b47;
	font-family: var(--mono);
	font-size: 0.88em;
}

.markdown-content pre {
	overflow-x: auto;
	padding: 16px 18px;
	border: 1px solid #e0e1d9;
	border-radius: 4px;
	background: #eeeee8;
	line-height: 1.6;
}

.markdown-content pre code {
	padding: 0;
	background: transparent;
}

.markdown-content .mermaid {
	overflow-x: auto;
	margin: 20px 0;
	padding: 14px;
	border: 1px solid #e0e1d9;
	border-radius: 4px;
	background: #eeeee8;
	text-align: center;
}

.markdown-content .mermaid svg {
	max-width: 100%;
	height: auto;
}

.markdown-content img {
	max-width: 100%;
	height: auto;
}

.status-message {
	margin: 0 0 16px;
	color: #8a6546;
	font-size: 13px;
}

.status-message:empty {
	display: none;
}

.reading-footer {
	display: flex;
	min-height: 54px;
	align-items: center;
	justify-content: space-between;
	border-top: 1px solid var(--line);
	color: #92998f;
}

.visually-hidden {
	position: absolute;
	overflow: hidden;
	width: 1px;
	height: 1px;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	clip-path: inset(50%);
}

@media (max-width: 760px) {
	.app-shell {
		grid-template-columns: 1fr;
	}

	.sidebar {
		min-height: auto;
		padding: 19px 20px 14px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.sidebar-section {
		margin-top: 22px;
	}

	.sidebar-foot {
		display: none;
	}

	.notes-list {
		grid-template-columns: 1fr;
		max-height: 150px;
		overflow-y: auto;
	}

	.reading-area {
		min-height: 65vh;
		padding: 0 20px;
	}

	.topbar {
		min-height: 58px;
	}

	.note-article {
		padding: 48px 0 52px;
	}
}

@media (max-width: 420px) {
	.reading-footer {
		gap: 16px;
		font-size: 9px;
	}

	.format-label {
		font-size: 9px;
	}
}
