navbar.css 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* resources/css/layout/navbar.css
  2. 顶部导航栏:面包屑 bar + desktop 导航链接 + mobile 汉堡按钮。
  3. 来源:main.css 的 .anthology-breadcrumb-bar、.bc-nav、.bc-hamburger 段落。
  4. 以 wiki.css 中同名规则为准(main.css 无冲突,wiki.css 中无同名规则,直接迁移)。
  5. */
  6. /* ── Breadcrumb bar ── */
  7. .anthology-breadcrumb-bar {
  8. background: rgba(255, 255, 255, 0.55);
  9. border-bottom: 1px solid var(--wp-border);
  10. padding: 0.5rem 0;
  11. }
  12. .anthology-breadcrumb-bar .bc-inner {
  13. display: flex;
  14. align-items: center;
  15. justify-content: space-between;
  16. gap: 1rem;
  17. }
  18. .anthology-breadcrumb-bar .breadcrumb {
  19. margin: 0;
  20. font-size: 0.78rem;
  21. flex-shrink: 0;
  22. }
  23. .anthology-breadcrumb-bar .breadcrumb-item a {
  24. color: var(--wp-brand);
  25. text-decoration: none;
  26. }
  27. .anthology-breadcrumb-bar .breadcrumb-item.active {
  28. color: var(--wp-ink-muted);
  29. }
  30. .anthology-breadcrumb-bar .breadcrumb-item + .breadcrumb-item::before {
  31. color: var(--wp-ink-muted);
  32. }
  33. /* ── 站点 logo(回 wikipali 首页) ── */
  34. .anthology-breadcrumb-bar .bc-logo {
  35. display: inline-flex;
  36. align-items: center;
  37. flex-shrink: 0;
  38. }
  39. .anthology-breadcrumb-bar .bc-logo__img {
  40. display: block;
  41. height: 40px;
  42. width: auto;
  43. }
  44. /* 默认浅色导航栏用深色字版;hero 上的白字版在下面「Hero 覆盖状态」里切换 */
  45. .anthology-breadcrumb-bar .bc-logo__img--light {
  46. display: none;
  47. }
  48. /* logo 之后的面包屑紧贴 logo,不被 space-between 推到中间 */
  49. .anthology-breadcrumb-bar .bc-logo + .breadcrumb {
  50. margin-right: auto;
  51. }
  52. /* ── Hero 覆盖状态:breadcrumb bar 透明悬浮于 hero 之上 ── */
  53. .hero-wrapper:has(.hero-section) .anthology-breadcrumb-bar {
  54. position: absolute;
  55. top: 0;
  56. left: 0;
  57. right: 0;
  58. z-index: 10;
  59. background: transparent;
  60. border-bottom: none;
  61. }
  62. .hero-wrapper:has(.hero-section) .bc-logo__img--dark {
  63. display: none;
  64. }
  65. .hero-wrapper:has(.hero-section) .bc-logo__img--light {
  66. display: block;
  67. }
  68. .hero-wrapper:has(.hero-section) .bc-nav li a {
  69. color: white;
  70. }
  71. .hero-wrapper:has(.hero-section) .bc-nav li a:hover {
  72. color: rgba(255, 255, 255, 0.75);
  73. }
  74. .hero-wrapper:has(.hero-section) .bc-hamburger {
  75. border-color: rgba(255, 255, 255, 0.6);
  76. color: white;
  77. }
  78. /* ── Desktop 导航链接 ── */
  79. .bc-nav {
  80. display: flex;
  81. align-items: center;
  82. gap: 1.25rem;
  83. list-style: none;
  84. margin: 0;
  85. padding: 0;
  86. flex-shrink: 0;
  87. }
  88. .bc-nav li a {
  89. font-size: 0.82rem;
  90. color: var(--wp-ink-soft);
  91. text-decoration: none;
  92. white-space: nowrap;
  93. transition: color 0.15s;
  94. }
  95. .bc-nav li a:hover {
  96. color: var(--wp-brand);
  97. }
  98. .bc-nav li a.active {
  99. color: var(--wp-brand);
  100. font-weight: 600;
  101. }
  102. /* ── 汉堡按钮(mobile) ── */
  103. .bc-hamburger {
  104. display: none;
  105. background: none;
  106. border: 1px solid var(--wp-border);
  107. border-radius: 5px;
  108. padding: 4px 8px;
  109. cursor: pointer;
  110. color: var(--wp-ink-soft);
  111. line-height: 1;
  112. }
  113. .bc-hamburger:hover {
  114. border-color: var(--wp-brand);
  115. color: var(--wp-brand);
  116. }
  117. /* ── 响应式 ── */
  118. @media (max-width: 640px) {
  119. .bc-nav {
  120. display: none;
  121. }
  122. .bc-hamburger {
  123. display: inline-flex;
  124. align-items: center;
  125. }
  126. }
  127. /* 窄屏:面包屑可收缩、超出截断,保证 logo 与右侧菜单按钮都在屏内 */
  128. @media (max-width: 768px) {
  129. .anthology-breadcrumb-bar .bc-logo + .breadcrumb {
  130. flex-shrink: 1;
  131. flex-wrap: nowrap;
  132. min-width: 0;
  133. overflow: hidden;
  134. white-space: nowrap;
  135. }
  136. /* 各项本身不压缩,只在末尾截掉,避免分隔符和文字挤在一起 */
  137. .anthology-breadcrumb-bar .bc-logo + .breadcrumb .breadcrumb-item {
  138. flex-shrink: 0;
  139. }
  140. .anthology-breadcrumb-bar .bc-logo__img {
  141. height: 32px;
  142. }
  143. }