@layer properties, theme, base, components, utilities, tgx;

/* 直接改 tailwind 半径变量（.rounded-2xl 用 --ui-radius-lg !important） */
:root, :host {
  --ui-radius-lg: 14px !important;
}
/* 阴影变量：tailwind .shadow 也可能走变量 */
:root, :host {
  --ui-shadow: 0 2px 12px rgba(109,40,217,0.09);
  --ui-shadow-lg: 0 8px 28px rgba(109,40,217,0.13);
}
@layer tgx {
/* ===== Kaquik × TGX 1:1 质感复刻 2026-10-02 ===== */
/* TGX design tokens 注入 */
:root, :host {
  --tgx-bg: #F2F0F8;
  --tgx-surface: #FFFFFF;
  --tgx-s2: #EDE9F6;
  --tgx-s3: #f8f9fe;
  --tgx-s4: #faf8ff;
  --tgx-s5: #f5f3ff;
  --tgx-purple: #6D28D9;
  --tgx-p2: #8B5CF6;
  --tgx-pink: #DB2777;
  --tgx-blue: #2563EB;
  --tgx-green: #059669;
  --tgx-text: #170F2E;
  --tgx-text2: #4C3D6E;
  --tgx-text3: #9485B8;
  --tgx-border: #DDD6EF;
  --tgx-border2: #e2dcf2;
  --tgx-grad: linear-gradient(120deg, #DB2777 0%, #6D28D9 55%, #2563EB 100%);
  --tgx-grad-hero: linear-gradient(160deg, #ece8ff 0%, #e0dbff 30%, #f0edff 60%, #f8f6ff 100%);
  --tgx-grad-section: linear-gradient(180deg, #ffffff 0%, #faf8ff 50%, #ffffff 100%);
  --tgx-shadow: 0 2px 12px rgba(109,40,217,0.09);
  --tgx-shadow-lg: 0 8px 28px rgba(109,40,217,0.13);
  --tgx-shadow-btn: 0 2px 10px rgba(109,40,217,0.22);
  --tgx-footer-bg: #1a1635;
  --tgx-radius: 14px;
  --tgx-radius-sm: 10px;
}
/* 1) 全局底色：Apple 白 → TGX 淡紫 */
html { background: var(--tgx-bg); }
body, .bg-background { background: var(--tgx-bg) !important; color: var(--tgx-text); }
/* 2) 导航：毛玻璃白卡 + 紫阴影（TGX header） */
nav.fixed.top-0 {
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--tgx-border) !important;
  box-shadow: 0 2px 10px rgba(109,40,217,0.06);
  height: 60px; padding-top: 0 !important; padding-bottom: 0 !important;
  display: flex; align-items: center;
}
.theme-wordmark-text {
  background: var(--tgx-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em;
}
/* 导航激活态：紫底白字（TGX nav a.active） */
nav a.\!text-primary, nav a.router-link-active {
  background: var(--tgx-purple) !important; color: #fff !important;
  border-radius: 8px;
}
nav a:hover { color: var(--tgx-purple) !important; }
/* 3) hero：TGX 渐变横幅 */
main section:first-of-type { position: relative; }
.theme-section-heading {
  background: var(--tgx-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800 !important; letter-spacing: -0.01em;
}
/* 4) 商品卡：TGX product-card 质感 */
#featured .grid > div, main .grid.grid-cols-2 > div {
  background: var(--tgx-surface);
  border: 1px solid var(--tgx-border) !important;
  border-radius: var(--tgx-radius) !important;
  box-shadow: var(--tgx-shadow);
  overflow: hidden;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
#featured .grid > div:hover, main .grid.grid-cols-2 > div:hover {
  box-shadow: var(--tgx-shadow-lg) !important;
  border-color: var(--tgx-p2) !important;
  transform: translateY(-4px);
}
/* 卡片图占位底色 */
.aspect-\\[4\\/3\\] { background: var(--tgx-s2); }
/* 价格：TGX 粉紫 */
.theme-price-lg, .text-lg.font-bold, .font-bold.text-foreground { color: var(--tgx-purple) !important; }
/* 5) badge：TGX 风格 */
.border-success\\/30.bg-success\\/10 { background: #e8f7ee !important; color: var(--tgx-green) !important; border-color: #b7e4c7 !important; }
/* 6) footer：TGX 深紫页脚 */
footer, .bg-card\\/90.text-muted-foreground {
  background: var(--tgx-footer-bg) !important;
  color: rgba(255,255,255,0.72) !important;
  border-top: none !important;
}
footer a, footer .text-muted-foreground { color: rgba(255,255,255,0.72) !important; }
footer h1, footer h2, footer h3, footer h4 { color: #fff !important; }
/* 7) 移动底栏 */
.fixed.bottom-0.bg-card\\/90 { background: rgba(255,255,255,0.95) !important; border-top: 1px solid var(--tgx-border) !important; }
/* 8) 按钮主色 */
button.bg-primary, .bg-primary { background: var(--tgx-grad) !important; color: #fff !important; border: none !important; box-shadow: var(--tgx-shadow-btn); }
button.bg-primary:hover { filter: brightness(1.06); }
/* 9) 分类条/标签 */
.bg-primary\\/10 { background: var(--tgx-s5) !important; }
/* 10) hero 背景渐变（如果有 theme banner 区） */
.theme-overlay { background: var(--tgx-grad-hero); }

/* 补丁：卡片圆角/阴影、footer、按钮 */

/* tailwind v4 utilities @layer 带 !important 时，unlayered !important 平级后比 specificity；
   用更高 specificity + !important 稳赢 */
:where(#featured) .grid > div.border.bg-card {
  border-radius: 14px !important;
}
#featured div.grid > div[class*=rounded] {
  border-radius: 14px !important;
  box-shadow: 0 2px 12px rgba(109,40,217,0.09) !important;
}
#featured div.grid > div[class*=rounded]:hover {
  box-shadow: 0 8px 28px rgba(109,40,217,0.13) !important;
}

footer { background: #1a1635 !important; color: rgba(255,255,255,0.72) !important; border-top: none !important; }
footer * { border-color: rgba(255,255,255,0.12) !important; }
footer a, footer span, footer p, footer div, footer h1, footer h2, footer h3, footer h4, footer li { color: rgba(255,255,255,0.72) !important; }
footer a:hover { color: #fff !important; }
/* hero 区加 TGX 渐变底 */
main > section:first-child { background: linear-gradient(180deg, #ece8ff 0%, #f8f6ff 100%); }
/* 商品卡标题悬停紫 */
#featured h3 { transition: color .2s; }
#featured .grid > div:hover h3 { color: #6D28D9; }

}

/* 紫影注入 --tw-shadow 变量（.shadow/.shadow-lg 组合值全走它） */
#featured .grid > div, main .grid.grid-cols-2 > div {
  --tw-shadow: 0 2px 12px rgba(109,40,217,0.13) !important;
}
#featured .grid > div:hover, main .grid.grid-cols-2 > div:hover {
  --tw-shadow: 0 8px 28px rgba(109,40,217,0.20) !important;
  border-color: #8B5CF6 !important;
}

/* 修正：卡片入场动画带黑影 → 用 TGX 紫影版本替换 keyframe */
@keyframes theme-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
#featured .grid > div, main .grid.grid-cols-2 > div {
  animation: theme-slide-up .25s ease-out both;
}

/* dujiao shadow token 直接换 TGX 紫影 */
:root, :host {
  --ui-shadow-1: 0 2px 12px rgba(109,40,217,0.10) !important;
  --ui-shadow-2: 0 2px 12px rgba(109,40,217,0.13) !important;
  --ui-shadow-3: 0 8px 28px rgba(109,40,217,0.18) !important;
}
