/* ============================================================
   麟翼逻辑栈 — 设计系统
   ============================================================ */

:root {
  --bg: #f7f8fc;
  --bg-grid: rgba(91, 91, 214, 0.045);
  --surface: #ffffff;
  --surface-2: #f2f4fa;
  --surface-hover: #fbfbff;
  --border: #e6e8f0;
  --border-strong: #d6d9e6;
  --text: #1b1e2f;
  --text-muted: #6b7288;
  --text-faint: #9aa0b4;
  --primary: #5b5bd6;
  --primary-hover: #4d4dc4;
  --primary-soft: #eeedff;
  --primary-ring: rgba(91, 91, 214, 0.18);
  --accent: #0ea5b7;
  --accent-soft: #e2f8fa;
  --shadow-sm: 0 1px 2px rgba(20, 24, 60, 0.05), 0 2px 8px rgba(20, 24, 60, 0.04);
  --shadow-md: 0 8px 24px rgba(28, 32, 74, 0.08), 0 2px 6px rgba(28, 32, 74, 0.04);
  --shadow-lg: 0 24px 56px rgba(28, 32, 74, 0.14);
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b0d17;
  --bg-grid: rgba(140, 140, 255, 0.05);
  --surface: #141725;
  --surface-2: #1c2032;
  --surface-hover: #1a1e30;
  --border: #272c40;
  --border-strong: #363c55;
  --text: #e9ebf6;
  --text-muted: #9ca4bd;
  --text-faint: #6e7691;
  --primary: #9090ff;
  --primary-hover: #a5a5ff;
  --primary-soft: #232447;
  --primary-ring: rgba(144, 144, 255, 0.22);
  --accent: #38c7d6;
  --accent-soft: #15353b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px),
                    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 520px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 520px);
  pointer-events: none; z-index: 0;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; }
