/*!
 * VditorNet —— Vditor Markdown 渲染流程的 .NET 移植。
 * MIT 许可证。版权（c）2018 至今 B3log 开源 / VditorNet 贡献者。
 *
 * VditorNet 生成 html 的内容与预览页面样式。
 * 内容主题（css/content-theme/*.css）在此文件之上叠加。
 */

.vditor-body {
  margin: 0;
  background-color: #fff;
  color: #24292e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------
 * 预览页面布局
 * ---------------------------------------------------------------------- */
.vditor-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 48px;
  background-color: #f6f8fa;
  border-bottom: 1px solid #eaecef;
  box-sizing: border-box;
  flex-wrap: wrap;
  gap: 4px;
}

.vditor-bar__title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vditor-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vditor-bar select,
.vditor-bar .vditor-btn {
  height: 30px;
  font-size: 12px;
  color: #24292e;
  background-color: #fff;
  border: 1px solid #d1d5da;
  border-radius: 4px;
  padding: 0 8px;
  cursor: pointer;
}

.vditor-bar .vditor-btn:hover {
  background-color: #f3f4f6;
  border-color: #b6bdc4;
}

.vditor-bar select:focus,
.vditor-bar .vditor-btn:focus {
  outline: none;
  border-color: #4285f4;
}

.vditor-wrap {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
}

.vditor-outline {
  width: 240px;
  flex: 0 0 240px;
  padding: 16px 12px 24px;
  box-sizing: border-box;
  border-right: 1px solid #eaecef;
  overflow: auto;
  max-height: calc(100vh - 48px);
  position: sticky;
  top: 48px;
  font-size: 13px;
  line-height: 1.6;
}

.vditor-outline ul {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}

.vditor-outline li {
  margin: 2px 0;
}

.vditor-outline [data-target-id] {
  display: block;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: #444c56;
  text-decoration: none;
  word-break: break-all;
}

.vditor-outline [data-target-id] svg {
  display: none;
}

.vditor-outline [data-target-id]:hover {
  background-color: #f3f4f6;
  color: #24292e;
}

.vditor-outline [data-target-id].vditor-outline__current {
  color: #4285f4;
  background-color: rgba(66, 133, 244, 0.1);
}

.vditor-main,
.vditor-reset--export {
  flex: 1;
  min-width: 0;
}

.vditor-reset {
  padding: 24px 32px 64px;
  box-sizing: border-box;
  max-width: 100%;
}

.vditor-reset--export {
  max-width: 860px;
  margin: 0 auto;
}

.vditor-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  left: -10000px;
  opacity: 0;
}

.vditor-body.theme-dark .vditor-bar {
  background-color: #1d2125;
  border-bottom-color: #141414;
}

.vditor-body.theme-dark {
  background-color: #1d2125;
  color: #d1d5da;
}

/* Flowchart 渲染固定浅色调色板；其深色配色通过
   JS 注入的内联样式应用（参见 vditor-net-preview.js）。 */

