/* ==========================================================================
   智教知识库 · 站点样式
   设计要点：清爽留白 / 专业中性色 + 主题色 / 弹性响应式 / 活泼但克制的动效
   零依赖：无外网字体、无 CDN、无 JS 框架
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */

:root {
  --bg: #f5f7fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #f1f4fa;
  --text: #101828;
  --text-dim: #57627a;
  --text-faint: #8a94aa;
  --border: #e6eaf3;
  --border-strong: #d2d9e8;

  --accent: #4c6ef5;
  --accent-2: #7c4dff;
  --accent-ink: #3a56d8;
  --accent-soft: #eef1ff;
  --accent-glow: rgba(76, 110, 245, .18);

  --mark-bg: #ffe08a;
  --mark-text: #4a3400;
  --warn-bg: #fff7e8;
  --warn-border: #f3cb8d;
  --dispute-bg: #fdeef1;
  --dispute-border: #f0a3b0;

  --t: var(--accent); /* 当前主题色（由 data-topic 覆盖） */

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-2: 0 2px 6px rgba(16, 24, 40, .05), 0 14px 36px rgba(16, 24, 40, .08);
  --shadow-3: 0 10px 26px rgba(16, 24, 40, .10), 0 30px 70px rgba(16, 24, 40, .12);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.42, .64, 1);

  --wrap: 1200px;
  --measure: 74ch;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC",
    "WenQuanYi Micro Hei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

