
/* ================= 文章正文排版样式（平台统一）=================
 *
 * 一处定义、两处消费：
 *   · 后台「AI 写作」工作台的**详情页预览**（经只读接口 `GET /sites/{id}/article-styles`
 *     取回本串注入 <style>）；
 *   · 站点构建时的**详情页正文**（物化期把本串写进 `static/css/nebula-article.css` 并引入
 *     <head>，同时给正文容器挂上 id=`ARTICLE_VIEW_ID` 与 `article-view article--{key}` 两个类）。
 *
 * 选择器一律以 `#nebula-article-view` 打头（id 级权重）：正文是嵌进主题页面渲染的，主题常见的
 * `.arc .content h2` 这类后代选择器权重是 (0,2,1)，普通类选择器 (0,1,1) 压不过，会被改成主题的
 * 样子（标题被塞进 50px 内距、渐变侧标压在字上）。抬到 id 级即稳过，不再依赖加载顺序。
 *
 * 纪律：本文件**只依赖 currentColor 与自带的 CSS 变量**，不引用后台的 `--text-1` / `--bg-2`
 * 等壳层变量 —— 站点主题里根本没有这些变量。文字色一律 `inherit`，跟随主题；强调色走
 * `--art-accent`（各套自带、主题可覆盖）。这样同一份样式放到任何主题里都不会"串色"。
 *
 * 九套样式（key → 定位）：
 *   · `minimal`   极简阅读 —— 单栏大留白、细分割线，通用兜底
 *   · `magazine`  杂志长文 —— 衬线标题、章节序号、导语首字下沉、金句引用
 *   · `data`      数据对比 —— 左侧强调标题、斑马表格、数字高亮
 *   · `tech`      科技蓝调 —— 渐变侧标、等宽小标签、代码块强化
 *   · `elegant`   雅致衬线 —— 居中标题、宽字距、上下细线、正文两端对齐
 *   · `newspaper` 报刊专栏 —— 双线报头式标题、密排正文、沉稳衬线
 *   · `card`      卡片分区 —— 标题做成色块胶囊、区块如卡片
 *   · `bold`      醒目大字 —— 超大粗标题、荧光笔强调、下划短线
 *   · `notebook`  手记便签 —— 楷体手写感、暖色引用便签、网格底纹
 */

#nebula-article-view {
  --art-accent: #2563eb;
  --art-muted: color-mix(in srgb, currentColor 58%, transparent);
  --art-line: color-mix(in srgb, currentColor 16%, transparent);
  --art-soft: color-mix(in srgb, currentColor 5%, transparent);
  max-width: 46rem;
  margin: 0 auto;
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.85;
  color: inherit;
  overflow-wrap: anywhere;
}

/* ---------------- 基础元素 ---------------- */

#nebula-article-view > *:first-child {
  margin-top: 0;
}

#nebula-article-view h1 {
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

#nebula-article-view h2 {
  font-size: 1.4rem;
  line-height: 1.4;
  font-weight: 700;
  margin: 2.1em 0 0.7em;
}

#nebula-article-view h3 {
  font-size: 1.12rem;
  line-height: 1.5;
  font-weight: 600;
  margin: 1.5em 0 0.5em;
}

#nebula-article-view p {
  margin: 0.95em 0;
}

#nebula-article-view strong {
  font-weight: 650;
}

#nebula-article-view a {
  color: var(--art-accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--art-accent) 35%, transparent);
}

#nebula-article-view a:hover {
  border-bottom-color: currentColor;
}

#nebula-article-view ul,
#nebula-article-view ol {
  margin: 0.95em 0;
  padding-left: 1.45em;
}

#nebula-article-view li {
  margin: 0.4em 0;
}

#nebula-article-view li::marker {
  color: var(--art-accent);
}

#nebula-article-view img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.2em auto;
  border-radius: 12px;
}

#nebula-article-view figure {
  margin: 1.2em 0;
}

#nebula-article-view figcaption {
  margin-top: 0.5em;
  font-size: 0.85em;
  text-align: center;
  color: var(--art-muted);
}

#nebula-article-view blockquote {
  margin: 1.2em 0;
  padding: 0.4em 1.1em;
  border-left: 3px solid var(--art-accent);
  border-radius: 0 10px 10px 0;
  background: var(--art-soft);
  color: var(--art-muted);
}

#nebula-article-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.3em 0;
  font-size: 0.94em;
}

#nebula-article-view th,
#nebula-article-view td {
  border: 1px solid var(--art-line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

#nebula-article-view th {
  background: var(--art-soft);
  font-weight: 650;
}

#nebula-article-view code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--art-soft);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

