/* 阅读进度条 */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(to right, #4285f4, #34a853, #fbbc05, #ea4335);
  z-index: 1000;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 优化文章阅读体验 */
.md-content article {
  font-size: 16px;
  line-height: 1.8;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
}

.md-content article p {
  margin-bottom: 1.5rem;
  color: var(--md-default-fg-color--light);
}

.md-content article img {
  border-radius: 4px;
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
}

/* 优化代码块 */
.md-typeset pre {
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: var(--md-code-bg-color);
}

.md-typeset pre > code {
  padding: 0;
  background-color: transparent;
}

/* 优化表格 */
.md-typeset table:not([class]) {
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  background-color: rgba(0, 0, 0, 0.04);
  padding: 12px 16px;
}

/* 自定义引用块 */
.md-typeset blockquote {
  border-left: 4px solid var(--md-primary-fg-color);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 0 4px 4px 0;
  color: var(--md-default-fg-color--light);
}

/* 文章元信息 */
.article-meta {
  display: flex;
  align-items: center;
  margin: 2rem 0;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--md-default-fg-color--light);
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 8px;
}

.meta-divider {
  margin: 0 8px;
}

/* 分享按钮样式 */
.share-buttons {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
}

.share-buttons h4 {
  font-size: 16px;
  margin-bottom: 12px;
}

/* 图片放大效果 */
.zoomable {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.zoomable:hover {
  transform: scale(1.02);
}

.image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}

.zoomed-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
}

/* 整体页面布局优化 */
.md-grid {
  max-width: 1200px;
}

/* 优化导航栏 */
.md-header {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background-color: var(--md-default-bg-color);
}

/* 优化文章内容区域 */
.md-content {
  padding: 0 1.5rem;
}

.md-content__inner {
  margin: 0 auto;
  padding: 2rem 0;
  max-width: 850px;
}

/* 优化文章标题 */
.md-content h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 2rem 0 1.5rem;
  color: var(--md-primary-fg-color);
  border-bottom: 2px solid var(--md-primary-fg-color);
  padding-bottom: 0.5rem;
}

.md-content h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--md-primary-fg-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.3rem;
}

.md-content h3 {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 1.5rem 0 1rem;
  color: var(--md-primary-fg-color);
}

/* 优化文章正文 */
.md-content p {
  line-height: 1.7;
  margin-bottom: 1.2rem;
  color: rgba(0, 0, 0, 0.85);
}

/* 优化列表样式 */
.md-content ul, .md-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.md-content li {
  margin-bottom: 0.8rem;
  line-height: 1.6;
}

/* 优化表格样式 */
.md-typeset table:not([class]) {
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin: 1.5rem 0;
}

.md-typeset table:not([class]) th {
  background-color: var(--md-primary-fg-color);
  color: white;
  padding: 1rem;
}

