/* ========================================================= * Cascade layer order * * theme * ↓ * base * ↓ * vendor.swiper * ↓ * components * ↓ * utilities * ======================================================= */ @layer theme, base, vendor, components, utilities; @layer vendor.swiper; /* ========================================================= * Framework / vendor imports * * 注意: * @import 必须位于普通 CSS rule 之前。 * Swiper 按需引入,不建议无脑使用 swiper/css/bundle。 * ======================================================= */ @import "tailwindcss"; @import "swiper/css" layer(vendor.swiper); @import "swiper/css/navigation" layer(vendor.swiper); @import "swiper/css/pagination" layer(vendor.swiper); @import 'swiper/css/free-mode' layer(vendor.swiper); @import 'swiper/css/thumbs' layer(vendor.swiper); /* ========================================================= * HeroUI v2 * ======================================================= */ @plugin "../../hero.ts"; @source "../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}"; @custom-variant dark (&:is(.dark *)); @import "../assets/styles/cms-content.css" layer(components); /* ========================================================= * Tailwind theme tokens * * @theme 中的变量会映射到 Tailwind utilities。 * * 例如: * --color-ly-gray * → text-ly-gray * → bg-ly-gray * → border-ly-gray * * --text-ly-16 * → text-ly-16 * * --leading-ly-24 * → leading-ly-24 * ======================================================= */ @theme { /* ---------- Colors ---------- */ --color-ly-inputborder: #e5e5e5; --color-ly-placeholder: #a6a6a6; --color-ly-errorcolor: #ff0000; --color-ly-lightgray: #f9f9f9; --color-ly-middlegray: #f2f2f2; --color-ly-gray: #d3d3d3; --color-ly-deepgray: #acacac; --color-ly-gold: #ffd700; --color-ly-green: #01754a; --color-ly-middlegreen: #036141; --color-ly-deepgreen: #1e3932; /* ---------- Font sizes ---------- */ --text-ly-12: 0.75rem; --text-ly-13: 0.8125rem; --text-ly-14: 0.875rem; --text-ly-16: 1rem; --text-ly-18: 1.125rem; --text-ly-20: 1.25rem; --text-ly-22: 1.375rem; --text-ly-24: 1.5rem; --text-ly-30: 1.875rem; --text-ly-36: 2.25rem; --text-ly-48: 3rem; /* ---------- Line heights ---------- */ --leading-ly-16: 1rem; --leading-ly-18: 1.125rem; --leading-ly-20: 1.25rem; --leading-ly-22: 1.375rem; --leading-ly-24: 1.5rem; --leading-ly-26: 1.625rem; --leading-ly-28: 1.75rem; --leading-ly-36: 2.25rem; } /* ========================================================= * Runtime variables -> Tailwind theme * * inline 用于引用其它 CSS variables。 * * 例如: * * --background * ↓ * --color-background * ↓ * bg-background * * 当 .dark 修改 --background 后, * bg-background 会自动跟随,不需要额外写: * * bg-white dark:bg-background * ======================================================= */ @theme inline { --font-outfit: var(--font-outfit-variable), system-ui, sans-serif; --color-background: var(--background); --color-foreground: var(--foreground); --color-selected-black: var(--selected-black); --color-dark-grey: var(--dark-grey); --color-selected-color: var(--selected-color); --color-selected-color-dark: var(--selected-color-dark); --color-selected-bottom-dark: var(--selected-bottom-dark); --color-selected-bg-bottom-dark: var(--selected-bg-bottom-dark); --color-input-color: var(--input-color); } /* ========================================================= * Base * * 只放: * - 全局 CSS variables * - html/body * - document-level defaults * * 不放具体业务组件样式。 * ======================================================= */ @layer base { :root { /* ---------- Theme ---------- */ --background: #ffffff; --foreground: #000000; --selected-black: rgb(0 0 0 / 60%); --hero-background: #ffffff; --hero-foreground: #000000; --dark-grey: #404040; --selected-color: #e3ecff; --selected-color-dark: #555b69; --selected-bottom-dark: #95b6ff; --selected-bg-bottom-dark: #314779; --input-color: #b3b3b3; } /* ---------- Dark theme ---------- */ .dark { --background: #171717; --foreground: #ffffff; --hero-background: #171717; --hero-foreground: #ffffff; } /* ---------- Document ---------- */ html { /*--font-outfit-variable 是在根layout.tsx中定义的*/ font-family: var(--font-outfit-variable), system-ui, sans-serif; /* * PC 项目推荐保留稳定 scrollbar gutter, * modal / drawer 锁定 body 时减少页面左右跳动。 */ scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #6b7280 transparent; } body { /* * PC 项目: * 保留你原来的最小页面宽度。 * * 如果你的产品实际设计基准是 1024 / 1200, * 可以后续根据设计稿调整。 */ min-width: 768px; background-color: var(--background); color: var(--foreground); } } /* ========================================================= * Components * * 放项目自己的复合样式和第三方组件 overrides。 * * vendor.swiper 在 components 之前,因此这里的 * Swiper override 不需要通过 !important 去抢优先级。 * ======================================================= */ @layer components { /* ======================================================= * Scrollbar * ===================================================== */ .drawer-scrollbar-hidden { scrollbar-width: none; } .drawer-scrollbar-hidden::-webkit-scrollbar { display: none; } /* ======================================================= * Placeholder * * 兼容旧代码。 * * 新代码优先考虑直接使用: * placeholder:text-input-color * dark:placeholder:text-selected-color-dark * ===================================================== */ .placeholder-input-color::placeholder { color: var(--input-color); } .dark .placeholder-selected-color-dark::placeholder { color: var(--selected-color-dark); } /* ======================================================= * Sticky heading * ===================================================== */ .mobile-heading h2 { /* * bg-background 本身已经会跟随 --background, * 不需要: * * bg-white dark:bg-background */ @apply sticky top-0 z-50 bg-background; } /* ======================================================= * Scroll lock * * PC 项目不需要通过 position: fixed + 100vw * 处理 iOS Safari body scroll。 * * scrollbar-gutter: stable 可以减少 scrollbar * 消失造成的页面横向跳动。 * ===================================================== */ .scroll-locked { overflow: hidden !important; } /* ======================================================= * Disabled stroke * ===================================================== */ .strokeline-bg-disabled { background-image: linear-gradient( to bottom right, transparent calc(50% - 1px), #acacac calc(50% - 1px), #acacac calc(50% + 1px), transparent calc(50% + 1px) ); } /* ======================================================= * Input * ===================================================== */ .ly-input { @apply block h-14 w-full box-border border border-ly-inputborder px-4 text-ly-16 leading-4 placeholder:text-ly-placeholder focus:outline-none focus-visible:border-ly-green focus-visible:ring-2 focus-visible:ring-ly-green/20; } /* ======================================================= * Swiper overrides * * Swiper 原始 CSS: * vendor.swiper * * 项目 override: * components * * 所以这里无需 !important。 * ===================================================== */ .addtocartmodal-main-swiper .swiper-pagination-fraction { @apply absolute bottom-4 left-1/2 z-1 flex h-6 w-auto -translate-x-1/2 items-center rounded-xl px-3 text-ly-14 bg-ly-deepgreen/50 text-white; } /* ======================================================= * Image * ===================================================== */ .image-carousel-aspect { aspect-ratio: 1.72; } /* ======================================================= * Animation * ===================================================== */ .fade-in { animation: fade-in 0.3s ease-in-out forwards; } .fade-out { animation: fade-out 0.3s ease-in-out forwards; } .slide-bottom-in { animation: slide-bottom-in 0.3s ease-in-out forwards; } .slide-bottom-out { animation: slide-bottom-out 0.3s ease-in-out forwards; } @keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } } @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes fade-out { from { opacity: 1; } to { opacity: 0; } } @keyframes slide-bottom-in { from { transform: translateY(100%); } to { transform: translateY(0); } } @keyframes slide-bottom-out { from { transform: translateY(0); } to { transform: translateY(100%); } } /* ======================================================= * Project styles * ===================================================== */ .ly-thin-shadow { box-shadow: 0 0 3px rgb(0 0 0 / 10%), 0 1px 2px rgb(0 0 0 / 6%); } .ly-vipplus-bg { background: linear-gradient( 128.05deg, rgb(250 231 200) 0%, rgb(249 255 235) 27.29%, rgb(242 215 172) 64.42%, rgb(232 202 153) 100% ); } /* ======================================================= * Apple Pay * ===================================================== */ apple-pay-button { --apple-pay-button-box-sizing: border-box; --apple-pay-button-width: 300px; --apple-pay-button-height: 48px; --apple-pay-button-border-radius: 24px; --apple-pay-button-padding: 6px 0; display: block; width: 100%; } .middle-image-swiper.swiper-horizontal > .swiper-pagination-progressbar, .middle-image-swiper.swiper-horizontal .swiper-pagination-progressbar.swiper-pagination-horizontal{ bottom: -16px ; top: unset; } }