home.css 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /* resources/css/home.css
  2. WikiPāli 首页(next.wikipali.org)样式入口。
  3. 只服务于首页:品牌 hero + 四张通栏分流卡片。
  4. 平面、哑光、克制,无渐变 / 发光 / 阴影 / 圆角卡片。
  5. */
  6. /* 1. Tabler(Bootstrap 5 底座)+ Tabler Icons */
  7. @import '@tabler/core/dist/css/tabler.min.css';
  8. @import '@tabler/icons-webfont/dist/tabler-icons.min.css';
  9. /* 2. 设计令牌 */
  10. :root {
  11. --home-bg: #F6F1E7;
  12. --home-text: #2B2318;
  13. --home-text-secondary: #63594A;
  14. --home-text-muted: #6F6555;
  15. --home-border-muted: #B6AB98;
  16. --home-cta-hover-text: #F6F1E7;
  17. --home-hero-tint: #8A6A3C;
  18. }
  19. /* 3. 页面底色 */
  20. .home-page {
  21. margin: 0;
  22. background: var(--home-bg);
  23. color: var(--home-text);
  24. }
  25. .home-page .page {
  26. background: var(--home-bg);
  27. }
  28. /* 4. 品牌 Hero */
  29. .home-hero {
  30. display: flex;
  31. flex-direction: column;
  32. align-items: center;
  33. justify-content: center;
  34. text-align: center;
  35. height: 44vh;
  36. min-height: 280px;
  37. padding: 2rem 1.5rem;
  38. background: color-mix(in srgb, var(--home-hero-tint) 16%, var(--home-bg));
  39. }
  40. .home-hero__title {
  41. margin: 0 0 .75rem;
  42. color: var(--home-text);
  43. font-size: clamp(2rem, 5vw, 3.5rem);
  44. font-weight: 500;
  45. line-height: 1.2;
  46. letter-spacing: .02em;
  47. }
  48. .home-hero__lead {
  49. margin: 0;
  50. color: var(--home-text-secondary);
  51. font-size: clamp(.95rem, 1.6vw, 1.125rem);
  52. line-height: 1.5;
  53. }
  54. /* 5. 通栏卡片 */
  55. .home-card {
  56. position: relative;
  57. display: flex;
  58. align-items: center;
  59. height: 40vh;
  60. min-height: 320px;
  61. max-height: 480px;
  62. overflow: hidden;
  63. color: var(--home-text);
  64. }
  65. /* 末卡(二次开发)高度略矮 */
  66. #card-development {
  67. height: 36vh;
  68. min-height: 280px;
  69. max-height: none;
  70. }
  71. /* 底图:通栏满铺 */
  72. .home-card__media-wrap {
  73. position: absolute;
  74. inset: 0;
  75. display: block;
  76. margin: 0;
  77. padding: 0;
  78. }
  79. .home-card__media {
  80. display: block;
  81. width: 100%;
  82. height: 100%;
  83. object-fit: cover;
  84. }
  85. /* 文字在左 → 图的视觉重心在右;文字在右 → 视觉重心在左 */
  86. .home-card--start .home-card__media {
  87. object-position: 70% center;
  88. }
  89. .home-card--end .home-card__media {
  90. object-position: 30% center;
  91. }
  92. /* 蒙版:保证文字对比度 ≥ 4.5:1 */
  93. .home-card__veil {
  94. position: absolute;
  95. inset: 0;
  96. background: color-mix(in srgb, var(--card-tint) 16%, rgba(246, 241, 231, .8));
  97. }
  98. /* 文字块:垂直居中,横向贴边 */
  99. .home-card__body {
  100. position: relative;
  101. z-index: 1;
  102. display: flex;
  103. align-items: center;
  104. width: 100%;
  105. padding: 2rem clamp(1.5rem, 6vw, 5rem);
  106. }
  107. .home-card--start .home-card__body {
  108. justify-content: flex-start;
  109. padding-left: calc(clamp(1.5rem, 6vw, 5rem) + 300px);
  110. }
  111. .home-card--end .home-card__body {
  112. justify-content: flex-end;
  113. padding-right: calc(clamp(1.5rem, 6vw, 5rem) + 300px);
  114. }
  115. .home-card__text {
  116. width: 100%;
  117. max-width: 26rem;
  118. }
  119. .home-card--start .home-card__text {
  120. text-align: left;
  121. }
  122. .home-card--end .home-card__text {
  123. text-align: right;
  124. }
  125. .home-card__eyebrow {
  126. margin: 0 0 .5rem;
  127. color: var(--home-text-muted);
  128. font-size: 12px;
  129. letter-spacing: .22em;
  130. text-transform: uppercase;
  131. }
  132. .home-card__title {
  133. margin: 0 0 .75rem;
  134. color: var(--home-text);
  135. font-size: clamp(1.5rem, 3.2vw, 2.5rem);
  136. font-weight: 500;
  137. line-height: 1.3;
  138. }
  139. .home-card__lead {
  140. margin: 0 0 1.5rem;
  141. color: var(--home-text-secondary);
  142. font-size: clamp(.9rem, 1.4vw, 1.0625rem);
  143. line-height: 1.5;
  144. }
  145. /* CTA / 状态角标:胶囊形 */
  146. .home-card__cta,
  147. .home-card__badge {
  148. display: inline-flex;
  149. align-items: center;
  150. gap: .5rem;
  151. border-radius: 999px;
  152. padding: .55rem 1.25rem;
  153. font-size: 14px;
  154. line-height: 1;
  155. }
  156. .home-card__cta {
  157. border: 1px solid var(--home-text);
  158. color: var(--home-text);
  159. text-decoration: none;
  160. transition: background-color .2s ease, color .2s ease;
  161. }
  162. .home-card__cta:hover,
  163. .home-card__cta:focus {
  164. background: var(--home-text);
  165. color: var(--home-cta-hover-text);
  166. text-decoration: none;
  167. }
  168. .home-card__cta:focus-visible {
  169. outline: 2px solid var(--home-text);
  170. outline-offset: 3px;
  171. }
  172. .home-card__badge {
  173. border: 1px solid var(--home-border-muted);
  174. color: var(--home-text-muted);
  175. }
  176. /* 6. 响应式:768–991px(高度不变,文字块收窄) */
  177. @media (max-width: 991.98px) {
  178. .home-card__text {
  179. max-width: 20rem;
  180. }
  181. }
  182. /* 7. 响应式:<768px(全部左对齐,换移动端高度,蒙版加深) */
  183. @media (max-width: 767.98px) {
  184. .home-hero {
  185. height: 40vh;
  186. min-height: 240px;
  187. }
  188. .home-card {
  189. height: 52vh;
  190. min-height: 300px;
  191. max-height: none;
  192. }
  193. #card-development {
  194. height: 46vh;
  195. min-height: 260px;
  196. }
  197. .home-card__body {
  198. justify-content: flex-start;
  199. padding: 2rem 1.5rem;
  200. }
  201. .home-card--start .home-card__body,
  202. .home-card--end .home-card__body {
  203. padding-left: 1.5rem;
  204. padding-right: 1.5rem;
  205. }
  206. .home-card__text {
  207. max-width: 100%;
  208. text-align: left;
  209. }
  210. .home-card__media {
  211. object-position: 75% center;
  212. }
  213. .home-card__veil {
  214. background: color-mix(in srgb, var(--card-tint) 20%, rgba(246, 241, 231, .88));
  215. }
  216. .home-card__eyebrow {
  217. font-size: 11px;
  218. }
  219. }
  220. /* 8. 尊重减少动态偏好:关闭过渡 */
  221. @media (prefers-reduced-motion: reduce) {
  222. .home-card__cta {
  223. transition: none;
  224. }
  225. }