/* ============================================================
   低熵财富 书籍正文样式（两卷共用）
   色调参照 landing page：琥珀主色 #D97706（卷一），蓝色由 book-vol2.css 覆盖
   ============================================================ */

/* ── 品牌色变量（卷一默认，卷二由 book-vol2.css 覆盖）── */
:root {
  --brand:        #D97706;
  --brand-dark:   #B45309;
  --brand-light:  #FEF3C7;
  --brand-border: #EBEBEB;
}

/* ── 整体背景 ── */
body {
  background-color: #FAFAFA;
  -webkit-font-smoothing: antialiased;
}

/* ── 隐藏作者/日期元数据块（author + date，仅 HTML；epub/pdf 不受影响）── */
.quarto-title-meta { display: none !important; }

/* ── 书籍封面缩略图（index 页，Quarto 自动注入）──
      双 class 选择器 specificity (0,2,0) 稳赢 lianxhcn.css 的所有 !important 规则 ── */
.quarto-cover-image.img-fluid {
  width: 145px !important;
  max-width: 145px !important;
  height: auto !important;
  display: block !important;
  float: right;
  margin: 0 0 1.25rem 1.75rem;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
}

@media (max-width: 767px) {
  .quarto-cover-image.img-fluid {
    width: 110px !important;
    max-width: 110px !important;
    margin: 0 0 1rem 1.25rem;
  }
}

/* ════════════════════════════════════════
   导航栏
   ════════════════════════════════════════ */
.navbar {
  background-color: #fff !important;
  border-bottom: 1px solid var(--brand-border);
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
}
.navbar-brand,
.nav-link {
  color: #111 !important;
  font-weight: 500;
}
.nav-link:hover { color: var(--brand) !important; }

/* ════════════════════════════════════════
   侧边栏
   ════════════════════════════════════════ */
#quarto-sidebar,
.sidebar {
  background-color: #fff !important;
  border-right: 1px solid var(--brand-border);
}

/* 书名（侧边栏顶部） */
.sidebar-title a,
.sidebar-title {
  color: #111 !important;
  font-weight: 700 !important;
  font-size: .97rem !important;
}

/* 封面缩略图（与 landing page 145px 保持一致） */
.sidebar-header img {
  width: 145px !important;
  height: auto !important;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  margin-bottom: .75rem;
}

/* 篇章标签（Part 标题） */
.sidebar-item-section > .sidebar-item-text {
  font-size: .73rem !important;
  font-weight: 700 !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  color: #999 !important;
  padding-top: .9rem !important;
  padding-bottom: .15rem !important;
}

/* 普通章节链接 */
.sidebar-item a.sidebar-link,
.sidebar-item button.sidebar-link {
  color: #555;
  font-size: .87rem;
  border-radius: 5px;
  padding: .22rem .55rem;
  transition: background .12s, color .12s;
  text-decoration: none !important;
}
.sidebar-item a.sidebar-link:hover,
.sidebar-item button.sidebar-link:hover {
  color: var(--brand);
  background-color: var(--brand-light);
}

/* 当前页高亮 */
.sidebar-item a.sidebar-link.active,
.sidebar-item > .active,
.sidebar-item .active > a.sidebar-link {
  color: var(--brand) !important;
  font-weight: 600;
  background-color: var(--brand-light) !important;
}

/* ════════════════════════════════════════
   章节标题
   ════════════════════════════════════════ */

