/* ===== 自定义首页样式（宽屏 · 简洁清爽） ===== */

/* 全站宽屏：容器放宽到 1200px（首页与所有内页统一宽度） */
.container {
  position: relative;
  width: 100%;
  max-width: 1200px;
}
.container .content-wrapper {
  padding: 0 40px;
}

/* ---------- 首屏 Hero ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 3rem;
  padding: 3.4rem 0 3rem;
  border: none;
  border-radius: 20px;
  background:
    radial-gradient(120% 120% at 88% 10%, rgba(37, 99, 235, 0.12), transparent 55%),
    linear-gradient(180deg, #eff4fd 0%, #ffffff 100%);
}
.home-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 2.5rem;
  padding: 0 3rem;
}
.home-hero-eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.28rem 0.85rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 999px;
}
.home-hero-title {
  margin: 0 0 1.1rem;
  font-size: 3rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1f2d3d;
}
.home-hero-title .accent {
  color: #2563eb;
}
.home-hero-subtitle {
  margin: 0 0 1.9rem;
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #6b7280;
}
.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}
.home-hero-btn {
  display: inline-block;
  padding: 0.7rem 1.8rem;
  font-size: 0.98rem;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.home-hero-btn.primary {
  color: #fff;
  background: #2563eb;
  border: 1px solid #2563eb;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}
.home-hero-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34);
}
.home-hero-btn.ghost {
  color: #34495e;
  background: #fff;
  border: 1px solid #e3e6ea;
}
.home-hero-btn.ghost:hover {
  color: #2563eb;
  border-color: #2563eb;
}

/* 首屏数据统计 */
.home-hero-stats {
  display: flex;
  gap: 2.4rem;
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
}
.home-hero-stats li {
  display: flex;
  flex-direction: column;
}
.home-hero-stats strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2d3d;
}
.home-hero-stats span {
  font-size: 0.82rem;
  color: #9aa0a6;
}

/* 右侧：CSS 绘制的「浏览器窗口」装饰，无需图片素材 */
.home-hero-visual {
  display: flex;
  justify-content: center;
}
.hero-window {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(31, 45, 61, 0.12);
}
.hero-window-bar {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f1f4;
}
.hero-window-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e6e8ec;
}
.hero-window-bar i:first-child {
  background: #2563eb;
}
.hero-window-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 20px 30px;
}
.hero-line {
  height: 10px;
  border-radius: 6px;
  background: #eef0f3;
}
.hero-line.accent {
  background: rgba(37, 99, 235, 0.55);
}
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }

/* ---------- 功能卡片 ---------- */
.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
  margin-bottom: 1rem;
}
.home-feature-card {
  display: block;
  padding: 1.8rem 1.6rem;
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 16px;
  text-decoration: none;
  color: #2c3e50;
  box-shadow: 0 2px 10px rgba(31, 45, 61, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.home-feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 16px 34px rgba(31, 45, 61, 0.1);
}
.home-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 14px;
}
.home-feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.12rem;
  font-weight: 700;
}
.home-feature-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #8a8f98;
  line-height: 1.7;
}

/* 文章列表（首页/文章页/分类页）：宽屏下改为两列卡片网格，充分利用横向空间 */
.container .posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
  .home-hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 2rem;
  }
  .home-hero-title {
    font-size: 2.4rem;
  }
  .home-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .container .posts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container .content-wrapper {
    padding: 0 20px;
  }
  .home-hero {
    padding: 2.2rem 0;
    border-radius: 14px;
  }
  .home-hero-inner {
    padding: 0 1.4rem;
  }
  .home-hero-title {
    font-size: 1.9rem;
  }
  .home-hero-visual {
    display: none;
  }
  .home-hero-stats {
    gap: 1.4rem;
  }
  .home-features {
    grid-template-columns: 1fr;
  }
}

/* ===== 文章列表页（/post/）：卡片式样式 ===== */

/* 1. 列表容器：改为纵向卡片流，去掉主题的底部分隔线 */
.posts {
  margin-bottom: 2rem;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 3. 取消相邻文章之间主题自带的顶部分隔线 */
.posts .post + .post {
  border-top: none;
}

/* 4. 单张卡片外层 */
.posts .post {
  padding: 1.4rem 1.6rem;
  background: #ffffff;
  border: 1px solid #ebedf0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.posts .post:hover {
  transform: translateY(-3px);
  border-color: #e0e3e8;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

/* 5. 卡片内容：左文字 + 右配图 */
.posts .post-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: inherit;
  text-decoration: none;
}

.posts .post-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

/* 6. 主标题 */
.posts .post-card-title {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  color: #2c3e50;
  font-family: Athelas, STHeiti, "Microsoft Yahei", serif;
  transition: color 0.15s ease;
}

.posts .post-card:hover .post-card-title {
  color: #2563eb;
}

/* 7. 简介文字：最多两行，超出省略 */
.posts .post-card-desc {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 8. 右侧配图：200×125，不裁剪，比例不符时上下留白 */
.posts .post-card-thumb {
  flex: 0 0 200px;
  width: 200px;
  height: 125px;
  border-radius: 8px;
  overflow: hidden;
}

.posts .post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
}

.posts .post-card:hover .post-card-thumb img {
  transform: scale(1.05);
}

/* 9. 移动端：配图移到标题上方，占满整行 */
@media (max-width: 768px) {
  .posts .post {
    padding: 1.1rem 1.1rem;
  }
  .posts .post-card {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 1rem;
  }
  .posts .post-card-thumb {
    flex-basis: auto;
    width: 100%;
    height: 170px;
  }
  .posts .post-card-title {
    font-size: 1.2rem;
  }
}

/* ===== 单篇文章页：正文里的 H1（# 标题）样式 ===== */
/* 页面标题由模板渲染（.post-title）；正文里的 # 标题改为「居中标题」，
   去掉底纹和左侧色条，避免看起来像引用块 */
.post-content h1 {
  margin: 2.4rem 0 1.4rem;
  padding: 0;
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  color: #2c3e50;
  background: none;
  border: none;
}

/* 标题下方的小装饰线，居中 */
.post-content h1::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin: 0.6rem auto 0;
  background: #2563eb;
  border-radius: 2px;
}

