Spaces:
Sleeping
Sleeping
File size: 3,446 Bytes
e66cfb4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | /* === TOC 區塊:捲動與底部空白 === */
:root {
--toc-bottom-gap: 10px;
}
/* TOC 欄:sticky 定位,高度跟隨視窗 */
.toc-col-wrapper {
/* 桌機:顯示 */
display: block;
}
/* 內層容器:只負責間距,overflow 由外層 sticky 容器管理 */
.toc-scroll {
padding-right: 4px;
padding-bottom: var(--toc-bottom-gap);
}
/* 再塞一塊看不見的空白,讓最後一個項目可以捲到按鈕上方 */
.toc-scroll::after {
content: "";
display: block;
height: var(--toc-bottom-gap);
}
/* === TOC 連結 / 按鈕 顏色設定 === */
/* 淺色主題 */
.toc-container .toc-link,
.toc-container .toc-link:link,
.toc-container .toc-link:visited,
.toc-container .toc-link:active,
.toc-container .toc-button {
color: #228be6 !important;
text-decoration: none !important;
}
/* 淺色主題 hover / active */
.toc-container .toc-link:hover,
.toc-container .toc-button:hover,
.toc-container .toc-button:active,
.toc-container .toc-button:focus,
.toc-container .toc-button[data-active="true"] {
color: #228be6 !important;
background-color: transparent !important;
box-shadow: none !important;
}
/* 深色主題 */
[data-mantine-color-scheme="dark"] .toc-container .toc-link,
[data-mantine-color-scheme="dark"] .toc-container .toc-link:link,
[data-mantine-color-scheme="dark"] .toc-container .toc-link:visited,
[data-mantine-color-scheme="dark"] .toc-container .toc-link:active,
[data-mantine-color-scheme="dark"] .toc-container .toc-button {
color: #b197fc !important;
}
[data-mantine-color-scheme="dark"] .toc-container .toc-link:hover,
[data-mantine-color-scheme="dark"] .toc-container .toc-button:hover,
[data-mantine-color-scheme="dark"] .toc-container .toc-button:active,
[data-mantine-color-scheme="dark"] .toc-container .toc-button:focus,
[data-mantine-color-scheme="dark"] .toc-container .toc-button[data-active="true"] {
color: #b197fc !important;
background-color: transparent !important;
box-shadow: none !important;
}
/* TOC 內所有超連結都不要底線 */
.toc-scroll a,
.toc-scroll a:link,
.toc-scroll a:visited,
.toc-scroll a:hover,
.toc-scroll a:active {
text-decoration: none !important;
}
/* 目前閱讀的段落在 TOC 上高亮 */
.toc-item.toc-active .mantine-Button-root {
font-weight: 600;
border-left: 3px solid var(--mantine-color-teal-6);
padding-left: 10px;
background-color: rgba(56, 178, 172, 0.08);
}
/* 讓目錄按鈕的文字可以換行 */
.toc-button {
white-space: normal;
height: auto;
line-height: 1.4;
}
.toc-button .mantine-Button-label {
white-space: normal;
text-align: left;
overflow: visible;
text-overflow: clip;
}
/* ===================================================================
響應式:小螢幕隱藏 TOC
=================================================================== */
/* < 768px:隱藏 TOC,主內容全寬 */
@media (max-width: 768px) {
.toc-col-wrapper {
display: none !important;
}
}
/* 768px ~ 992px:顯示但縮小 */
@media (min-width: 769px) and (max-width: 992px) {
.toc-scroll {
max-height: calc(100vh - 140px);
}
}
/* ===================================================================
視窗過小(縮放超過 125%)時也隱藏 TOC
依據實際視窗寬度,非 CSS zoom
=================================================================== */
@media (max-width: 900px) {
.toc-col-wrapper {
display: none !important;
}
}
|