/* 亮色模式 (默认) - 提取自 GitHub 亮色主题 */
:root {
  --color-canvas-default: #ffffff; /* 背景色 */
  --color-fg-default: #000000;     /* 字体色 */
  --color-border-default: #d0d7de; /* 边框色 */
  --color-accent-fg: #0969da;      /* 链接/强调色 (GitHub 蓝) */
}

/* 暗色模式 - 提取自 GitHub 暗色主题 */
html[data-theme="dark"] {
  --color-canvas-default: #000000;
  --color-fg-default: #c9d1d9;
  --color-border-default: #121315;
  --color-accent-fg: #58a6ff;
}

/* 基础全局样式 */
body {
  background-color: var(--color-canvas-default);
  color: var(--color-fg-default);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s; /* 切换时平滑过渡 */
}

a {
  color: var(--color-accent-fg);
  text-decoration: none;
}

/* 类似 GitHub 的顶部导航条 */
.header {
  background-color: #24292f;
  color: rgba(255, 255, 255, 0.7);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ========== 语言切换菜单（Cloudflare 风格紧凑设计） ========== */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-switcher-toggle {
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  color: rgba(255,255,255,0.7);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, color 0.15s;
}

.lang-switcher-toggle:hover {
  background-color: rgba(255,255,255,0.12);
  color: #ffffff;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  list-style: none;
  padding: 6px 0;
  min-width: 130px;
  z-index: 1000;
  margin: 0;
}

.lang-dropdown.open {
  display: block;
}

.lang-dropdown li a {
  display: block;
  padding: 8px 16px;
  color: #374151;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.1s;
}

.lang-dropdown li a:hover {
  background-color: #f3f4f6;
}

.lang-dropdown li a.active {
  font-weight: 600;
  color: #1d4ed8;
  background-color: #eff6ff;
}

/* 暗色模式 */
html[data-theme="dark"] .lang-dropdown {
  background-color: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .lang-dropdown li a {
  color: #e2e8f0;
}

html[data-theme="dark"] .lang-dropdown li a:hover {
  background-color: #334155;
}

html[data-theme="dark"] .lang-dropdown li a.active {
  color: #93c5fd;
  background-color: #1e3a5f;
}

/* ========== 文章页面样式 ========== */
.post {
  max-width: 100%;
}

.post-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border-default);
  padding-bottom: 16px;
}

.post-title {
  font-size: 28px;
  margin: 0 0 8px 0;
  color: var(--color-fg-default);
}

.post-header time {
  color: #57606a;
  font-size: 14px;
}

.post-content {
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-fg-default);
}

.post-content h2 {
  font-size: 22px;
  margin-top: 32px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-default);
}

.post-content h3 {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 8px;
}

.post-content p {
  margin: 12px 0;
}

.post-content a {
  display: inline-block;
  padding: 6px 14px;
  margin: 4px 4px 4px 0;
  background-color: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  color: #0969da;
  font-weight: 500;
  transition: background-color 0.15s, border-color 0.15s;
}

.post-content a:hover {
  background-color: #ddf4ff;
  border-color: #0969da;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border-default);
  margin: 32px 0;
}

.post-content ul {
  padding-left: 24px;
  margin: 12px 0;
}

.post-content ul li {
  margin: 6px 0;
}

/* ========== 多语言内容容器：根据 html[data-lang] 显示对应语言 ========== */
.post-content > [data-lang] {
  display: none;
}

html[data-lang="zh-CN"] .post-content > [data-lang="zh-CN"],
html[data-lang="en"] .post-content > [data-lang="en"],
html[data-lang="ru"] .post-content > [data-lang="ru"] {
  display: block;
}

/* 暗色模式文章页 */
html[data-theme="dark"] .post-header time {
  color: #8b949e;
}

html[data-theme="dark"] .post-content a {
  background-color: #21262d;
  border-color: #30363d;
  color: #58a6ff;
}

html[data-theme="dark"] .post-content a:hover {
  background-color: #0d419d;
  border-color: #58a6ff;
}
