/* ==========================================================================
   ColorUI 官网 v2 · 页面装置库（catalog.css）
   全站共用：统一页头 / 数据条 / 链路条 / 分板块头 / 三型卡片 / 命令块 / 下一步 / 空态
   约定：本文件的类名一律带 cat 前缀，只新增装置，不覆盖 site.css 的既有选择器。
   真源说明见 docs/05-运维与发布/design-system/colorui-shop/MASTER.md
   ========================================================================== */

/* —— 01 统一页头 ——
   每页回答三件事：这是什么（编号 + 标题 + 定位）、有多少（右侧数据格）、下一步去哪（页尾）。
   与 site.css 的 .section-head 并存，前者用于页内分节，本装置只用于页首。 */
.cathead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: clamp(28px, 4vw, 44px) var(--pad) clamp(24px, 3vw, 36px);
}
@media (min-width: 900px) {
  .cathead {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 32px;
  }
}
.cathead__main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-inline-size: 0;
}
.cathead__title {
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.cathead__en {
  margin-inline-start: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
  white-space: nowrap;
}
.cathead__desc {
  max-inline-size: 62ch;
  font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
  line-height: 1.8;
  color: var(--muted);
  text-wrap: pretty;
}
/* 右侧数据格：等宽数字 + 小标签，贴齐页头右缘 */
.cathead__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  min-inline-size: 0;
}
/* 手机档三格挤一行，内距收一号；四格以上的页面自动折成两行 */
@media (max-width: 599px) {
  .cathead__stat {
    padding: 10px;
  }
  .cathead__v {
    font-size: var(--text-lg);
  }
}
@media (min-width: 600px) {
  .cathead__stats {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: minmax(78px, auto);
  }
}
.cathead__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface);
}
:root[data-theme="dark"] .cathead__stat {
  background: var(--page);
}
.cathead__v {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-medium);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.cathead__l {
  font-size: var(--text-3xs);
  line-height: 1.3;
  color: var(--subtle);
  white-space: nowrap;
}

/* —— 02 链路条 ——
   按件数加权切段：宽度即占比，段内数字在深底上转白色。
   电商 9 段 / 大促 4 族 / 基础组件 6 类都由同一装置承载。 */
.catflow {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.catflow__bar {
  display: flex;
  gap: 2px;
  block-size: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.catflow__seg {
  display: grid;
  place-items: center;
  min-inline-size: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1;
  transition: filter var(--dur) var(--ease);
}
.catflow__seg:hover {
  filter: brightness(1.08) saturate(1.15);
}
.catflow__legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 16px;
}
.catflow__item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-inline-size: 0;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--muted);
}
.catflow__dot {
  flex: none;
  inline-size: 7px;
  block-size: 7px;
  border-radius: 1px;
  translate: 0 -1px;
}
.catflow__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catflow__n {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--fg);
}

/* —— 03 分板块头 ——
   序号 + 名称 + 英文键 + 件数与占比 + 3px 占比条；占比条是板块之间唯一的节奏差异来源。 */
.catboard {
  border-block-start: 1px solid var(--line);
}
.catboard__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 14px;
  padding: 22px var(--pad) 0;
}
.catboard__no {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  color: var(--brand-ink);
}
.catboard__name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  min-inline-size: 0;
}
.catboard__en {
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  font-weight: var(--weight-regular);
  letter-spacing: 0.06em;
  color: var(--subtle);
}
.catboard__meta {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--subtle);
  white-space: nowrap;
}
.catboard__bar {
  block-size: 3px;
  margin: 12px var(--pad) 18px;
  background: var(--line);
}
.catboard__fill {
  display: block;
  block-size: 100%;
  background: var(--brand);
}

/* —— 04 三型卡片 ——
   标准卡走 4 列；每板块首件升为两列宽的 lead 卡，带 props 摘要，打破等尺寸网格。 */
.catgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 0 var(--pad) clamp(20px, 2.6vw, 30px);
}
@media (min-width: 680px) {
  .catgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .catgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1320px) {
  .catgrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.catcard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  min-inline-size: 0;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease),
    translate 0.18s var(--ease);
}
:root[data-theme="dark"] .catcard {
  background: var(--page);
}
.catcard:hover {
  border-color: var(--line-strong);
  background: var(--raised);
  translate: 0 -1px;
}
:root[data-theme="dark"] .catcard:hover {
  background: var(--surface);
}
.catcard:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* lead 卡：两列宽 + 顶部品牌色条 + 更大的名称与 props 摘要 */
.catcard--lead::before {
  content: "";
  position: absolute;
  inset-block-start: -1px;
  inset-inline: -1px;
  block-size: 3px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--brand);
}
.catcard--lead {
  border-color: var(--line-strong);
}
@media (min-width: 680px) {
  .catcard--lead {
    grid-column: span 2;
  }
}
.catcard__ref {
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catcard__name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: 1.35;
}
.catcard--lead .catcard__name {
  font-size: var(--text-2xl);
}
.catcard__code {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--brand-ink);
  overflow-wrap: anywhere;
}
.catcard__desc {
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catcard--lead .catcard__desc {
  -webkit-line-clamp: 2;
}
.catcard__props {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-block: 2px 4px;
  background: var(--line);
  border: 1px solid var(--line);
}
.catprop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 5px 8px;
  background: var(--surface);
  font-size: var(--text-2xs);
  line-height: 1.4;
}
:root[data-theme="dark"] .catprop {
  background: var(--page);
}
.catprop__k {
  font-family: var(--font-mono);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catprop__t {
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  color: var(--subtle);
  white-space: nowrap;
}
.catcard__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block-start: auto;
  padding-block-start: 4px;
}
.catcard .link-arrow {
  margin-block-start: 6px;
  font-size: var(--text-xs);
}
.catcard:hover .link-arrow {
  color: var(--brand-ink);
}

