/* shangpinka.com — 商品卡 · 抖音商品卡 × TikTok Shop 商品卡
   v2：动效增强版（入场动画 / 悬停交互 / 滚动显现 / 阅读进度）
   所有动效在 prefers-reduced-motion 下自动关闭；JS 只是增强，内容始终可读。 */
:root {
  --bg: #ffffff;
  --card: #fafafa;
  --text: #1f2328;
  --muted: #59636e;
  --border: #e4e7eb;
  --accent: #e5304e;
  --accent-2: #ff7a45;
  --accent-dark: #c22743;
  --accent-soft: #fdeef1;
  --tt: #25b8c4;
  --code: #f3f4f6;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 26px -10px rgba(15, 23, 42, .16);
  --ease: cubic-bezier(.22, .61, .36, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --card: #171a21;
    --text: #e6e8eb;
    --muted: #9aa4b2;
    --border: #2a2f3a;
    --accent: #ff5c76;
    --accent-2: #ffa06e;
    --accent-dark: #ff7c92;
    --accent-soft: #2a1620;
    --tt: #3ec9d6;
    --code: #1c2029;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
    --shadow-md: 0 10px 26px -10px rgba(0, 0, 0, .55);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.75;
  font-size: 16px;
  overflow-x: clip;
}
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 页面载入 ---------- */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  main { animation: pageIn .45s var(--ease) both; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s var(--ease), background .3s var(--ease);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
@keyframes headerIn {
  from { transform: translateY(-100%); }
  to   { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .site-header { animation: headerIn .5s var(--ease) both; }
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); letter-spacing: .5px; }
.logo span { color: var(--accent); display: inline-block; }
.logo:hover { text-decoration: none; }
@media (prefers-reduced-motion: no-preference) {
  .logo:hover span { animation: bump .45s var(--ease); }
}
@keyframes bump {
  0% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a {
  position: relative;
  color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: .95rem;
  transition: color .2s var(--ease);
}
.site-header nav a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 1px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left center;
  transition: transform .28s var(--ease);
}
.site-header nav a:hover { color: var(--text); text-decoration: none; }
.site-header nav a:hover::after,
.site-header nav a.active::after { transform: scaleX(1); }
.site-header nav a.active { color: var(--accent); font-weight: 600; }

/* ---------- hero / home ---------- */
.hero { padding: 48px 0 24px; position: relative; }
/* 背景光斑装饰 */
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(64px); pointer-events: none; z-index: -1;
}
.hero::before {
  width: 340px; height: 340px; top: -90px; right: -70px;
  background: var(--accent); opacity: .22;
  animation: float 9s ease-in-out infinite;
}
.hero::after {
  width: 260px; height: 260px; bottom: -110px; left: -50px;
  background: var(--tt); opacity: .14;
  animation: float 13s ease-in-out infinite reverse;
}
@media (prefers-color-scheme: dark) {
  .hero::before { opacity: .13; }
  .hero::after { opacity: .10; }
}
@media (max-width: 720px) {
  .hero::before, .hero::after { display: none; }
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-16px, 18px) scale(1.07); }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: riseIn .55s var(--ease) both; }
  .hero > :nth-child(2) { animation-delay: .08s; }
  .hero > :nth-child(3) { animation-delay: .16s; }
  .hero > :nth-child(4) { animation-delay: .24s; }
}
.hero h1 { font-size: 2rem; line-height: 1.35; margin: 0 0 12px; }
/* 标题关键词渐变流光 */
.grad {
  background: linear-gradient(92deg, var(--accent) 0%, var(--accent-2) 50%, var(--tt) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .grad { animation: gradShift 5.5s ease-in-out infinite alternate; }
}
@keyframes gradShift {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}
.hero .sub { color: var(--muted); font-size: 1.05rem; max-width: 46rem; margin: 0 0 20px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  position: relative; overflow: hidden;
  display: inline-block; padding: 10px 18px; border-radius: 10px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  background-size: 160% 160%; background-position: 0% 0%;
  color: #fff;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-position .45s var(--ease);
}
.btn:hover {
  transform: translateY(-2px);
  background-position: 100% 100%;
  box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--accent) 60%, transparent);
  color: #fff; text-decoration: none;
}
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost {
  background: transparent; color: var(--accent-dark);
  border: 1px solid var(--accent); box-shadow: none;
}
.btn.ghost:hover { background: var(--accent-soft); box-shadow: none; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 8px; }
.pill {
  display: inline-block; border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 12px; font-size: .85rem; color: var(--muted); background: var(--card);
  transition: transform .22s var(--ease), border-color .22s, color .22s, box-shadow .22s;
}
.pill:hover {
  color: var(--accent-dark); border-color: var(--accent); text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px -5px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- 滚动显现（由 js/main.js 标记 data-reveal，渐进增强） ---------- */
[data-reveal]:not(.in) { opacity: 0; transform: translateY(18px); }
[data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  transition-delay: var(--rd, 0ms);
}

/* ---------- sections & cards ---------- */
.section { padding: 28px 0; }
.section > h2 { font-size: 1.4rem; margin: 0 0 6px; position: relative; padding-left: 14px; }
.section > h2::before {
  content: ""; position: absolute; left: 0; top: .32em; bottom: .32em; width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.section > .lead { color: var(--muted); margin: 0 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
  position: relative; overflow: hidden;
  display: block; border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; background: var(--card);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
/* 鼠标光斑（坐标由 JS 写入 --mx / --my） */
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  opacity: 0; transition: opacity .3s var(--ease);
}
/* 掠过高光 */
.card::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-18deg); pointer-events: none;
  transition: left .55s var(--ease);
}
.card:hover {
  text-decoration: none;
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: var(--shadow-md),
    0 14px 32px -14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.card:hover::before { opacity: 1; }
.card:hover::after { left: 125%; }
.card:active { transform: translateY(-2px) scale(.995); }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--text); transition: color .25s var(--ease); }
.card:hover h3 { color: var(--accent-dark); }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .tag {
  display: inline-block; font-size: .75rem; color: var(--accent-dark);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; margin-bottom: 8px;
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.card:hover .tag { background: var(--accent); color: #fff; transform: translateY(-1px); }
.duo { border-left: 4px solid var(--accent); }
.duo-tt { border-left: 4px solid var(--tt); }

/* ---------- breadcrumb ---------- */
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: .85rem; color: var(--muted); margin: 18px 0 4px;
}
.breadcrumb a { color: var(--muted); transition: color .2s var(--ease); }
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb em { font-style: normal; color: var(--text); }

/* ---------- article ---------- */
article.prose { max-width: 46rem; padding-bottom: 8px; }
article.prose h1 { font-size: 1.7rem; line-height: 1.4; margin: 10px 0 6px; }
.page-meta { color: var(--muted); font-size: .85rem; margin: 0 0 24px; }
article.prose h2 { font-size: 1.35rem; margin: 2.2em 0 .7em; line-height: 1.4; }
article.prose h3 { font-size: 1.12rem; margin: 1.8em 0 .5em; }
article.prose p, article.prose ul, article.prose ol { margin: .7em 0; }
article.prose ul, article.prose ol { padding-left: 1.4em; }
article.prose li { margin: .35em 0; }
article.prose li::marker { color: var(--accent); }
article.prose strong { color: var(--text); }
article.prose img { max-width: 100%; border-radius: 10px; }
article.prose code {
  background: var(--code); border-radius: 6px; padding: 1px 6px; font-size: .9em;
}
blockquote {
  margin: 1em 0; padding: 2px 16px; color: var(--muted);
  border-left: 3px solid var(--border);
}
.callout {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 16px; margin: 1.2em 0; font-size: .95rem;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.callout:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }
.callout p { margin: .4em 0; }

/* tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .93rem; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: var(--card); font-weight: 600; }
tbody tr { transition: background .2s var(--ease); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* FAQ 手风琴（Chrome 131+ 平滑展开；其他浏览器瞬时展开，同样可用） */
html { interpolate-size: allow-keywords; }
details {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin: 10px 0; background: var(--card);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
details:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
details summary {
  font-weight: 600; cursor: pointer; list-style: none; position: relative;
  padding-right: 26px; transition: color .25s var(--ease);
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+"; position: absolute; right: 2px; top: -1px;
  color: var(--accent); font-weight: 700; font-size: 1.1em; line-height: inherit;
  transition: transform .3s var(--ease);
}
details[open] summary { color: var(--accent-dark); }
details[open] summary::after { transform: rotate(45deg); }
details::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size .35s var(--ease), content-visibility .35s allow-discrete;
}
details[open]::details-content { block-size: auto; }
details > div { margin-top: 8px; color: var(--text); }

/* related */
.related { border-top: 1px dashed var(--border); margin-top: 36px; padding-top: 8px; }
.related h2 { font-size: 1.15rem; }
.related ul { list-style: none; padding: 0; margin: 8px 0; }
.related li { margin: 6px 0; }
.related a { display: inline-block; transition: transform .22s var(--ease), color .22s var(--ease); }
.related a:hover { transform: translateX(4px); }
.src { font-size: .82rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 64px; border-top: 1px solid var(--border);
  padding: 28px 0 40px; color: var(--muted); font-size: .88rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0; }
.site-footer a { color: var(--muted); transition: color .2s var(--ease); }
.site-footer a:hover { color: var(--accent-dark); }

/* ---------- 阅读进度条 & 回到顶部（由 js/main.js 注入） ---------- */
.read-progress {
  position: fixed; top: 0; left: 0; z-index: 60;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--tt));
  transform: scaleX(0); transform-origin: 0 50%;
  pointer-events: none;
}
.to-top {
  position: fixed; right: 20px; bottom: 26px; z-index: 55;
  width: 42px; height: 42px; border: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 1.15rem; font-weight: 700; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent);
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); box-shadow: 0 12px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent); }