#nebula-article-view pre {
  margin: 1.2em 0;
  padding: 14px 16px;
  border: 1px solid var(--art-line);
  border-radius: 12px;
  background: var(--art-soft);
  overflow: auto;
}

#nebula-article-view pre code {
  background: none;
  padding: 0;
}

#nebula-article-view hr {
  border: none;
  border-top: 1px solid var(--art-line);
  margin: 2em 0;
}

/* 导语段（正文的第一个自然段，紧随 H1 / 标题）—— 各套样式都给它一个"引子"的位置感。
 * 用 `> p:first-of-type` 而非专门的类：详情页里 H1 由主题单独渲染、正文容器内首段即导语；
 * 后台预览里 H1 在容器内、首段同样是导语 —— 一处规则两边都对得上，不必额外注入类名。 */
#nebula-article-view > p:first-of-type {
  font-size: 1.08em;
  color: var(--art-muted);
}

/* ================= ① 极简阅读 ================= */

#nebula-article-view.article--minimal {
  line-height: 1.9;
}

#nebula-article-view.article--minimal h2 {
  margin-top: 2.5em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--art-line);
}

#nebula-article-view.article--minimal h3 {
  color: var(--art-muted);
}

#nebula-article-view.article--minimal > p:first-of-type {
  font-size: 1.12em;
  line-height: 1.85;
}

/* ================= ② 杂志长文 ================= */

#nebula-article-view.article--magazine {
  counter-reset: art-h2;
  font-family: Georgia, 'Songti SC', 'Noto Serif SC', 'Times New Roman', serif;
  font-size: 17.5px;
  line-height: 1.95;
}

#nebula-article-view.article--magazine h1 {
  font-size: 2.35rem;
  line-height: 1.25;
}

#nebula-article-view.article--magazine h2 {
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  margin-top: 2.7em;
  font-size: 1.5rem;
}

#nebula-article-view.article--magazine h2::before {
  content: counter(art-h2, decimal-leading-zero);
  counter-increment: art-h2;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--art-accent);
}

#nebula-article-view.article--magazine > p:first-of-type::first-letter {
  float: left;
  padding: 0.04em 0.12em 0 0;
  font-size: 3.4em;
  line-height: 0.86;
  font-weight: 700;
  color: var(--art-accent);
}

#nebula-article-view.article--magazine blockquote {
  border-left-width: 4px;
  font-size: 1.15em;
  font-style: italic;
}

/* ================= ③ 数据对比 ================= */

#nebula-article-view.article--data {
  --art-accent: #0f766e;
  font-size: 16.5px;
  line-height: 1.8;
}

#nebula-article-view.article--data h2 {
  margin-top: 2.2em;
  padding-left: 0.6em;
  border-left: 4px solid var(--art-accent);
}

#nebula-article-view.article--data thead th {
  background: color-mix(in srgb, var(--art-accent) 12%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--art-accent) 35%, transparent);
  color: var(--art-accent);
}

#nebula-article-view.article--data tbody tr:nth-child(even) {
  background: var(--art-soft);
}

#nebula-article-view.article--data tbody tr:hover {
  background: color-mix(in srgb, var(--art-accent) 8%, transparent);
}

#nebula-article-view.article--data strong {
  color: var(--art-accent);
}

#nebula-article-view.article--data > p:first-of-type {
  font-size: 1.04em;
}

/* ================= ④ 科技蓝调 ================= */

#nebula-article-view.article--tech {
  --art-accent: #0ea5e9;
  font-size: 16.5px;
}

#nebula-article-view.article--tech h2 {
  position: relative;
  padding-left: 0.95em;
}

#nebula-article-view.article--tech h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    var(--art-accent),
    color-mix(in srgb, var(--art-accent) 25%, transparent)
  );
}

#nebula-article-view.article--tech h3 {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.98em;
  letter-spacing: 0.01em;
  color: var(--art-accent);
}

#nebula-article-view.article--tech code {
  border: 1px solid color-mix(in srgb, var(--art-accent) 22%, transparent);
}

#nebula-article-view.article--tech pre {
  border-color: color-mix(in srgb, var(--art-accent) 30%, transparent);
  background: color-mix(in srgb, var(--art-accent) 7%, transparent);
}

#nebula-article-view.article--tech blockquote {
  border-left-color: var(--art-accent);
  background: color-mix(in srgb, var(--art-accent) 8%, transparent);
}

#nebula-article-view.article--tech thead th {
  background: color-mix(in srgb, var(--art-accent) 10%, transparent);
  color: var(--art-accent);
}

/* ================= ⑤ 雅致衬线 ================= */

#nebula-article-view.article--elegant {
  --art-accent: #9a6b3f;
  font-family: Georgia, 'Songti SC', 'Noto Serif SC', serif;
  line-height: 1.95;
  text-align: justify;
}

