/* ===========================================================
   代码块：深色底 + 语法高亮
   Hexo highlight.js 输出（hljs: true）
   =========================================================== */

:root {
  --code-bg:     #1c2128;
  --code-fg:     #c9d1d9;
  --code-gutter: #4d5560;
  --code-line:   #262c34;
  --code-border: #30363d;
}

/* ---------- 容器 ---------- */
.post-content figure.highlight {
  margin: 1.6rem 0;
  padding: 0;
  background: var(--code-bg);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.post-content figure.highlight table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  font-size: 0.855rem;
  line-height: 1.65;
  display: table;
  overflow: visible;
}

.post-content figure.highlight td {
  border: 0;
  padding: 0;
  vertical-align: top;
}

/* 行号列 */
.post-content figure.highlight td.gutter {
  width: 1%;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.post-content figure.highlight td.gutter pre {
  padding: 16px 10px 16px 16px;
  margin: 0;
  color: var(--code-gutter);
  text-align: right;
  background: transparent;
  border: 0;
}

/* 代码列 */
.post-content figure.highlight td.code {
  width: 99%;
}
.post-content figure.highlight td.code pre {
  padding: 16px 18px 16px 4px;
  margin: 0;
  overflow-x: auto;
  background: transparent;
  border: 0;
}

/* 有行号时，代码列左边留一点 */
.post-content figure.highlight td.gutter + td.code pre { padding-left: 6px; }

/* 重置行内 code 的浅底（在 pre 里不该继承） */
.post-content figure.highlight code,
.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  word-break: normal;
}

.post-content figure.highlight pre,
.post-content figure.highlight code {
  font-family: var(--font-mono);
  color: var(--code-fg);
  tab-size: 2;
}

.post-content figure.highlight .line {
  display: inline;
}

/* 无行号模式（如果关掉 line_number，Hexo 会直接给 pre） */
.post-content > pre,
.post-content > .highlight {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.6rem 0;
  font-family: var(--font-mono);
  font-size: 0.855rem;
  line-height: 1.65;
}

/* 语言标签：Hexo 不输出 data-lang，用 code 上的 language-* 类做兜底不做展示 */

/* ===========================================================
   语法配色
   =========================================================== */

.hljs-comment,
.hljs-quote {
  color: #768390;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag,
.hljs-formula {
  color: #ff7b72;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string {
  color: #a5d6ff;
}

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo {
  color: #79c0ff;
}

.hljs-title,
.hljs-title.class_,
.hljs-title.function_,
.hljs-section,
.hljs-name {
  color: #d2a8ff;
}

.hljs-variable,
.hljs-template-variable,
.hljs-attr,
.hljs-property,
.hljs-params {
  color: #ffa657;
}

.hljs-type,
.hljs-class .hljs-title,
.hljs-built_in,
.hljs-builtin-name {
  color: #7ee787;
}

.hljs-tag {
  color: #7ee787;
}

.hljs-meta,
.hljs-meta .hljs-keyword {
  color: #ff7b72;
}

.hljs-deletion {
  color: #ffdcd7;
  background: #67060c;
}

.hljs-addition {
  color: #aff5b4;
  background: #033a16;
}

.hljs-emphasis { font-style: italic; }
.hljs-strong  { font-weight: 600; }

.hljs-operator,
.hljs-punctuation {
  color: #9aa5b1;
}

@media (max-width: 640px) {
  .post-content figure.highlight table { font-size: 0.8rem; }
  .post-content figure.highlight td.gutter pre { padding: 14px 8px 14px 12px; }
  .post-content figure.highlight td.code pre { padding: 14px 14px 14px 4px; }
}
