@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap');

@font-face {
  font-family: "LXWK";
  src: url("/fonts/LXGWWenKai-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --width: 1200px; /* 增加最大宽度从800px到1200px，以容纳三栏布局 */
  --font-main: lxwk, Verdana, sans-serif;
  --font-secondary: lxwk, Verdana, sans-serif;
  --font-scale: 1em;
  --background-color: #fff;
  --heading-color: #222;
  --text-color: #444;
  --link-color: #3273dc;
  --visited-color: #8b6fcb;
  --code-background-color: #f2f2f2;
  --code-color: #222;
  --blockquote-color: #222;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #030002;
    --heading-color: #eee;
    --text-color: #ddd;
    --link-color: #8cc2dd;
    --visited-color: #8b6fcb;
    --code-background-color: #000;
    --code-color: #ddd;
    --blockquote-color: #ccc;
  }
}

body {
  font-family: var(--font-secondary);
  font-size: var(--font-scale);
  margin: auto;
  padding: 20px;
  max-width: var(--width);
  text-align: left;
  background-color: var(--background-color);
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.5;
  color: var(--text-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-main);
  color: var(--heading-color);
}

a {
  color: var(--link-color);
  cursor: pointer;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

nav a {
  margin-right: 8px;
}

nav span.active {
  font-weight: bold;
  margin-right: 10px;
}
strong,
b {
  color: var(--heading-color);
}

button {
  margin: 0;
  cursor: pointer;
}

main {
  line-height: 1.6;
}

table {
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px dashed;
}

img {
  max-width: 100%;
}

/* 为博文内容中的图片添加圆角 */
main img {
  border-radius: 8px;
}

/* 保持头像的圆形样式 */
.avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

pre code {
  background-color: var(--code-background-color);
  color: var(--code-color);
  display: block;
  padding: 20px;
  white-space: pre-wrap;
  font-size: 0.875rem;
  overflow-x: auto;
}

code {
  font-family: Source Code Pro, Ubuntu Mono, JetBrains Mono, monospace;
  padding: 2px;
  background-color: var(--code-background-color);
  color: var(--code-color);
  border-radius: 3px;
}

blockquote {
  border-left: 1px solid #999;
  color: var(--code-color);
  padding-left: 20px;
  font-style: italic;
}

footer {
  padding: 25px 0;
  text-align: center;
}

.title:hover {
  text-decoration: none;
}

.title h1 {
  font-size: 1.5em;
}

.inline {
  width: auto !important;
}

.highlight,
.code {
  padding: 1px 15px;
  background-color: var(--code-background-color);
  color: var(--code-color);
  border-radius: 3px;
  margin-block-start: 1em;
  margin-block-end: 1em;
  overflow-x: auto;
}

/* blog post list */
ul.blog-posts {
  list-style-type: none;
  padding: unset;
}

ul.blog-posts li {
  display: flex;
}

ul.blog-posts li span {
  flex: 0 0 130px;
}

ul.blog-posts li a:visited {
  color: var(--visited-color);
}

.tags {
  font-size: smaller;
}

.avatar {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

/* 新的头部和导航栏样式 */
.site-header {
  margin-bottom: 30px;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

/* 网站标题和头像 */
.site-branding {
  display: flex;
  align-items: center;
  flex: 1;
}

.site-branding .title {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-branding .avatar {
  margin-right: 15px;
}

/* 导航和语言切换器 */
.site-navigation {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav {
  display: flex;
  gap: 10px;
}

nav a.nav-link {
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--link-color);
  transition: all 0.2s ease;
}

nav a.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  nav a.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
  }
}

.language-switcher {
  display: flex;
  align-items: center;
}

/* 语言切换器国旗样式 */
.lang {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-icon {
  font-size: 1.5em; /* 增加字体大小以便更好地显示emoji */
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
  padding: 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lang-icon:hover {
  opacity: 1;
  transform: scale(1.1);
  text-decoration: none;
  background-color: rgba(0, 0, 0, 0.05);
}

.lang-icon.active {
  opacity: 1;
  box-shadow: 0 2px 0 var(--link-color);
}

@media (prefers-color-scheme: dark) {
  .lang-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* 语言切换器下拉菜单样式 */
.language-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-btn {
  background-color: transparent;
  color: var(--text-color);
  padding: 8px 12px;
  font-size: 0.9em;
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease;
}

.dropdown-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-arrow {
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--background-color);
  min-width: 120px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  z-index: 100;
  border-radius: 4px;
  margin-top: 5px;
  border: 1px solid rgba(128, 128, 128, 0.2);
}

.dropdown-content a {
  color: var(--text-color);
  padding: 10px 14px;
  text-decoration: none;
  display: block;
  transition: background-color 0.2s ease;
}

.dropdown-content a:hover {
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

.dropdown-content.show {
  display: block;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .dropdown-btn:hover,
  .dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .site-navigation {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  
  nav {
    flex-wrap: wrap;
  }
}

/* 移除不再需要的旧样式 */
.header-content, .top-row, .header-divider, .nav-container {
  /* 这些类将被替换，可以移除它们的样式 */
}

/* 替换三栏布局为两栏布局 */
.two-column-layout {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.main-content {
  flex: 3;
  min-width: 0; /* 确保弹性元素可以缩小到小于内容大小 */
  order: 2; /* 在移动视图中排序 */
  background-color: var(--background-color);
  padding: 0 20px;
}

/* 更优雅的左侧栏分割效果 */
.left-sidebar {
  flex: 1;
  width: 250px;
  flex-shrink: 0;
  order: 1;
  padding-right: 15px;
  position: relative;
}

.left-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(128, 128, 128, 0.2) 20%,
    rgba(128, 128, 128, 0.2) 80%,
    transparent
  );
}

/* 添加广告部分的样式 */
.ad-section {
  margin-top: 30px;
  padding: 15px;
  border-radius: 8px;
  background-color: rgba(128, 128, 128, 0.05);
}

/* 响应式设计调整 */
@media (max-width: 800px) {
  .two-column-layout {
    flex-direction: column;
  }
  
  .main-content, .left-sidebar {
    width: 100%;
  }
  
  .left-sidebar {
    padding: 0;
    margin-top: 0;
    margin-bottom: 30px;
    position: relative;
  }
  
  .left-sidebar::after {
    display: none; /* 移动端视图中移除垂直分割线 */
  }
  
  /* 在移动端视图中使用水平分割线 */
  .left-sidebar::before {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      rgba(128, 128, 128, 0.2) 20%,
      rgba(128, 128, 128, 0.2) 80%,
      transparent
    );
  }
}

/* 保留三栏布局相关类以兼容旧代码 */
.three-column-layout {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  flex-direction: column;
}

.right-sidebar {
  display: none; /* 隐藏右侧边栏 */
}

/* 右侧栏关注区域中的社交图标样式 */
.sidebar .social-icons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.sidebar .social-icons a {
  color: var(--text-color);
  font-size: 1.5em;
  transition: color 0.3s ease, transform 0.2s ease;
}

.sidebar .social-icons a:hover {
  color: var(--link-color);
  transform: scale(1.1);
  text-decoration: none;
}

/* 文章列表样式 */
.article-list {
  display: flex;
  flex-direction: column;
  margin-top: 20px;
}

.article-item {
  padding: 20px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.article-item:first-child {
  padding-top: 0;
}

.article-item:last-child {
  border-bottom: none;
}

.article-title {
  font-size: 1.3em;
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.4;
}

.article-title a {
  color: var(--heading-color);
  text-decoration: none;
}

.article-title a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.article-meta {
  font-size: 0.85em;
  color: var(--text-color);
  opacity: 0.8;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.article-tags .tag {
  font-size: 0.9em;
  opacity: 0.8;
  margin-right: 6px;
}

.article-excerpt {
  font-size: 0.95em;
  line-height: 1.6;
  color: var(--text-color);
  margin-bottom: 15px;
  /* 限制为4行文本 */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-footer {
  display: flex;
  justify-content: flex-end;
}

.read-more-btn {
  display: inline-block;
  padding: 6px 12px;
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--link-color);
  border-radius: 4px;
  font-size: 0.9em;
  transition: background-color 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.read-more-btn:hover {
  background-color: var(--link-color);
  color: white;
  text-decoration: none;
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
  .article-item {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  
  .read-more-btn {
    background-color: rgba(255, 255, 255, 0.1);
  }
}