/* Typecho 中文显示优化样式 */

/* ========================================================================== 
   字体优化设置
   ========================================================================== */

/* 全局字体栈优化 - 针对不同系统的中文字体回退策略 */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 
               "Segoe UI", Roboto, 
               "Hiragino Sans GB", "Microsoft YaHei", 
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  
  --font-mono: "SF Mono", Monaco, Inconsolata, "Courier New", 
               "Hiragino Sans GB", "Microsoft YaHei", monospace;
}

/* 全局字体应用 */
body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  /* 移除不支持的 -moz-osx-font-smoothing 属性 */
  text-rendering: optimizeLegibility;
  font-variant-ligatures: common-ligatures;
  line-height: 1.6; /* 增加行高提升中文可读性 */
}

/* 等宽字体优化 */
code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.95em; /* 微调字体大小以适应中文编码 */
}

/* ========================================================================== 
   文本渲染优化
   ========================================================================== */

/* 标题优化 */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.01em; /* 微调标题字符间距 */
  line-height: 1.3;
  font-weight: 500; /* 调整标题字重，避免过粗 */
}

/* 正文字体优化 */
p {
  letter-spacing: 0.02em;
  line-height: 1.7;
  margin-bottom: 1.2em;
  text-indent: 0; /* 移除不必要的首行缩进 */
}

/* 链接文本优化 */
a {
  /* 移除不支持的 text-decoration-skip 属性 */
  text-decoration-skip-ink: auto;
}

/* ========================================================================== 
   编辑器优化
   ========================================================================== */

/* 编辑器输入区域优化 */
textarea {
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

/* 编辑器预览区域优化 */
#wmd-preview {
  font-family: var(--font-sans);
  letter-spacing: 0.015em;
  line-height: 1.8;
  padding: 15px;
}

/* 预览区域中的代码块优化 */
#wmd-preview pre {
  font-family: var(--font-mono);
  line-height: 1.5;
  letter-spacing: 0;
}

/* 预览区域中的标题优化 */
#wmd-preview h1,
#wmd-preview h2,
#wmd-preview h3,
#wmd-preview h4,
#wmd-preview h5,
#wmd-preview h6 {
  margin-top: 1.5em;
  margin-bottom: 0.8em;
}

/* ========================================================================== 
   表单元素优化
   ========================================================================== */

/* 输入框字体优化 */
input[type=text],
input[type=password],
input[type=email],
select,
textarea {
  font-family: var(--font-sans);
  font-size: 1em;
}

/* 网址缩略名输入框优化 */
.mono.url-slug input {
  font-family: var(--font-mono);
  letter-spacing: 0;
  padding: 4px 8px;
}

/* ========================================================================== 
   表格样式优化
   ========================================================================== */

table {
  font-family: var(--font-sans);
}

table th,
table td {
  padding: 10px 12px;
  line-height: 1.5;
}

/* ========================================================================== 
   响应式字体调整
   ========================================================================== */

@media (max-width: 768px) {
  body {
    font-size: 100%; /* 在小屏幕上略微放大字体 */
    letter-spacing: 0;
  }
  
  h1 {
    font-size: 1.8em;
  }
  
  h2 {
    font-size: 1.6em;
  }
  
  h3 {
    font-size: 1.4em;
  }
}

/* ========================================================================== 
   特殊元素样式优化
   ========================================================================== */

/* 按钮文本优化 */
.btn {
  letter-spacing: 0.03em;
  text-transform: none; /* 禁止英文大写转换，保持中文原样 */
}

/* 提示信息框优化 */
.message {
  line-height: 1.6;
  padding: 12px 15px;
}

/* 后台分页样式优化 */
.typecho-pager {
  letter-spacing: 0;
}

.typecho-pager li {
  margin: 0 2px;
}

/* ========================================================================== 
   富文本编辑器特定优化
   ========================================================================== */

/* 编辑器工具栏按钮大小优化 */
.wmd-button-row li {
  padding: 4px;
}

.wmd-button-row li span {
  width: 22px;
  height: 22px;
}

/* 修复编辑器工具栏图标在高分辨率屏幕上的显示 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .editor-sprite,
  .editor-editor-bold,
  .editor-editor-code,
  .editor-editor-exit-fullscreen,
  .editor-editor-fullscreen,
  .editor-editor-heading,
  .editor-editor-hr,
  .editor-editor-image,
  .editor-editor-italic,
  .editor-editor-link,
  .editor-editor-more,
  .editor-editor-olist,
  .editor-editor-quote,
  .editor-editor-redo,
  .editor-editor-ulist,
  .editor-editor-undo,
  .wmd-button-row li#wmd-bold-button span,
  .wmd-button-row li#wmd-italic-button span,
  .wmd-button-row li#wmd-link-button span,
  .wmd-button-row li#wmd-quote-button span,
  .wmd-button-row li#wmd-code-button span,
  .wmd-button-row li#wmd-image-button span,
  .wmd-button-row li#wmd-olist-button span,
  .wmd-button-row li#wmd-ulist-button span,
  .wmd-button-row li#wmd-heading-button span,
  .wmd-button-row li#wmd-hr-button span,
  .wmd-button-row li#wmd-more-button span,
  .wmd-button-row li#wmd-undo-button span,
  .wmd-button-row li#wmd-redo-button span,
  .wmd-button-row li#wmd-fullscreen-button span,
  .wmd-button-row li#wmd-exit-fullscreen-button span {
    background-size: 22px 330px; /* 略微调整图标大小以适应高DPI屏幕 */
  }
}

/* 修复Firefox中的文本渲染问题 */
@-moz-document url-prefix() {
  body {
    letter-spacing: 0.01em;
  }
}