/* 页面大标题（章标题） */
.quarto-title .title,
h1.title {
  font-size: clamp(1.55rem, 3.8vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: #111;
  padding-bottom: .55rem;
  border-bottom: 3px solid var(--brand);
  margin-bottom: 1.1rem;
}

/* H1 内嵌段落（如 unnumbered 章节） */
h1.anchored {
  font-size: 1.6rem;
  font-weight: 800;
  color: #111;
  border-bottom: 2.5px solid var(--brand);
  padding-bottom: .45rem;
  margin-top: 1.5rem;
  margin-bottom: .9rem;
}

/* H2 节标题 */
h2.anchored {
  font-size: 1.28rem;
  font-weight: 700;
  color: #111;
  margin-top: 2.1rem;
  margin-bottom: .65rem;
  padding-bottom: .3rem;
  border-bottom: 1.5px solid #E8E8E8;
}

/* H3 小节标题 */
h3.anchored {
  font-size: 1.07rem;
  font-weight: 700;
  color: #222;
  margin-top: 1.7rem;
  margin-bottom: .45rem;
}

/* H4 */
h4.anchored {
  font-size: .97rem;
  font-weight: 600;
  color: #333;
  margin-top: 1.2rem;
}

/* ════════════════════════════════════════
   正文链接
   ════════════════════════════════════════ */
/* 内容区链接（避免影响侧边栏/导航） */
.quarto-content a:not(.sidebar-link):not(.nav-link):not(.navbar-brand):not(.btn):not([class*="nav-page"]) {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.quarto-content a:not(.sidebar-link):not(.nav-link):not(.navbar-brand):not(.btn):not([class*="nav-page"]):hover {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
}

/* ════════════════════════════════════════
   表格
   ════════════════════════════════════════ */
.quarto-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-bottom: 1.5rem;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.quarto-content thead th {
  background-color: var(--brand-light);
  color: #111;
  font-weight: 700;
  padding: .6rem .85rem;
  border-bottom: 2px solid var(--brand);
  text-align: left;
  white-space: nowrap;
}
.quarto-content tbody tr {
  border-bottom: 1px solid #F2F2F2;
  transition: background .1s;
}
.quarto-content tbody tr:hover { background-color: #FFFBF4; }
.quarto-content tbody td {
  padding: .5rem .85rem;
  vertical-align: top;
}
.quarto-content tbody tr:nth-child(even) {
  background-color: #FDFCF9;
}

/* ════════════════════════════════════════
   目录（右侧浮动 TOC）
   ════════════════════════════════════════ */
#TOC a {
  color: #666;
  font-size: .83rem;
  text-decoration: none;
  transition: color .12s;
}
#TOC a:hover,
#TOC a.active {
  color: var(--brand);
}
#TOC .active {
  color: var(--brand);
}

/* ════════════════════════════════════════
   页内 Callout 微调（补充 lianxhcn 样式）
   ════════════════════════════════════════ */
.callout {
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
  margin: 1.35rem 0;
}
.callout-header {
  font-size: .93rem;
  letter-spacing: .01em;
}

/* ════════════════════════════════════════
   前/下一章导航
   ════════════════════════════════════════ */
.nav-page {
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .75rem 1rem;
  transition: border-color .15s, box-shadow .15s;
  text-decoration: none !important;
}
.nav-page:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.nav-page .nav-page-text {
  color: var(--brand) !important;
  font-weight: 600;
  font-size: .9rem;
}

/* ════════════════════════════════════════
   页脚
   ════════════════════════════════════════ */
.nav-footer {
  border-top: 1px solid var(--brand-border);
  background: #fff;
  color: #999;
  font-size: .82rem;
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.nav-footer a {
  color: #777;
  text-decoration: none;
}
.nav-footer a:hover { color: var(--brand); }

/* ════════════════════════════════════════
   章节 metadata（日期/作者块）
   ════════════════════════════════════════ */
.quarto-title-meta {
  font-size: .81rem;
  color: #999;
  margin-top: .3rem;
}

/* ════════════════════════════════════════
   移动端
   ════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .quarto-title .title,
  h1.title {
    font-size: 1.5rem;
  }
  h2.anchored { font-size: 1.15rem; }
  h3.anchored { font-size: 1rem; }

  .quarto-content table {
    font-size: .83rem;
    display: block;
    overflow-x: auto;
    box-shadow: none;
  }
}

/* ── 术语 tooltip（abbr-expand.lua 生成）── */
abbr.abbr-term {
  text-decoration: underline dotted var(--brand);
  cursor: help;
  text-underline-offset: 3px;
}
