/* ============================================================
   灵燕智能 · 指南区共用样式（assets/guides.css）
   ------------------------------------------------------------
   服务范围：guides/ 下的聚合页、系列目录页与文章页。
   首页 index.html 仍使用自身的内联 <style> + tailwind.js，不受影响。
   设计 token 与首页一致；导航与页脚照着首页的形态实现
   （guides 不加载 tailwind.js，所以布局全部由本文件承担，不用工具类）。
   纯静态 CSS，页面不加载 JS。
   ============================================================ */

:root {
  --ink: #1A1A1A;
  --ink-2: #3D3D3D;
  --muted: #6B6B6B;
  --line: #E5E5E5;
  --line-2: #D6D6D6;
  --bg: #FFFFFF;
  --bg-2: #FAFAF9;
  --bg-3: #F4F4F2;
  --accent: #2F5BFF;

  --motion-instant: 110ms;
  --motion-fast: 180ms;
  --motion-base: 260ms;
  --motion-reveal: 520ms;
  --ease-glide: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);

  /* 吸顶导航高度：与首页 nav 的 h-14 sm:h-16 对齐，供锚点留白计算 */
  --nav-h: 56px;
  --measure: 720px;   /* 正文阅读宽度 */
}
@media (min-width: 640px) { :root { --nav-h: 64px; } }

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02", "cv11";
}
img { max-width: 100%; height: auto; }
a { color: inherit; }

/* 锚点跳转的留白只由 html 的 scroll-padding-top 承担。
   不要再给 :target 加 scroll-margin-top —— 两者会叠加，锚点会被顶到导航的两倍高度以下。 */

.container-x { padding-left: 20px; padding-right: 20px; }
@media (min-width: 768px) { .container-x { padding-left: 32px; padding-right: 32px; } }
@media (min-width: 1024px) { .container-x { padding-left: 48px; padding-right: 48px; } }

/* ---------- 通用文本件（与首页同名同义） ---------- */

.ink { color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xs { font-size: 11px; }

.lede {
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0;
}

/* ---------- 链接与按钮 ---------- */

.underline-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-2);
  transition: text-decoration-color var(--motion-instant) var(--ease-standard);
}
.underline-link:hover { text-decoration-color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--ease-glide),
              border-color var(--motion-fast) var(--ease-glide),
              color var(--motion-fast) var(--ease-glide),
              transform var(--motion-fast) var(--ease-glide);
}
.btn-primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-primary:hover { background: #000; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* 图标链接（GitHub 等）：颜色随悬停 / 键盘聚焦加深 */
.icon-link {
  display: inline-flex;
  color: var(--ink-2);
  transition: color var(--motion-instant) var(--ease-standard);
}
.icon-link:hover,
.icon-link:focus-visible { color: var(--ink); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  font-size: 11px;
  color: var(--ink-2);
  font-weight: 500;
}

/* ---------- 站点头部（与首页一致） ---------- */

.site-nav {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand img { width: 26px; height: 26px; }
.brand-word { font-size: 17px; font-weight: 600; color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: 12px; }
@media (min-width: 640px) { .nav-right { gap: 20px; } }
.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-instant) var(--ease-standard);
}
.nav-link:hover,
.nav-link:focus-visible { color: var(--ink); }
/* 逐级收起：<640px 藏 GitHub 图标（页脚「资源」已有入口），<360px 藏品牌名只留标识 */
@media (max-width: 639px) { .nav-gh { display: none; } }
@media (max-width: 359px) { .brand-word { display: none; } }

/* ---------- 面包屑 ---------- */

.breadcrumb { grid-area: crumb; font-size: 13px; color: var(--muted); margin: 0; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }

/* ---------- 聚合页 / 系列目录页 ---------- */

