/* ═══ 站点补充样式（在 style.css 之后加载）═══ */

/* 本站不使用右侧常驻栏：归零留白 */
body { --railw: 0px; }
#dash-rail, #era-rail { display: none; }

/* 入场动画 */
.rev { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s cubic-bezier(.25,.7,.3,1); }
.rev.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rev { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* 思维导图容器 */
#mindmap-chart svg { background: #f4fafd; border: 1px solid var(--line-lo); border-radius: 6px; }
#mindmap-chart svg text { user-select: none; }

/* 各图表 SVG 文字选择禁用 */
.chart-frame svg text { user-select: none; }

/* 思维导图工具条 */
.mm-tools { display: flex; gap: 8px; margin: 0 0 10px; }
.mm-tools button {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--ink-md); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer;
}
.mm-tools button:hover { border-color: var(--red); color: var(--red); }

/* 图注 */
.fig-cap { font-family: var(--mono); font-size: 10px; color: var(--ink-lo); margin-top: 8px; }

/* 代码徽标（蓝图名） */
code.bp {
  font-family: var(--mono); font-size: .86em;
  background: var(--paper-hi); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 5px; color: var(--ink); white-space: nowrap;
}

/* 封面单画布 */
#cover-canvas-x, #cover-canvas-w { display: none; }

/* 响应式：窄屏图表横向滚动 */
@media (max-width: 980px) {
  .fig-xscroll { overflow-x: auto; }
  .fig-xscroll > svg, .fig-xscroll > canvas { min-width: 760px; }
}

/* ═══ 覆盖层：红紫强调色 + 长文本防溢出 ═══ */

/* 重点强调改用红紫对比色（与蓝色主调互补，小面积使用） */
em { color: var(--neg); }
::selection { background: rgba(160, 0, 109, .14); }

/* 长英文/路径/文件名 token 允许断行，避免撑破居中栏宽 */
.prose p, .prose li, .prose td, .prose h2, .prose h3,
.t-gist, .t-full, .t-more p, .dek, .muted, .cover-lede, .cover-anchor,
.fig-cap, .s-fact, .s-cite, .colophon {
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { overflow-wrap: anywhere; }

/* 代码徽标与数字单元格取消强制不换行 */
code.bp { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
table.dt td.num { white-space: normal; overflow-wrap: anywhere; }

/* 图表不越出版心 */
.chart-frame svg, .fig-xscroll svg, #mindmap-chart svg { max-width: 100%; }

/* ═══ 导航双件：顶部流体横条（约1.3倍）+ 右侧弹性弹出卡片 ═══ */
.fnav-brand {
  font-weight: 800; letter-spacing: .01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: color .3s;
}
.fnav-brand:hover { color: var(--red); }
.fnav-items { position: relative; display: flex; align-items: center; gap: 3px; }
.fnav-items a {
  position: relative; z-index: 2; cursor: pointer; text-decoration: none;
  font-family: var(--mono); font-weight: 600;
  color: var(--ink-md); white-space: nowrap;
  transition: color .3s;
}
.fnav-items a:hover { color: var(--red); }
.fnav-items a.active { color: #ffffff; }
.fnav-blob {
  position: absolute; z-index: 1; left: 0; top: 0; width: 0; height: 0;
  background: linear-gradient(135deg, #3a72cf, #2b4f96);
  opacity: 0;
  transition: left .45s cubic-bezier(.3,.85,.3,1), top .45s cubic-bezier(.3,.85,.3,1),
              width .45s cubic-bezier(.3,.85,.3,1), height .45s cubic-bezier(.3,.85,.3,1),
              opacity .25s;
}

/* 顶部横条：进入网页时居中置顶 */
#fnav-top {
  position: fixed; z-index: 200; top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line-lo); border-radius: 999px;
  box-shadow: 0 10px 34px rgba(5, 28, 44, .13);
  transition: opacity .35s ease, transform .35s ease;
}
#fnav-top.fnav-hide {
  opacity: 0; transform: translateX(-50%) translateY(-18px); pointer-events: none;
}
#fnav-top .fnav-brand { font-size: 17px; padding: 6px 12px; }
#fnav-top .fnav-items a { font-size: 16px; padding: 8px 18px; border-radius: 999px; }
#fnav-top .fnav-blob { border-radius: 999px; }

/* 右侧卡片：滚过封面后从右往左弹性弹出 */
#fnav-side {
  position: fixed; z-index: 200; right: 16px; top: 50%;
  transform: translateY(-50%) translateX(70px) scale(.82);
  opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 12px; background: #ffffff;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 40px rgba(5, 28, 44, .16);
  transition: transform .55s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
}
#fnav-side.show {
  opacity: 1; transform: translateY(-50%) translateX(0) scale(1); pointer-events: auto;
}
#fnav-side .fnav-brand {
  font-size: 12px; text-align: center; padding: 2px 6px 9px;
  border-bottom: 1px solid var(--line-lo); margin-bottom: 7px;
}
#fnav-side .fnav-items { flex-direction: column; align-items: stretch; gap: 3px; }
#fnav-side .fnav-items a { font-size: 14px; padding: 8px 16px; border-radius: 9px; }
#fnav-side .fnav-blob { border-radius: 9px; }

