/**
 * MD 默认主题（重制版）
 * 设计语言：腾讯蓝品牌色系 + 大气标题 + 舒适阅读体验
 *
 * v2 更新：腾讯蓝(#0052D9) 主色调，标题醒目放大，段落留白舒适
 */

/* ==================== 一级标题（文章大标题） ==================== */
h1 {
  display: block;
  padding: 0.6em 0;
  margin: 1.2em auto 0.8em;
  color: hsl(var(--foreground));
  font-size: calc(var(--md-font-size) * 1.7);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.06em;
  position: relative;
}

/* 标题下装饰线 */
h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--md-primary-color);
  margin: 0.4em auto 0;
  border-radius: 2px;
}

/* ==================== 二级标题 ==================== */
h2 {
  display: block;
  padding: 0.4em 0 0.4em 0.8em;
  margin: 2.2em 8px 1em;
  color: hsl(var(--foreground));
  font-size: calc(var(--md-font-size) * 1.45);
  font-weight: 700;
  border-left: 5px solid var(--md-primary-color);
  border-bottom: 1px solid color-mix(in srgb, var(--md-primary-color) 25%, transparent);
  letter-spacing: 0.04em;
}

/* ==================== 三级标题 ==================== */
h3 {
  display: inline-block;
  padding: 0.2em 1em 0.2em 0;
  margin: 1.8em 8px 0.8em;
  color: hsl(var(--foreground));
  font-size: calc(var(--md-font-size) * 1.25);
  font-weight: 600;
  border-bottom: 2px solid var(--md-primary-color);
  letter-spacing: 0.03em;
}

/* ==================== 四级标题 ==================== */
h4 {
  margin: 1.5em 8px 0.5em;
  color: var(--md-primary-color);
  font-size: calc(var(--md-font-size) * 1.15);
  font-weight: 600;
}

/* ==================== 五级标题 ==================== */
h5 {
  margin: 1.2em 8px 0.5em;
  color: hsl(var(--foreground));
  font-size: calc(var(--md-font-size) * 1.08);
  font-weight: 600;
}

/* ==================== 六级标题 ==================== */
h6 {
  margin: 1.2em 8px 0.5em;
  font-size: calc(var(--md-font-size) * 1.05);
  color: var(--md-primary-color);
  font-weight: 500;
}

/* ==================== 段落 ==================== */
p {
  margin: 1.5em 8px;
  letter-spacing: 0.05em;
  line-height: 1.85;
  color: hsl(var(--foreground));
  font-size: var(--md-font-size);
}

/* ==================== 引用块 ==================== */
blockquote {
  font-style: normal;
  padding: 1.2em 1.5em;
  border-left: 4px solid var(--md-primary-color);
  border-radius: 0 8px 8px 0;
  color: hsl(var(--foreground));
  background: var(--blockquote-background);
  margin: 1.5em 0;
  position: relative;
}

blockquote::before {
  content: '"';
  position: absolute;
  top: -0.1em;
  left: 0.3em;
  font-size: 3em;
  color: var(--md-primary-color);
  opacity: 0.12;
  font-family: Georgia, serif;
  line-height: 1;
}

blockquote > p {
  display: block;
  font-size: 1em;
  letter-spacing: 0.05em;
  color: hsl(var(--foreground));
  margin: 0;
  line-height: 1.8;
}

