965 lines
23 KiB
CSS
965 lines
23 KiB
CSS
/**
|
||
* TOC (Table of Contents) 组件样式
|
||
*
|
||
* 职责:目录浮动按钮、弹窗、列表项、层级结构等完整样式
|
||
* 作用域:#toc-float-btn, #toc-popup 及其子元素
|
||
* 依赖:variables.css
|
||
*
|
||
* 合并自:
|
||
* - history_detail/toc-base.css (基础样式)
|
||
* - history_detail/toc-extensions.css (扩展功能)
|
||
* - toc-optimized.css (现代化设计,部分采纳)
|
||
*
|
||
* 重构说明:
|
||
* 1. 使用 CSS 变量替换硬编码值
|
||
* 2. 移除大部分 !important(保留少数必要的)
|
||
* 3. 保持向后兼容(ID 选择器)
|
||
* 4. 消除三个文件之间的样式冲突
|
||
*/
|
||
|
||
/* ==================== 1. TOC 浮动按钮 ==================== */
|
||
|
||
#toc-float-btn {
|
||
position: fixed;
|
||
left: var(--toc-button-left);
|
||
top: var(--toc-button-top);
|
||
z-index: var(--toc-button-z-index);
|
||
|
||
/* 尺寸 - 由 .tiny-round-btn 类控制,此处保留兼容性 */
|
||
width: var(--toc-button-size);
|
||
height: var(--toc-button-size);
|
||
|
||
/* 布局 */
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
/* 交互 */
|
||
cursor: pointer;
|
||
transition: background var(--transition-fast),
|
||
transform var(--transition-fast);
|
||
}
|
||
|
||
#toc-float-btn:hover {
|
||
transform: scale(1.1);
|
||
}
|
||
|
||
#toc-float-btn:active {
|
||
transform: scale(0.95);
|
||
}
|
||
|
||
/* TOC 按钮图标 - 由 .tiny-round-btn 控制,此处保留文档 */
|
||
#toc-float-btn i {
|
||
/* 样式由 .tiny-round-btn > i 控制 */
|
||
}
|
||
|
||
/* ==================== 2. TOC 弹窗容器 ==================== */
|
||
|
||
#toc-popup {
|
||
/* 显示控制 */
|
||
display: none;
|
||
|
||
/* 定位 */
|
||
position: fixed;
|
||
left: var(--toc-popup-left);
|
||
top: var(--toc-popup-top);
|
||
z-index: var(--toc-popup-z-index);
|
||
|
||
/* 尺寸 */
|
||
width: var(--toc-popup-width);
|
||
max-width: 85vw;
|
||
max-height: var(--toc-popup-max-height);
|
||
|
||
/* 样式 */
|
||
background: var(--color-bg-overlay);
|
||
border: 1px solid var(--color-border-light);
|
||
border-radius: var(--radius-lg);
|
||
box-shadow: var(--shadow-float);
|
||
|
||
/* 动画 */
|
||
transition: opacity var(--transition-base),
|
||
transform var(--transition-base),
|
||
width var(--transition-base);
|
||
transform: translateY(-10px);
|
||
opacity: 0;
|
||
|
||
/* 溢出控制 */
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* TOC 弹窗显示状态 */
|
||
#toc-popup.toc-popup-visible,
|
||
#toc-popup.visible {
|
||
display: block;
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
|
||
/* TOC 弹窗隐藏动画 */
|
||
#toc-popup.toc-popup-hiding {
|
||
opacity: 0;
|
||
transform: translateY(-10px);
|
||
}
|
||
|
||
/* TOC 展开模式 */
|
||
#toc-popup.toc-expanded {
|
||
width: 320px; /* 展开到2倍宽度(相对于新的 160px 基准) */
|
||
}
|
||
|
||
/* ==================== 3. TOC 弹窗头部 ==================== */
|
||
|
||
#toc-popup-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: var(--spacing-sm) var(--spacing-md);
|
||
border-bottom: 1px solid var(--color-border-light);
|
||
background: var(--color-bg-base); /* 纯白背景 */
|
||
}
|
||
|
||
#toc-popup-header span {
|
||
font-weight: var(--font-weight-medium); /* 减轻字重 */
|
||
font-size: var(--font-size-xs);
|
||
color: var(--color-text-secondary); /* 使用次要文本色 */
|
||
display: flex;
|
||
align-items: center;
|
||
gap: var(--spacing-xs);
|
||
}
|
||
|
||
#toc-popup-header i {
|
||
color: var(--color-text-muted); /* 图标改为灰色 */
|
||
font-size: var(--font-size-sm);
|
||
}
|
||
|
||
/* 关闭按钮 */
|
||
#toc-popup-close-btn {
|
||
background: transparent;
|
||
border: none;
|
||
border-radius: var(--radius-sm);
|
||
padding: 2px var(--spacing-xs); /* 缩小内边距 */
|
||
cursor: pointer;
|
||
font-size: var(--font-size-xs); /* 缩小字体 */
|
||
color: var(--color-text-secondary);
|
||
transition: background var(--transition-fast),
|
||
color var(--transition-fast);
|
||
}
|
||
|
||
#toc-popup-close-btn:hover {
|
||
background: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
color: var(--color-text-primary); /* 黑色文字 */
|
||
}
|
||
|
||
/* 展开按钮 */
|
||
#toc-expand-btn {
|
||
position: absolute;
|
||
right: var(--spacing-sm);
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
background: transparent;
|
||
border: none;
|
||
color: var(--color-primary);
|
||
cursor: pointer;
|
||
font-size: var(--font-size-lg);
|
||
padding: var(--spacing-xs);
|
||
border-radius: var(--radius-sm);
|
||
line-height: 1;
|
||
opacity: 0.7;
|
||
transition: opacity var(--transition-fast),
|
||
background-color var(--transition-fast);
|
||
}
|
||
|
||
#toc-expand-btn:hover {
|
||
opacity: 1;
|
||
background-color: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
}
|
||
|
||
/* ==================== 4. TOC 模式选择器 ==================== */
|
||
|
||
.toc-mode-selector {
|
||
display: none; /* 默认隐藏,由 JavaScript 控制显示 */
|
||
gap: var(--spacing-xs);
|
||
margin: var(--spacing-sm) var(--spacing-md);
|
||
padding: var(--spacing-xs);
|
||
background-color: var(--color-bg-secondary);
|
||
border-radius: var(--radius-md);
|
||
justify-content: center;
|
||
}
|
||
|
||
.toc-mode-btn {
|
||
padding: var(--spacing-xs) var(--spacing-sm);
|
||
border: 1px solid var(--color-border-medium);
|
||
border-radius: var(--radius-sm);
|
||
background-color: var(--color-bg-base);
|
||
color: var(--color-text-secondary);
|
||
cursor: pointer;
|
||
font-size: var(--font-size-xs);
|
||
font-weight: var(--font-weight-medium);
|
||
transition: all var(--transition-base);
|
||
user-select: none;
|
||
}
|
||
|
||
.toc-mode-btn:hover {
|
||
background: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
color: var(--color-text-primary); /* 黑色文字 */
|
||
transform: none; /* 移除动画 */
|
||
box-shadow: none; /* 移除阴影 */
|
||
}
|
||
|
||
.toc-mode-btn.active {
|
||
background: var(--color-text-primary); /* 黑色背景 */
|
||
color: var(--color-text-inverse); /* 白色文字 */
|
||
border-color: var(--color-text-primary); /* 黑色边框 */
|
||
box-shadow: none; /* 移除阴影 */
|
||
}
|
||
|
||
/* ==================== 5. TOC 列表容器 ==================== */
|
||
|
||
#toc-list {
|
||
list-style: none;
|
||
padding: var(--spacing-xs) 0; /* 缩小上下内边距 */
|
||
margin: 0;
|
||
font-size: var(--font-size-xs); /* 缩小列表字体 */
|
||
max-height: 60vh;
|
||
overflow-y: auto;
|
||
|
||
/* 滚动条样式 */
|
||
scrollbar-width: thin;
|
||
scrollbar-color: var(--color-border-medium) transparent;
|
||
}
|
||
|
||
#toc-list::-webkit-scrollbar {
|
||
width: 6px;
|
||
}
|
||
|
||
#toc-list::-webkit-scrollbar-track {
|
||
background: transparent;
|
||
}
|
||
|
||
#toc-list::-webkit-scrollbar-thumb {
|
||
background: var(--color-border-medium);
|
||
border-radius: var(--radius-sm);
|
||
transition: background var(--transition-fast);
|
||
}
|
||
|
||
#toc-list::-webkit-scrollbar-thumb:hover {
|
||
background: var(--color-border-dark);
|
||
}
|
||
|
||
/* TOC 子项容器 */
|
||
#toc-list ul.toc-children {
|
||
list-style: none;
|
||
padding-left: 0;
|
||
margin: 0;
|
||
overflow: hidden;
|
||
transition: height var(--transition-base),
|
||
opacity var(--transition-base);
|
||
}
|
||
|
||
/* 折叠状态下的子项容器 */
|
||
#toc-list .toc-children.collapsed {
|
||
height: 0 !important; /* !important 必要,用于覆盖 JS 设置的高度 */
|
||
margin: 0;
|
||
padding: 0;
|
||
opacity: 0;
|
||
}
|
||
|
||
/* ==================== 6. TOC 列表项样式 ==================== */
|
||
|
||
#toc-list li {
|
||
margin-bottom: 0;
|
||
line-height: var(--line-height-base);
|
||
position: relative;
|
||
}
|
||
|
||
/* 不同层级标题的间距 */
|
||
#toc-list li.toc-h1 {
|
||
margin-top: var(--spacing-sm);
|
||
}
|
||
|
||
#toc-list li.toc-h2 {
|
||
margin-top: var(--spacing-xs);
|
||
}
|
||
|
||
#toc-list li.toc-h3,
|
||
#toc-list li.toc-h4,
|
||
#toc-list li.toc-h5,
|
||
#toc-list li.toc-h6 {
|
||
margin-top: 2px;
|
||
}
|
||
|
||
/* TOC 链接样式 */
|
||
#toc-list li a {
|
||
display: block;
|
||
padding: 4px 8px; /* 缩小内边距以适应窄宽度 */
|
||
color: var(--color-text-primary);
|
||
text-decoration: none;
|
||
font-weight: var(--font-weight-normal); /* 减轻字重 */
|
||
font-size: var(--font-size-xs); /* 缩小链接字体 */
|
||
transition: background var(--transition-fast),
|
||
color var(--transition-fast),
|
||
border-left-color var(--transition-fast);
|
||
border-left: 2px solid var(--color-border-light); /* 缩窄边框 */
|
||
|
||
/* 多行支持 */
|
||
white-space: normal;
|
||
word-break: break-word;
|
||
line-height: 1.3;
|
||
padding-right: var(--spacing-xs); /* 缩小右侧内边距 */
|
||
}
|
||
|
||
#toc-list li a:hover {
|
||
background: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
color: var(--color-text-primary); /* 黑色文字 */
|
||
border-left-color: var(--color-text-secondary); /* 灰色边框 */
|
||
}
|
||
|
||
#toc-list li a.active {
|
||
background: var(--color-bg-base); /* 白色背景 */
|
||
color: var(--color-primary); /* 蓝色文字(唯一的蓝色重点) */
|
||
border-left-color: var(--color-primary); /* 蓝色边框 */
|
||
font-weight: var(--font-weight-semibold);
|
||
}
|
||
|
||
/* 不同层级标题的缩进和字体大小 */
|
||
#toc-list li.toc-h2 a {
|
||
padding-left: 16px; /* 缩小缩进量 */
|
||
font-size: 0.95em;
|
||
}
|
||
|
||
#toc-list li.toc-h3 a {
|
||
padding-left: 22px; /* 缩小缩进量 */
|
||
font-size: 0.90em;
|
||
color: var(--color-text-secondary);
|
||
}
|
||
|
||
#toc-list li.toc-h3 a:hover {
|
||
color: var(--color-primary);
|
||
}
|
||
|
||
#toc-list li.toc-h4 a {
|
||
padding-left: 28px; /* 缩小缩进量 */
|
||
font-size: 0.87em;
|
||
}
|
||
|
||
#toc-list li.toc-h5 a {
|
||
padding-left: 34px; /* 缩小缩进量 */
|
||
font-size: 0.85em;
|
||
}
|
||
|
||
#toc-list li.toc-h6 a {
|
||
padding-left: 40px; /* 缩小缩进量 */
|
||
font-size: 0.83em;
|
||
}
|
||
|
||
/* ==================== 7. 折叠/展开功能 ==================== */
|
||
|
||
/* 折叠按钮 */
|
||
#toc-list .toc-toggle {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 16px;
|
||
height: 16px;
|
||
text-align: center;
|
||
line-height: 16px;
|
||
margin-right: var(--spacing-xs);
|
||
font-size: 10px;
|
||
color: var(--color-text-secondary);
|
||
transition: transform var(--transition-fast),
|
||
color var(--transition-fast),
|
||
background-color var(--transition-fast);
|
||
cursor: pointer;
|
||
border-radius: var(--radius-sm);
|
||
}
|
||
|
||
#toc-list .toc-toggle:hover {
|
||
color: var(--color-text-primary); /* 黑色 */
|
||
background-color: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
}
|
||
|
||
#toc-list .toc-toggle.collapsed {
|
||
transform: rotate(-90deg);
|
||
}
|
||
|
||
/* 有子项的 TOC 项样式 */
|
||
#toc-list li.has-children > a {
|
||
font-weight: var(--font-weight-semibold);
|
||
}
|
||
|
||
/* 修复悬停状态与折叠状态的冲突 */
|
||
#toc-list li a:hover .toc-toggle {
|
||
color: var(--color-text-primary); /* 黑色 */
|
||
}
|
||
|
||
/* ==================== 8. TOC 文本内容结构 ==================== */
|
||
|
||
/* 多行 TOC 文本布局 */
|
||
#toc-list .toc-text {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: baseline;
|
||
line-height: 1.4; /* 缩小行高 */
|
||
width: 100%;
|
||
padding: 0;
|
||
margin: 0;
|
||
font-size: 11px; /* 进一步缩小文本 */
|
||
}
|
||
|
||
#toc-list li.has-children > a .toc-text {
|
||
padding-left: 0;
|
||
}
|
||
|
||
/* TOC 内容 */
|
||
.toc-content {
|
||
display: inline-block;
|
||
flex: 1;
|
||
min-width: 0;
|
||
word-break: break-word;
|
||
overflow-wrap: break-word;
|
||
white-space: normal;
|
||
font-weight: var(--font-weight-normal);
|
||
}
|
||
|
||
/* TOC 英文翻译 */
|
||
#toc-list span.toc-en-translation,
|
||
.toc-en-translation {
|
||
font-size: 0.80em; /* 进一步缩小译文 */
|
||
color: var(--color-text-muted);
|
||
margin-left: 2px; /* 缩小间距 */
|
||
font-weight: var(--font-weight-normal);
|
||
font-style: italic;
|
||
}
|
||
|
||
/* 非展开模式下的文本显示限制 */
|
||
#toc-popup:not(.toc-expanded) .toc-text {
|
||
max-height: 3.9em; /* 三行文本高度 */
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 3;
|
||
-webkit-box-orient: vertical;
|
||
}
|
||
|
||
/* 展开模式下取消文本限制 */
|
||
#toc-popup.toc-expanded .toc-text {
|
||
max-height: none;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: baseline;
|
||
-webkit-line-clamp: unset;
|
||
}
|
||
|
||
/* ==================== 9. 结构化标题样式 ==================== */
|
||
|
||
/* 通用结构化标题样式 */
|
||
.toc-structured .toc-prefix {
|
||
font-weight: var(--font-weight-medium); /* 减轻字重 */
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
margin-right: var(--spacing-xs);
|
||
display: inline-block;
|
||
font-family: var(--font-family-monospace);
|
||
background: transparent; /* 移除背景色 */
|
||
padding: 0; /* 移除内边距 */
|
||
border-radius: 0;
|
||
font-size: 0.85em;
|
||
}
|
||
|
||
.toc-structured .toc-content {
|
||
padding-left: 0;
|
||
margin-left: 2px;
|
||
}
|
||
|
||
/* 结构化标题首字母 - 避免与前缀冲突 */
|
||
.toc-structured .toc-content::first-letter {
|
||
font-weight: var(--font-weight-normal);
|
||
color: inherit;
|
||
}
|
||
|
||
/* 章节标题样式(如"第一章") - 简化为统一样式 */
|
||
.toc-structure-chapter .toc-prefix {
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
font-size: 0.85em;
|
||
}
|
||
|
||
/* 数字编号标题样式(如"1.1") */
|
||
.toc-structure-numeric .toc-prefix {
|
||
font-family: var(--font-family-monospace);
|
||
letter-spacing: 0.5px;
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
}
|
||
|
||
/* 罗马数字标题样式 */
|
||
.toc-structure-roman .toc-prefix {
|
||
font-style: normal; /* 移除斜体 */
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
}
|
||
|
||
/* 字母标题样式 */
|
||
.toc-structure-letter .toc-prefix {
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
}
|
||
|
||
/* 结构化标题缩进优化 */
|
||
#toc-list > li.toc-structured {
|
||
padding-left: 0;
|
||
}
|
||
|
||
#toc-list .toc-structured.toc-h1 { padding-left: 0; }
|
||
#toc-list .toc-structured.toc-h2 { padding-left: var(--spacing-md); }
|
||
#toc-list .toc-structured.toc-h3 { padding-left: calc(var(--spacing-md) * 2); }
|
||
#toc-list .toc-structured.toc-h4 { padding-left: calc(var(--spacing-md) * 3); }
|
||
#toc-list .toc-structured.toc-h5 { padding-left: calc(var(--spacing-md) * 4); }
|
||
#toc-list .toc-structured.toc-h6 { padding-left: calc(var(--spacing-md) * 5); }
|
||
|
||
/* 强化层级视觉效果 - 简化为统一灰色 */
|
||
.toc-structured {
|
||
border-left: none;
|
||
position: relative;
|
||
}
|
||
|
||
.toc-structured.toc-h2 { border-left: 2px solid var(--color-border-light); }
|
||
.toc-structured.toc-h3 { border-left: 2px solid var(--color-border-light); }
|
||
.toc-structured.toc-h4 { border-left: 2px solid var(--color-border-light); }
|
||
.toc-structured.toc-h5,
|
||
.toc-structured.toc-h6 { border-left: 2px solid var(--color-border-light); }
|
||
|
||
/* 简单数字列表项样式 */
|
||
.toc-simple-numbered {
|
||
position: relative;
|
||
}
|
||
|
||
.toc-simple-numbered .toc-prefix {
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
font-weight: var(--font-weight-medium); /* 减轻字重 */
|
||
font-size: 0.9em;
|
||
}
|
||
|
||
#toc-list li.toc-simple-numbered {
|
||
padding-left: var(--spacing-md) !important;
|
||
}
|
||
|
||
.toc-simple-numbered::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
height: 100%;
|
||
border-left: 2px dotted var(--color-border-medium); /* 灰色虚线 */
|
||
}
|
||
|
||
.toc-simple-numbered:hover::before {
|
||
border-left-color: var(--color-border-dark); /* 深灰色 */
|
||
}
|
||
|
||
/* 带空格多级编号标题样式 */
|
||
.toc-spaced-numeric .toc-prefix {
|
||
font-family: var(--font-family-monospace);
|
||
letter-spacing: 0.5px;
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
font-weight: var(--font-weight-medium); /* 减轻字重 */
|
||
}
|
||
|
||
.toc-spaced-numeric:hover {
|
||
background-color: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
}
|
||
|
||
#toc-list .toc-spaced-numeric {
|
||
padding-left: inherit;
|
||
}
|
||
|
||
/* ==================== 10. 图表标题样式 ==================== */
|
||
|
||
/* 图表标题在 TOC 中的特殊样式 - 简化 */
|
||
#toc-list li.toc-caption a::before {
|
||
content: "• "; /* 简化为圆点 */
|
||
margin-right: var(--spacing-xs);
|
||
font-size: var(--font-size-sm);
|
||
color: var(--color-text-muted);
|
||
}
|
||
|
||
#toc-list li.toc-caption a {
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
font-style: normal; /* 移除斜体 */
|
||
}
|
||
|
||
#toc-list li.toc-caption a:hover {
|
||
background-color: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
}
|
||
|
||
/* 图表标题作为子项的样式调整 */
|
||
.toc-caption {
|
||
font-style: italic;
|
||
color: var(--color-text-secondary);
|
||
padding-left: var(--spacing-md) !important;
|
||
position: relative;
|
||
}
|
||
|
||
.toc-caption::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
height: 100%;
|
||
border-left: 2px dotted rgba(97, 97, 97, 0.2);
|
||
}
|
||
|
||
.toc-structured + li.toc-caption {
|
||
padding-left: calc(var(--spacing-md) * 2) !important;
|
||
}
|
||
|
||
/* 图表图标样式 */
|
||
.toc-chart-icon {
|
||
margin-right: var(--spacing-xs);
|
||
font-size: 0.9em;
|
||
opacity: 0.8;
|
||
transition: opacity var(--transition-fast),
|
||
transform var(--transition-fast);
|
||
}
|
||
|
||
.toc-caption:hover .toc-chart-icon {
|
||
opacity: 1;
|
||
transform: scale(1.1);
|
||
}
|
||
|
||
/* 图表标题的内容样式 */
|
||
.toc-caption .toc-content {
|
||
font-style: normal; /* 移除斜体 */
|
||
color: var(--color-text-secondary); /* 灰色 */
|
||
}
|
||
|
||
.toc-caption .toc-content::first-letter {
|
||
font-weight: inherit;
|
||
color: inherit;
|
||
}
|
||
|
||
/* ==================== 11. 文件名占位符样式 ==================== */
|
||
|
||
#toc-list li a[href^="#placeholder-"] {
|
||
font-weight: var(--font-weight-medium); /* 减轻字重 */
|
||
color: var(--color-text-primary); /* 黑色 */
|
||
border-left-color: var(--color-border-medium); /* 灰色边框 */
|
||
background-color: transparent; /* 移除背景色 */
|
||
padding-left: 8px;
|
||
}
|
||
|
||
#toc-list li a[href^="#placeholder-"]::before {
|
||
content: "• "; /* 简化为圆点 */
|
||
margin-right: var(--spacing-xs);
|
||
color: var(--color-text-muted);
|
||
}
|
||
|
||
/* ==================== 12. TOC 控制按钮区域 ==================== */
|
||
|
||
.toc-controls {
|
||
padding: var(--spacing-sm) var(--spacing-md);
|
||
text-align: center;
|
||
border-top: 1px solid var(--color-border-light);
|
||
font-size: 0.8em;
|
||
color: var(--color-text-muted);
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
gap: var(--spacing-sm);
|
||
background: var(--color-bg-secondary);
|
||
}
|
||
|
||
.toc-control-btn {
|
||
background: transparent;
|
||
border: none;
|
||
margin: 0 var(--spacing-xs);
|
||
padding: var(--spacing-xs) var(--spacing-sm);
|
||
color: var(--color-primary);
|
||
cursor: pointer;
|
||
border-radius: var(--radius-sm);
|
||
transition: background-color var(--transition-fast);
|
||
font-size: var(--font-size-xs);
|
||
user-select: none;
|
||
}
|
||
|
||
.toc-control-btn:hover {
|
||
background-color: var(--color-bg-secondary); /* 浅灰色背景 */
|
||
color: var(--color-text-primary); /* 黑色文字 */
|
||
}
|
||
|
||
/* ==================== 13. 特殊效果 ==================== */
|
||
|
||
/* 目标高亮效果(跳转后的高亮) - 简化 */
|
||
.toc-target-highlight {
|
||
background: var(--color-bg-secondary) !important; /* 浅灰色背景 */
|
||
box-shadow: none !important; /* 移除阴影 */
|
||
border-left: 3px solid var(--color-primary) !important; /* 蓝色边框(重点色) */
|
||
transition: all var(--transition-base) !important;
|
||
border-radius: 0 !important; /* 移除圆角 */
|
||
padding: var(--spacing-sm) !important; /* 缩小内边距 */
|
||
}
|
||
|
||
/* TOC 弹窗显示/隐藏动画效果 */
|
||
.toc-popup-visible {
|
||
display: block !important;
|
||
opacity: 1 !important;
|
||
transform: translateY(0) !important;
|
||
}
|
||
|
||
.toc-popup-hidden {
|
||
display: none !important;
|
||
}
|
||
|
||
/* 强化TOC的视觉层级 */
|
||
#toc-list ul.toc-children {
|
||
margin-left: 0;
|
||
border-left: 1px solid var(--color-border-light); /* 统一灰色边框 */
|
||
}
|
||
|
||
/* ==================== 14. 响应式设计 ==================== */
|
||
|
||
@media (max-width: 768px) {
|
||
#toc-float-btn {
|
||
left: 15px;
|
||
width: 44px;
|
||
height: 44px;
|
||
font-size: var(--font-size-lg);
|
||
}
|
||
|
||
#toc-popup {
|
||
left: 15px;
|
||
width: calc(100vw - 30px);
|
||
max-width: 350px;
|
||
}
|
||
|
||
.toc-mode-btn {
|
||
padding: var(--spacing-xs) var(--spacing-md);
|
||
font-size: 0.8rem;
|
||
}
|
||
|
||
#toc-list li a {
|
||
padding: 10px 14px 10px 18px;
|
||
margin: 2px 8px;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
#toc-popup {
|
||
width: calc(100vw - 20px);
|
||
left: 10px;
|
||
max-height: 70vh;
|
||
}
|
||
|
||
#toc-popup-header {
|
||
padding: var(--spacing-md) var(--spacing-lg) var(--spacing-sm) var(--spacing-lg);
|
||
}
|
||
|
||
#toc-popup-header span {
|
||
font-size: 1rem;
|
||
}
|
||
}
|
||
|
||
/* ==================== 15. TOC 模式选择器 ==================== */
|
||
|
||
.toc-mode-selector {
|
||
display: flex;
|
||
gap: 5px;
|
||
margin: var(--spacing-sm) 0;
|
||
padding: 5px;
|
||
background-color: #f5f7fa;
|
||
border-radius: var(--radius-sm);
|
||
justify-content: center;
|
||
}
|
||
|
||
.toc-mode-btn {
|
||
padding: var(--spacing-xs) var(--spacing-md);
|
||
border: 1px solid var(--color-border);
|
||
border-radius: var(--radius-sm);
|
||
background-color: #fff;
|
||
cursor: pointer;
|
||
font-size: var(--font-size-xs);
|
||
transition: all var(--transition-fast) ease;
|
||
}
|
||
|
||
.toc-mode-btn.active {
|
||
background-color: var(--color-primary);
|
||
color: white;
|
||
border-color: #2563eb;
|
||
}
|
||
|
||
.toc-mode-btn:hover:not(.active) {
|
||
background-color: #f0f4f8;
|
||
}
|
||
|
||
/* ==================== 16. TOC 高亮效果 ==================== */
|
||
|
||
.toc-highlight,
|
||
.toc-target-highlight {
|
||
animation: toc-highlight-pulse 3s ease-out;
|
||
position: relative;
|
||
z-index: 1;
|
||
}
|
||
|
||
@keyframes toc-highlight-pulse {
|
||
0% {
|
||
box-shadow: none;
|
||
background-color: var(--color-bg-secondary);
|
||
}
|
||
50% {
|
||
box-shadow: none;
|
||
background-color: var(--color-bg-secondary);
|
||
}
|
||
100% {
|
||
box-shadow: none;
|
||
background-color: transparent;
|
||
}
|
||
}
|
||
|
||
/* 确保图片和表格等特殊元素在高亮时的效果 - 简化 */
|
||
.markdown-body img.toc-highlight,
|
||
.markdown-body table.toc-highlight,
|
||
.markdown-body img.toc-target-highlight,
|
||
.markdown-body table.toc-target-highlight {
|
||
border: 2px solid var(--color-border-medium); /* 灰色边框 */
|
||
border-radius: 0; /* 移除圆角 */
|
||
}
|
||
|
||
/* ==================== 17. 转换后的标题样式 ==================== */
|
||
|
||
.converted-from-heading {
|
||
font-weight: var(--font-weight-semibold);
|
||
margin-top: 1.5em;
|
||
margin-bottom: 0.75em;
|
||
color: var(--color-text-primary);
|
||
border-bottom: 1px solid var(--color-border);
|
||
padding-bottom: 5px;
|
||
}
|
||
|
||
/* ==================== 18. TOC 信息提示 ==================== */
|
||
|
||
.toc-info {
|
||
padding: var(--spacing-md);
|
||
margin: var(--spacing-md) 0;
|
||
background-color: #f8f9fa;
|
||
border-left: 3px solid var(--color-primary);
|
||
color: var(--color-text-secondary);
|
||
font-style: italic;
|
||
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
|
||
}
|
||
|
||
/* ==================== 19. TOC 层级详细样式 ==================== */
|
||
|
||
#toc-list li.toc-h1 a {
|
||
padding-left: var(--spacing-md);
|
||
font-size: 1em;
|
||
font-weight: var(--font-weight-semibold);
|
||
}
|
||
|
||
#toc-list li.toc-h2 a {
|
||
padding-left: var(--spacing-lg);
|
||
font-size: 0.95em;
|
||
font-weight: var(--font-weight-medium);
|
||
}
|
||
|
||
#toc-list li.toc-h3 a {
|
||
padding-left: 28px;
|
||
font-size: 0.9em;
|
||
font-weight: var(--font-weight-medium);
|
||
}
|
||
|
||
#toc-list li.toc-h4 a {
|
||
padding-left: 36px;
|
||
font-size: 0.85em;
|
||
font-weight: normal;
|
||
}
|
||
|
||
#toc-list li.toc-h5 a {
|
||
padding-left: 44px;
|
||
font-size: 0.8em;
|
||
font-weight: normal;
|
||
color: #555;
|
||
}
|
||
|
||
#toc-list li.toc-h6 a {
|
||
padding-left: 52px;
|
||
font-size: 0.75em;
|
||
font-weight: normal;
|
||
color: #666;
|
||
}
|
||
|
||
/* 转换后的标题在TOC中的样式 */
|
||
#toc-list li.toc-p.converted-from-heading a {
|
||
/* 根据原始标签应用相应的样式 */
|
||
}
|
||
|
||
/* ==================== 20. 可折叠 TOC 样式 ==================== */
|
||
|
||
#toc-list .toc-toggle {
|
||
cursor: pointer;
|
||
width: 16px;
|
||
height: 16px;
|
||
display: inline-block;
|
||
text-align: center;
|
||
line-height: 16px;
|
||
margin-right: var(--spacing-xs);
|
||
color: var(--color-text-secondary);
|
||
transition: transform var(--transition-fast);
|
||
float: left;
|
||
margin-top: 2px;
|
||
}
|
||
|
||
#toc-list .toc-toggle.collapsed {
|
||
transform: rotate(-90deg);
|
||
}
|
||
|
||
#toc-list .toc-children {
|
||
height: auto;
|
||
overflow: hidden;
|
||
transition: height var(--transition-base) ease;
|
||
clear: both;
|
||
}
|
||
|
||
#toc-list .toc-children.collapsed {
|
||
height: 0;
|
||
}
|
||
|
||
/* 为有子项的TOC项添加特殊样式 */
|
||
#toc-list .has-children > a {
|
||
font-weight: var(--font-weight-semibold);
|
||
display: flex;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
/* ==================== 21. TOC 英文翻译样式 ==================== */
|
||
|
||
#toc-list span.toc-en-translation {
|
||
font-size: 0.85em;
|
||
color: var(--color-text-secondary);
|
||
margin-left: var(--spacing-xs);
|
||
font-weight: var(--font-weight-normal);
|
||
display: inline-block;
|
||
}
|
||
|
||
/* ==================== 22. 设置对话框中的单选按钮样式 ==================== */
|
||
|
||
.radio-container {
|
||
margin: var(--spacing-md) 0 var(--spacing-md);
|
||
}
|
||
|
||
.radio-group {
|
||
margin-bottom: var(--spacing-sm);
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.radio-group input[type="radio"] {
|
||
margin-right: var(--spacing-sm);
|
||
}
|
||
|
||
.radio-group label {
|
||
cursor: pointer;
|
||
}
|
||
|
||
/* ==================== 23. 打印样式 ==================== */
|
||
|
||
@media print {
|
||
#toc-float-btn,
|
||
#toc-popup {
|
||
display: none !important;
|
||
}
|
||
}
|