/* WaveDrom 是基于类名配色的内联 svg；在深色模式下使用原生样式重新着色 */
.vditor-body.theme-dark .language-wavedrom svg rect[style*="fill:white" i],
.vditor-body.theme-dark .language-wavedrom svg rect[style*="fill: white" i],
.vditor-body.theme-dark .language-wavedrom svg rect[style*="fill:#fff" i],
.vditor-body.theme-dark .language-wavedrom svg rect[style*="fill: #fff" i] {
  fill: transparent !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s1,
.vditor-body.theme-dark .language-wavedrom svg .s2,
.vditor-body.theme-dark .language-wavedrom svg .s3,
.vditor-body.theme-dark .language-wavedrom svg .s4 {
  stroke: #9aa0a6 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s5 {
  fill: #3d444d !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s6,
.vditor-body.theme-dark .language-wavedrom svg text {
  fill: #d1d5da !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s15 {
  fill: #58a6ff !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s16 {
  stroke: #58a6ff !important;
}

/* 数值 / 总线数据区域：深色模式下保留色相，仅降低亮度 */
.vditor-body.theme-dark .language-wavedrom svg .s7 {
  fill: #2d333b !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s8 {
  fill: #5d5400 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s9 {
  fill: #6b4a1d !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s10 {
  fill: #1e4568 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s11 {
  fill: #005e61 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s12 {
  fill: #1d5a14 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s13 {
  fill: #5a2064 !important;
}

.vditor-body.theme-dark .language-wavedrom svg .s14 {
  fill: #63201f !important;
}

.vditor-body.theme-dark .language-wavedrom svg .info {
  fill: #58a6ff !important;
}

.vditor-body.theme-dark .language-wavedrom svg .muted {
  fill: #9aa0a6 !important;
}

/* 思维导图标签在深色画布上保持可读 */
.vditor-body.theme-dark .language-mindmap,
.vditor-body.theme-dark .language-echarts {
  background-color: transparent;
}

.vditor-body.theme-dark .vditor-bar select,
.vditor-body.theme-dark .vditor-bar .vditor-btn {
  color: #d1d5da;
  background-color: #2f363d;
  border-color: #141414;
}

.vditor-body.theme-dark .vditor-outline {
  border-right-color: #141414;
}

.vditor-body.theme-dark .vditor-outline [data-target-id] {
  color: #b9b9b9;
}

.vditor-body.theme-dark .vditor-outline [data-target-id]:hover {
  background-color: #2f363d;
  color: #d1d5da;
}

/* -------------------------------------------------------------------------
 * .vditor-reset 内容
 * ---------------------------------------------------------------------- */
.vditor-reset {
  word-wrap: break-word;
}

.vditor-reset a {
  color: #4285f4;
  text-decoration: none;
}

.vditor-reset a:hover {
  text-decoration: underline;
}

.vditor-reset img {
  max-width: 100%;
  box-sizing: border-box;
}

.vditor-reset h1,
.vditor-reset h2,
.vditor-reset h3,
.vditor-reset h4,
.vditor-reset h5,
.vditor-reset h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  position: relative;
}

.vditor-reset h1 {
  font-size: 1.75em;
}

.vditor-reset h2 {
  font-size: 1.55em;
}

.vditor-reset h3 {
  font-size: 1.38em;
}

.vditor-reset h4 {
  font-size: 1.25em;
}

.vditor-reset h5 {
  font-size: 1.13em;
}

.vditor-reset h6 {
  font-size: 1em;
  color: #6a737d;
}

.vditor-reset .vditor-anchor {
  float: left;
  margin-left: -20px;
  padding-right: 4px;
  line-height: 1;
}

.vditor-reset .vditor-anchor::before {
  content: "#";
  color: #4285f4;
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 0.15s;
}

.vditor-reset h1:hover .vditor-anchor::before,
.vditor-reset h2:hover .vditor-anchor::before,
.vditor-reset h3:hover .vditor-anchor::before,
.vditor-reset h4:hover .vditor-anchor::before,
.vditor-reset h5:hover .vditor-anchor::before,
.vditor-reset h6:hover .vditor-anchor::before {
  opacity: 1;
}

.vditor-reset hr {
  height: 2px;
  padding: 0;
  margin: 24px 0;
  background-color: #eaecef;
  border: 0;
}

.vditor-reset p {
  margin-top: 0;
  margin-bottom: 16px;
}

.vditor-reset blockquote {
  padding: 0 1em;
  color: #6a737d;
  border-left: 0.25em solid #eaecef;
  margin: 0 0 16px 0;
}

.vditor-reset blockquote > :first-child {
  margin-top: 0;
}

.vditor-reset blockquote > :last-child {
  margin-bottom: 0;
}

.vditor-reset iframe {
  border: 1px solid #d1d5da;
  max-width: 100%;
  box-sizing: border-box;
}

.vditor-reset iframe.iframe__video {
  min-width: 80%;
  min-height: 36vh;
}

.vditor-reset table {
  border-collapse: collapse;
  empty-cells: show;
  margin-bottom: 16px;
  overflow: auto;
  border-spacing: 0;
  display: block;
  width: 100%;
}

.vditor-reset table tr {
  background-color: #fafbfc;
  border-top: 1px solid #c6cbd1;
}

.vditor-reset table td,
.vditor-reset table th {
  padding: 6px 13px;
  border: 1px solid #dfe2e5;
}

.vditor-reset table th {
  font-weight: 600;
}

.vditor-reset table tbody tr:nth-child(2n) {
  background-color: #fff;
}

.vditor-reset code:not(.hljs):not(.highlight-chroma) {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
  background-color: rgba(27, 31, 35, 0.05);
  word-break: break-word;
}

.vditor-reset kbd {
  display: inline-block;
  padding: 3px 5px;
  font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
  line-height: 10px;
  color: #24292e;
  vertical-align: middle;
  background-color: #fafbfc;
  border: solid 1px #d1d5da;
  border-radius: 3px;
  box-shadow: inset 0 -1px 0 #d1d5da;
}

.vditor-reset pre {
  margin: 1em 0;
  position: relative;
}

.vditor-reset pre > code {
  margin: 0;
  font-size: 85%;
  padding: 0.5em;
  border-radius: 5px;
  display: block;
  overflow: auto;
  white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
}

/* 仅在未应用 highlight.js 主题时使用默认浅色背景 */
.vditor-reset pre > code:not(.hljs):not(.highlight-chroma) {
  background-color: #f6f8fa;
}

/* 代码语言类型标签（小写风格） */
.vditor-reset .vditor-code-lang {
  position: absolute;
  top: 0.6em;
  right: 48px;
  font-size: 0.72em;
  color: #8b949e;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  user-select: none;
  pointer-events: none;
  z-index: 2;
}

/* 行号，从 vditor 的 _reset.less &-linenumber 移植而来 */
.vditor-reset pre > code.vditor-linenumber {
  padding-left: 4em !important;
  position: relative;
}

/* 行号槽位背景：与代码内容背景分开，形成层次分明的两段式效果。
   使用半透明叠加，浅色/深色代码主题下都能自动适应。 */
.vditor-reset pre > code.vditor-linenumber::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3em;
  background-color: rgba(128, 128, 128, 0.12);
  border-right: 1px solid rgba(128, 128, 128, 0.28);
  pointer-events: none;
  box-sizing: border-box;
}