/* —— 05 命令块 ——
   安装说明从两段散文压成两块可扫读的对照卡，命令单独成块。 */
.catinstall {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  margin: 0 var(--pad) clamp(20px, 2.6vw, 28px);
  background: var(--line);
  border: 1px solid var(--line);
}
@media (min-width: 820px) {
  .catinstall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.catinstall__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  min-inline-size: 0;
}
:root[data-theme="dark"] .catinstall__col {
  background: var(--page);
}
.catinstall__name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.catinstall__name code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--brand-ink);
}
.catinstall__desc {
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--muted);
}
.catcmd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-start: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--page);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--fg);
  overflow-x: auto;
}
:root[data-theme="dark"] .catcmd {
  background: var(--surface);
}
.catcmd::before {
  content: "$";
  flex: none;
  color: var(--brand-ink);
}
.catinstall__note {
  padding: 0 var(--pad) clamp(20px, 2.6vw, 28px);
  font-size: var(--text-xs);
  color: var(--subtle);
}

/* —— 06 下一步 ——
   每页收口统一为三张去路卡，替代原来的一句「见 X 页」。 */
.catnext {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 0 var(--pad) clamp(28px, 4vw, 44px);
}
@media (min-width: 720px) {
  .catnext {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.catnext__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
:root[data-theme="dark"] .catnext__card {
  background: var(--page);
}
.catnext__card:hover {
  border-color: var(--brand);
}
.catnext__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.catnext__desc {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}
.catnext__card .link-arrow {
  margin-block-start: 6px;
  font-size: var(--text-xs);
}
.catnext__card:hover .link-arrow {
  color: var(--brand-ink);
}

/* —— 07 空态 ——
   搜索无结果时给建议与一个动作，不留白屏（UX 规则：Search / No Results）。 */
.catempty {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 var(--pad) clamp(28px, 4vw, 44px);
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  text-align: center;
}
:root[data-theme="dark"] .catempty {
  background: var(--page);
}
.catempty__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.catempty__hint {
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--muted);
}
.catempty__act {
  align-self: center;
  margin-block-start: 4px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  color: var(--brand-ink);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.catempty__act:hover {
  border-color: var(--brand);
  background: var(--brand-weak);
}

/* —— 08 折叠 ——
   搜索与筛选生效时分板块整体收起，避免只剩一条空段头。 */
[data-hide="1"] {
  display: none !important;
}

/* —— 09 顶栏窄面板 ——
   工具 / 社区两组用单列短面板，复用 site.css 的 .mega 定位与动画，只改宽度与行样式。 */
.mega--list {
  inline-size: min(19rem, calc(100vw - 32px));
}
.mega__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block-start: 6px;
}
.mega__link {
  display: grid;
  gap: 2px;
  padding: 9px 8px;
  border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease);
}
.mega__link:hover {
  background: var(--brand-weak);
}
.mega__link strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}
.mega__link span {
  font-size: var(--text-2xs);
  line-height: 1.5;
  color: var(--muted);
}

/* —— 10 数值格子 ——
   详情页/文档页页首的规格速览，与页头数据格同语言。 */
.catmetrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
@media (min-width: 720px) {
  .catmetrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.catmetrics__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--surface);
}
:root[data-theme="dark"] .catmetrics__item {
  background: var(--page);
}
.catmetrics__v {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--fg);
}
.catmetrics__l {
  font-size: var(--text-3xs);
  color: var(--subtle);
}

/* —— 11 通用条带 ——   页头与目录之间的过渡条：链路条、安装块、说明段都挂在这里，保证左右对齐 --pad。 */
.catstrip {
  padding: 0 var(--pad) clamp(20px, 2.6vw, 28px);
}
.catstrip__label {
  display: block;
  margin-block-end: 10px;
}

/* —— 12 产品矩阵 ——
   首页用来并列四套组件的去路，大号等宽数字作视觉锚点，与页头数据格同一语言。 */
.catmatrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 var(--pad) clamp(20px, 2.6vw, 28px);
}
@media (min-width: 1000px) {
  .catmatrix {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.catmatrix__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
:root[data-theme="dark"] .catmatrix__card {
  background: var(--page);
}
.catmatrix__card:hover {
  border-color: var(--brand);
}
.catmatrix__v {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--brand-ink);
}
.catmatrix__name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}
.catmatrix__desc {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}

/* —— 13 页脚五列 ——
   site.css 的 .site-footer__grid 是「品牌 + 三列」，新增「分类」一列后需在 ≥1040 扩到五列。 */
@media (min-width: 1040px) {
  .site-footer__grid {
    grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr));
  }
}

/* —— 产品首页卡片减法（2026-11-06）：组名 / Slug 与卡片代码重复，不再占用卡内首行 —— */
.catcard__ref {
  display: none;
}