#nebula-article-view.article--elegant h1 {
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#nebula-article-view.article--elegant h2 {
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--art-line);
}

#nebula-article-view.article--elegant h2::after {
  content: '';
  display: block;
  width: 2.4em;
  height: 1px;
  margin: 0.6em auto 0;
  background: var(--art-accent);
}

#nebula-article-view.article--elegant > p:first-of-type {
  text-align: center;
  font-style: italic;
}

#nebula-article-view.article--elegant blockquote {
  border-left: none;
  border-top: 1px solid var(--art-line);
  border-bottom: 1px solid var(--art-line);
  border-radius: 0;
  background: none;
  text-align: center;
  font-style: italic;
}

/* ================= ⑥ 报刊专栏 ================= */

#nebula-article-view.article--newspaper {
  --art-accent: #b91c1c;
  font-family: Georgia, 'Times New Roman', 'Songti SC', serif;
  font-size: 16.5px;
  line-height: 1.75;
  text-align: justify;
}

#nebula-article-view.article--newspaper h1 {
  font-weight: 800;
  letter-spacing: -0.01em;
  border-bottom: 3px double currentColor;
  padding-bottom: 0.3em;
}

#nebula-article-view.article--newspaper h2 {
  margin-top: 2.2em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid currentColor;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#nebula-article-view.article--newspaper h3 {
  font-weight: 700;
  font-style: italic;
}

#nebula-article-view.article--newspaper > p:first-of-type {
  font-weight: 500;
  color: inherit;
}

#nebula-article-view.article--newspaper > p:first-of-type::first-letter {
  font-size: 2.6em;
  line-height: 1;
  font-weight: 700;
  float: left;
  padding: 0.02em 0.1em 0 0;
}

/* ================= ⑦ 卡片分区 ================= */

#nebula-article-view.article--card {
  --art-accent: #4f46e5;
}

#nebula-article-view.article--card h2 {
  display: inline-block;
  margin-top: 2.4em;
  padding: 0.32em 0.85em;
  border-radius: 10px;
  background: var(--art-accent);
  color: #fff;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--art-accent) 70%, transparent);
}

#nebula-article-view.article--card h3 {
  padding-left: 0.6em;
  border-left: 3px solid var(--art-accent);
}

#nebula-article-view.article--card blockquote,
#nebula-article-view.article--card pre {
  border: 1px solid var(--art-line);
  border-left-width: 3px;
  border-radius: 12px;
  box-shadow: 0 8px 22px -18px color-mix(in srgb, currentColor 55%, transparent);
}

#nebula-article-view.article--card img {
  box-shadow: 0 10px 26px -18px color-mix(in srgb, currentColor 60%, transparent);
}

#nebula-article-view.article--card > p:first-of-type {
  padding: 0.85em 1.05em;
  border-radius: 12px;
  background: var(--art-soft);
  font-size: 1.05em;
}

/* ================= ⑧ 醒目大字 ================= */

#nebula-article-view.article--bold {
  --art-accent: #e11d48;
}

#nebula-article-view.article--bold h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

#nebula-article-view.article--bold h2 {
  margin-top: 2.4em;
  font-size: 1.7rem;
  font-weight: 800;
}

#nebula-article-view.article--bold h2::after {
  content: '';
  display: block;
  width: 2.6em;
  height: 0.28em;
  margin-top: 0.35em;
  border-radius: 99px;
  background: var(--art-accent);
}

#nebula-article-view.article--bold strong {
  font-weight: 750;
  background: linear-gradient(
    transparent 62%,
    color-mix(in srgb, var(--art-accent) 32%, transparent) 0
  );
}

#nebula-article-view.article--bold a {
  font-weight: 650;
}

#nebula-article-view.article--bold > p:first-of-type {
  font-size: 1.16em;
  font-weight: 500;
  color: inherit;
}

/* ================= ⑨ 手记便签 ================= */

#nebula-article-view.article--notebook {
  --art-accent: #d97706;
  font-family: 'Kaiti SC', STKaiti, KaiTi, Georgia, 'Songti SC', serif;
  font-size: 17px;
  line-height: 2.05;
}

#nebula-article-view.article--notebook h2 {
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-bottom: 0.25em;
  border-bottom: 1px dashed var(--art-line);
}

#nebula-article-view.article--notebook blockquote {
  border-left-color: var(--art-accent);
  background: color-mix(in srgb, var(--art-accent) 10%, transparent);
  color: inherit;
  font-style: italic;
}

#nebula-article-view.article--notebook hr {
  border-top: 1px dashed var(--art-line);
}

#nebula-article-view.article--notebook > p:first-of-type {
  color: inherit;
  border-left: 3px solid var(--art-accent);
  padding-left: 0.9em;
}
