/**
 * 二级分类页 · 产品与分类列表
 * 作用域：#app-category-item
 */

#app-category-item.category-product-page {
    --cat-hero-from: #eef3fb;
    --cat-hero-to: #f6f8fc;
    --cat-panel-bg: #ffffff;
    --cat-panel-border: rgba(15, 23, 42, 0.06);
    --cat-panel-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 28px rgba(64, 102, 184, 0.06);
    --cat-muted: #64748b;
    --cat-heading: #0f172a;
    --cat-link: #334155;
    --cat-radius-lg: 16px;
    --cat-radius-md: 12px;
}

#app-category-item.category-product-page {
    background: linear-gradient(180deg, var(--cat-hero-from) 0%, var(--cat-hero-to) 220px, #eef2f7 100%);
    padding-bottom: 48px;
}

/* —— Hero —— */
.category-product-page__hero {
    position: relative;
    padding: 28px 0 20px;
    margin-bottom: 8px;
}

.category-product-page__hero::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 140px;
    pointer-events: none;
    background: radial-gradient(ellipse 90% 80% at 50% -20%, rgba(64, 102, 184, 0.14), transparent 55%);
}

.category-product-page__hero-inner {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
}

.category-product-page__title {
    margin: 0;
    /* 较原先整体约小两档（原 clamp 22–30px） */
    font-size: clamp(18px, 3.25vw, 26px);
    font-weight: 800;
    color: var(--cat-heading);
    letter-spacing: -0.03em;
    line-height: 1.2;
    max-width: min(100%, 920px);
}

.category-product-page__hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.category-product-page__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* 标题后一侧：较原 13px 再小一号 */
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color, #4066b8);
    background: rgba(64, 102, 184, 0.1);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(64, 102, 184, 0.18);
}

/* —— Content stack —— */
.category-product-page__stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 各版块高度随内容，避免父级 flex 或被内部 Grid 间接撑高 */
.category-product-page__stack > .category-product-page__panel {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    align-self: stretch;
}

.category-product-page__panel {
    background: var(--cat-panel-bg);
    border: 1px solid var(--cat-panel-border);
    border-radius: var(--cat-radius-lg);
    box-shadow: var(--cat-panel-shadow);
    overflow: hidden;
}

.category-product-page__panel--intro {
    padding: 18px 18px 18px;
}

@media (min-width: 768px) {
    .category-product-page__panel--intro {
        padding: 20px 22px;
    }
}

.category-product-page__intro-layout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

@media (min-width: 768px) {
    .category-product-page__intro-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 22px;
    }
}

.category-product-page__intro-media {
    flex-shrink: 0;
    width: 132px;
    height: 132px;
    margin: 0 auto;
    padding: 14px;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid rgba(64, 102, 184, 0.12);
    border-radius: var(--cat-radius-md);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

@media (min-width: 768px) {
    .category-product-page__intro-media {
        margin: 0;
        width: 148px;
        height: 148px;
    }
}

.category-product-page__intro-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-product-page__intro-copy {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

@media (max-width: 767.98px) {
    .category-product-page__intro-copy {
        width: 100%;
    }
}

.category-product-page__intro-heading {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.35;
}

.category-product-page__intro-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
    color: var(--cat-muted);
    max-height: 10.5em;
    overflow-y: auto;
    padding-right: 4px;
}

.category-product-page__intro-text::-webkit-scrollbar {
    width: 6px;
}

.category-product-page__intro-text::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 99px;
}

/* Section titles inside panels */
.category-product-page__panel-header {
    padding: 16px 20px 0;
}

@media (min-width: 768px) {
    .category-product-page__panel-header {
        padding: 18px 24px 0;
    }
}

.category-product-page__section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.category-product-page__section-title::before {
    content: '';
    width: 4px;
    height: 17px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-color, #4066b8), #64748b);
}

.category-product-page__panel-body {
    padding: 12px 18px 14px;
}

@media (min-width: 768px) {
    .category-product-page__panel-body {
        padding: 12px 22px 16px;
    }
}

/* 产品列表板块：标题与其它 panel 的 category-product-page__section-title 视觉一致 */
.category-product-page__panel--products {
    padding: 0;
    overflow: hidden;
}

#app-category-item .category-product-page__panel--products .product-box {
    margin: 0;
    width: 100%;
}