/* 正文开头的第一个 H1 离页面标题近一点 */
.post-content > h1:first-child {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .post-content h1 {
    font-size: 1.35rem;
  }
}

/* ===== 图片网格（gallery 短代码 / .photo-grid） ===== */
/* 用法：md 里 {{< gallery >}}，或直接写 <div class="photo-grid"> … </div> */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 14px;
  margin: 1.5rem 0;
}

/* 内层若被包成 <p>，用 contents 让里面的 img 直接参与网格 */
.photo-grid > p {
  display: contents;
}

.photo-grid img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 8px;
}

@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 正文单图收窄（narrow 短代码 / .post-img-narrow） ===== */
/* 用法：
     {{% narrow %}}
     ![说明](img/xxx.jpg)
     {{% /narrow %}}
   让长图（截图、对账单之类）在 PC 上只占正文一半宽并居中，不至于占满整行。
   想改比例给短代码加 width="70"，对应下面的 --post-img-w 变量。 */
.post-content .post-img-narrow {
  width: var(--post-img-w, 50%);
  max-width: 100%;
  margin: 1.5rem auto;
}

/* 短代码内层的 markdown 会被包成 <p>，去掉它自带的上下边距，避免多余空白 */
.post-content .post-img-narrow p {
  margin: 0;
}

.post-content .post-img-narrow img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

/* 手机上恢复整宽：半宽在窄屏上会小到看不清 */
@media (max-width: 768px) {
  .post-content .post-img-narrow {
    width: 100%;
    margin: 1.2rem auto;
  }
}

/* ===== 单篇文章页：正文行距 ===== */
/* 中文长文阅读更舒适，段落之间也稍微拉开一点 */
.post-content {
  line-height: 1.9;
}

.post-content p {
  margin: 1.2em 0;
}

@media (max-width: 768px) {
  .post-content {
    line-height: 1.85;
  }
}

/* ===== 首页：区块小标题栏 ===== */
.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ececec;
}

.home-section-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.home-more {
  font-size: 0.85rem;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
}

.home-more:hover {
  text-decoration: underline;
}

/* 首页「最新文章」复用列表卡片样式 */
.home-posts .posts {
  margin-bottom: 0;
}

/* ===== 首页：分类胶囊 ===== */
.home-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.home-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  color: #34495e;
  background: #f7f7f7;
  border: 1px solid #ececec;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.home-chip span {
  font-size: 0.72rem;
  color: #9aa0a6;
}

.home-chip:hover {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.home-chip:hover span {
  color: rgba(255, 255, 255, 0.8);
}

/* ===== 首页：投资大纲全文卡片 ===== */
.home-dagang {
  margin: 2.5rem 0;
}

.home-dagang-card {
  position: relative;
  padding: 2.4rem 2rem 1rem;
  background: linear-gradient(180deg, #fafbff 0%, #ffffff 55%);
  border: 1px solid #eceef5;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.06);
  overflow: hidden;
}

.home-dagang-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.home-dagang-card h1:first-child {
  margin: 0 0 1.6rem;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #1f2d3d;
}

.home-dagang-card h1:first-child::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin: 0.7rem auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.home-dagang-card h2 {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  color: #34495e;
  margin: 1.6rem 0 1rem;
}

.home-dagang-card ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 0.5rem;
}

.home-dagang-card li {
  padding: 0.75rem 1rem;
  margin-bottom: 0.55rem;
  background: #fff;
  border: 1px solid #f0f1f6;
  border-radius: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-dagang-card li:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
  border-color: #dbeafe;
}

.home-dagang-card a {
  color: #2563eb;
  text-decoration: none;
}

.home-dagang-card a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .home-dagang {
    margin-top: 2rem;
  }

  .home-dagang-card {
    padding: 1.6rem 1.2rem 0.8rem;
  }

  .home-dagang-card h1:first-child {
    font-size: 1.4rem;
    letter-spacing: 2px;
  }
}