/* ==================== GFM 警告块 ==================== */
.alert-title-note,
.alert-title-tip,
.alert-title-info,
.alert-title-important,
.alert-title-warning,
.alert-title-caution,
.alert-title-abstract,
.alert-title-summary,
.alert-title-tldr,
.alert-title-todo,
.alert-title-success,
.alert-title-done,
.alert-title-question,
.alert-title-help,
.alert-title-faq,
.alert-title-failure,
.alert-title-fail,
.alert-title-missing,
.alert-title-danger,
.alert-title-error,
.alert-title-bug,
.alert-title-example,
.alert-title-quote,
.alert-title-cite {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

.alert-title-note { color: #478be6; }
.alert-title-tip { color: #57ab5a; }
.alert-title-info { color: #93c5fd; }
.alert-title-important { color: #986ee2; }
.alert-title-warning { color: #c69026; }
.alert-title-caution { color: #e5534b; }
.alert-title-abstract,
.alert-title-summary,
.alert-title-tldr { color: #00bfff; }
.alert-title-todo { color: #478be6; }
.alert-title-success,
.alert-title-done { color: #57ab5a; }
.alert-title-question,
.alert-title-help,
.alert-title-faq { color: #c69026; }
.alert-title-failure,
.alert-title-fail,
.alert-title-missing { color: #e5534b; }
.alert-title-danger,
.alert-title-error { color: #e5534b; }
.alert-title-bug { color: #e5534b; }
.alert-title-example { color: #986ee2; }
.alert-title-quote,
.alert-title-cite { color: #9ca3af; }

/* GFM Alert SVG 图标颜色 */
.alert-icon-note { fill: #478be6; }
.alert-icon-tip { fill: #57ab5a; }
.alert-icon-info { fill: #93c5fd; }
.alert-icon-important { fill: #986ee2; }
.alert-icon-warning { fill: #c69026; }
.alert-icon-caution { fill: #e5534b; }
.alert-icon-abstract,
.alert-icon-summary,
.alert-icon-tldr { fill: #00bfff; }
.alert-icon-todo { fill: #478be6; }
.alert-icon-success,
.alert-icon-done { fill: #57ab5a; }
.alert-icon-question,
.alert-icon-help,
.alert-icon-faq { fill: #c69026; }
.alert-icon-failure,
.alert-icon-fail,
.alert-icon-missing { fill: #e5534b; }
.alert-icon-danger,
.alert-icon-error { fill: #e5534b; }
.alert-icon-bug { fill: #e5534b; }
.alert-icon-example { fill: #986ee2; }
.alert-icon-quote,
.alert-icon-cite { fill: #9ca3af; }

/* ==================== 代码块 ==================== */
pre.code__pre,
.hljs.code__pre {
  font-size: 92%;
  overflow-x: auto;
  border-radius: 8px;
  padding: 0 !important;
  line-height: 1.6;
  margin: 10px 8px;
  border: 1px solid color-mix(in srgb, var(--md-primary-color) 15%, transparent);
}

/* ==================== 图片 ==================== */
img {
  display: block;
  max-width: 100%;
  margin: 0.1em auto 0.8em;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

figcaption,
.md-figcaption {
  text-align: center;
  color: #999;
  font-size: 0.8em;
  margin-top: -0.3em;
}

/* ==================== 列表 ==================== */
ol {
  padding-left: 1.2em;
  margin-left: 0;
  color: hsl(var(--foreground));
  line-height: 1.85;
}

ul {
  padding-left: 0.8em;
  margin-left: 0;
  color: hsl(var(--foreground));
  line-height: 1.85;
}

li {
  display: block;
  margin: 0.4em 8px;
  color: hsl(var(--foreground));
  position: relative;
  padding-left: 1em;
}

ul > li::before {
  content: '◆';
  position: absolute;
  left: -0.5em;
  color: var(--md-primary-color);
  font-size: 0.5em;
  top: 0.6em;
}

/* ==================== 脚注 ==================== */
p.footnotes {
  margin: 0.5em 8px;
  font-size: 80%;
  color: hsl(var(--foreground));
  border-top: 1px solid color-mix(in srgb, var(--md-primary-color) 12%, transparent);
  padding-top: 0.8em;
}

/* ==================== 图表 ==================== */
figure {
  margin: 1.5em 8px;
  color: hsl(var(--foreground));
}

/* ==================== 分隔线 ==================== */
hr {
  border-style: solid;
  border-width: 1px 0 0;
  border-color: color-mix(in srgb, var(--md-primary-color) 20%, transparent);
  margin: 2.5em 0;
  height: 0;
  opacity: 0.5;
}

/* ==================== 行内代码 ==================== */
code {
  font-size: 90%;
  color: var(--md-primary-color);
  background: color-mix(in srgb, var(--md-primary-color) 8%, transparent);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

pre.code__pre > code,
.hljs.code__pre > code {
  display: -webkit-box;
  padding: 0.5em 1em 1em;
  overflow-x: auto;
  text-indent: 0;
  color: inherit;
  background: none;
  white-space: nowrap;
  margin: 0;
}

/* ==================== 强调 ==================== */
em {
  font-style: italic;
  font-size: inherit;
  color: hsl(var(--foreground));
}

/* ==================== 链接 ==================== */
a {
  color: var(--md-primary-color);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--md-primary-color) 30%, transparent);
  transition: border-color 0.2s;
}

a:hover {
  border-bottom-color: var(--md-primary-color);
}

/* ==================== 粗体 ==================== */
strong {
  color: hsl(var(--foreground));
  font-weight: 700;
  font-size: inherit;
}

/* ==================== 表格 ==================== */
table {
  color: hsl(var(--foreground));
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 95%;
}

thead {
  font-weight: 600;
  color: #fff;
  background: var(--md-primary-color);
}

th {
  border: 1px solid color-mix(in srgb, var(--md-primary-color) 20%, transparent);
  padding: 0.6em 0.8em;
  color: #fff;
  word-break: keep-all;
}

td {
  border: 1px solid color-mix(in srgb, var(--md-primary-color) 10%, #e0e0e0);
  padding: 0.5em 0.8em;
  color: hsl(var(--foreground));
  word-break: keep-all;
}

tr:nth-child(even) td {
  background: color-mix(in srgb, var(--md-primary-color) 4%, transparent);
}

/* ==================== KaTeX 公式 ==================== */
.katex-inline {
  max-width: 100%;
  overflow-x: auto;
}

.katex-block {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5em 0;
  text-align: center;
}

/* ==================== 标记高亮 ==================== */
.markup-highlight {
  background-color: var(--md-primary-color);
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
}

.markup-underline {
  text-decoration: underline;
  text-decoration-color: var(--md-primary-color);
}

.markup-wavyline {
  text-decoration: underline wavy;
  text-decoration-color: var(--md-primary-color);
  text-decoration-thickness: 2px;
}
