/* 借鉴 hello-algo 的样式 */

/* 顶部标题链接样式 */
.md-header__title-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.md-header__title-link:hover {
  opacity: 0.8;
}

/* 字体优化 */
:root {
  --md-text-font: "Noto Sans SC", sans-serif;
  --md-code-font: "Fira Code", monospace;
  
  /* TDesign 风格颜色变量 */
  --td-brand-color: #0052d9;
  --td-brand-color-light: #ecf2fe;
  --td-success-color: #00a870;
  --td-warning-color: #ed7b2f;
  --td-error-color: #e34d59;
  --td-gray-color-1: #f3f3f3;
  --td-gray-color-2: #eeeeee;
  --td-gray-color-3: #e7e7e7;
  --td-gray-color-8: #5a5a5a;
  --td-gray-color-10: #383838;
  --td-shadow-1: 0 1px 10px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
  --td-shadow-2: 0 3px 14px 2px rgba(0, 0, 0, 0.05), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 5px 5px -3px rgba(0, 0, 0, 0.1);
  --td-radius-medium: 9px;
  --td-radius-large: 12px;
}

/* 深色模式变量 */
[data-md-color-scheme="slate"] {
  --td-brand-color: #4787f0;
  --td-brand-color-light: #1b2b4a;
  --td-gray-color-1: #2c2c2c;
  --td-gray-color-2: #353535;
  --td-gray-color-3: #404040;
  --td-gray-color-8: #b0b0b0;
  --td-gray-color-10: #e0e0e0;
}

/* ========== 现代化极简首页样式 ========== */

/* 首页容器 - 确保居中且占满宽度 */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  text-align: center;
}

/* 首页内容区域占满整个宽度 */
.md-content:has(.home-container) {
  max-width: 100% !important;
}

/* 首页主区域占满宽度 */
.md-main__inner:has(.home-container) {
  max-width: 100% !important;
}

/* 隐藏首页的所有侧边栏 */
body:has(.home-container) .md-sidebar {
  display: none !important;
}

/* 首页内容区域占满整个宽度 */
.md-content:has(.home-container) {
  max-width: 100% !important;
}

/* Hero Section - 超紧凑风格 */
.hero-section {
  text-align: center;
  padding: 1rem 0 1.5rem;
  animation: fadeInUp 0.5s ease-out;
}

.hero-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--td-gray-color-8);
  margin: 0;
  letter-spacing: 0.05em;
}

/* 专题区域 */
.topics-section {
  margin-top: 1rem;
  animation: fadeInUp 0.5s ease-out 0.1s backwards;
  text-align: center;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin: 0 0 1rem 0;
  text-align: center;
}

/* 专题卡片网格 */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

/* 极简卡片样式 - 紧凑版 */
.topic-card {
  display: block;
  padding: 2rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--td-gray-color-2);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--td-brand-color);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.topic-card:hover {
  border-color: var(--td-brand-color);
  box-shadow: 0 2px 12px rgba(0, 82, 217, 0.08);
  transform: translateY(-2px);
}

.topic-card:hover::before {
  transform: scaleX(1);
}

.topic-card.featured {
  background: linear-gradient(135deg, rgba(0, 82, 217, 0.02) 0%, var(--md-default-bg-color) 100%);
}

.card-content {
  position: relative;
  z-index: 1;
}

.card-category {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--td-brand-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.card-description {
  font-size: 0.9375rem;
  color: var(--td-gray-color-8);
  margin: 0 0 1.25rem 0;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8125rem;
}

.meta-count {
  color: var(--td-gray-color-8);
}

/* 即将上线区域 - 紧凑版 */
.coming-section {
  margin-top: 2.5rem;
  animation: fadeInUp 0.6s ease-out 0.3s backwards;
  text-align: center;
}

.coming-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.coming-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--td-gray-color-1);
  border-radius: 10px;
  opacity: 0.6;
  transition: opacity 0.25s ease;
  text-align: center;
}

.coming-card:hover {
  opacity: 0.8;
}

.coming-number {
  font-size: 1.5rem;
  font-weight: 200;
  color: var(--td-gray-color-8);
  line-height: 1;
}

.coming-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin: 0 0 0.125rem 0;
}

.coming-content p {
  font-size: 0.8125rem;
  color: var(--td-gray-color-8);
  margin: 0;
}

/* 动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
  .home-container {
    padding: 1.5rem 1.5rem 2rem;
  }

  .hero-section {
    padding: 1.5rem 0 2rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.9375rem;
  }

  .stats-section {
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem 0;
  }

  .stat-divider {
    width: 2.5rem;
    height: 1px;
  }

  .topics-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .section-title {
    font-size: 1.125rem;
  }

  .card-title {
    font-size: 1.125rem;
  }

  .topic-card {
    padding: 1.25rem;
  }
}

@media screen and (max-width: 480px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .topic-card {
    padding: 1rem;
  }
}

/* ========== 保留原有样式用于兼容 ========== */
.topic-home {
  padding: 2rem 0;
  max-width: 1200px;
  margin: 0 auto;
}

.topic-header {
  text-align: center;
  margin-bottom: 3rem;
}

.topic-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--md-default-fg-color);
  margin-bottom: 0.5rem;
}

.topic-subtitle {
  font-size: 1.1rem;
  color: var(--td-gray-color-8);
  margin: 0;
}

/* 统计数据样式 */
.topic-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.topic-stats-item {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.75rem 1.5rem;
  background: var(--td-gray-color-1);
  border-radius: var(--td-radius-medium);
}

.topic-stats-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--td-brand-color);
}