.md-typeset table:not([class]) td {
  padding: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* 优化图片样式 */
.md-content img {
  border-radius: 6px;
  display: block;
  margin: 2rem auto;
  max-width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.md-content img:hover {
  transform: scale(1.02);
}

/* 优化卡片样式 */
.md-typeset .admonition {
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin: 1.5rem 0;
}

/* 首页特殊样式 */
.md-content__inner:not(.md-typeset) > h1 {
  color: var(--md-primary-fg-color);
  font-size: 2.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* 博客文章卡片样式 */
.blog-post-card {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
  background-color: var(--md-default-bg-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.blog-post-card h3 {
  margin-top: 0;
}

/* 深色模式适配 */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #1a1a2e;
}

[data-md-color-scheme="slate"] .md-content p,
[data-md-color-scheme="slate"] .md-content li {
  color: rgba(255, 255, 255, 0.85);
}

[data-md-color-scheme="slate"] .blog-post-card {
  background-color: #2a2a3c;
}

[data-md-color-scheme="slate"] .md-content h2 {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* 自定义Logo尺寸 */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.8rem !important;
  width: auto !important;
}

.md-header__title {
  margin-left: 0.5rem;
}

/* 美化标题和文本样式 */
.md-typeset h1 {
  color: var(--md-primary-fg-color);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.md-typeset h2 {
  font-weight: 600;
  margin-top: 2.5rem;
}

.md-typeset h3 {
  font-weight: 600;
}

/* 改进代码块样式 */
.md-typeset code {
  border-radius: 4px;
}

.md-typeset pre > code {
  padding: 1rem;
}

/* 卡片布局 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  grid-gap: 1rem;
  margin: 1.5rem 0;
}

.grid.cards > * {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grid.cards > *:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* 页脚美化 */
.md-footer {
  background-color: var(--md-default-bg-color);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
}

.md-footer-meta {
  background-color: var(--md-primary-fg-color--dark);
}

/* 首页特殊样式 */
.md-content__inner:has(.homepage) {
  padding-top: 0;
  margin-top: -1.5rem;
}

.homepage h1 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 3rem;
}

/* 404页面样式 */
.md-typeset:has(h1:first-child:contains("页面未找到")) {
  text-align: center;
  max-width: 35rem;
  margin: 0 auto;
  padding: 3rem 0;
}

.md-typeset:has(h1:first-child:contains("页面未找到")) h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.md-typeset:has(h1:first-child:contains("页面未找到")) h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
}

.md-typeset:has(h1:first-child:contains("页面未找到")) .grid {
  max-width: 30rem;
  margin: 2rem auto;
}

/* 卡片样式美化 */
.md-typeset .grid {
  grid-gap: .4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 1em 0;
}

.md-typeset .card {
  background-color: var(--md-default-bg-color);
  border-radius: 0.2rem;
  box-shadow: var(--md-shadow-z1);
  display: flex;
  flex-direction: column;
  font-size: .8rem;
  justify-content: space-between;
  margin: 0;
  min-height: 6rem;
  padding: 1rem;
  transition: box-shadow 125ms;
}

.md-typeset .card:hover {
  box-shadow: var(--md-shadow-z2);
  transition-duration: 0ms;
}

.md-typeset .card h3 {
  color: var(--md-primary-fg-color);
  font-weight: 600;
  margin-top: 0;
}

/* 改进按钮样式 */
.md-button {
  color: var(--md-primary-fg-color);
  border: 1px solid var(--md-primary-fg-color);
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}

.md-button:hover {
  background-color: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
}

/* 在深色模式下调整卡片样式 */
[data-md-color-scheme="slate"] .md-typeset .card {
  background-color: var(--md-default-bg-color--lightest);
}

/* 改进首页布局 */
.md-typeset {
  font-size: 0.75rem;
  line-height: 1.6;
}

.md-typeset h1 {
  color: var(--md-default-fg-color);
  font-weight: 500;
  margin: 1.5em 0 0.8em;
}

@media screen and (min-width: 60em) {
  .md-sidebar--secondary:not([hidden]) {
    display: none;
  }
}

/* 优化文章目录 */
.md-nav--secondary {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-right: 1rem;
}

.md-nav--secondary .md-nav__link {
  color: var(--md-default-fg-color--light);
  padding: 0.3rem 0;
}

.md-nav--secondary .md-nav__link:hover {
  color: var(--md-primary-fg-color);
}

/* 优化打印样式 */
@media print {
  .md-content article {
    max-width: none;
    padding: 0;
  }
  
  .md-nav--secondary,
  .md-header,
  .md-footer {
    display: none;
  }
  
  .md-content img {
    max-width: 100%;
    page-break-inside: avoid;
  }
  
  .md-content pre {
    page-break-inside: avoid;
  }
}

/* 优化移动端样式 */
@media screen and (max-width: 768px) {
  .md-content article {
    font-size: 15px;
    padding: 0 0.5rem;
  }
  
  .md-content h1 {
    font-size: 2rem;
  }
  
  .md-content h2 {
    font-size: 1.5rem;
  }
  
  .md-content h3 {
    font-size: 1.2rem;
  }
  
  .md-nav--secondary {
    position: static;
    max-height: none;
  }
}

/* 添加平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 优化代码高亮 */
.highlight {
  background-color: var(--md-code-bg-color);
  border-radius: 6px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.highlight pre {
  margin: 0;
  padding: 0;
  background-color: transparent;
}

/* 优化搜索框 */
.md-search__input {
  background-color: var(--md-default-bg-color);
  border-radius: 6px;
  padding: 0.5rem 1rem;
}

.md-search__output {
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 添加文章阅读时间估算 */
.reading-time {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--md-default-fg-color--light);
  margin-left: 1rem;
}

.reading-time::before {
  content: "⏱";
  margin-right: 0.5rem;
}

/* 优化文章标签 */
.md-typeset .tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  margin: 0.2rem;
  border-radius: 4px;
  background-color: var(--md-primary-fg-color);
  color: white;
  font-size: 0.8rem;
}

/* 优化文章目录折叠/展开按钮 */
.toc-toggle {
  display: none;
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  padding: 0.5rem;
  border-radius: 50%;
  background-color: var(--md-primary-fg-color);
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media screen and (max-width: 768px) {
  .toc-toggle {
    display: block;
  }
  
  .md-nav--secondary {
    display: none;
  }
  
  .md-nav--secondary.show {
    display: block;
  }
}