/* ---------- error page ---------- */
.error-box { text-align: center; padding: 80px 0; }
.error-box h1 { font-size: 3rem; margin: 0; color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .error-box h1 { animation: pop .6s var(--ease) both; }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(.6); }
  60% { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 8px; border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }

/* ---------- reduced motion：全部动效关闭 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  [data-reveal]:not(.in) { opacity: 1 !important; transform: none !important; }
}

/* ---------- 顶部工具（搜索 + 汉堡菜单） ---------- */
.header-tools { display: flex; align-items: center; gap: 4px; }
.nav-search-btn {
  width: 34px; height: 34px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-search-btn:hover { background: var(--card); color: var(--accent); }
.nav-search-btn:active { transform: scale(.92); }
.menu-btn {
  display: none; width: 34px; height: 34px; border: none; border-radius: 8px;
  background: transparent; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.menu-btn span {
  width: 17px; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.site-header.nav-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-header.nav-open .menu-btn span:nth-child(2) { opacity: 0; }
.site-header.nav-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@keyframes navDrop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 880px) {
  .menu-btn { display: inline-flex; }
  .site-header nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 10px 20px 14px; box-shadow: var(--shadow-md);
  }
  .site-header.nav-open nav { display: flex; animation: navDrop .25s var(--ease); }
  .site-header nav a { padding: 10px 12px; font-size: 1rem; }
  .site-header nav a::after { display: none; }
}

/* ---------- 站内搜索面板 ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.search-overlay.open { opacity: 1; pointer-events: auto; }
.search-panel {
  max-width: 580px; margin: 12vh auto 0; background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: translateY(-12px) scale(.98); opacity: 0;
  transition: transform .28s var(--ease), opacity .28s var(--ease);
}
.search-overlay.open .search-panel { transform: none; opacity: 1; }
.search-box {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); color: var(--muted);
}
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  color: var(--text); font-size: 1rem; font-family: inherit;
}
.search-close {
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
  font-size: .72rem; font-family: inherit; padding: 3px 8px; border-radius: 6px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.search-close:hover { color: var(--accent); border-color: var(--accent); }
.search-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.search-result {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--text);
  transition: background .18s var(--ease);
}
.search-result:hover { background: var(--card); text-decoration: none; }
.search-result .sr-cat {
  display: inline-block; font-size: .72rem; color: var(--accent-dark); background: var(--accent-soft);
  border-radius: 5px; padding: 0 6px; margin-right: 8px; vertical-align: 1px;
}
.search-result .sr-title { font-weight: 600; font-size: .95rem; }
.search-result .sr-desc { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.search-empty { padding: 26px 16px; color: var(--muted); font-size: .9rem; text-align: center; line-height: 1.9; }
.search-foot {
  border-top: 1px solid var(--border); padding: 8px 14px; font-size: .78rem; color: var(--muted);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
body.search-open { overflow: hidden; }

/* ---------- 外链卡片角标 / 锚点偏移 ---------- */
.card .ext-mark {
  display: inline-block; margin-top: 10px; font-size: .8rem; color: var(--accent-dark);
  transition: transform .25s var(--ease);
}
.card:hover .ext-mark { transform: translate(3px, -2px); }
section[id] { scroll-margin-top: 72px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.55rem; }
  article.prose h1 { font-size: 1.45rem; }
  .header-inner { height: auto; padding: 8px 0; }
  .to-top { right: 14px; bottom: 18px; }
  .search-panel { margin: 8vh 14px 0; }
}
