/* DDKK 分类页面布局样式 - 基于 Ant Design 5.x 设计规范 */
/* 所有选择器均使用完整前缀，避免样式冲突 */

/* 分类页面隐藏侧边栏切换按钮 */
/* 使用 :has() 伪类选择器，当 body 包含分类页面容器时自动隐藏按钮 */
body:has(.ddkk-category-wrapper) header nav.navbar.ddkk-navbar .sidebar-toggler {
  display: none !important;
}

.ddkk-category-wrapper {
  /* 默认最大宽度 1200px（适用于屏幕宽度小于 1366px），与文章页保持一致 */
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  padding-top: 65px;
  background-color: #f2f3f5;
}

.ddkk-category-hero {
  position: sticky;
  top: 64px;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 32px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-top: -10px;
  /* 全宽显示：突破容器限制，占满屏幕宽度 */
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}

.ddkk-category-hero::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: #ffffff;
  z-index: 101;
}

.ddkk-category-hero-content {
  /* 内容宽度与容器保持一致，默认最大宽度 1200px */
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
  position: relative;
  z-index: 102;
  text-align: center;
}

/* ============= 分类页主容器宽度响应式适配（PC端），与文章页保持一致 ============= */
/* 1366px–1499px：最大宽度 1300px */
@media (min-width: 1366px) and (max-width: 1499.98px) {
  .ddkk-category-wrapper {
    max-width: 1300px;
  }
  .ddkk-category-hero-content {
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1300px;
  }
}

/* 1500px–1599px：最大宽度 1500px */
@media (min-width: 1500px) and (max-width: 1599.98px) {
  .ddkk-category-wrapper {
    max-width: 1500px;
  }
  .ddkk-category-hero-content {
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1500px;
  }
}

/* 1600px–1699px：最大宽度 1600px */
@media (min-width: 1600px) and (max-width: 1699.98px) {
  .ddkk-category-wrapper {
    max-width: 1600px;
  }
  .ddkk-category-hero-content {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1600px;
  }
}

/* 1700px–1919px：最大宽度 1700px */
@media (min-width: 1700px) and (max-width: 1919.98px) {
  .ddkk-category-wrapper {
    max-width: 1700px;
  }
  .ddkk-category-hero-content {
    max-width: 1700px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1700px;
  }
}

/* 1920px–2559px：最大宽度 1700px */
@media (min-width: 1920px) and (max-width: 2559.98px) {
  .ddkk-category-wrapper {
    max-width: 1700px;
  }
  .ddkk-category-hero-content {
    max-width: 1700px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1700px;
  }
}

/* ≥2560px：最大宽度 1900px */
@media (min-width: 2560px) {
  .ddkk-category-wrapper {
    max-width: 1900px;
  }
  .ddkk-category-hero-content {
    max-width: 1900px;
    margin-left: auto;
    margin-right: auto;
  }
  .ddkk-category-container {
    min-height: 1900px;
  }
}

.ddkk-category-hero-title {
  font-size: 28px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.ddkk-category-hero-description {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.ddkk-category-hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ddkk-category-hero-tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 14px;
  color: #1677ff;
  background: rgba(22, 119, 255, 0.06);
  border: 1px solid rgba(22, 119, 255, 0.2);
  border-radius: 2px;
  text-decoration: none;
  transition: all 0.2s;
}

.ddkk-category-hero-tag:hover {
  color: #0958d9;
  background: rgba(22, 119, 255, 0.1);
  border-color: rgba(22, 119, 255, 0.3);
}

.ddkk-category-hero-count {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1.5;
}

.ddkk-category-hero-count strong {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
}

.ddkk-category-hero-views {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1.5;
}

.ddkk-category-hero-views-label {
  margin-right: 4px;
}

.ddkk-category-hero-views-value {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
}

.ddkk-category-container {
  /* 在容器中占满宽度，使用 2:1 比例的网格布局 */
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); /* 2:1 比例，相当于 12 栅格中的 8:4 */
  column-gap: 24px;
  align-items: stretch;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  /* 默认最小高度 1200px（适用于屏幕宽度小于 1366px） */
  min-height: 1200px;
}

.ddkk-category-main {
  min-width: 0;
  position: relative;
  z-index: 1;
  padding-top: 25px;
  overflow: visible; /* 不产生内部滚动条，使用页面整体滚动 */
}

.ddkk-category-sidebar {
  position: sticky;
  padding-top: 25px;
  align-self: flex-start;
  overflow: visible; /* 不产生内部滚动条 */
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 767.98px) {
  .ddkk-category-wrapper {
    padding: 12px;
    background-color: #f2f3f5; /* 移动端保持灰色背景 */
    overflow-x: hidden; /* 防止出现横向滚动条 */
  }

  .ddkk-category-hero {
    position: sticky;
    top: 64px;
    padding: 16px 0;
    /* 移动端全宽显示：突破容器的内边距限制 */
    margin-left: -12px;
    margin-right: -12px;
    margin-top: -10px;
    width: calc(100% + 24px); /* 容器左右内边距各 12px，合计 24px */
  }

  .ddkk-category-hero-content {
    padding: 0 12px;
  }

  .ddkk-category-hero-title {
    font-size: 18px;
    margin-bottom: 6px;
  }

  .ddkk-category-hero-description {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .ddkk-category-hero-meta {
    gap: 8px;
  }

  .ddkk-category-hero-tag {
    padding: 2px 8px;
    font-size: 12px;
  }

  .ddkk-category-hero-count {
    font-size: 12px;
  }

  .ddkk-category-hero-views {
    font-size: 12px;
    margin-top: 8px;
  }

  .ddkk-category-container {
    padding: 0;
    max-width: 100%;
    display: block; /* 移动端采用单列布局 */
    min-height: auto; /* 避免在小屏幕上强制过高的最小高度 */
    padding-top: 65px; /* 移动端与专栏文章保持间距 */
  }

  .ddkk-category-main {
    width: 100%;
    padding-top: 16px;
  }

  .ddkk-category-sidebar {
    /* 移动端显示在专栏文章下方 */
    display: block;
    position: static; /* 取消 sticky 定位，采用正常文档流布局 */
    width: 100%;
    padding-top: 5px; /* 移动端与专栏文章保持间距 */
  }
}