/* 主题色（六个知识主题） */
[data-topic="课件资源"] { --t: #4c6ef5; }
[data-topic="AI使用方法"] { --t: #0d9e9e; }
[data-topic="开源项目"] { --t: #7c4dff; }
[data-topic="自研项目"] { --t: #e8820c; }
[data-topic="学习资源"] { --t: #12a76a; }
[data-topic="育儿方法"] { --t: #e2569a; }

/* ---------- 2. 暗色模式 ---------- */

html[data-theme="dark"],
html[data-theme="dark"] body {
  --bg: #0a0e17;
  --bg-2: #0f1420;
  --surface: #141a27;
  --surface-2: #19202f;
  --surface-3: #1f2738;
  --text: #e8edf7;
  --text-dim: #a3aec4;
  --text-faint: #77839b;
  --border: #232c3f;
  --border-strong: #33405a;

  --accent: #7d97ff;
  --accent-2: #a78bfa;
  --accent-ink: #a5b8ff;
  --accent-soft: #1a2244;
  --accent-glow: rgba(125, 151, 255, .22);

  --mark-bg: #7a5f14;
  --mark-text: #ffeab5;
  --warn-bg: #2b2413;
  --warn-border: #7d6025;
  --dispute-bg: #2e1a1f;
  --dispute-border: #7d3644;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .34);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .42);
  --shadow-3: 0 12px 30px rgba(0, 0, 0, .55), 0 34px 80px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0a0e17;
    --bg-2: #0f1420;
    --surface: #141a27;
    --surface-2: #19202f;
    --surface-3: #1f2738;
    --text: #e8edf7;
    --text-dim: #a3aec4;
    --text-faint: #77839b;
    --border: #232c3f;
    --border-strong: #33405a;
    --accent: #7d97ff;
    --accent-2: #a78bfa;
    --accent-ink: #a5b8ff;
    --accent-soft: #1a2244;
    --accent-glow: rgba(125, 151, 255, .22);
    --mark-bg: #7a5f14;
    --mark-text: #ffeab5;
    --warn-bg: #2b2413;
    --warn-border: #7d6025;
    --dispute-bg: #2e1a1f;
    --dispute-border: #7d3644;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .34);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .42);
    --shadow-3: 0 12px 30px rgba(0, 0, 0, .55), 0 34px 80px rgba(0, 0, 0, .5);
  }
}

/* ---------- 3. 基础 ---------- */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

::selection { background: var(--accent-glow); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px 88px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 24px 88px; }

/* 滚动揭示动画 */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* 跳转链接 */
.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 12px 12px;
  font-size: 14px;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 0; text-decoration: none; }

/* ---------- 4. 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 6px 24px rgba(16, 24, 40, .06);
}

.read-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: transparent;
  overflow: hidden;
}
.read-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width .12s linear;
}

.site-header .bar {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text);
  letter-spacing: .01em;
  flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px var(--accent-glow);
  transition: transform .45s var(--spring), box-shadow .3s var(--ease);
}
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); box-shadow: 0 10px 22px var(--accent-glow); }
.brand .logo svg { width: 19px; height: 19px; display: block; }
.brand .brand-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: .04em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative;
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: transform .3s var(--spring), border-color .25s var(--ease),
              color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn .ic-light { display: none; }
html[data-theme="dark"] .icon-btn .ic-light { display: block; }
html[data-theme="dark"] .icon-btn .ic-dark { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .icon-btn .ic-light { display: block; }
  html:not([data-theme="light"]) .icon-btn .ic-dark { display: none; }
}
.icon-btn .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  line-height: 1.6;
}

/* ---------- 5. 首页 Hero ---------- */

.hero {
  position: relative;
  padding: 60px 0 20px;
  text-align: center;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -120px 0 auto 0;
  height: 420px;
  z-index: -1;
  background:
    radial-gradient(640px 300px at 18% 40%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(560px 280px at 82% 30%, color-mix(in srgb, var(--accent-2) 15%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg-2), transparent);
  pointer-events: none;
}
.hero .orbs { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.hero .orb {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .5;
  animation: orb-drift 16s var(--ease) infinite;
}
.hero .orb.a { background: color-mix(in srgb, var(--accent) 55%, transparent); top: 6%; left: 6%; }
.hero .orb.b { background: color-mix(in srgb, var(--accent-2) 50%, transparent); top: 16%; right: 8%; animation-delay: -5s; }
.hero .orb.c { background: color-mix(in srgb, #12a76a 40%, transparent); bottom: 4%; left: 38%; animation-delay: -9s; }
@keyframes orb-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(26px, -30px, 0) scale(1.12); }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  animation: pulse-dot 2.4s var(--ease) infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  margin: 0 0 12px;
  line-height: 1.18;
  letter-spacing: -.02em;
  font-weight: 800;
  background: linear-gradient(115deg, var(--text) 18%, var(--accent) 62%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .tagline {
  color: var(--text-dim);
  margin: 0 auto 30px;
  font-size: clamp(14.5px, 1.6vw, 16.5px);
  max-width: 640px;
  line-height: 1.8;
}

/* 搜索框 */
.search-box {
  position: relative;
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 6px 6px 44px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-2);
  transform: translateY(-1px);
}
.search-box .search-icon {
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-faint);
  pointer-events: none;
  transition: color .25s var(--ease);
}
.search-box:focus-within .search-icon { color: var(--accent); }
.search-box input[type="search"],
.search-box input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 9px 2px;
  font-size: 15.5px;
  font-family: inherit;
  color: var(--text);
  background: none;
  border: none;
  outline: none;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box button {
  padding: 9px 22px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--accent-glow);
  transition: transform .3s var(--spring), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.search-box button:hover { transform: translateY(-2px); box-shadow: 0 10px 22px var(--accent-glow); }
.search-box button:active { transform: translateY(0) scale(.97); }

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
}
.quick-tags .qt-label { color: var(--text-faint); }
.quick-tags a {
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  transition: all .25s var(--ease);
}
.quick-tags a:hover {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  text-decoration: none;
}

.search-hint { color: var(--text-faint); font-size: 13px; margin: 14px 0 0; }
.search-hint code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
}

/* 首页实时建议下拉 */
.suggest {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  padding: 6px;
  z-index: 40;
  text-align: left;
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--spring);
  max-height: 60vh;
  overflow-y: auto;
}
.suggest.open { opacity: 1; transform: none; pointer-events: auto; }
.suggest .sg-item {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.suggest .sg-item:hover, .suggest .sg-item.active {
  background: var(--surface-3);
  text-decoration: none;
  transform: translateX(3px);
}
.suggest .sg-item .sg-title { font-size: 14.5px; font-weight: 600; }
.suggest .sg-item .sg-meta { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.suggest .sg-empty { padding: 14px 12px; color: var(--text-faint); font-size: 13.5px; text-align: center; }

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 760px;
  margin: 34px auto 6px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-1);
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
}
.stat .num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .lbl { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* ---------- 6. 区块与卡片 ---------- */

.section { margin-top: 56px; }
.section > h2 {
  font-size: clamp(18px, 2.4vw, 21px);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -.01em;
}
.section > h2::before {
  content: "";
  width: 4px; height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.section > h2 .h2-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 9px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}
.topic-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  color: var(--text);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform .4s var(--spring), box-shadow .35s var(--ease), border-color .3s var(--ease);
}
.topic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--t), transparent);
  opacity: .85;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease);
}
.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--t) 34%, var(--border));
  text-decoration: none;
}
.topic-card:hover::before { transform: scaleX(1); }
.topic-card .t-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--t);
  background: color-mix(in srgb, var(--t) 12%, transparent);
  margin-bottom: 12px;
  transition: transform .45s var(--spring), background .3s var(--ease);
}
.topic-card:hover .t-icon { transform: translateY(-2px) rotate(-6deg) scale(1.06); }
.topic-card .t-icon svg { width: 21px; height: 21px; }
.topic-card .t-name {
  font-weight: 700;
  font-size: 16.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topic-card .t-count {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 9px;
}
.topic-card .t-desc {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 7px;
  line-height: 1.7;
}
.topic-card .t-arrow {
  position: absolute;
  right: 18px; bottom: 14px;
  color: var(--t);
  font-size: 17px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .3s var(--ease), transform .4s var(--spring);
}
.topic-card:hover .t-arrow { opacity: 1; transform: none; }

/* 文章列表 */
.article-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.article-list li { border-bottom: none; }
.a-item { position: relative; }
.a-item > .a-title, .a-item > a { display: block; }
.article-list .a-title {
  font-weight: 650;
  font-size: 16px;
  color: var(--text);
  transition: color .25s var(--ease);
}
.article-list .a-summary {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.7;
}
.article-list .a-meta {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 7px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.a-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 15px 20px;
  color: var(--text);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.a-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--t);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .3s var(--ease), transform .35s var(--spring);
}
.a-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--t) 30%, var(--border));
  text-decoration: none;
}
.a-card:hover::before { opacity: 1; transform: none; }
.a-card:hover .a-title { color: var(--t); }
.a-card .a-title { font-weight: 650; font-size: 16.5px; }
.a-card > span { display: block; }
.a-card .a-summary { color: var(--text-dim); font-size: 14px; margin-top: 5px; line-height: 1.72; }
.a-card .a-meta {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 9px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* 标签 chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--t) 12%, transparent);
  color: var(--t);
  border: 1px solid color-mix(in srgb, var(--t) 20%, transparent);
}
.chip::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

