/* Harness Agent — 书籍版式
   继承 gottao 品牌 (blog-article.css) 的变量与阅读排版，
   新增：左侧章节树侧栏、面包屑、上下章导航、代码块。 */

:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --brand: #7c3aed;
  --brand-strong: #6d28d9;
  --brand-soft: #f5f3ff;
  --teal: #0f766e;
  --sidebar-w: 18rem;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(180deg, #fbfbff 0%, #ffffff 26rem), #ffffff;
}

a, a:hover, a:focus { text-decoration: none; }

.hero-grad {
  background: linear-gradient(283.01deg, #834CD6 8.03%, #9546E2 34.85%, #B935D9 100%);
}

/* ---- 顶部导航（沿用 gottao） ---- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  border-bottom: 1px solid rgba(237, 233, 254, .7);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
}
.article-nav {
  max-width: 84rem;
  height: 4rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand-mark {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--ink); font-size: 1.125rem; font-weight: 800; text-decoration: none;
}
.brand-mark img {
  width: 1.75rem; height: 1.75rem; border-radius: .5rem;
  box-shadow: 0 10px 24px -12px rgba(131, 76, 214, .7);
}
.article-nav-links {
  display: flex; align-items: center; gap: 1.75rem;
  font-size: .875rem; font-weight: 500;
}
.article-nav-links a { color: #4b5563; text-decoration: none; transition: color .2s ease; }
.article-nav-links a:hover { color: var(--brand); }
.article-nav-links a.is-active { color: var(--brand); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: .875rem; font-weight: 700; }
.nav-actions a { border-radius: 999px; text-decoration: none; }
.brand-accent { color: var(--brand); }
.nav-cta {
  padding: .5rem 1rem; color: #fff; font-weight: 600; font-size: .875rem;
  box-shadow: 0 10px 24px -12px rgba(107, 70, 193, .5); transition: opacity .2s ease;
}
.nav-cta:hover { opacity: .95; }

/* ---- 顶部 Books 下拉（与 Agents 同交互） ---- */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: 0;
  border: none;
  background: none;
  color: #4b5563;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .2s ease;
}
.nav-dropdown-trigger:hover,
.nav-dropdown:focus-within .nav-dropdown-trigger { color: var(--brand); }
.nav-dropdown-trigger.is-active { color: var(--brand); font-weight: 600; }
.nav-dropdown-chevron { width: .875rem; height: .875rem; opacity: .5; }
.nav-dropdown-panel {
  position: absolute;
  left: 50%;
  top: 100%;
  z-index: 50;
  padding-top: .5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu {
  min-width: 15.5rem;
  padding: .5rem 0;
  border: 1px solid rgba(237, 233, 254, .8);
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 20px 50px -24px rgba(91, 33, 182, .35);
}
.nav-dropdown-menu a {
  display: block;
  margin: 0 .25rem;
  padding: .65rem 1rem;
  border-radius: .5rem;
  color: var(--ink);
  text-decoration: none;
  transition: background .15s ease;
}
.nav-dropdown-menu a:hover { background: var(--brand-soft); color: var(--brand-strong); }
.nav-dropdown-menu a.is-active { background: var(--brand-soft); }
.nav-dropdown-item-title { display: block; font-weight: 700; line-height: 1.35; }
.nav-dropdown-item-desc { display: block; margin-top: .15rem; color: var(--muted); font-size: .75rem; font-weight: 500; line-height: 1.4; }

/* ---- 书籍布局：左侧栏 + 阅读区 ---- */
.book-layout {
  max-width: 84rem;
  margin: 0 auto;
  padding: 5rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.book-sidebar {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-right: .5rem;
}
.book-sidebar-title {
  display: block;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  text-decoration: none;
}
.book-toc { font-size: .875rem; }
.book-toc .toc-part {
  margin: 1.1rem 0 .35rem;
  color: var(--brand-strong);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.book-toc ul { margin: 0; padding: 0; list-style: none; }
.book-toc li { margin: 0; }
.book-toc a {
  display: block;
  padding: .34rem .6rem;
  border-radius: .5rem;
  color: #475569;
  line-height: 1.5;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.book-toc a:hover { background: var(--brand-soft); color: var(--brand-strong); }
.book-toc a.is-current {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
}
.book-toc .toc-num { color: var(--muted); font-weight: 700; margin-right: .3rem; }
.book-toc a.is-current .toc-num { color: var(--brand); }

/* ---- 侧栏移动端开关 ---- */
.book-sidebar-toggle {
  display: none;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  padding: .6rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  box-shadow: 0 12px 28px -12px rgba(124, 58, 237, .8);
  cursor: pointer;
}

/* ---- 阅读区（沿用 blog-article 排版） ---- */
.book-main { min-width: 0; }
.book-article { max-width: 54rem; }

.book-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
  color: var(--brand-strong);
  font-size: .82rem;
  font-weight: 800;
}
.book-breadcrumb a { color: var(--brand-strong); text-decoration: none; }
.book-breadcrumb a:hover { color: var(--brand); }
.book-breadcrumb .sep { color: var(--line); }

.book-body { color: #374151; font-size: 1.05rem; line-height: 1.95; }
.book-body > h1:first-child { margin-top: 0; }
.book-body h1 {
  margin: 0 0 1.4rem;
  color: var(--ink);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.book-body h2 {
  margin: 2.4rem 0 .9rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.3;
  font-weight: 750;
  letter-spacing: -0.005em;
}
.book-body h3 {
  margin: 1.6rem 0 .6rem;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 700;
}
.book-body p { margin: 1.05rem 0; }
.book-body a { color: var(--brand-strong); text-decoration: none; font-weight: 600; }
.book-body a:hover { color: var(--brand); }

.book-body ul, .book-body ol { margin: 1.25rem 0; padding-left: 1.4rem; }
.book-body ul { list-style: none; padding-left: 0; }
.book-body ul > li {
  position: relative; margin: .6rem 0; padding-left: 1.3rem;
  color: #475569; line-height: 1.85;
}
.book-body ul > li::before {
  content: ""; position: absolute; top: .78em; left: 0;
  width: .42rem; height: .42rem; border-radius: 999px; background: var(--teal);
}
.book-body ol > li { margin: .6rem 0; color: #475569; line-height: 1.85; }

.book-body blockquote {
  position: relative;
  margin: 1.9rem 0;
  padding: 1.15rem 1.35rem 1.15rem 3.1rem;
  border: 1px solid #ece9fe;
  border-left: 4px solid var(--brand);
  border-radius: .875rem;
  background: linear-gradient(180deg, #faf8ff 0%, #f6f3ff 100%);
  color: #4c1d95;
  font-weight: 600;
  line-height: 1.8;
}
.book-body blockquote::before {
  content: "“";
  position: absolute;
  top: .35rem;
  left: 1rem;
  color: #c4b5fd;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
}
.book-body blockquote p { margin: .4rem 0; }
.book-body blockquote p:first-child { margin-top: 0; }
.book-body blockquote p:last-child { margin-bottom: 0; }

/* 行内 code */
.book-body :not(pre) > code {
  padding: .16rem .4rem;
  border: 1px solid #e2e8f0;
  border-radius: .45rem;
  background: #f8fafc;
  color: #b91c8c;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 代码块 */
.book-body pre {
  margin: 1.5rem 0;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  border-radius: .875rem;
  background: #1e1b2e;
  color: #e5e7eb;
  font-size: .9rem;
  line-height: 1.7;
}
.book-body pre code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}

/* 轻量语法高亮 token（配色贴合深色底 #1e1b2e） */
.book-body pre .tok-c { color: #8b83a8; font-style: italic; }  /* 注释 */
.book-body pre .tok-s { color: #a5d6a7; }                      /* 字符串 */
.book-body pre .tok-k { color: #c792ea; font-weight: 600; }    /* 关键字 */
.book-body pre .tok-n { color: #f6c177; }                      /* 数字 */
.book-body pre .tok-f { color: #82aaff; }                      /* 函数名 */

.book-body table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: .95rem;
}
.book-body th, .book-body td {
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.book-body th { background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; }

.book-body hr { margin: 2.5rem 0; border: none; border-top: 1px solid var(--line); }

/* ---- 上下章导航 ---- */
.book-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}
.book-pager a {
  flex: 1;
  max-width: 48%;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: .875rem;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.book-pager a:hover {
  border-color: #ddd6fe;
  box-shadow: 0 16px 36px -30px rgba(124, 58, 237, .8);
}
.book-pager .pager-dir { font-size: .75rem; font-weight: 800; color: var(--muted); }
.book-pager .pager-title { display: block; margin-top: .3rem; color: var(--ink); font-weight: 800; }
.book-pager .pager-next { text-align: right; margin-left: auto; }

/* ---- 概览页（index）封面 ---- */
.book-cover {
  margin-bottom: 2.5rem;
  padding: 2.5rem;
  border-radius: 1.25rem;
  color: #fff;
  box-shadow: 0 26px 70px -42px rgba(109, 40, 217, .9);
}
.book-cover h1 { margin: 0 0 .75rem; font-size: clamp(1.7rem, 3.2vw, 2.3rem); line-height: 1.18; font-weight: 850; }
.book-cover p { margin: 0; color: rgba(255,255,255,.85); font-size: 1.1rem; line-height: 1.7; }

.book-meta {
  margin: 1.5rem 0 2rem;
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: .875rem;
  background: #fbfaff;
  font-size: .95rem;
}
.book-meta-row { display: flex; gap: .75rem; padding: .3rem 0; line-height: 1.6; }
.book-meta-row + .book-meta-row { border-top: 1px solid #f1eefe; }
.book-meta-key {
  flex: 0 0 5.5rem;
  color: var(--muted);
  font-weight: 700;
}
.book-meta-val { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.book-meta-val a { color: var(--brand-strong); text-decoration: none; font-weight: 600; }
.book-meta-val a:hover { color: var(--brand); }

.book-parts-grid { display: grid; gap: 1rem; margin: 1.5rem 0; }
.book-part-card {
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
}
.book-part-card h3 { margin: 0 0 .35rem; font-size: 1.05rem; font-weight: 900; color: var(--ink); }
.book-part-card .part-theme { margin: 0 0 .6rem; color: var(--muted); font-size: .9rem; }
.book-part-card .part-chapters { display: flex; flex-wrap: wrap; gap: .4rem; }
.book-part-card .part-chapters a,
.book-part-card .part-chapters span {
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
}
.book-part-card .part-chapters a:hover { background: #ede9fe; }

/* ---- 新首页主线：经营结果 → AI 业务能力 ---- */
.book-thesis {
  margin: 1.75rem 0 2.25rem;
  padding: 1.6rem;
  border: 1px solid #312e3b;
  border-radius: 1rem;
  background: #11131a;
  color: #fff;
}
.book-thesis-kicker {
  display: block;
  margin-bottom: .65rem;
  color: #c9f36b;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.book-thesis strong { display: block; font-size: 1.35rem; line-height: 1.5; }
.book-thesis p { margin: .75rem 0 0; color: #b8bdc8; font-size: .95rem; line-height: 1.75; }
.capability-six {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .65rem;
  margin: 1.35rem 0 2rem;
}
.capability-item {
  min-height: 8.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fff;
}
.capability-item b { display: block; margin-bottom: .8rem; color: var(--brand-strong); font-size: .72rem; letter-spacing: .06em; }
.capability-item strong { display: block; color: var(--ink); font-size: .95rem; line-height: 1.45; }
.capability-item span { display: block; margin-top: .4rem; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.company-paths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
  margin: 1.3rem 0 2rem;
}
.company-path {
  display: flex;
  min-height: 13rem;
  padding: 1.15rem;
  flex-direction: column;
  border-radius: 1rem;
  background: var(--brand-soft);
}
.company-path:nth-child(2) { background: #f5fae9; }
.company-path:nth-child(3) { background: #fff3ed; }
.company-path b { color: var(--brand-strong); font-size: .76rem; letter-spacing: .05em; }
.company-path h3 { margin: 1.5rem 0 .55rem; font-size: 1.05rem; }
.company-path p { margin: 0; color: #596071; font-size: .86rem; line-height: 1.65; }
.company-path a { margin-top: auto; padding-top: 1rem; font-size: .8rem; }

/* ---- 响应式 ---- */
@media (max-width: 960px) {
  .book-layout { grid-template-columns: 1fr; padding-top: 4.5rem; }
  .book-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 16rem;
    max-height: 100vh;
    padding: 5rem 1rem 2rem;
    background: #fff;
    border-right: 1px solid var(--line);
    box-shadow: 0 0 60px -20px rgba(15,23,42,.3);
    transform: translateX(-105%);
    transition: transform .25s ease;
    z-index: 55;
  }
  .book-sidebar.is-open { transform: translateX(0); }
  .book-sidebar-toggle { display: block; }
}

@media (max-width: 860px) {
  .article-nav-links { display: none; }
}

@media (max-width: 640px) {
  .article-nav { padding: 0 1rem; }
  .book-body { font-size: 1rem; }
  .book-pager { flex-direction: column; }
  .book-pager a { max-width: 100%; }
  .book-cover { padding: 1.6rem; }
  .capability-six, .company-paths { grid-template-columns: 1fr; }
  .company-path { min-height: 10rem; }
}
