File size: 18,585 Bytes
96dd062 | 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | @import 'tailwindcss';
@import './layout-styles.css';
@import './navbar.css';
@import './waves.css';
@import './transition.css';
@import './custom-scrollbar.css';
@plugin '@tailwindcss/typography';
/* 暗色模式选择器配置 */
@custom-variant dark (&:where(.dark, .dark *));
/* Tailwind v4 配置 - 从 tailwind.config.cjs 迁移 */
@theme {
--font-sans:
'Roboto', 'sans-serif', ui-sans-serif, system-ui, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
/* 自定义工具类 - Tailwind v4 使用 @utility 定义 */
@utility expand-animation {
position: relative;
z-index: 0;
&::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
scale: 0.85;
z-index: -10;
transition: all 0.15s ease-out;
}
&:hover::before {
background-color: var(--btn-plain-bg-hover);
scale: 1;
}
&:active::before {
background-color: var(--btn-plain-bg-active);
}
&:active {
background: none;
}
}
/* 确保平滑滚动 */
html {
scroll-behavior: smooth;
}
/* 页面顶部渐变高光效果 */
.top-gradient-highlight {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 180px;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.3) 30%, rgba(255, 255, 255, 0.15) 60%, rgba(255, 255, 255, 0.05) 80%, transparent 100%);
pointer-events: none;
z-index: 20;
transition: all var(--duration-medium) var(--ease-standard);
}
/* 暗色主题下的渐变高光效果 */
:root.dark .top-gradient-highlight {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.3) 30%, rgba(0, 0, 0, 0.15) 60%, rgba(0, 0, 0, 0.05) 80%, transparent 100%);
}
@layer components {
/* View Transitions API 主题切换动画 */
/* 为整个文档根元素设置视图过渡 */
::view-transition-old(root),
::view-transition-new(root) {
animation-duration: 0.5s;
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
/* 使用混合模式使颜色过渡更平滑 */
mix-blend-mode: normal;
}
/* 视图过渡组 - 使用交叉淡化效果 */
::view-transition-group(root) {
animation-duration: 0.5s;
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
/* 淡出旧视图 - 使用更平滑的曲线 */
::view-transition-old(root) {
animation-name: theme-fade-out;
/* 确保背景色同步切换 */
z-index: 2;
}
/* 淡入新视图 - 使用更平滑的曲线 */
::view-transition-new(root) {
animation-name: theme-fade-in;
/* 确保新视图在上层 */
z-index: 1;
}
/* 定义淡出动画 - 使用更平滑的缓动函数 */
@keyframes theme-fade-out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
/* 定义淡入动画 - 从下层淡入 */
@keyframes theme-fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
/* 确保边框和分隔线元素在主题切换时有更明确的过渡时长 */
.transition,
[class*="border"],
[class*="transition"] {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 0.15s;
}
/* 主题过渡保护类 - 仅在非 View Transitions 模式下使用 */
/* 当使用 View Transitions API 时,浏览器会自动处理过渡,不需要禁用 transition */
.is-theme-transitioning:not(.use-view-transition) *,
.is-theme-transitioning:not(.use-view-transition) *::before,
.is-theme-transitioning:not(.use-view-transition) *::after {
transition: none !important;
animation: none !important;
}
/* 在主题切换时禁用代码块的复杂效果以提升性能 */
/* 使用 View Transitions 时也需要禁用代码块动画,因为它们太多了 */
.is-theme-transitioning .expressive-code,
.is-theme-transitioning .expressive-code * {
transition: none !important;
animation: none !important;
will-change: auto !important;
}
/* 禁用复杂选择器元素的过渡 - 仅在非 View Transitions 模式下 */
.is-theme-transitioning:not(.use-view-transition) .float-panel,
.is-theme-transitioning:not(.use-view-transition) .float-panel *,
.is-theme-transitioning:not(.use-view-transition) .music-player,
.is-theme-transitioning:not(.use-view-transition) .music-player *,
.is-theme-transitioning:not(.use-view-transition) .widget,
.is-theme-transitioning:not(.use-view-transition) .widget *,
.is-theme-transitioning:not(.use-view-transition) .dropdown-content,
.is-theme-transitioning:not(.use-view-transition) .dropdown-content * {
transition: none !important;
animation: none !important;
}
/* 强制使用 contain 隔离渲染上下文 - 仅在非 View Transitions 模式下 */
.is-theme-transitioning:not(.use-view-transition) .post-card,
.is-theme-transitioning:not(.use-view-transition) .widget,
.is-theme-transitioning:not(.use-view-transition) .float-panel {
contain: layout style paint !important;
}
/* 波浪效果精确同步处理 - 仅在非 View Transitions 模式下 */
.is-theme-transitioning:not(.use-view-transition) svg use {
/* 禁用过渡但保持动画 */
transition: none;
/* 强制立即继承页面背景色 */
fill: currentColor;
}
/* 导航栏主题切换保护 - 仅在非 View Transitions 模式下禁用过渡 */
.is-theme-transitioning:not(.use-view-transition) #navbar > div,
.is-theme-transitioning:not(.use-view-transition) #navbar[data-transparent-mode] > div,
.is-theme-transitioning:not(.use-view-transition) #navbar[data-transparent-mode].scrolled > div,
.is-theme-transitioning:not(.use-view-transition) body.wallpaper-transparent #navbar > div,
.is-theme-transitioning:not(.use-view-transition) body.wallpaper-transparent #navbar[data-transparent-mode] > div,
.is-theme-transitioning:not(.use-view-transition) body.wallpaper-transparent #navbar[data-transparent-mode].scrolled > div,
.is-theme-transitioning:not(.use-view-transition) #banner-wrapper ~ * #navbar > div,
.is-theme-transitioning:not(.use-view-transition) #banner-wrapper ~ * #navbar[data-transparent-mode] > div,
.is-theme-transitioning:not(.use-view-transition) body:has(#banner-wrapper) #navbar > div,
.is-theme-transitioning:not(.use-view-transition) body:has(#banner-wrapper) #navbar[data-transparent-mode] > div {
transition: none !important;
backdrop-filter: none !important;
}
/* 导航栏相关浮动面板的过渡禁用 */
.is-theme-transitioning .dropdown-content,
.is-theme-transitioning .float-panel,
.is-theme-transitioning #display-setting,
.is-theme-transitioning #nav-menu-panel,
.is-theme-transitioning #translate-panel,
.is-theme-transitioning #mobile-toc-panel,
.is-theme-transitioning #search-panel {
transition: none !important;
backdrop-filter: none !important;
}
/* 波浪容器的颜色传递 */
.is-theme-transitioning #header-waves {
/* 设置当前颜色为页面背景色,供SVG继承 */
color: var(--page-bg);
/* 确保与页面在同一合成层 */
isolation: isolate;
/* 优化渲染性能 */
contain: layout style paint;
/* GPU层合成 */
transform: translateZ(0);
/* 确保没有背景色 */
background: transparent;
}
.is-theme-transitioning #header-waves use {
/* 保持动画连续性 */
will-change: transform;
/* GPU优化 */
transform: translateZ(0);
}
.card-base {
@apply rounded-(--radius-large) overflow-hidden bg-(--card-bg) transition-colors duration-150;
}
.card-base-transparent {
@apply rounded-(--radius-large) overflow-hidden bg-(--card-bg-transparent) transition-colors duration-150;
}
/* 开启边框和阴影效果时的样式 */
.enable-card-border .card-base {
@apply transition-all duration-300 border border-(--line-divider) shadow-xs;
}
.enable-card-border .card-base-transparent {
@apply transition-all duration-300 border border-(--line-divider) shadow-xs;
}
/* 导航栏样式适配 */
.enable-card-border #navbar > div:not(.absolute) {
@apply transition-all duration-300 border shadow-xs;
border-color: var(--line-divider) !important;
}
/* 全屏壁纸模式下的半透明效果 */
.wallpaper-transparent .card-base {
background-color: var(--card-bg-transparent) !important;
}
.wallpaper-transparent #navbar > div {
background-color: var(--card-bg-transparent) !important;
}
.wallpaper-transparent .btn-card {
background-color: var(--card-bg-transparent) !important;
}
h1, h2, h3, h4, h5, h6, p, a, span, li, ul, ol, blockquote, code, pre, table, th, td, strong {
@apply transition-colors duration-150;
}
.card-shadow {
@apply drop-shadow-[0_2px_4px_rgba(0,0,0,0.005)]
}
.link {
@apply transition-colors duration-150 rounded-md p-1 -m-1 expand-animation;
}
.link-lg {
@apply transition-colors duration-150 rounded-md p-1.5 -m-1.5 expand-animation;
}
.float-panel {
@apply top-21 rounded-(--radius-large) overflow-hidden bg-(--card-bg) transition-colors duration-150 shadow-xl border border-black/5 dark:border-white/10
}
.float-panel-closed {
@apply -translate-y-1 opacity-0 pointer-events-none
}
.float-panel-closed * {
@apply pointer-events-none
}
.search-panel mark {
@apply bg-transparent text-(--primary)
}
.btn-card {
@apply transition-colors duration-150 flex items-center justify-center bg-(--card-bg) hover:bg-(--btn-card-bg-hover)
active:bg-(--btn-card-bg-active)
}
.btn-card.disabled {
@apply pointer-events-none text-black/10 dark:text-white/10
}
.btn-plain {
@apply transition-colors duration-150 relative flex items-center justify-center bg-none
text-black/75 hover:text-(--primary) dark:text-white/75 dark:hover:text-(--primary);
&:not(.scale-animation) {
@apply hover:bg-(--btn-plain-bg-hover) active:bg-(--btn-plain-bg-active)
}
&.scale-animation {
@apply expand-animation;
}
}
.current-theme-btn {
@apply bg-(--btn-plain-bg-hover) text-(--primary);
}
.btn-regular {
@apply transition-colors duration-150 flex items-center justify-center bg-(--btn-regular-bg) hover:bg-(--btn-regular-bg-hover) active:bg-(--btn-regular-bg-active)
text-(--btn-content) dark:text-white/75
}
.link-underline {
@apply transition-colors duration-150 underline decoration-2 decoration-dashed decoration-(--link-underline)
hover:decoration-(--link-hover) active:decoration-(--link-active) underline-offset-[0.25rem]
}
.toc-hide,
.toc-not-ready {
@apply opacity-0 pointer-events-none
}
/* #toc-inner-wrapper {
mask-image: linear-gradient(to bottom, transparent 0%, black 2rem, black calc(100% - 2rem), transparent 100%);
} */
.hide-scrollbar {
scrollbar-width: none;
-ms-overflow-style: none;
}
.hide-scrollbar::-webkit-scrollbar {
display: none;
}
.text-90 {
@apply text-black/90 dark:text-white/90
}
.text-75 {
@apply text-black/75 dark:text-white/75
}
.text-50 {
@apply text-black/50 dark:text-white/50
}
.text-30 {
@apply text-black/30 dark:text-white/30
}
.text-25 {
@apply text-black/25 dark:text-white/25
}
/* 下拉菜单样式 */
.dropdown-container {
@apply relative;
}
.dropdown-menu {
@apply absolute top-full left-0 pt-2 opacity-0 invisible pointer-events-none transition-all duration-200 ease-out transform translate-y-[-8px] z-50;
}
.dropdown-container:hover .dropdown-menu,
.dropdown-container:focus-within .dropdown-menu {
@apply opacity-100 visible pointer-events-auto translate-y-0;
}
.dropdown-container:hover .dropdown-arrow,
.dropdown-container:focus-within .dropdown-arrow {
@apply rotate-180;
}
.dropdown-content {
@apply bg-(--card-bg) rounded-(--radius-large) shadow-xl border border-black/5 dark:border-white/10 py-2 min-w-48;
}
.dropdown-item {
@apply flex items-center justify-between px-4 py-2.5 text-black/75 dark:text-white/75 hover:text-(--primary) hover:bg-(--btn-plain-bg-hover) transition-colors duration-150 font-medium;
}
.dropdown-item:first-child {
@apply rounded-t-[calc(var(--radius-large)-0.5rem)];
}
.dropdown-item:last-child {
@apply rounded-b-[calc(var(--radius-large)-0.5rem)];
}
/* 移动端菜单样式 */
.mobile-submenu {
@apply max-h-0 overflow-hidden transition-all duration-300 ease-in-out;
}
.mobile-dropdown[data-expanded="true"] .mobile-submenu {
@apply max-h-96;
}
.mobile-dropdown[data-expanded="true"] .mobile-dropdown-arrow {
@apply rotate-180;
}
/* 响应式隐藏 */
@media (max-width: 768px) {
.dropdown-container {
@apply hidden;
}
}
/* 无障碍支持 */
.dropdown-container:focus-within .dropdown-menu {
@apply opacity-100 visible pointer-events-auto translate-y-0;
}
.dropdown-item:focus {
@apply outline-hidden;
}
.mobile-dropdown button:focus {
@apply outline-hidden;
}
.meta-icon {
@apply w-8 h-8 transition-colors duration-150 rounded-md flex items-center justify-center bg-(--btn-regular-bg)
text-(--btn-content) mr-2
}
.with-divider {
@apply before:content-['/'] before:ml-1.5 before:mr-1.5 before:text-(--meta-divider) before:text-sm
before:font-medium before:first-of-type:hidden before:transition-colors before:duration-150
}
.btn-regular-dark {
@apply flex items-center justify-center
bg-[oklch(0.45_0.01_var(--hue))] hover:bg-[oklch(0.50_0.01_var(--hue))] active:bg-[oklch(0.55_0.01_var(--hue))]
dark:bg-[oklch(0.30_0.02_var(--hue))] dark:hover:bg-[oklch(0.35_0.03_var(--hue))] dark:active:bg-[oklch(0.40_0.03_var(--hue))]
}
.btn-regular-dark.success {
@apply bg-[oklch(0.75_0.14_var(--hue))] dark:bg-[oklch(0.75_0.14_var(--hue))]
}
}
.custom-md img, #post-cover img {
@apply cursor-zoom-in
}
::selection {
background-color: var(--selection-bg)
}
.dash-line {
position: relative;
}
.dash-line::before {
content: "";
position: absolute;
width: 10%;
height: 100%;
left: calc(50% - 1px);
border-left: 2px dashed var(--line-color);
pointer-events: none;
transition: all 0.3s;
transform: translateY(-50%);
}
/*剧透效果*/
.custom-md spoiler {
--_spoiler-mask: var(--primary);
@apply hover:bg-transparent px-1 py-0.5 overflow-hidden rounded-md transition-all duration-150;
background-color: var(--_spoiler-mask);
box-decoration-break: clone;
&:not(:hover) {
color: var(--_spoiler-mask);
* {
color: var(--_spoiler-mask);
}
}
}
/* 浅色模式:使用更浅的主题色且完全不透明 */
:root:not(.dark) .custom-md spoiler {
--_spoiler-mask: color-mix(in oklch, var(--primary) 55%, white 45%);
}
/* 文章列表布局切换样式 */
.post-list-layout-switch {
@apply flex items-center gap-2 mb-6 p-3 bg-(--card-bg) rounded-lg border border-(--line-divider);
}
.post-list-layout-switch span {
@apply text-sm text-(--text-secondary);
}
.post-list-layout-switch .layout-buttons {
@apply flex gap-1;
}
.post-list-layout-switch button {
@apply px-3 py-1.5 text-sm rounded-md transition-colors;
}
.post-list-layout-switch button.active {
@apply bg-(--primary) text-white;
}
.post-list-layout-switch button:not(.active) {
@apply bg-(--bg-secondary) text-(--text-secondary) hover:bg-(--bg-hover);
}
/* 网格模式下的文章卡片样式调整 */
.post-list-container.grid-mode .post-card-item {
@apply w-full;
}
.post-list-container.grid-mode .post-card-item a[href] {
@apply text-xl before:h-4 before:top-[28px] before:left-[-18px] truncate;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.post-list-container.grid-mode .post-card-item a[aria-label] {
@apply hidden;
}
.post-list-container.grid-mode .post-card-item .btn-regular {
@apply hidden;
}
.post-list-container.grid-mode .post-card-item .line-clamp-1 {
@apply line-clamp-2;
}
/* 网格模式下的卡片内容区域调整 */
.post-list-container.grid-mode .post-card-item > div {
@apply p-4;
}
/* 网格模式下的元数据样式调整 */
.post-list-container.grid-mode .post-card-item .post-meta {
@apply mb-2;
}
/* 网格模式下的描述文本调整 */
.post-list-container.grid-mode .post-card-item .description {
@apply text-sm mb-2 line-clamp-2;
}
/* 网格模式下的统计信息调整 */
.post-list-container.grid-mode .post-card-item .stats {
@apply text-xs;
}
/* 响应式分页样式 */
.device-mobile .pagination-info {
@apply text-xs;
}
.device-tablet .pagination-info {
@apply text-sm;
}
.device-desktop .pagination-info {
@apply text-base;
}
/* 分页信息样式 */
.pagination-info {
@apply text-sm text-(--text-secondary) text-center mb-2;
} |