/* ---------- 7. 文章页 ---------- */

.article-head { padding: 40px 0 10px; }
.article-head h1 {
  font-size: clamp(25px, 3.6vw, 34px);
  margin: 10px 0 0;
  line-height: 1.3;
  letter-spacing: -.015em;
  font-weight: 800;
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-dim); transition: color .2s var(--ease); }
.breadcrumb a:hover { color: var(--accent-ink); }
.breadcrumb .sep { opacity: .45; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 40px;
  align-items: start;
}
.article-layout.no-aside { grid-template-columns: minmax(0, 1fr); }
.article-main { min-width: 0; }

.article-aside { position: sticky; top: 88px; }
.article-aside:empty { display: none; }

.meta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 18px;
  margin: 22px 0 26px;
  font-size: 14px;
  box-shadow: var(--shadow-1);
}
.meta-row {
  display: flex;
  gap: 14px;
  padding: 11px 0;
  align-items: baseline;
}
.meta-row + .meta-row { border-top: 1px dashed var(--border); }
.meta-key {
  flex: 0 0 74px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.meta-val { color: var(--text-dim); min-width: 0; word-break: break-word; flex: 1; }
.meta-val a {
  display: inline-block;
  margin-right: 10px;
  padding: 1px 9px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-dim);
  transition: all .22s var(--ease);
}
.meta-val a:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  text-decoration: none;
  transform: translateY(-1px);
}