.topic-stats-label {
  font-size: 1rem;
  color: var(--td-gray-color-8);
}

/* 专题卡片网格 */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0 1rem;
}

/* 专题卡片基础样式 - TDesign 风格 */
.topic-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--td-gray-color-3);
  border-radius: var(--td-radius-large);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.topic-card:hover {
  border-color: var(--td-brand-color);
  box-shadow: var(--td-shadow-2);
  transform: translateY(-2px);
}

.topic-card__icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.topic-card__content {
  flex: 1;
  min-width: 0;
}

.topic-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--md-default-fg-color);
}

.topic-card__desc {
  font-size: 0.875rem;
  color: var(--td-gray-color-8);
  margin: 0 0 0.75rem 0;
  line-height: 1.5;
}

/* 徽章样式 */
.topic-card__badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 100px;
  background: var(--td-gray-color-2);
  color: var(--td-gray-color-8);
}

.topic-card__badge--count {
  background: var(--td-brand-color-light);
  color: var(--td-brand-color);
}

/* 已上线卡片 */
.topic-card--active {
  border-color: var(--td-brand-color);
  background: linear-gradient(135deg, var(--md-default-bg-color) 0%, var(--td-brand-color-light) 100%);
}

.topic-card--active .topic-card__title {
  color: var(--td-brand-color);
}

/* 即将上线卡片 */
.topic-card--coming {
  opacity: 0.75;
  cursor: default;
}

.topic-card--coming:hover {
  transform: none;
  box-shadow: var(--td-shadow-1);
}

/* 添加更多卡片 */
.topic-card--add {
  border-style: dashed;
  border-color: var(--td-gray-color-3);
  background: var(--td-gray-color-1);
  cursor: default;
}

.topic-card--add:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--td-gray-color-3);
}

.topic-card--add .topic-card__icon {
  color: var(--td-gray-color-8);
}

.topic-card--add .topic-card__title {
  color: var(--td-gray-color-8);
}

/* 响应式 */
@media screen and (max-width: 600px) {
  .topic-title {
    font-size: 1.75rem;
  }

  .topic-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .topic-card {
    padding: 1.25rem;
  }

  .topic-card__icon {
    font-size: 2rem;
  }
}

/* ========== 原有样式 ========== */

/* 代码块样式 */
.highlight code {
  font-size: 0.85em;
}

/* 链接样式 - 与 weqoocu.com 一致 */
.md-content a {
  color: #0067FF !important;
  text-decoration: none !important;
}

.md-content a:hover {
  color: #0067FF !important;
  text-decoration: none !important;
}

/* 卡片链接不显示下划线 */
.md-content a.topic-card,
.md-content a.topic-card:hover {
  text-decoration: none !important;
}

/* 标题样式 - 标题黑色，链接蓝色 */
.md-typeset h1 {
  font-weight: 700;
  margin-bottom: 1em;
  color: inherit;
}

.md-typeset h2 {
  font-weight: 600;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  padding-bottom: 0.3em;
  color: inherit;
}

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

.md-typeset h4 {
  font-weight: 600;
  color: inherit;
}

/* 标题内的链接保持蓝色 */
.md-typeset h1 a,
.md-typeset h2 a,
.md-typeset h3 a,
.md-typeset h4 a {
  color: #0067FF !important;
}

/* 标签样式 - 蓝色文字无背景 */
.md-tag {
  color: #0067FF !important;
  font-size: 0.9em;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin-right: 0.5em;
}

.md-tag::before {
  content: "#";
}

.md-tag a {
  color: #0067FF !important;
  text-decoration: none !important;
}

.md-tag a:hover {
  color: #0067FF !important;
  text-decoration: none !important;
}
}

/* 导航栏优化 */
.md-header {
  box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.1), 0 0.2rem 0.4rem rgba(0, 0, 0, 0.2);
}

/* 侧边栏优化 */
.md-sidebar__scrollwrap {
  padding: 0 0.6rem;
}

/* 内容区域 */
.md-content {
  max-width: 50rem;
}

/* 首页内容区域放宽 */
.md-content:has(.topic-home) {
  max-width: 100%;
}

/* 代码高亮 */
.md-typeset code {
  background-color: var(--md-code-bg-color);
  border-radius: 0.2rem;
  padding: 0 0.3em;
}

/* 表格样式 */
.md-typeset__table {
  width: 100%;
  display: block;
}

.md-typeset table:not([class]) {
  font-size: 0.85rem;
  border-collapse: collapse;
  width: 100% !important;
  max-width: 100% !important;
  display: table !important;
}

.md-typeset table:not([class]) th {
  background-color: var(--md-default-fg-color--lightest);
}

/* 集数列固定宽度，标题列自适应 */
.md-typeset table:not([class]) th:first-child,
.md-typeset table:not([class]) td:first-child {
  width: 60px;
  min-width: 60px;
  white-space: nowrap;
}

.md-typeset table:not([class]) th:last-child,
.md-typeset table:not([class]) td:last-child {
  width: 100%;
}

/* Giscus 评论容器 */
.giscus-container {
  width: 100%;
  max-width: 50rem;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

/* 响应式优化 */
@media screen and (max-width: 76.25em) {
  .md-content {
    max-width: 100%;
  }
}

/* 标签样式 */
.md-typeset .md-tag {
  background-color: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
}

/* 提示框样式优化 */
.md-typeset .admonition {
  border-radius: 0.4rem;
}

/* 关键词链接样式 */
.md-content a[target="_blank"]::after {
  content: none;  /* 移除外链图标 */
}