@media (max-width: 980px) {
  #fnav-side { display: none; }
  #fnav-top { max-width: calc(100vw - 20px); }
  #fnav-top .fnav-items { overflow-x: auto; scrollbar-width: none; }
  #fnav-top .fnav-brand { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #fnav-top, #fnav-side, .fnav-blob, .fnav-items a, .fnav-brand { transition: none !important; }
}

/* ═══ 字号补偿：正文放大后的局部微调 ═══ */
.chip { font-size: 13px; }
table.dt { font-size: 15px; }
table.dt td.num { font-size: 13px; }

/* ═══ 图表缩放按钮（＋/－/复位） ═══ */
.chart-frame { position: relative; }
.zoom-tools {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  display: flex; gap: 6px;
}
.zoom-tools button {
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer;
  font-family: var(--mono); font-size: 15px; font-weight: 700; line-height: 1;
  color: var(--ink-md); background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(5, 28, 44, .10);
  transition: color .2s, border-color .2s, transform .15s;
}
.zoom-tools button:hover { color: var(--red); border-color: var(--red); transform: scale(1.08); }

/* ═══ 子文章页通用样式 ═══ */
body.article-page {
  background: transparent;
}
#article-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1;
  pointer-events: none;
}
.article-cover {
  position: relative; min-height: 58vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 84px 24px 28px; border-bottom: 1px solid var(--line-lo);
  overflow: hidden;
}
.article-cover-inner {
  position: relative; z-index: 2; max-width: 1120px; width: 100%; margin: 0 auto;
  padding: 20px 34px 22px; border-radius: 16px;
  background: rgba(255,255,255,.84);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,.94);
  box-shadow: 0 20px 50px rgba(5,28,44,.12), inset 0 0 0 1px rgba(255,255,255,.75);
}
.article-cover .cover-kicker { margin-bottom: 8px; color: var(--red); }
.article-cover h1 { font-size: clamp(28px, 3.8vw, 46px); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; margin-bottom: 8px; }
.article-cover .cover-sub { margin: 0 0 4px; font-size: clamp(14px, 1.45vw, 17px); color: var(--ink-md); }
.article-cover .cover-anchor { font-size: 12.5px; color: var(--ink-lo); margin-top: 6px; }
.article-cover .cover-anchor a { color: var(--blue); }
.article-cover .cover-anchor code.bp { font-size: .92em; }

/* 向下滚动按钮 — 位于 .article-cover-inner 底部，紧贴标题下方 */
.scroll-down {
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%);
  width: 38px; height: 38px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.85);
  border: 1px solid var(--line); color: var(--red);
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(5,28,44,.10);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform .2s, border-color .2s, color .2s;
  animation: bounceDown 2s ease-in-out infinite;
  pointer-events: auto; z-index: 3;
}
.scroll-down:hover { transform: translateX(-50%) translateY(3px); border-color: var(--red); color: var(--red-hi); }
@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

.article-body {
  position: relative; z-index: 1; max-width: 860px; margin: 0 auto;
  padding: 28px 34px 80px;
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  border-left: 1px solid var(--line-lo); border-right: 1px solid var(--line-lo);
  box-shadow: 0 0 60px rgba(5,28,44,.05);
}
.article-body h2 { font-size: clamp(24px, 2.6vw, 32px); margin-top: 48px; }
.article-body h3 { font-size: 19px; margin-top: 32px; color: var(--ink); }
.article-body h4 { font-size: 16px; margin-top: 22px; color: var(--ink-md); }
.article-body ul, .article-body ol { margin: 0 0 18px 22px; }
.article-body li { margin-bottom: 8px; }
.article-body li::marker { color: var(--red); }
pre.code-block {
  background: #f6f9fb; border: 1px solid var(--line); border-radius: 6px;
  padding: 16px 18px; overflow-x: auto; margin: 14px 0 18px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
}
pre.code-block code { font-family: inherit; color: var(--ink); white-space: pre; }
.article-body blockquote { margin: 28px 0; }
.article-note { display: flex; gap: 12px; align-items: flex-start; margin: 26px 0; padding: 16px 18px; background: var(--paper-hi); border-radius: 6px; font-size: 14px; color: var(--ink-md); }
.article-note::before { content: "i"; flex: 0 0 22px; height: 22px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; text-align: center; line-height: 22px; }
.exp-line { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 26px; }
.exp-line pre { margin-bottom: 6px; }
.exp-line p { margin: 0 0 4px; padding-left: 4px; border-left: 2px solid var(--line); font-size: 14px; color: var(--ink-md); }
.exp-line p strong { color: var(--ink); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-md); text-decoration: none; margin-bottom: 18px; }
.back-link:hover { color: var(--red); }
@media (max-width: 900px) {
  .article-cover { min-height: 48vh; padding-top: 78px; }
  .article-cover-inner { padding: 16px 20px 18px; border-radius: 12px; }
  .article-body { padding: 20px 20px 60px; }
  .scroll-down { bottom: 12px; width: 34px; height: 34px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #article-canvas { display: none; }
  .scroll-down { animation: none; }
}