.hub { max-width: var(--measure); margin: 0 auto; padding-bottom: 88px; }
.hub .breadcrumb { margin: 32px 0 0; }
.hub .eyebrow { margin: 28px 0 14px; }
.hub h1 {
  font-size: clamp(30px, 5.2vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 16px;
}
.hub .lede { margin: 0 0 8px; }

.hub-sections { margin-top: 44px; }
.hub-section + .hub-section { margin-top: 56px; }

/* 区块头：一条墨线定住分组，右侧是元信息 */
.hub-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--ink);
  padding-top: 14px;
}
.hub-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0;
}
.hub-section-note { font-size: 12px; color: var(--muted); margin: 0; white-space: nowrap; }
.hub-section-lede { font-size: 14px; line-height: 1.75; color: var(--ink-2); margin: 14px 0 20px; }
.hub-section-foot { font-size: 14px; margin: 16px 0 0; }

.post-list { border-top: 1px solid var(--line); }

/* 带篇号的紧凑索引行（连载） */
.post-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.post-num {
  flex: 0 0 22px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.post-row-title { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.5; min-width: 0; }
.post-row-meta { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
a.post-row:hover .post-row-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.post-row.is-todo .post-row-title { color: var(--muted); }

/* 单篇：标题 + 摘要 */
.post {
  display: block;
  text-decoration: none;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.post h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 8px;
}
.post:hover h3 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.post p { font-size: 14px; line-height: 1.75; color: var(--muted); margin: 0 0 10px; }
.post .post-meta { font-size: 12px; color: var(--muted); margin: 0; }

/* ---------- 文章布局 ----------
   阅读顺序：移动端 = 面包屑 → 标题 → 目录 → 正文；≥1024px 目录升为左侧固定栏。
   面包屑进网格是为了与正文左沿严格对齐（放在网格外会贴到容器边）。 */

.article-layout { max-width: 1040px; margin: 0 auto; padding-bottom: 72px; }

.article-body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "crumb" "head" "toc" "content" "foot";
  row-gap: 24px;
  min-width: 0;
}
@media (min-width: 1024px) {
  .article-body {
    grid-template-columns: 224px minmax(0, var(--measure));
    grid-template-areas: ". crumb" "toc head" "toc content" "toc foot";
    column-gap: 48px;
    justify-content: center;
  }
}

.article-body > .breadcrumb { margin-top: 32px; }
.article-head { grid-area: head; }
.article-body > .prose { grid-area: content; min-width: 0; }
.article-foot { grid-area: foot; }

/* ---------- 文章标题区 ---------- */

.eyebrow { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: -0.01em; margin: 0 0 12px; }
.article-title {
  font-size: clamp(30px, 5.2vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 14px;
}
.article-meta { font-size: 13px; color: var(--muted); margin: 0; }
.article-meta span + span::before { content: "·"; margin: 0 8px; color: var(--line-2); }

/* ---------- 本文目录 ----------
   两层：h2 带 h3 子项。折叠用原生 <details open>（默认展开、零 JS），
   正文以外的任何内容都不依赖脚本。

   注意：toc-title 的样式写在 summary 上，列表缩进写在 ul 上。 */

.toc { grid-area: toc; align-self: start; font-size: 13px; }
@media (min-width: 1024px) {
  .toc { position: sticky; top: calc(var(--nav-h) + 24px); }
}

.toc .toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin: 0 0 10px;
  transition: color var(--motion-fast) var(--ease-glide);
}
.toc .toc-title::-webkit-details-marker { display: none; }
.toc .toc-title:hover { color: var(--ink); }
.toc .toc-title .arr {
  font-size: 13px;
  font-weight: 300;
  transition: transform var(--motion-base) var(--ease-glide);
}
.toc details[open] > .toc-title .arr { transform: rotate(45deg); }

.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 12px;
  margin-left: -1px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.5;
  border-left: 1px solid transparent;
  transition: color var(--motion-fast) var(--ease-glide),
              border-color var(--motion-fast) var(--ease-glide);
}
.toc a:hover { color: var(--ink); border-left-color: var(--line-2); }
/* 子项：缩进弱化，只变颜色不叠第二道竖线 */
.toc ul ul { border-left: 0; padding-left: 12px; }
.toc ul ul a { padding: 4px 0 4px 12px; font-size: 12px; }
.toc ul ul a:hover { border-left-color: transparent; }

