style.css 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* --- 全局与变量定义 (新拟物风格) --- */
  2. @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');
  3. :root {
  4. /* 色彩方案 - 白天模式 */
  5. --primary-color: #5b86e5;
  6. --background-color: #e0e5ec;
  7. --text-color: #555e67;
  8. --text-muted-color: #9ba1a8;
  9. /* 字体 */
  10. --font-family-sans-serif: 'Inter', sans-serif;
  11. /* 新拟物阴影 */
  12. --neumorph-shadow-light: inset -5px -5px 10px #ffffff, inset 5px 5px 10px #bec3c9;
  13. --neumorph-shadow-dark: -5px -5px 10px #ffffff, 5px 5px 10px #bec3c9;
  14. --neumorph-shadow-dark-active: inset -3px -3px 7px #ffffff, inset 3px 3px 7px #bec3c9;
  15. /* 圆角 */
  16. --border-radius: 20px;
  17. }
  18. body.dark-mode {
  19. /* 色彩方案 - 黑夜模式 */
  20. --primary-color: #6a82fb;
  21. --background-color: #2c2f35;
  22. --text-color: #e2e2e2;
  23. --text-muted-color: #8f9297;
  24. /* 新拟物阴影 - 黑夜模式 */
  25. --neumorph-shadow-light: inset -5px -5px 10px #35393f, inset 5px 5px 10px #232529;
  26. --neumorph-shadow-dark: -5px -5px 10px #35393f, 5px 5px 10px #232529;
  27. --neumorph-shadow-dark-active: inset -3px -3px 7px #35393f, inset 3px 3px 7px #232529;
  28. }
  29. * { margin: 0; padding: 0; box-sizing: border-box; }
  30. body {
  31. font-family: var(--font-family-sans-serif);
  32. background-color: var(--background-color);
  33. color: var(--text-color);
  34. line-height: 1.6;
  35. transition: background-color 0.4s ease, color 0.4s ease;
  36. -webkit-font-smoothing: antialiased;
  37. }
  38. .container { max-width: 980px; margin: 0 auto; padding: 0 20px; }
  39. /* --- 页头与导航 (新拟物风格) --- */
  40. header {
  41. background-color: transparent; /* 背景透明以融入页面 */
  42. padding: 1.5rem 0;
  43. position: sticky; top: 0; z-index: 1000;
  44. }
  45. header .container { display: flex; align-items: center; justify-content: space-between; }
  46. .logo { font-size: 1.8rem; font-weight: 700; color: var(--text-color); text-decoration: none; flex-shrink: 0; }
  47. .main-nav { flex-grow: 1; }
  48. .main-nav ul { list-style: none; display: flex; justify-content: center; }
  49. .main-nav li { margin: 0 5px; }
  50. .main-nav a { text-decoration: none; color: var(--text-muted-color); font-weight: 500; padding: 10px 20px; border-radius: 15px; transition: all 0.3s ease; }
  51. .main-nav a:hover { color: var(--primary-color); }
  52. .main-nav a.active { color: var(--primary-color); font-weight: 700; box-shadow: var(--neumorph-shadow-dark-active); }
  53. .header-controls { display: flex; align-items: center; flex-shrink: 0; gap: 15px; }
  54. /* --- 统一控制按钮样式 --- */
  55. .control-btn {
  56. background: var(--background-color);
  57. border: none;
  58. width: 45px;
  59. height: 45px;
  60. border-radius: 50%;
  61. cursor: pointer;
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. box-shadow: var(--neumorph-shadow-dark);
  66. transition: box-shadow 0.2s ease, color 0.2s ease;
  67. color: var(--text-muted-color);
  68. }
  69. .control-btn:hover { color: var(--primary-color); }
  70. .control-btn:active, .control-btn.active { box-shadow: var(--neumorph-shadow-dark-active); }
  71. #theme-switcher { font-size: 1.2rem; }
  72. .hamburger { padding-top: 2px; } /* 微调汉堡图标位置 */
  73. /* --- 轮播图 (新拟物风格) --- */
  74. .carousel { position: relative; width: 100%; margin: 2rem 0 3rem; border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--neumorph-shadow-dark); }
  75. .carousel-inner { position: relative; width: 100%; aspect-ratio: 16 / 7; }
  76. .carousel-item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; transition: opacity 0.7s ease-in-out; }
  77. .carousel-item.active { opacity: 1; visibility: visible; z-index: 2; }
  78. .carousel-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
  79. .carousel-control { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; opacity: 0.8; }
  80. .carousel-control.prev { left: 15px; }
  81. .carousel-control.next { right: 15px; }
  82. /* --- 主体内容 (新拟物风格) --- */
  83. main { padding: 2rem 0; }
  84. h1 { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; color: var(--text-color); }
  85. .article-list { display: grid; gap: 2.5rem; }
  86. .article-card { background-color: var(--background-color); border-radius: var(--border-radius); padding: 2.5rem; box-shadow: var(--neumorph-shadow-dark); transition: box-shadow 0.3s ease; }
  87. .article-card:hover { box-shadow: var(--neumorph-shadow-dark-active); }
  88. .article-card h2 { font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--text-color); }
  89. .article-card .meta { font-size: 0.9rem; color: var(--text-muted-color); margin-bottom: 1rem; }
  90. .article-card p { margin-bottom: 1.5rem; }
  91. /* --- 按钮与表单 (新拟物风格) --- */
  92. .btn { display: inline-block; background-color: var(--primary-color); color: #fff; padding: 14px 28px; border-radius: 15px; text-decoration: none; font-weight: 500; border: none; cursor: pointer; transition: all 0.2s ease; box-shadow: -3px -3px 7px rgba(255,255,255,0.1), 3px 3px 7px rgba(0,0,0,0.2); }
  93. .btn:hover { filter: brightness(1.1); }
  94. .btn:active { transform: scale(0.98); box-shadow: inset -3px -3px 7px rgba(255,255,255,0.1), inset 3px 3px 7px rgba(0,0,0,0.2); }
  95. /* --- 联系我页面 - 社交链接样式 --- */
  96. .social-links-container {
  97. display: flex;
  98. justify-content: center;
  99. align-items: center;
  100. flex-wrap: wrap; /* 在小屏幕上自动换行 */
  101. gap: 2.5rem; /* 链接之间的间距 */
  102. margin-top: 4rem; /* 与标题的间距 */
  103. text-align: center;
  104. }
  105. .social-link-card {
  106. display: flex;
  107. flex-direction: column; /* 图标和文字垂直排列 */
  108. align-items: center;
  109. justify-content: center;
  110. width: 150px;
  111. height: 150px;
  112. text-decoration: none;
  113. background-color: var(--background-color);
  114. border-radius: var(--border-radius);
  115. box-shadow: var(--neumorph-shadow-dark);
  116. transition: all 0.3s ease;
  117. color: var(--text-color); /* 统一卡片文字颜色 */
  118. }
  119. .social-link-card:hover {
  120. transform: translateY(-10px); /* 悬停时向上浮动 */
  121. box-shadow: var(--neumorph-shadow-dark-active);
  122. color: var(--primary-color);
  123. }
  124. .social-icon {
  125. font-size: 3rem; /* 图标大小 */
  126. margin-bottom: 1rem; /* 图标和文字的间距 */
  127. color: var(--primary-color);
  128. transition: color 0.3s ease;
  129. }
  130. .social-link-card:hover .social-icon {
  131. color: inherit; /* 继承父元素 a 的颜色 */
  132. }
  133. .social-text {
  134. font-size: 1rem;
  135. font-weight: 500;
  136. transition: color 0.3s ease;
  137. color: inherit; /* 继承父元素 a 的颜色 */
  138. }
  139. /* --- 页脚 --- */
  140. footer { text-align: center; padding: 3rem 0; margin-top: 3rem; color: var(--text-muted-color); font-size: 0.9rem; }
  141. footer p { margin: 0.5rem 0; }
  142. /* --- 响应式设计 --- */
  143. .hamburger span { display: block; width: 22px; height: 2px; background-color: var(--text-muted-color); margin: 5px 0; transition: all 0.3s ease-in-out; border-radius: 2px; }
  144. @media (max-width: 768px) {
  145. .main-nav { display: none; position: fixed; top: 0; left: -100%; width: 280px; height: 100%; background-color: var(--background-color); transition: left 0.4s ease; z-index: 1000; box-shadow: 10px 0 20px -5px rgba(0,0,0,0.1); }
  146. .main-nav.active { left: 0; }
  147. .main-nav ul { flex-direction: column; align-items: flex-start; padding: 80px 30px; }
  148. .main-nav li { margin: 15px 0; width: 100%; }
  149. .main-nav a { font-size: 1.2rem; }
  150. .hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  151. .hamburger.active span:nth-child(2) { opacity: 0; }
  152. .hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  153. .header-controls { position: relative; z-index: 1001; }
  154. }