/* 文件描述：ZStack 社区页样式（开源代码 / 技术博文 / 加入社区，对齐官网信息架构 + zst2026 token） */

body.cs-page {
  padding-top: 0;
  background: #fff;
}

/* ── Hero 居中文案（深色 banner 用浅色字） ── */
.cs-page .inner-topbanner-content--center {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 800px;
}

.cs-page .inner-topbanner-content--center .inner-topbanner-title {
  color: var(--on-surface, #1a2736);
}

.cs-page .inner-topbanner-content--center .inner-topbanner-desc {
  margin-left: auto;
  margin-right: auto;
  color: var(--on-surface-variant, #37475a);
}

/* ── Tab 栏：叠在 hero 底部，对齐本站 switch_tab / hci-prod-tab 风格 ── */
.cs-page .inner-topbanner {
  /* 给底部叠层 Tab 留出视觉衔接 */
  margin-bottom: 0;
}

.cs-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-top: -40px;
  margin-bottom: 0;
  padding: 0 var(--container-px, 24px) 0;
  background: transparent;
  transition: background 0.2s, box-shadow 0.2s, padding 0.2s;
}

.cs-tabs-inner {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  max-width: min(720px, 100%);
  margin: 0 auto;
  padding: 0;
  height: auto;
}

.cs-tab {
  position: relative;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 56px;
  padding: 14px 20px 18px;
  font-size: clamp(15px, calc(100vw * 17 / 1440), 17px);
  font-weight: 500;
  color: var(--on-surface-variant, #5e6978);
  text-decoration: none;
  white-space: nowrap;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--primary, #115391) 14%, #e8eef5);
  border-radius: var(--r8, 8px);
  box-shadow: 0 8px 24px rgba(17, 83, 145, 0.1);
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.cs-tab-label {
  position: relative;
  z-index: 1;
}

.cs-tab-arrow {
  display: none;
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--primary, #115391);
}

.cs-tab:hover {
  color: var(--primary, #115391);
  border-color: color-mix(in srgb, var(--primary, #115391) 35%, #fff);
  box-shadow: 0 10px 28px rgba(17, 83, 145, 0.14);
  transform: translateY(-1px);
}

.cs-tab.is-active {
  color: #fff;
  font-weight: 600;
  background: var(--primary, #115391);
  border-color: var(--primary, #115391);
  box-shadow: 0 10px 28px rgba(17, 83, 145, 0.28);
}

.cs-tab.is-active:hover {
  color: #fff;
  transform: none;
}

.cs-tab.is-active .cs-tab-arrow {
  display: block;
}

/* 吸顶：变完整白条，保留激活态 */
.cs-tabs.is-stuck {
  padding: 10px var(--container-px, 24px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(198, 211, 220, 0.35);
  border-bottom: 1px solid color-mix(in srgb, var(--primary, #115391) 8%, transparent);
}

.cs-tabs.is-stuck .cs-tabs-inner {
  max-width: min(720px, 100%);
}

.cs-tabs.is-stuck .cs-tab {
  min-height: 44px;
  padding: 10px 16px 12px;
  box-shadow: none;
}

.cs-tabs.is-stuck .cs-tab.is-active {
  box-shadow: 0 4px 14px rgba(17, 83, 145, 0.22);
}

.cs-tabs.is-stuck .cs-tab.is-active .cs-tab-arrow {
  display: none;
}

/* ── 主内容：贴紧 hero，仅顶部一小段浅蓝渐变 ── */
.cs-main {
  position: relative;
  z-index: 1;
  margin-top: -28px;
  padding: clamp(56px, calc(100vw * 80 / 1440), 88px) 0 clamp(80px, calc(100vw * 120 / 1440), 120px);
  min-height: 420px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--primary, #115391) 10%, #eaf4fc) 0%,
      #fff 72px
    );
}

.cs-main .container {
  max-width: min(1040px, 100%);
  margin: 0 auto;
  padding: 0 var(--container-px, 24px);
}

.cs-panel {
  display: none;
}

.cs-panel.is-active {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── 开源代码 ── */
.cs-open-intro {
  border-radius: 8px;
  padding: clamp(28px, calc(100vw * 40 / 1440), 40px);
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--primary, #115391) 8%, #fff) 0%, color-mix(in srgb, var(--primary, #115391) 14%, #e8f4ff) 55%, transparent 100%),
    #eef6fc;
  border: 1px solid color-mix(in srgb, var(--primary, #115391) 16%, #fff);
}

.cs-open-desc {
  margin: 0 0 24px;
  max-width: 36em;
  font-size: 16px;
  line-height: 1.8;
  color: var(--on-surface, #1a2736);
  text-align: left;
}

.cs-open-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cs-open-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #fff;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary, #115391) 20%, #fff);
  text-decoration: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.cs-open-link:hover {
  border-color: var(--primary, #115391);
  box-shadow: 0 4px 16px rgba(17, 83, 145, 0.12);
}

.cs-open-link-url {
  font-size: 15px;
  color: var(--primary, #115391);
  word-break: break-all;
}

.cs-open-link-tag {
  font-size: 13px;
  color: #97a4b6;
  flex-shrink: 0;
}

.cs-repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.cs-repo-card {
  background: #fff;
  border: 1px solid #cbedff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(198, 211, 220, 0.1);
  transition: box-shadow 0.25s;
}

.cs-repo-card:hover {
  box-shadow: 0 10px 24px rgba(3, 27, 78, 0.1);
}

.cs-repo-card a {
  display: block;
  padding: 40px 24px 36px;
  text-decoration: none;
  text-align: center;
  color: inherit;
}

.cs-repo-name {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  color: var(--on-surface, #1a2736);
  line-height: 1.3;
}

.cs-repo-desc {
  margin: 0;
  font-size: 14px;
  color: #5e6978;
  line-height: 1.5;
}

.cs-repo-arrow {
  display: block;
  width: 20px;
  height: 20px;
  margin: 28px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none'%3E%3Cpath d='M4 10h12M11 5l5 5-5 5' stroke='%23007FDF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.25s;
}

.cs-repo-card:hover .cs-repo-arrow {
  transform: translateX(8px);
}

/* ── 技术博文：复用白皮书 csr-showroom + bps-grid，仅补社区页差异 ── */
.cs-page .cs-blog-layout {
  max-width: none;
  margin: 0;
}

.cs-page .cs-blog-catalog .csr-showroom-nav-link {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.cs-page .bps-grid {
  /* 社区主区略窄于白皮书整页，保持三列 */
  align-items: stretch;
}

.cs-page .bps-card {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--primary, #115391) 8%, #e8eef5);
}

.cs-page .bps-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cs-page .bps-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* PDF 封面占位（无 litpic 时） */
.cs-blog-cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 180px;
  height: clamp(120px, calc(100vw * 160 / 1440), 160px);
  margin: 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--primary, #115391) 12%, #fff) 0%, #e8f3fb 55%, #d9ebf8 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 83, 145, 0.08);
}

.cs-blog-cover-icon {
  display: block;
  width: 48px;
  height: 56px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='56' fill='none'%3E%3Cpath d='M8 2h24l12 12v38a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z' fill='%23fff' stroke='%23115391' stroke-width='1.5'/%3E%3Cpath d='M32 2v10a2 2 0 0 0 2 2h10' stroke='%23115391' stroke-width='1.5'/%3E%3Cpath d='M12 28h24M12 34h24M12 40h16' stroke='%23115391' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.cs-blog-cover-tag {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary, #115391);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.cs-blog-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  text-align: center;
  color: #97a4b6;
  font-size: 15px;
}

/* ── 加入社区 ── */
.cs-join {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.cs-join-wechat,
.cs-join-qq {
  background: #fff;
  border: 1px solid #cbedff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(198, 211, 220, 0.1);
  padding: 36px 24px;
}

.cs-join-wechat {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cs-join-qq {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cs-join-title {
  margin: 0 0 28px;
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface, #1a2736);
  line-height: 1.4;
}

.cs-join-wechat img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.cs-join-name {
  margin-top: 12px;
  font-size: 15px;
  color: #37475a;
}

.cs-join-qq-layout {
  display: flex;
  gap: clamp(40px, 8vw, 100px);
  align-items: center;
  width: 100%;
  justify-content: center;
}

.cs-join-qq-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

.cs-join-qq-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  line-height: 1.4;
}

.cs-join-qq-num {
  color: #37475a;
}

.cs-join-qq-status {
  color: #97a4b6;
  flex-shrink: 0;
}

.cs-join-qq-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cs-join-qq-active img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  body.cs-page {
    overflow-x: clip;
  }

  .cs-tabs {
    margin-top: -28px;
    padding: 0 16px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .cs-main,
  .cs-main .container,
  .cs-panel {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* 侧栏分类：禁止 nowrap 链接把整页撑宽，滚动只发生在导航内 */
  .cs-page .cs-blog-layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .cs-page .csr-showroom-nav.cs-blog-catalog {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
  }

  .cs-page .cs-blog-catalog .csr-showroom-nav-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .cs-page .cs-blog-main {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .cs-page .bps-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .cs-page .bps-card {
    min-width: 0;
    max-width: 100%;
  }

  .cs-page .bps-card-cover,
  .cs-page .bps-card-body {
    min-width: 0;
    max-width: 100%;
  }

  .cs-page .bps-card-title,
  .cs-page .bps-card-desc,
  .cs-page .csr-showroom-desc {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .cs-page .cs-blog-cover {
    max-width: 100%;
  }

  .cs-tabs-inner {
    gap: 8px;
    max-width: 100%;
  }

  .cs-tab {
    min-height: 48px;
    padding: 12px 10px 14px;
    font-size: 14px;
    border-radius: 6px;
  }

  .cs-tabs.is-stuck {
    padding: 8px 12px;
  }

  .cs-tabs.is-stuck .cs-tab {
    min-height: 40px;
    padding: 8px 8px 10px;
  }

  .cs-repo-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-open-link {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .cs-open-link-url {
    min-width: 0;
  }

  .cs-join {
    flex-direction: column;
  }

  .cs-join-wechat {
    flex: none;
    width: 100%;
  }

  .cs-join-qq-list {
    min-width: 0;
    width: 100%;
  }

  .cs-open-links {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .cs-blog-grid {
    grid-template-columns: 1fr;
  }

  .cs-join-qq-layout {
    flex-direction: column;
  }
}