/* ---------- 正文排版 ---------- */

.prose { font-size: 16px; line-height: 1.85; }
.prose p { margin: 0 0 20px; color: var(--ink-2); }
.prose h2 {
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
  margin: 56px 0 18px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
@media (min-width: 768px) { .prose h2 { font-size: 28px; } }
.prose h3 {
  font-size: 19px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--ink);
  margin: 36px 0 12px;
}
.prose h4 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 28px 0 10px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: normal; border-bottom: 1px solid var(--line-2); }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(47, 91, 255, 0.35);
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 0; list-style: none; }
/* 标记用绝对定位，正文按普通流排版——若用 flex，<strong> 会变成独立 flex 项被压换行 */
.prose li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  color: var(--ink-2);
}
.prose li::before {
  position: absolute;
  left: 0;
  top: 0;
  content: "—";
  color: var(--ink);
}
.prose ol { counter-reset: item; }
.prose ol li { counter-increment: item; padding-left: 28px; }
.prose ol li::before {
  content: counter(item, decimal-leading-zero);
  font-size: 13px;
  font-weight: 500;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 44px 0; }
.prose blockquote {
  margin: 28px 0;
  padding-left: 20px;
  border-left: 2px solid var(--line-2);
  color: var(--muted);
}

/* 章节级大字引言（首页 .quote-big 的对应实现） */
.quote-big {
  border-left: 2px solid var(--ink);
  padding-left: 20px;
  font-size: clamp(17px, 3.4vw, 22px);
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 40px 0;
}
@media (min-width: 768px) { .quote-big { padding-left: 24px; } }

/* 提示块：中性底 + 左侧墨线，不引入状态色 */
.callout {
  background: var(--bg-3);
  border-left: 2px solid var(--ink);
  border-radius: 0 4px 4px 0;
  padding: 16px 20px;
  margin: 28px 0;
}
.callout-label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.callout p { margin: 0 0 10px; font-size: 15px; }
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout ul, .callout ol { margin: 0; }
.callout li { font-size: 15px; }

/* 勾选清单 */
.checklist { list-style: none; margin: 24px 0; padding: 0; }
.checklist li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  display: block;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
}

/* 表格 */
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 28px 0 8px; }
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
}
.prose th { background: var(--bg-2); font-weight: 500; color: var(--ink); white-space: nowrap; }
.prose td { color: var(--ink-2); }
.table-note { font-size: 12px; color: var(--muted); margin: 0 0 28px; }