#app-category-item .product-box > .title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 16px 20px 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    line-height: 1.35;
}

@media (min-width: 768px) {
    #app-category-item .product-box > .title {
        padding: 18px 24px 0;
    }
}

#app-category-item .product-box > .title::before {
    content: '';
    width: 4px;
    height: 17px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-color, #4066b8), #64748b);
    flex-shrink: 0;
}

#app-category-item .product-box > .title .iconright,
#app-category-item .product-box > .title > i.iconfont {
    display: none;
}

#app-category-item .product-box > .content {
    padding: 14px 18px 20px;
}

@media (min-width: 768px) {
    #app-category-item .product-box > .content {
        padding: 16px 22px 22px;
    }
}

/*
 * 子分类：不用 Grid「先行后列、同行等高」——否则第一行会被最高那一格撑满，
 * 矮格（如「专用IC」）下方整块空白，下一行「接口」只能压在下面。
 * 多列（column-count）让区块在列内自上而下紧密排列，下方数据能往上顶。
 * 阅读顺序为先左列从上到下，再中列、右列（列优先），与 Grid 行优先略有不同。
 */
.category-product-page__subgrid {
    column-count: 1;
    column-gap: 28px;
    column-fill: balance;
}

@media (min-width: 520px) {
    .category-product-page__subgrid {
        column-count: 2;
    }
}

@media (min-width: 900px) {
    .category-product-page__subgrid {
        column-count: 3;
    }
}

.category-product-page__subcell {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    box-sizing: border-box;
    min-width: 0;
    margin-bottom: 20px;
    padding-bottom: 4px;
    -webkit-column-break-inside: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
}

/*
 * 品牌列表：不用 Grid 行等高（短名称下会垫高整行留白）。
 * 多列纵向流水，总高度随品牌数量与换行变化。
 */
.category-product-page__chip-grid {
    column-count: 1;
    column-gap: 12px;
    column-fill: balance;
}

@media (min-width: 577px) {
    .category-product-page__chip-grid {
        column-count: 2;
    }
}

@media (min-width: 900px) {
    .category-product-page__chip-grid {
        column-count: 3;
    }
}

.category-product-page__chip {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    box-sizing: border-box;
    min-width: 0;
    margin-bottom: 8px;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    -webkit-column-break-inside: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
    transition:
        border-color 0.18s ease,
        color 0.18s ease;
}

.category-product-page__chip:hover {
    border-color: rgba(64, 102, 184, 0.22);
    color: var(--primary-color, #4066b8);
    background: transparent;
}

/* —— 面包屑与本页衔接 —— */
.category-product-page + * {
    margin-top: 0;
}

.page-breadcrumb-nav + #app-category-item.category-product-page {
    margin-top: 0;
}

/* —— 子分类树：极简现代（留白、细线、无卡片投影）—— */
#app-category-item .category-child-branch {
    --depth: 0;
}

#app-category-item .category-child-branch--root {
    margin-bottom: 8px;
}

#app-category-item .category-child-branch--nested {
    margin-bottom: 1px;
}

#app-category-item .category-child-branch__link {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0;
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.15s ease, border-color 0.15s ease;
}

#app-category-item .category-child-branch__count {
    margin-left: 4px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
}

#app-category-item .category-child-branch__link--primary .category-child-branch__count {
    color: #64748b;
}

/* 一级：强调字重 + 底部分隔线，无盒形背景 */
#app-category-item .category-child-branch__link--primary {
    margin-left: 0;
    padding: 4px 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
    background: transparent;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
}

#app-category-item .category-child-branch__link--primary::before {
    display: none;
}

#app-category-item .category-child-branch__link--primary:hover {
    color: var(--primary-color, #4066b8);
    border-bottom-color: rgba(64, 102, 184, 0.25);
}

/* 二级及以下：纯文字层级 + 左缩进，无底色与装饰符号 */
#app-category-item .category-child-branch__link--secondary {
    margin-left: 0;
    padding: 5px 0 5px calc(10px + (var(--depth) - 1) * 18px);
    font-size: 13px;
    font-weight: 400;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

#app-category-item .category-child-branch__link--secondary::before {
    display: none;
}

#app-category-item .category-child-branch__link--secondary:hover {
    color: var(--primary-color, #4066b8);
}
