/* ==========================================================================
   site.css —— 全站共用样式（首页 / 目录页 / 内页）
   ========================================================================== */

/* ============================ 主题变量 ============================ */
:root {
  --bg: #fbfbfd;
  --glow-1: rgba(99, 102, 241, .12);
  --glow-2: rgba(236, 72, 153, .07);
  --card: #ffffff;
  --card-2: #f7f8fb;
  --border: #ebecf0;
  --border-strong: #dcdee6;
  --text: #10131c;
  --text-2: #4b5265;
  --muted: #8a90a2;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef0ff;
  --doc: #b45309;
  --doc-soft: #fef4e2;
  --ring: rgba(79, 70, 229, .28);
  --shadow: 0 1px 2px rgba(16, 19, 28, .04), 0 10px 30px -18px rgba(16, 19, 28, .28);
  --shadow-hover: 0 2px 8px rgba(16, 19, 28, .06), 0 22px 44px -22px rgba(79, 70, 229, .45);
  --maxw: 920px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0f;
    --glow-1: rgba(129, 140, 248, .16);
    --glow-2: rgba(244, 114, 182, .08);
    --card: #13151c;
    --card-2: #191c25;
    --border: #23262f;
    --border-strong: #2f333f;
    --text: #eceef3;
    --text-2: #b3b9c7;
    --muted: #868da0;
    --accent: #a5b4fc;
    --accent-2: #c4b5fd;
    --accent-soft: #1b1f2e;
    --doc: #fbbf24;
    --doc-soft: rgba(251, 191, 36, .13);
    --ring: rgba(165, 180, 252, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(0, 0, 0, .7);
    --shadow-hover: 0 2px 8px rgba(0, 0, 0, .45), 0 22px 44px -22px rgba(129, 140, 248, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b0f;
  --glow-1: rgba(129, 140, 248, .16);
  --glow-2: rgba(244, 114, 182, .08);
  --card: #13151c;
  --card-2: #191c25;
  --border: #23262f;
  --border-strong: #2f333f;
  --text: #eceef3;
  --text-2: #b3b9c7;
  --muted: #868da0;
  --accent: #a5b4fc;
  --accent-2: #c4b5fd;
  --accent-soft: #1b1f2e;
  --doc: #fbbf24;
  --doc-soft: rgba(251, 191, 36, .13);
  --ring: rgba(165, 180, 252, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(0, 0, 0, .7);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, .45), 0 22px 44px -22px rgba(129, 140, 248, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  padding: 78px 20px 56px;
  background:
    radial-gradient(820px 460px at 8% -14%, var(--glow-1), transparent 68%),
    radial-gradient(700px 420px at 96% 4%, var(--glow-2), transparent 66%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}

.wrap { max-width: var(--maxw); margin: 0 auto; }
.wrap--narrow { --maxw: 700px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
p { margin-bottom: 14px; color: var(--text-2); }

/* ============================ 顶部 ============================ */
.hero { margin-bottom: 34px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--accent);
  text-transform: uppercase;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  margin-bottom: 18px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero h1 {
  font-size: clamp(30px, 5.6vw, 42px);
  font-weight: 650;
  letter-spacing: -.032em;
  line-height: 1.18;
  margin-bottom: 12px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .sub { color: var(--text-2); font-size: 15.5px; max-width: 46ch; margin-bottom: 0; }

/* ============================ 分类导航条 ============================ */
.chips {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  margin: 0 0 30px;
  background: linear-gradient(var(--bg) 72%, transparent);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-theme="dark"] .chip.is-active { color: #0a0b0f; }
.chip .n {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: .62;
}
.chip.is-active .n { opacity: .8; }

/* ============================ 分类区块 ============================ */
.cat { margin-bottom: 44px; scroll-margin-top: 64px; }
.cat-head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.cat-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 19px;
  line-height: 1;
}
.cat-head h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.018em;
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-head h2 .en {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
}
.cat-head .desc { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.cat-count {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  padding-top: 4px;
}

/* ============================ 品牌分组 ============================ */
.brand { margin-bottom: 22px; }
.brand:last-child { margin-bottom: 0; }
.brand-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 11px;
}
.brand-head h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
}
.brand-head .en {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-head .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.brand-head .n {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 空品牌占位（品牌已建但还没内容） */
.brand-empty {
  padding: 15px 17px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--card-2);
}
.brand-empty code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ============================ 卡片 ============================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 13px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .22s ease, transform .22s ease, box-shadow .22s ease;
  animation: rise .5s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .25s ease;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.card:hover::before { opacity: .55; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head .icon {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 17px;
  line-height: 1;
  transition: transform .22s ease;
}
.card:hover .icon { transform: scale(1.08) rotate(-4deg); }
.card-head .arrow {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .22s ease, transform .22s ease;
}
.card:hover .arrow { opacity: 1; transform: translateX(0); }

.card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.012em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.card p { font-size: 12.5px; color: var(--muted); line-height: 1.62; margin: 0; }

/* ============================ 标签 ============================ */
.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
}
.tag--doc { background: var(--doc-soft); color: var(--doc); }

/* ============================ 列表视图（works.html） ============================ */
.list-cat { margin-bottom: 40px; }
.item {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 17px 18px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
a.item:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.item h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.item p { font-size: 13px; color: var(--muted); margin: 0; }
.item-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .04em;
}

/* 搜索框 */
.search { margin-bottom: 26px; }
.search input {
  width: 100%;
  padding: 11px 15px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.no-hit {
  padding: 26px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--card-2);
}

/* ============================ 内页排版（home / about） ============================ */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  text-decoration: none;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  transition: color .2s ease, border-color .2s ease;
}
.back:hover { color: var(--accent); border-color: var(--accent); }

.page-title {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 650;
  letter-spacing: -.028em;
  line-height: 1.22;
  margin-bottom: 10px;
}
.lead { font-size: 15.5px; color: var(--text-2); margin-bottom: 36px; max-width: 48ch; }
h2.sec {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 40px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
h2.sec::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
ul { padding-left: 20px; margin-bottom: 14px; }
li { margin-bottom: 6px; color: var(--text-2); }

/* ============================ 页脚 ============================ */
footer.site-foot {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  letter-spacing: .02em;
}
footer.site-foot a { color: var(--text-2); text-decoration: none; }
footer.site-foot a:hover { color: var(--accent); }

/* ============================ 主题切换 ============================ */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
  z-index: 30;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.07); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ============================ 响应式 ============================ */
@media (max-width: 620px) {
  body { padding: 62px 15px 40px; }
  .hero { margin-bottom: 22px; }
  .hero .sub { font-size: 14.5px; }
  .cat-head { gap: 11px; }
  .cat-icon { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
  .cat-head h2 { font-size: 17px; }
  .cat-head .desc { font-size: 12px; }
  /* 手机上两列，卡片收紧 */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 13px 12px; border-radius: 14px; }
  .card-head { margin-bottom: 10px; }
  .card-head .icon { width: 30px; height: 30px; font-size: 14px; border-radius: 9px; }
  .card-head .arrow { display: none; }
  .card h3 { font-size: 13.5px; gap: 5px; }
  .card p {
    font-size: 11.5px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .tag { font-size: 9px; padding: 1px 5px; }
  .theme-toggle { top: 12px; right: 12px; }
  footer.site-foot { flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
