globals.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /* =========================================================
  2. * Cascade layer order
  3. *
  4. * theme
  5. * ↓
  6. * base
  7. * ↓
  8. * vendor.swiper
  9. * ↓
  10. * components
  11. * ↓
  12. * utilities
  13. * ======================================================= */
  14. @layer theme, base, vendor, components, utilities;
  15. @layer vendor.swiper;
  16. /* =========================================================
  17. * Framework / vendor imports
  18. *
  19. * 注意:
  20. * @import 必须位于普通 CSS rule 之前。
  21. * Swiper 按需引入,不建议无脑使用 swiper/css/bundle。
  22. * ======================================================= */
  23. @import "tailwindcss";
  24. @import "swiper/css" layer(vendor.swiper);
  25. @import "swiper/css/navigation" layer(vendor.swiper);
  26. @import "swiper/css/pagination" layer(vendor.swiper);
  27. @import 'swiper/css/free-mode' layer(vendor.swiper);
  28. @import 'swiper/css/thumbs' layer(vendor.swiper);
  29. /* =========================================================
  30. * HeroUI v2
  31. * ======================================================= */
  32. @plugin "../../hero.ts";
  33. @source "../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}";
  34. @custom-variant dark (&:is(.dark *));
  35. @import "../assets/styles/cms-content.css" layer(components);
  36. /* =========================================================
  37. * Tailwind theme tokens
  38. *
  39. * @theme 中的变量会映射到 Tailwind utilities。
  40. *
  41. * 例如:
  42. * --color-ly-gray
  43. * → text-ly-gray
  44. * → bg-ly-gray
  45. * → border-ly-gray
  46. *
  47. * --text-ly-16
  48. * → text-ly-16
  49. *
  50. * --leading-ly-24
  51. * → leading-ly-24
  52. * ======================================================= */
  53. @theme {
  54. /* ---------- Colors ---------- */
  55. --color-ly-inputborder: #e5e5e5;
  56. --color-ly-placeholder: #a6a6a6;
  57. --color-ly-errorcolor: #ff0000;
  58. --color-ly-lightgray: #f9f9f9;
  59. --color-ly-middlegray: #f2f2f2;
  60. --color-ly-gray: #d3d3d3;
  61. --color-ly-deepgray: #acacac;
  62. --color-ly-gold: #ffd700;
  63. --color-ly-green: #01754a;
  64. --color-ly-middlegreen: #036141;
  65. --color-ly-deepgreen: #1e3932;
  66. /* ---------- Font sizes ---------- */
  67. --text-ly-12: 0.75rem;
  68. --text-ly-13: 0.8125rem;
  69. --text-ly-14: 0.875rem;
  70. --text-ly-16: 1rem;
  71. --text-ly-18: 1.125rem;
  72. --text-ly-20: 1.25rem;
  73. --text-ly-22: 1.375rem;
  74. --text-ly-24: 1.5rem;
  75. --text-ly-30: 1.875rem;
  76. --text-ly-36: 2.25rem;
  77. --text-ly-48: 3rem;
  78. /* ---------- Line heights ---------- */
  79. --leading-ly-16: 1rem;
  80. --leading-ly-18: 1.125rem;
  81. --leading-ly-20: 1.25rem;
  82. --leading-ly-22: 1.375rem;
  83. --leading-ly-24: 1.5rem;
  84. --leading-ly-26: 1.625rem;
  85. --leading-ly-28: 1.75rem;
  86. --leading-ly-36: 2.25rem;
  87. }
  88. /* =========================================================
  89. * Runtime variables -> Tailwind theme
  90. *
  91. * inline 用于引用其它 CSS variables。
  92. *
  93. * 例如:
  94. *
  95. * --background
  96. * ↓
  97. * --color-background
  98. * ↓
  99. * bg-background
  100. *
  101. * 当 .dark 修改 --background 后,
  102. * bg-background 会自动跟随,不需要额外写:
  103. *
  104. * bg-white dark:bg-background
  105. * ======================================================= */
  106. @theme inline {
  107. --font-outfit:
  108. var(--font-outfit-variable),
  109. system-ui,
  110. sans-serif;
  111. --color-background: var(--background);
  112. --color-foreground: var(--foreground);
  113. --color-selected-black: var(--selected-black);
  114. --color-dark-grey: var(--dark-grey);
  115. --color-selected-color: var(--selected-color);
  116. --color-selected-color-dark: var(--selected-color-dark);
  117. --color-selected-bottom-dark: var(--selected-bottom-dark);
  118. --color-selected-bg-bottom-dark: var(--selected-bg-bottom-dark);
  119. --color-input-color: var(--input-color);
  120. }
  121. /* =========================================================
  122. * Base
  123. *
  124. * 只放:
  125. * - 全局 CSS variables
  126. * - html/body
  127. * - document-level defaults
  128. *
  129. * 不放具体业务组件样式。
  130. * ======================================================= */
  131. @layer base {
  132. :root {
  133. /* ---------- Theme ---------- */
  134. --background: #ffffff;
  135. --foreground: #000000;
  136. --selected-black: rgb(0 0 0 / 60%);
  137. --hero-background: #ffffff;
  138. --hero-foreground: #000000;
  139. --dark-grey: #404040;
  140. --selected-color: #e3ecff;
  141. --selected-color-dark: #555b69;
  142. --selected-bottom-dark: #95b6ff;
  143. --selected-bg-bottom-dark: #314779;
  144. --input-color: #b3b3b3;
  145. }
  146. /* ---------- Dark theme ---------- */
  147. .dark {
  148. --background: #171717;
  149. --foreground: #ffffff;
  150. --hero-background: #171717;
  151. --hero-foreground: #ffffff;
  152. }
  153. /* ---------- Document ---------- */
  154. html {
  155. /*--font-outfit-variable 是在根layout.tsx中定义的*/
  156. font-family:
  157. var(--font-outfit-variable),
  158. system-ui,
  159. sans-serif;
  160. /*
  161. * PC 项目推荐保留稳定 scrollbar gutter,
  162. * modal / drawer 锁定 body 时减少页面左右跳动。
  163. */
  164. scrollbar-gutter: stable;
  165. scrollbar-width: thin;
  166. scrollbar-color: #6b7280 transparent;
  167. }
  168. body {
  169. /*
  170. * PC 项目:
  171. * 保留你原来的最小页面宽度。
  172. *
  173. * 如果你的产品实际设计基准是 1024 / 1200,
  174. * 可以后续根据设计稿调整。
  175. */
  176. min-width: 768px;
  177. background-color: var(--background);
  178. color: var(--foreground);
  179. }
  180. }
  181. /* =========================================================
  182. * Components
  183. *
  184. * 放项目自己的复合样式和第三方组件 overrides。
  185. *
  186. * vendor.swiper 在 components 之前,因此这里的
  187. * Swiper override 不需要通过 !important 去抢优先级。
  188. * ======================================================= */
  189. @layer components {
  190. /* =======================================================
  191. * Scrollbar
  192. * ===================================================== */
  193. .drawer-scrollbar-hidden {
  194. scrollbar-width: none;
  195. }
  196. .drawer-scrollbar-hidden::-webkit-scrollbar {
  197. display: none;
  198. }
  199. /* =======================================================
  200. * Placeholder
  201. *
  202. * 兼容旧代码。
  203. *
  204. * 新代码优先考虑直接使用:
  205. * placeholder:text-input-color
  206. * dark:placeholder:text-selected-color-dark
  207. * ===================================================== */
  208. .placeholder-input-color::placeholder {
  209. color: var(--input-color);
  210. }
  211. .dark .placeholder-selected-color-dark::placeholder {
  212. color: var(--selected-color-dark);
  213. }
  214. /* =======================================================
  215. * Sticky heading
  216. * ===================================================== */
  217. .mobile-heading h2 {
  218. /*
  219. * bg-background 本身已经会跟随 --background,
  220. * 不需要:
  221. *
  222. * bg-white dark:bg-background
  223. */
  224. @apply sticky top-0 z-50 bg-background;
  225. }
  226. /* =======================================================
  227. * Scroll lock
  228. *
  229. * PC 项目不需要通过 position: fixed + 100vw
  230. * 处理 iOS Safari body scroll。
  231. *
  232. * scrollbar-gutter: stable 可以减少 scrollbar
  233. * 消失造成的页面横向跳动。
  234. * ===================================================== */
  235. .scroll-locked {
  236. overflow: hidden !important;
  237. }
  238. /* =======================================================
  239. * Disabled stroke
  240. * ===================================================== */
  241. .strokeline-bg-disabled {
  242. background-image:
  243. linear-gradient(
  244. to bottom right,
  245. transparent calc(50% - 1px),
  246. #acacac calc(50% - 1px),
  247. #acacac calc(50% + 1px),
  248. transparent calc(50% + 1px)
  249. );
  250. }
  251. /* =======================================================
  252. * Input
  253. * ===================================================== */
  254. .ly-input {
  255. @apply
  256. block
  257. h-14
  258. w-full
  259. box-border
  260. border
  261. border-ly-inputborder
  262. px-4
  263. text-ly-16
  264. leading-4
  265. placeholder:text-ly-placeholder
  266. focus:outline-none
  267. focus-visible:border-ly-green
  268. focus-visible:ring-2
  269. focus-visible:ring-ly-green/20;
  270. }
  271. /* =======================================================
  272. * Swiper overrides
  273. *
  274. * Swiper 原始 CSS:
  275. * vendor.swiper
  276. *
  277. * 项目 override:
  278. * components
  279. *
  280. * 所以这里无需 !important。
  281. * ===================================================== */
  282. .addtocartmodal-main-swiper .swiper-pagination-fraction {
  283. @apply
  284. absolute
  285. bottom-4
  286. left-1/2
  287. z-1
  288. flex
  289. h-6
  290. w-auto
  291. -translate-x-1/2
  292. items-center
  293. rounded-xl
  294. px-3
  295. text-ly-14
  296. bg-ly-deepgreen/50
  297. text-white;
  298. }
  299. /* =======================================================
  300. * Image
  301. * ===================================================== */
  302. .image-carousel-aspect {
  303. aspect-ratio: 1.72;
  304. }
  305. /* =======================================================
  306. * Animation
  307. * ===================================================== */
  308. .fade-in {
  309. animation: fade-in 0.3s ease-in-out forwards;
  310. }
  311. .fade-out {
  312. animation: fade-out 0.3s ease-in-out forwards;
  313. }
  314. .slide-bottom-in {
  315. animation: slide-bottom-in 0.3s ease-in-out forwards;
  316. }
  317. .slide-bottom-out {
  318. animation: slide-bottom-out 0.3s ease-in-out forwards;
  319. }
  320. @keyframes shimmer {
  321. from {
  322. transform: translateX(-100%);
  323. }
  324. to {
  325. transform: translateX(100%);
  326. }
  327. }
  328. @keyframes fade-in {
  329. from {
  330. opacity: 0;
  331. }
  332. to {
  333. opacity: 1;
  334. }
  335. }
  336. @keyframes fade-out {
  337. from {
  338. opacity: 1;
  339. }
  340. to {
  341. opacity: 0;
  342. }
  343. }
  344. @keyframes slide-bottom-in {
  345. from {
  346. transform: translateY(100%);
  347. }
  348. to {
  349. transform: translateY(0);
  350. }
  351. }
  352. @keyframes slide-bottom-out {
  353. from {
  354. transform: translateY(0);
  355. }
  356. to {
  357. transform: translateY(100%);
  358. }
  359. }
  360. /* =======================================================
  361. * Project styles
  362. * ===================================================== */
  363. .ly-thin-shadow {
  364. box-shadow:
  365. 0 0 3px rgb(0 0 0 / 10%),
  366. 0 1px 2px rgb(0 0 0 / 6%);
  367. }
  368. .ly-vipplus-bg {
  369. background:
  370. linear-gradient(
  371. 128.05deg,
  372. rgb(250 231 200) 0%,
  373. rgb(249 255 235) 27.29%,
  374. rgb(242 215 172) 64.42%,
  375. rgb(232 202 153) 100%
  376. );
  377. }
  378. /* =======================================================
  379. * Apple Pay
  380. * ===================================================== */
  381. apple-pay-button {
  382. --apple-pay-button-box-sizing: border-box;
  383. --apple-pay-button-width: 300px;
  384. --apple-pay-button-height: 48px;
  385. --apple-pay-button-border-radius: 24px;
  386. --apple-pay-button-padding: 6px 0;
  387. display: block;
  388. width: 100%;
  389. }
  390. .middle-image-swiper.swiper-horizontal > .swiper-pagination-progressbar,
  391. .middle-image-swiper.swiper-horizontal .swiper-pagination-progressbar.swiper-pagination-horizontal{
  392. bottom: -16px ;
  393. top: unset;
  394. }
  395. }