.vditor-reset .vditor-linenumber__rows {
  position: absolute;
  pointer-events: none;
  top: 1em;
  left: 0;
  width: 3em;
  user-select: none;
  counter-reset: linenumber;
}

.vditor-reset .vditor-linenumber__rows > span {
  pointer-events: none;
  display: block;
}

.vditor-reset .vditor-linenumber__rows > span::before {
  counter-increment: linenumber;
  content: counter(linenumber);
  color: rgba(158, 150, 150, 0.38);
  display: block;
  padding-right: 1em;
  text-align: right;
}

.vditor-reset .vditor-linenumber__temp {
  display: none;
}

.vditor-reset pre:hover div.vditor-copy {
  display: block;
}

.vditor-reset ul,
.vditor-reset ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 2em;
}

.vditor-reset li + li {
  margin-top: 0.25em;
}

.vditor-reset li > p {
  margin-bottom: 0.5em;
}

.vditor-reset .task-list-item {
  list-style: none;
}

.vditor-reset .task-list-item-checkbox {
  margin: 0 0.2em 0.25em -1.6em;
  vertical-align: middle;
}

.vditor-reset figure {
  margin: 0 0 16px;
  text-align: center;
}

.vditor-reset figure figcaption {
  font-size: 0.875em;
  margin-top: 4px;
  opacity: 0.65;
}

/* -------------------------------------------------------------------------
 * 复制按钮
 * ---------------------------------------------------------------------- */
.vditor-reset .vditor-copy {
  position: relative;
  display: none;
  z-index: 1;
}

.vditor-reset .vditor-copy textarea {
  position: absolute;
  left: -100000px;
  height: 10px;
}

.vditor-reset .vditor-copy span {
  cursor: pointer;
  position: absolute;
  right: 15px;
  top: 0.5em;
}