@media (max-width: 768px) {
  .home-section-head {
    margin-top: 2rem;
  }
}

/* ===== 单篇文章页：正文表格 ===== */
.post-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin: 1.2rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.post-content th,
.post-content td {
  padding: 8px 14px;
  border: 1px solid #e8e8e8;
  text-align: left;
  white-space: nowrap;
}

.post-content thead th {
  background: #faf7f0;
  font-weight: 600;
  color: #2c3e50;
}

.post-content tbody tr:nth-child(even) {
  background: #fbfbfb;
}

/* ===== 财务自由进度表（progress 短代码 / .ff-progress） ===== */
/* 数据来自文章 front matter 的 progress 列表。
   进度条按 0–100% 的真实比例绘制、不做缩放，避免"看着像快完成了"的错觉。 */
.post-content table.ff-progress {
  display: table;
  table-layout: fixed;
  overflow: visible;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.post-content .ff-progress th,
.post-content .ff-progress td {
  border: 0;
  padding: 0.55rem 0.6rem;
  vertical-align: middle;
}

.post-content .ff-progress thead th {
  background: transparent;
  border-bottom: 1px solid #ececec;
  color: #9aa0a6;
  font-weight: 400;
  font-size: 0.82rem;
}

.post-content .ff-progress tbody tr:nth-child(even) {
  background: transparent;
}

/* 列宽：年份/百分比固定，进度条吃掉剩余空间 */
.post-content .ff-progress .ff-col-year {
  width: 4.2rem;
}

.post-content .ff-progress .ff-col-pct {
  width: 4rem;
  text-align: right;
}

.post-content .ff-progress .ff-year,
.post-content .ff-progress .ff-pct {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-content .ff-progress .ff-pct {
  color: #2563eb;
  font-weight: 600;
}

/* 进度条：底槽 + 填充 */
.post-content .ff-progress .ff-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  overflow: hidden;
}

.post-content .ff-progress .ff-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.post-content .ff-progress .ff-note {
  color: #9aa0a6;
  font-size: 0.85rem;
}

/* ===== 分类/标签术语页 ===== */
/* 复用 .posts 卡片样式，这里只补标题 */
.term-posts .term-title {
  margin: 0 0 1.5rem;
  padding-bottom: 0.6rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 1px solid #ececec;
}

.term-posts .posts {
  margin-bottom: 0;
}

/* ===== 首页：财务自由进度图 ===== */
.home-progress {
  margin: 2.5rem 0;
}

.home-progress-card {
  position: relative;
  padding: 2rem 2rem 1.4rem;
  background: linear-gradient(180deg, #fafbff 0%, #ffffff 55%);
  border: 1px solid #eceef5;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.06);
  overflow: hidden;
}

.home-progress-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.home-progress-goal {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
  white-space: nowrap;
}

.progress-bars {
  margin-top: 0.6rem;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.progress-year {
  flex: 0 0 3.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #34495e;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  flex: 1 1 auto;
  height: 16px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  width: 0;
  animation: progress-grow 1s ease-out forwards;
}

@keyframes progress-grow {
  from { width: 0; }
  to { width: var(--w, 100%); }
}

.progress-pct {
  flex: 0 0 3rem;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}

.progress-foot {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #9aa0a6;
}

@media (max-width: 768px) {
  .home-progress-card {
    padding: 1.6rem 1.2rem 1.2rem;
  }

  .progress-row {
    gap: 0.6rem;
    margin-bottom: 0.8rem;
  }

  .progress-year {
    flex-basis: 2.8rem;
    font-size: 0.88rem;
  }

  .progress-pct {
    flex-basis: 2.6rem;
    font-size: 0.88rem;
  }
}

/* ===== 站点标题（Logo）英文字体 ===== */
/* 主题默认用 Chancery 花体；这里把英文换成更清爽的衬线体，
   中文字形仍走 LiSu（隶书），保持原样 */
.header .logo-wrapper .logo,
.mobile-navbar .mobile-header-logo .logo {
  font-family: Georgia, "Times New Roman", "Songti SC", LiSu, "STLiti", serif;
  letter-spacing: 0.5px;
}

/* ===== 内页宽屏适配 ===== */

/* 归档页：解除主题默认 550px 的宽度限制，跟随宽屏容器 */
.archive {
  max-width: none;
}

/* 文章页：正文 + 右侧目录 两栏布局；目录用原生 sticky 吸附（无 JS、无内联样式） */
@media (min-width: 1186px) {
  .container.is-single .post {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    column-gap: 40px;
    align-items: start;
  }
  .container.is-single .post-main {
    grid-column: 1;
    min-width: 0;
  }
  .container.is-single .post-aside {
    grid-column: 2;
    position: sticky;
    top: 30px;
    align-self: start;
  }
  /* 取消主题对目录的绝对定位与固定左边距，改由 grid + sticky 接管 */
  .container.is-single .post .post-toc {
    position: static;
    width: auto;
    margin-left: 0;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: #f6f8fc;
    border: 1px solid #e9eef6;
    box-shadow: 0 6px 18px rgba(31, 45, 61, 0.06);
  }
}