/* 目录 */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 26px;
  font-size: 14px;
  box-shadow: var(--shadow-1);
}
.article-aside .toc { margin: 0; }
.toc summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .02em;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before {
  content: "";
  width: 0; height: 0;
  border-left: 5px solid var(--text-faint);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .3s var(--ease);
}
.toc[open] summary::before { transform: rotate(90deg); }
.toc ul {
  margin: 10px 0 4px;
  padding-left: 4px;
  list-style: none;
  counter-reset: toc;
}
.toc li { margin: 3px 0; }
.toc a {
  display: block;
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  line-height: 1.6;
  transition: all .22s var(--ease);
}
.toc a:hover { color: var(--accent-ink); background: var(--surface-3); text-decoration: none; }
.toc a.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* 正文 */
.article-body {
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--text);
  max-width: var(--measure);
  overflow-wrap: break-word;
}
.article-body > *:first-child { margin-top: 0; }
.article-body h2 {
  font-size: 21px;
  margin: 44px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.01em;
  scroll-margin-top: 90px;
}
.article-body h3 {
  font-size: 17.5px;
  margin: 30px 0 10px;
  scroll-margin-top: 90px;
}
.article-body h4 { font-size: 16px; margin: 24px 0 8px; color: var(--text-dim); }
.article-body p { margin: 14px 0; }
.article-body ul, .article-body ol { padding-left: 26px; margin: 14px 0; }
.article-body li { margin: 7px 0; }
.article-body li::marker { color: var(--text-faint); }
.article-body li > ul, .article-body li > ol { margin: 5px 0; }
.article-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color .2s var(--ease), text-decoration-color .2s var(--ease);
}
.article-body a:hover { text-decoration-color: var(--accent); }
.article-body strong { font-weight: 700; }
.article-body code {
  font-family: var(--font-mono);
  font-size: .86em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  word-break: break-word;
}
.article-body pre {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.7;
  font-size: 13.5px;
  box-shadow: var(--shadow-1);
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}
.code-copy {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .25s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .3s var(--spring);
}
.article-body pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--accent-ink); border-color: var(--accent); transform: translateY(-1px); }
.code-copy.done { color: #12a76a; border-color: #12a76a; opacity: 1; }

.article-body blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
}
.article-body blockquote p { margin: 7px 0; }
.article-body blockquote.status-block {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--text);
}
.article-body blockquote.status-disputed {
  border-left-color: var(--dispute-border);
  background: var(--dispute-bg);
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
  position: relative;
}
.article-body img {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  margin: 10px 0;
}
.article-body .table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.article-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}
.article-body th, .article-body td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 10px 14px;
  vertical-align: top;
  text-align: left;
}
.article-body th:last-child, .article-body td:last-child { border-right: none; }
.article-body tbody tr:last-child td { border-bottom: none; }
.article-body th { background: var(--surface-3); font-weight: 700; white-space: nowrap; }
.article-body td { color: var(--text-dim); }
.article-body tbody tr { transition: background .2s var(--ease); }
.article-body tbody tr:hover { background: var(--surface-2); }
.article-body td a { color: var(--accent-ink); }

/* See Also */
.see-also {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 18px 14px;
  margin-top: 28px;
}
.see-also h2 {
  border-bottom: none;
  margin: 14px 0 6px;
  font-size: 15px;
  color: var(--text-dim);
  letter-spacing: .04em;
}
.see-also ul { padding-left: 20px; margin: 6px 0; }
.see-also li { margin: 6px 0; }
.see-also a { font-weight: 600; }

/* 上一篇 / 下一篇 */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 40px;
}
.pager > div { display: flex; }
.pager .next { justify-content: flex-end; }
.pager a {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: var(--shadow-1);
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.pager a:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  text-decoration: none;
}
.pager .label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.pager .next a { text-align: right; }

.article-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  font-size: 14px;
}
.article-nav a {
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  transition: all .25s var(--ease);
}
.article-nav a:hover {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ---------- 8. 搜索页 ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 6px;
}
.filter-chip {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all .25s var(--spring);
}
.filter-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.filter-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 6px 16px var(--accent-glow);
}

.result-count { color: var(--text-faint); font-size: 13.5px; margin: 16px 0 6px; text-align: center; }

.results { margin-top: 12px; display: grid; gap: 12px; }
.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), border-color .3s var(--ease);
  animation: result-in .45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes result-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.result:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--t) 30%, var(--border));
}
.result .r-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
  display: inline-block;
  transition: color .2s var(--ease);
}
.result:hover .r-title { color: var(--t); text-decoration: none; }
.result .r-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 7px 0 3px;
  font-size: 12.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.result .r-snip { margin: 6px 0 0; font-size: 14px; color: var(--text-dim); line-height: 1.75; }

mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 600;
  animation: mark-pop .5s var(--spring) both;
}
@keyframes mark-pop {
  0% { background-size: 0 100%; }
  100% { background-size: 100% 100%; }
}

.empty {
  text-align: center;
  color: var(--text-faint);
  padding: 52px 0;
  font-size: 15px;
}
.empty .empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: var(--surface-3);
  color: var(--text-faint);
}
.empty .empty-icon svg { width: 26px; height: 26px; }

/* ---------- 9. 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 70px;
  padding: 30px 0 44px;
  color: var(--text-faint);
  font-size: 13px;
  background: var(--surface-2);
}
.site-footer .foot-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-dim); transition: color .2s var(--ease); }
.site-footer a:hover { color: var(--accent-ink); }
.site-footer code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
}
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- 10. 浮层组件 ---------- */

.to-top {
  position: fixed;
  right: 26px; bottom: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0;
  transform: translateY(14px) scale(.85);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .4s var(--spring), color .2s var(--ease), border-color .2s var(--ease);
  z-index: 70;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
  transform: translateY(-3px) scale(1.06);
}
.to-top svg { width: 18px; height: 18px; }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text);
  margin: 18px 0;
}

.empty-state {
  text-align: center;
  padding: 46px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
}
.empty-state h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.empty-state p { margin: 0; font-size: 14px; }

/* ---------- 11. 响应式 ---------- */

@media (max-width: 1080px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-aside { position: static; order: -1; }
  .article-aside .toc ul { columns: 2; }
}

@media (max-width: 760px) {
  .wrap, .wrap-narrow { padding: 0 16px 64px; }
  .site-header .bar { padding: 10px 16px; gap: 10px; }
  .brand .brand-sub { display: none; }
  .hero { padding: 40px 0 12px; }
  .search-box { padding-left: 40px; }
  .search-box button { padding: 9px 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { justify-content: flex-start; }
  .pager .next a { text-align: left; }
  .meta-row { flex-direction: column; gap: 2px; }
  .meta-key { flex-basis: auto; }
  .article-aside .toc ul { columns: 1; }
  .site-footer .foot-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .to-top { right: 16px; bottom: 16px; }
}

@media (max-width: 520px) {
  .nav a { padding: 6px 9px; font-size: 13.5px; }
  .icon-btn .kbd { display: none; }
  .topic-grid { grid-template-columns: 1fr; }
}

/* ---------- 12. 动效降级 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hero .orb { animation: none; }
}

@media print {
  .site-header, .site-footer, .to-top, .pager, .article-nav, .article-aside { display: none !important; }
  body { background: #fff; }
  .article-body { max-width: none; }
}

/* 精修：信息优先，动效服务操作而不抢占阅读。 */
.hero { padding-top: clamp(42px, 6vw, 76px); padding-bottom: 24px; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); letter-spacing: -.045em; }
.hero .tagline { max-width: 560px; margin-left: auto; margin-right: auto; text-wrap: balance; }
.hero .orb { opacity: .16; }
.search-box { border-radius: 18px; box-shadow: 0 8px 30px rgba(40,65,120,.06); }
.search-box input { min-width: 0; }
.stats { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; border-top: 1px solid var(--border); padding-top: 22px; }
.stat { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat:hover { transform: none; box-shadow: none; }
.stat .num { font-size: 25px; background: none; color: var(--text); }
.stat .lbl { color: var(--text-dim); }
.topic-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.topic-card { min-width: 0; box-shadow: none; border-radius: 18px; }
.topic-card .t-desc { min-height: 3.4em; }
.a-card { box-shadow: none; }
.a-card:hover { border-color: var(--border-strong); }
.article-content { overflow-wrap: anywhere; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .quick-tags a, .filter-chip { touch-action: manipulation; }
@media (hover: none) { .topic-card:hover, .a-card:hover { transform: none; } }
@media (max-width: 760px) {
  .topic-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { padding-top: 36px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 16px; }
  .stat:nth-child(3) { border-left: 0; }
}
@media (max-width: 480px) {
  .topic-grid { grid-template-columns: minmax(0,1fr); }
  .topic-card { padding: 18px; }
  .topic-card .t-desc { min-height: 0; }
  .search-box input::placeholder { font-size: 12px; }
  .section { margin-top: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
