/* Sidebar TOC - 页面级左侧目录栏（GeneratePress 配色对齐）
   宽度变量 --toc-width / --toc-width-mid / --toc-width-collapsed 由后台设置注入；
   断点媒体查询由 PHP 动态生成（@media 不支持 var()）。 */

/* 三栏布局：左侧目录 | 正文 | 右侧栏 */
.single .site-content,
.page .site-content {
	align-items: flex-start;
}

.single .site-content .content-area,
.page .site-content .content-area {
	width: auto;
	flex: 1 1 auto;
	min-width: 0;
}

.single .site-content .widget-area,
.page .site-content .widget-area {
	width: auto;
	flex: 0 0 300px;
}

/* 左侧目录栏 */
#sidebar-toc {
	position: sticky;
	top: 24px;
	display: flex;
	flex-direction: column;
	flex: 0 0 var(--toc-width, 300px);
	width: var(--toc-width, 300px);
	max-height: calc(100vh - 48px);
	overflow: hidden;
	box-sizing: border-box;
	margin: 0 30px 0 0;
	background: var(--base-3);
	border: 1px solid var(--base);
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.55;
	transition: flex-basis .25s ease, width .25s ease, margin .25s ease, padding .25s ease;
}

/* 目录内部滚动区 */
#sidebar-toc .toc-inner {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 12px;
	box-sizing: border-box;
	scrollbar-width: thin;
	scrollbar-color: var(--base) transparent;
}

#sidebar-toc .toc-inner::-webkit-scrollbar {
	width: 6px;
}

#sidebar-toc .toc-inner::-webkit-scrollbar-thumb {
	background: var(--base);
	border-radius: 3px;
}

/* 头部：标题 + 收起按钮 */
#sidebar-toc .toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 10px;
	padding: 0 0 10px 8px;
	border-bottom: 1px solid var(--base);
}

#sidebar-toc .toc-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .5px;
	color: var(--contrast-2);
	margin: 0;
}

#sidebar-toc .toc-collapse-btn {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--contrast-3);
	font-size: 14px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 3px;
	transition: color .15s, background .15s;
}

#sidebar-toc .toc-collapse-btn:hover {
	background: var(--base);
	color: var(--contrast);
}

/* 折叠后的展开按钮（竖条） */
#sidebar-toc .toc-expand-btn {
	display: none;
	align-items: center;
	justify-content: center;
	height: 100%;
	min-height: 120px;
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--contrast-3);
	font-size: 16px;
	padding: 0;
	width: 100%;
	transition: color .15s;
}

#sidebar-toc .toc-expand-btn:hover {
	color: var(--accent);
}

/* 折叠态：栏收成窄竖条 */
body.toc-collapsed #sidebar-toc {
	flex-basis: var(--toc-width-collapsed, 44px);
	width: var(--toc-width-collapsed, 44px);
	margin-right: 16px;
}

body.toc-collapsed #sidebar-toc .toc-inner {
	display: none;
}

body.toc-collapsed #sidebar-toc .toc-expand-btn {
	display: flex;
}

/* 目录列表 */
#sidebar-toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

#sidebar-toc ul ul {
	padding-left: 14px;
}

#sidebar-toc li {
	margin: 1px 0;
}

#sidebar-toc a {
	display: block;
	padding: 4px 8px;
	color: var(--contrast-2);
	text-decoration: none;
	border-left: 2px solid transparent;
	border-radius: 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background .15s, color .15s, border-color .15s;
}

#sidebar-toc a:hover {
	background: var(--base);
	color: var(--contrast);
}

#sidebar-toc a.active {
	background: rgba(30, 115, 190, .08);
	color: var(--accent);
	border-left-color: var(--accent);
	font-weight: 600;
}

/* 抽屉相关的基础隐藏态（显示规则由 PHP 媒体查询控制） */
#toc-fab,
#toc-overlay {
	display: none;
}

#toc-fab {
	align-items: center;
	justify-content: center;
	position: fixed;
	left: 16px;
	bottom: 24px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--base-3);
	border: 1px solid var(--base);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
	color: var(--contrast-2);
	font-size: 18px;
	cursor: pointer;
	z-index: 99990;
	transition: background .15s, color .15s, box-shadow .15s;
}

#toc-fab:hover {
	background: var(--base);
	color: var(--accent);
	box-shadow: 0 3px 14px rgba(0, 0, 0, .18);
}

#toc-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .35);
	z-index: 99989;
}