.wrap { width: min(var(--maxw), calc(100% - 40px)); margin: 0 auto; position: relative; z-index: 1; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav { height: 66px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #8a5cf6);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px var(--primary-ring);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text strong { display: block; font-size: 16px; letter-spacing: .3px; line-height: 1.2; }
.brand-text small { display: block; font-size: 10px; color: var(--text-faint); letter-spacing: 1.6px; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 13px; border-radius: 9px; font-size: 14px; color: var(--text-muted);
  transition: color .18s, background .18s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); display: grid; place-items: center;
  cursor: pointer; transition: all .18s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 54px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: var(--text-muted); box-shadow: var(--shadow-sm); margin-bottom: 26px;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.hero h1 {
  margin: 0 auto 18px; font-size: clamp(34px, 5.2vw, 58px); line-height: 1.16; letter-spacing: -1.4px;
  font-weight: 800; max-width: 820px;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--primary), #8a5cf6 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0 auto 32px; max-width: 620px; font-size: 17px; color: var(--text-muted); }
.hero-search {
  display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 7px 8px 7px 18px; box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.hero-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-md); }
.hero-search svg { width: 19px; height: 19px; color: var(--text-faint); flex-shrink: 0; }
.hero-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; min-width: 0; }
.hero-search input::placeholder { color: var(--text-faint); }
.btn-primary {
  border: 0; background: linear-gradient(135deg, var(--primary), #7c4df0); color: #fff;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer;
  box-shadow: 0 6px 16px var(--primary-ring); transition: transform .16s, filter .16s; white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.hero-stats { display: flex; justify-content: center; gap: 36px; margin-top: 34px; flex-wrap: wrap; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.hero-stats span { font-size: 12.5px; color: var(--text-faint); }

/* ---------- 区块标题 ---------- */
.section { padding: 26px 0 46px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: 25px; letter-spacing: -.6px; }
.section-head h2 .accent-bar { display: inline-block; width: 5px; height: 22px; border-radius: 3px; background: linear-gradient(var(--primary), #8a5cf6); margin-right: 11px; vertical-align: -3px; }
.section-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.section-head .link-more { color: var(--primary); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.section-head .link-more:hover { text-decoration: underline; }

/* ---------- 分类筛选 ---------- */
.cat-bar { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 26px; scrollbar-width: none; }
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: all .18s;
}
.cat-chip svg { width: 15px; height: 15px; }
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: linear-gradient(135deg, var(--primary), #7c4df0); border-color: transparent; color: #fff; box-shadow: 0 5px 14px var(--primary-ring); }

/* ---------- 教程卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column; cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-cover { height: 124px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-cover::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.35) 1px, transparent 0);
  background-size: 16px 16px; opacity: .5;
}
.cover-indigo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.cover-violet { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.cover-emerald { background: linear-gradient(135deg, #10b981, #0ea5b7); }
.cover-amber { background: linear-gradient(135deg, #f59e0b, #f97316); }
.cover-rose { background: linear-gradient(135deg, #f43f5e, #ec4899); }
.cover-sky { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.card-cover .cover-icon {
  width: 54px; height: 54px; border-radius: 15px; background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35); display: grid; place-items: center; color: #fff; z-index: 1;
  backdrop-filter: blur(4px);
}
.card-cover .cover-icon svg { width: 28px; height: 28px; }
.cover-tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(255,255,255,.9); color: #3b3f52; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 7px; letter-spacing: .3px;
}
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); margin-bottom: 9px; }
.card-meta .cat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.card-title { margin: 0 0 8px; font-size: 17px; line-height: 1.45; letter-spacing: -.2px; }
.card:hover .card-title { color: var(--primary); }
.card-desc { margin: 0 0 16px; font-size: 13.5px; color: var(--text-muted); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; margin-bottom: 14px; }
.tag { font-size: 11.5px; color: var(--text-muted); background: var(--surface-2); padding: 3px 9px; border-radius: 6px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 13px; font-size: 12px; color: var(--text-faint); }
.card-foot .author { display: flex; align-items: center; gap: 7px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8a5cf6); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.card-foot .read { display: flex; align-items: center; gap: 4px; }
.card-foot svg { width: 14px; height: 14px; }

/* 精选横条 */
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; min-height: 210px;
  padding: 26px; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer;
  transition: transform .22s, box-shadow .22s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-card::before { content: ""; position: absolute; inset: 0; z-index: 0; }
.feature-card::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(8,10,24,.82), rgba(8,10,24,.05) 70%); }
.fc-indigo::before { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.fc-emerald::before { background: linear-gradient(135deg, #0f766e, #0ea5b7); }
.fc-sky::before { background: linear-gradient(135deg, #0369a1, #6d28d9); }
.feature-card > * { position: relative; z-index: 2; }
.feature-card .fc-label { position: absolute; top: 18px; left: 22px; font-size: 11px; font-weight: 700; letter-spacing: 1px; background: rgba(255,255,255,.2); padding: 4px 10px; border-radius: 6px; backdrop-filter: blur(4px); }
.feature-card h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.4; }
.feature-card p { margin: 0; font-size: 13px; color: rgba(255,255,255,.82); }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 30px; }
.footer-inner { padding: 40px 0 30px; display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.footer-brand p { color: var(--text-muted); font-size: 13.5px; max-width: 320px; margin: 14px 0 0; }
.footer-col h4 { font-size: 13px; margin: 0 0 14px; }
.footer-col a { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 9px; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; text-align: center; font-size: 12.5px; color: var(--text-faint); }

/* ============================================================
   教程文章页
   ============================================================ */
.article-header { padding: 44px 0 30px; border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-faint); margin-bottom: 22px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span.sep { opacity: .5; }
.article-title { font-size: clamp(28px, 4vw, 40px); line-height: 1.25; letter-spacing: -1px; margin: 0 0 16px; max-width: 760px; }
.article-desc { font-size: 17px; color: var(--text-muted); margin: 0 0 24px; max-width: 720px; }
.article-info { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-faint); }
.article-info .who { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
.article-info .meta-item { display: flex; align-items: center; gap: 6px; }
.article-info svg { width: 15px; height: 15px; }
.level-pill { font-size: 11.5px; padding: 3px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 60px; padding: 40px 0 70px; align-items: start; }
.article-body { font-size: 15.5px; color: var(--text); min-width: 0; }
.article-body section { margin-bottom: 44px; scroll-margin-top: 92px; }
.article-body h2 { font-size: 23px; letter-spacing: -.5px; margin: 0 0 16px; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
.article-body h2 .sec-num { color: var(--primary); font-variant-numeric: tabular-nums; margin-right: 10px; }
.article-body p { margin: 0 0 16px; line-height: 1.85; color: var(--text); }
.article-body strong { font-weight: 700; }
.article-body ul, .article-body ol { padding-left: 22px; margin: 0 0 18px; }
.article-body li { margin-bottom: 9px; line-height: 1.75; }
.article-body li::marker { color: var(--primary); font-weight: 700; }
.article-body code:not(pre code) {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; color: var(--primary);
}
.article-body pre {
  background: #121522; color: #e5e9f5; border-radius: 13px; padding: 20px 22px;
  overflow-x: auto; margin: 0 0 20px; font-size: 13.5px; line-height: 1.7;
  border: 1px solid #22273c; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .article-body pre { background: #0a0c15; border-color: #202438; }
.article-body pre code { font-family: var(--mono); }
.hl-kw { color: #c792ea; }
.hl-str { color: #c3e88d; }
.hl-com { color: #6c7694; font-style: italic; }
.hl-num { color: #f78c6c; }
.hl-fn  { color: #82aaff; }

.callout {
  display: flex; gap: 13px; padding: 16px 18px; border-radius: 11px; margin: 0 0 20px;
  font-size: 14px; line-height: 1.7; border: 1px solid;
}
.callout-icon {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff;
}
.callout-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout-info .callout-icon { background: var(--accent); }
.callout-warn { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); }
.callout-warn .callout-icon { background: #f59e0b; }
[data-theme="dark"] .callout-warn { background: rgba(245,158,11,.08); }

/* 侧边目录 */
.toc { position: sticky; top: 92px; }
.toc-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--text-faint); text-transform: uppercase; margin-bottom: 14px; }
.toc a {
  display: block; font-size: 13px; color: var(--text-muted); padding: 7px 0 7px 13px;
  border-left: 2px solid var(--border); line-height: 1.5; transition: all .18s;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.toc-progress { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.toc-progress .bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.toc-progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #8a5cf6); transition: width .1s; }
.toc-progress small { font-size: 11.5px; color: var(--text-faint); display: block; margin-top: 7px; }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 28px; border-top: 1px solid var(--border); }
.article-nav a {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; transition: all .18s;
}
.article-nav a:hover { border-color: var(--primary); transform: translateY(-2px); }
.article-nav .dir { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }
.article-nav .t { font-size: 14.5px; font-weight: 600; }
.article-nav .next { text-align: right; }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty svg { width: 46px; height: 46px; color: var(--text-faint); margin-bottom: 14px; }
.empty h3 { margin: 0 0 6px; color: var(--text); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .card-grid, .featured-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: 1fr; gap: 30px; }
  .toc { display: none; }
}
@media (max-width: 720px) {
  .nav-links { display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px; box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 14px; }
  .menu-btn { display: grid; }
  .hero { padding: 48px 0 36px; }
  .card-grid, .featured-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 22px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .article-nav { grid-template-columns: 1fr; }
}