.vditor-copy svg {
  color: #586069;
  height: 14px;
  width: 14px;
  display: block;
  fill: currentColor;
}

/* 复制成功反馈状态：绿色对勾 */
.vditor-copy .vditor-copy__button--copied {
  color: #2da44e;
}

.vditor-copy .vditor-copy__button--copied svg {
  color: #2da44e !important;
  fill: currentColor;
}

/* -------------------------------------------------------------------------
 * 提示框（Callout）
 * ---------------------------------------------------------------------- */
.vditor-reset .vditor-callout {
  --callout-color: var(--callout-note-color, #0969da);
  --callout-background-color: var(--callout-note-background-color, rgba(9, 105, 218, 0.08));
  padding: 12px 16px;
  margin: 16px 0;
  background-color: var(--callout-background-color);
  border-left: 0.25em solid var(--callout-color);
  border-radius: 0 6px 6px 0;
  color: inherit;
}

.vditor-reset .vditor-callout--tip {
  --callout-color: var(--callout-tip-color, #1a7f37);
  --callout-background-color: var(--callout-tip-background-color, rgba(26, 127, 55, 0.08));
}

.vditor-reset .vditor-callout--important {
  --callout-color: var(--callout-important-color, #8250df);
  --callout-background-color: var(--callout-important-background-color, rgba(130, 80, 223, 0.08));
}

.vditor-reset .vditor-callout--warning {
  --callout-color: var(--callout-warning-color, #9a6700);
  --callout-background-color: var(--callout-warning-background-color, rgba(154, 103, 0, 0.08));
}

.vditor-reset .vditor-callout--caution {
  --callout-color: var(--callout-caution-color, #cf222e);
  --callout-background-color: var(--callout-caution-background-color, rgba(207, 34, 46, 0.08));
}

.vditor-reset .vditor-callout__title {
  display: inline-block;
  font-weight: 600;
  text-transform: capitalize;
  margin-right: 0.4em;
}

/* -------------------------------------------------------------------------
 * 图表容器
 * ---------------------------------------------------------------------- */
.vditor-reset .language-math,
.vditor-reset .language-echarts,
.vditor-reset .language-mindmap,
.vditor-reset .language-plantuml,
.vditor-reset .language-mermaid,
.vditor-reset .language-smiles,
.vditor-reset .language-markmap,
.vditor-reset .language-abc,
.vditor-reset .language-flowchart,
.vditor-reset .language-graphviz,
.vditor-reset .language-wavedrom {
  margin-bottom: 16px;
}

.vditor-reset .language-math {
  text-align: center;
  overflow-x: auto;
}

.vditor-reset .language-math .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.vditor-reset .language-echarts,
.vditor-reset .language-mindmap {
  overflow: hidden;
  height: 420px;
}

.vditor-reset .language-mermaid,
.vditor-reset .language-markmap,
.vditor-reset .language-flowchart,
.vditor-reset .language-graphviz,
.vditor-reset .language-wavedrom {
  text-align: center;
}

.vditor-reset .language-mermaid svg,
.vditor-reset .language-flowchart svg,
.vditor-reset .language-graphviz svg,
.vditor-reset .language-wavedrom svg {
  max-width: 100%;
  height: auto;
}

.vditor-reset .vditor-reset--error {
  color: #cf222e;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  text-align: left;
}

/* -------------------------------------------------------------------------
 * 语音朗读按钮
 * ---------------------------------------------------------------------- */
.vditor-speech {
  position: fixed;
  z-index: 100;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d1d5da;
  background-color: #f6f8fa;
  color: #586069;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.vditor-speech--current,
.vditor-speech:hover {
  color: #4285f4;
}

.vditor-speech svg {
  fill: currentColor;
}

/* -------------------------------------------------------------------------
 * 打印（PDF 导出）
 * ---------------------------------------------------------------------- */
@media print {
  .vditor-bar,
  .vditor-outline {
    display: none !important;
  }

  .vditor-wrap {
    display: block;
  }

  .vditor-reset {
    max-width: 100%;
    padding: 0;
  }

  body {
    background: #fff;
  }
}
