/* ============================================================
   LUCERNA — 研究文章页（博客式，共享样式）
   ============================================================ */

.article-wrap {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 56px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 28px 90px;
}

/* ---------- 左侧固定目录 ---------- */
.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.toc-head {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--faint);
  margin-bottom: 14px;
}
.toc ol {
  list-style: none;
  border-left: 1px solid var(--line);
}
.toc a {
  position: relative;
  display: block;
  padding: 7px 0 7px 16px;
  font-size: 0.84rem;
  color: var(--dim);
  transition: color 0.2s;
}
.toc a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.2s, transform 0.2s;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--gold); }
.toc a.active::before { opacity: 1; transform: scaleY(1); }

/* ---------- 文章主体 ---------- */
.article { min-width: 0; }
.article-meta {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--faint);
}
.article-title {
  font-family: var(--font-cn);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  line-height: 1.5;
  text-align: center;
  color: var(--ink);
  margin: 14px 0 8px;
}
.article-sub {
  text-align: center;
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--faint);
  margin-bottom: 42px;
}

.article h2 {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 12px;
  scroll-margin-top: 92px;
}
.article h3 {
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 10px;
  scroll-margin-top: 92px;
}
.article h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0 8px;
}
.article p {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #34373d;
  margin-bottom: 12px;
}
.article p.no-indent { margin-top: 14px; }
.article .en {
  font-family: var(--font-en);
  font-weight: 500;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84em;
  background: #f2f3f6;
  color: #b02a4c;
  padding: 1px 6px;
  border-radius: 4px;
}

/* 引用 */
.article blockquote {
  font-family: "楷体", "KaiTi", "STKaiti", serif;
  font-size: 0.98rem;
  line-height: 1.95;
  color: #454a53;
  background: var(--soft);
  border-left: 3px solid var(--gold);
  padding: 14px 20px;
  margin: 18px 0;
}
.article blockquote cite {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--faint);
}

/* 链接 */
.doc-link {
  color: var(--link);
  border-bottom: 1px solid rgba(26, 86, 219, 0.35);
  transition: border-color 0.2s;
}
.doc-link:hover { border-color: var(--link); }

.dl-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px;
  padding: 8px 18px 8px 14px;
  background: #ffedd2;
  border: 1px solid #ffc47a;
  border-radius: 6px;
  color: #8a4b0e;
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.2s, transform 0.2s;
}
.dl-link:hover { background: #ffe2b3; transform: translateY(-1px); }
.dl-link::before { content: "↓"; font-weight: 700; }
.dl-link::after {
  content: "下载";
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  background: var(--gold);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(184, 116, 31, 0.35);
}

/* 代码框 */
.code-block {
  background: #14161c;
  border-radius: 10px;
  overflow: hidden;
  margin: 18px 0;
  box-shadow: 0 8px 28px rgba(20, 22, 26, 0.12);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #1d2027;
}
.code-head .file {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #9aa1ad;
}
.copy-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #c3cad6;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  padding: 3px 10px;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.code-block pre {
  padding: 14px 16px;
  overflow-x: auto;
}
.code-block code {
  background: none;
  color: #d4d4d4;
  padding: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.7;
}
.tok-kw { color: #c586c0; }
.tok-str { color: #ce9178; }
.tok-com { color: #6a9955; font-style: italic; }
.tok-num { color: #b5cea8; }
.tok-pre { color: #569cd6; }
.tok-fn { color: #dcdcaa; }

/* 媒体 */
.media, .figure { margin: 20px 0; }
.media video, .figure img {
  width: 100%;
  display: block;
  background: #000;
  border-radius: 10px;
}
.media figcaption, .figure figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--faint);
}

/* 表格 */
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
  font-size: 0.88rem;
}
.article th,
.article td {
  border: 1px solid #e2e4e9;
  padding: 8px 12px;
  text-align: left;
  line-height: 1.7;
}
.article th { background: var(--soft); font-weight: 700; }

/* 列表 */
.article ul,
.article ol {
  margin: 8px 0 14px 1.5em;
  font-size: 0.92rem;
  line-height: 1.9;
  color: #34373d;
}

/* 页脚 */
.article-foot {
  margin-top: 52px;
  padding-top: 16px;
  font-size: 0.76rem;
  color: var(--faint);
  line-height: 1.9;
}

/* 响应式 */
@media (max-width: 900px) {
  .article-wrap { grid-template-columns: 1fr; gap: 24px; }
  .toc { display: none; }
}