/* 代码 */
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-3);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--ink);
}
.prose pre {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  margin: 28px 0;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

/* 图与图注 */
.prose figure { margin: 32px 0; }
.prose figure img { border: 1px solid var(--line); border-radius: 6px; display: block; }
.prose figcaption { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.65; }
.prose > img { border: 1px solid var(--line); border-radius: 6px; display: block; margin: 32px 0; }

/* ---------- 文章尾部：上一篇 / 下一篇 + 相关 ---------- */

.article-foot { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 28px; }
.prevnext { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
@media (min-width: 640px) { .prevnext { flex-direction: row; justify-content: space-between; } }
.prevnext a {
  text-decoration: none;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  max-width: 320px;
  transition: border-color var(--motion-fast) var(--ease-glide);
}
.prevnext a:hover { border-color: var(--ink); }
.prevnext .label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.related-title { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 12px; }
.related { display: flex; flex-direction: column; gap: 8px; }
.related a { font-size: 15px; color: var(--ink); }

/* 文末引导条 */
.cta-box {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding-top: 28px;
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.8;
}

/* ---------- 页脚（与首页一致） ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--bg); }
.footer-inner { max-width: 1280px; margin: 0 auto; padding-top: 48px; padding-bottom: 32px; }
.footer-top { display: grid; grid-template-columns: 1fr; gap: 32px; margin-bottom: 40px; }
@media (min-width: 640px) { .footer-top { grid-template-columns: 2fr 1fr; gap: 40px; margin-bottom: 48px; } }
.footer-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.footer-brand img { width: 20px; height: 20px; }
.footer-brand span { font-size: 14px; font-weight: 600; }
.footer-tagline { font-size: 12px; line-height: 1.7; color: var(--muted); max-width: 300px; margin: 0; }
.footer-label { font-size: 13px; font-weight: 500; color: var(--ink); margin: 0 0 12px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 12px; color: var(--muted); }
.footer-legal { border-top: 1px solid var(--line); padding-top: 24px; }
.footer-disclaimer { font-size: 11px; line-height: 1.7; color: var(--muted); max-width: 640px; margin: 0 0 16px; }
.footer-row { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .footer-row { flex-direction: row; justify-content: space-between; align-items: center; } }
.footer-row p, .footer-row a { font-size: 11px; color: var(--muted); margin: 0; }

/* ---------- 下载页（download/index.html） ---------- */

.dl-main { max-width: var(--measure); margin: 0 auto; padding-bottom: 88px; }
.dl-main .breadcrumb { margin: 32px 0 0; }
.dl-main h1 {
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
  margin: 20px 0 10px;
}
.dl-version { font-size: 13px; color: var(--muted); margin: 0; }
.dl-cards { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; }
.dl-card { border: 1px solid var(--line); border-radius: 6px; padding: 20px 22px; background: var(--bg); }
.dl-card-head h2 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0; }
.dl-card-head p { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.dl-card-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.65; }
/* 卡片内的醒目说明（如 macOS 首次打开放行）：中性底 + 左侧墨线，不引入状态色 */
.dl-notice { margin-top: 16px; background: var(--bg-3); border-left: 2px solid var(--ink); border-radius: 0 4px 4px 0; padding: 12px 16px; }
.dl-notice p { font-size: 12px; line-height: 1.7; color: var(--ink-2); margin: 0 0 6px; }
.dl-notice p:last-child { margin-bottom: 0; }
.dl-notice .dl-notice-title { font-weight: 600; color: var(--ink); }
.dl-notice code { word-break: break-all; }
.dl-file { display: flex; align-items: center; gap: 16px; margin-top: 16px; min-width: 0; }
.dl-file + .dl-file { border-top: 1px solid var(--line); padding-top: 16px; }
.dl-file > div { min-width: 0; }
.dl-file-name { font-size: 14px; font-weight: 500; color: var(--ink); word-break: break-all; margin: 0; }
.dl-file-note { font-size: 12px; color: var(--muted); margin: 3px 0 0; line-height: 1.6; }
.dl-file .btn { margin-left: auto; flex-shrink: 0; padding: 10px 18px; font-size: 14px; }
@media (max-width: 480px) {
  .dl-file { flex-wrap: wrap; }
  .dl-file .btn { margin-left: 0; flex-basis: 100%; text-align: center; }
}
.dl-verify { margin-top: 32px; font-size: 13px; color: var(--ink-2); }
.dl-verify summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink); }
.dl-verify ul { list-style: none; margin: 12px 0 0; padding: 0; }
.dl-verify li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 8px;
  line-height: 1.7;
}
.dl-verify code, .dl-notes code, .dl-notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}
.dl-notes { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 20px; font-size: 13px; line-height: 1.8; color: var(--ink-2); }
.dl-notes p { margin: 0 0 8px; }
.dl-notes a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: rgba(47, 91, 255, 0.35); }
.dl-notes a:hover { text-decoration-color: var(--accent); }

/* ---------- 小屏微调 ---------- */

@media (max-width: 640px) {
  .prose { font-size: 15px; }
  .prose table { font-size: 13px; }
  .prose th, .prose td { padding: 8px 10px; }
  .prose h2 { font-size: 22px; margin-top: 44px; padding-top: 24px; }
  .prose h3 { font-size: 18px; margin-top: 32px; }
  .post-row-meta { padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
