/* 分类全页专属：仅 body.cat-page 与分类列表主体（页头/页脚见 style.css） */

.cat-page {
    box-sizing: border-box;
    margin: 0;
    background: var(--cat-bg, #f6f8fc);
    color: var(--cat-text, #333);
    font-family: Roboto, "Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, Helvetica, Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.2px;
    min-height: calc(100vh + 20px);
}

/* 仅分类主体内重置，勿用 .cat-page * 否则后载的页面样式会扒掉页头/页脚在 style.css 里的内外边距 */
.cat-main :not(input) {
    text-transform: capitalize;
}

.cat-main .not-text-transform,
.cat-main .not-text-transform * {
    text-transform: none;
}

.cat-main *,
.cat-main *::before,
.cat-main *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.cat-main li,
.cat-main ol,
.cat-main ul {
    list-style: none;
    padding: 0;
}

.cat-page .layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.cat-main {
    flex: 1;
    min-height: calc(100vh - 401px);
}

@media (max-width: 991.98px) {
    .cat-main {
        min-height: 0;
    }
}

/* ----- 分类列表主体 ----- */
.cat-body {
    background: var(--cat-bg, #f6f8fc);
    overflow: hidden;
}

.cat-body__inner {
    max-width: 100%;
    width: var(--cat-max, 1320px);
    margin: 20px auto;
    padding: 0 10px;
    font-size: 14px;
    color: var(--cat-text, #333);
}

.cat-body__card {
    margin-bottom: 16px;
    padding: 0 20px 20px;
    background: #fff;
}

.cat-body__card-title {
    margin: 0;
    border-bottom: 1px solid var(--cat-border);
}

.cat-body__card-title a {
    position: relative;
    display: block;
    padding: 15px 36px 15px 0;
    font-weight: 700;
    font-size: 16px;
    line-height: 24px;
    color: var(--cat-text);
    text-decoration: none;
}

.cat-body__card-title a:hover {
    color: var(--cat-primary);
}

.cat-body__card-title .cat-body__count {
    margin-left: 3px;
    color: var(--cat-primary);
    font-weight: 700;
}

.cat-body__card-title .cat-body__arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--cat-primary);
}

.cat-body__children {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
    padding-top: 4px;
}

.cat-body__children a {
    display: block;
    margin-top: 16px;
    padding: 0 8px;
    font-size: 14px;
    line-height: 20px;
    color: var(--cat-text);
    text-decoration: none;
    width: 100%;
}

@media (min-width: 768px) {
    .cat-body__children a {
        width: 33.333%;
    }
}

.cat-body__children a:hover {
    color: var(--cat-primary);
}

.cat-body__children .cat-body__count {
    margin-left: 3px;
    color: var(--cat-primary);
    font-weight: 700;
}

/* ----- 分类子级页（有下级分类的 DK-{id}.html） -----
   说明：模板中的字号、间距、加粗等 utility class 在 seemb4 未全局定义，且 .cat-main 通配符会清零 margin，
   故以下样式全部写在 .category-branch-page 下并自带字阶与留白（参考 Digi-Key 式信息层级）。 */

.category-branch-page {
    --branch-accent: var(--cat-primary, #4267b2);
    --branch-border: var(--cat-border, #dfe4ed);
    --branch-muted: var(--cat-muted, #666);
}

.category-branch-page .branch-page-inner {
    padding-bottom: 40px;
}

.category-branch-page .branch-breadcrumb {
    line-height: 1.6;
    font-size: 14px;
    margin: 0 0 16px;
    padding: 0;
    color: var(--branch-muted);
}

.category-branch-page .branch-breadcrumb a {
    color: var(--branch-accent);
    text-decoration: none;
}

.category-branch-page .branch-breadcrumb a:hover {
    text-decoration: underline;
}

.category-branch-page .branch-breadcrumb [aria-current="page"] {
    color: var(--cat-text, #333);
    font-weight: 600;
}

.category-branch-page .cat-body__breadcrumb-sep {
    margin: 0 6px;
    color: #999;
}

.category-branch-page .branch-result-line {
    margin: 0 0 20px;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cat-text, #333);
}

.category-branch-page .branch-result-count {
    margin-left: 6px;
    font-weight: 700;
    color: var(--branch-accent);
}

.category-branch-page .branch-panel {
    margin: 0 0 24px;
    padding: 24px 22px;
    background: #fff;
    border: 1px solid var(--branch-border);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* 分类介绍：左栏图+名称（居中），右栏正文 */
.category-branch-page .branch-intro.branch-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    border-left: none;
    padding-left: 22px;
}

@media (min-width: 768px) {
    .category-branch-page .branch-intro.branch-panel {
        grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
        column-gap: 36px;
        align-items: start;
    }
}

.category-branch-page .branch-intro__col--visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.category-branch-page .branch-intro__media {
    flex-shrink: 0;
    width: 100%;
    max-width: 180px;
}

.category-branch-page .branch-intro__img {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
    border: 1px solid var(--branch-border);
    border-radius: 4px;
    background: #fafafa;
}

.category-branch-page .branch-intro__img--placeholder {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1;
    margin: 0 auto;
    background: linear-gradient(145deg, #f1f5f9, #e8eef5);
    border: 1px dashed var(--branch-border);
    border-radius: 4px;
}

.category-branch-page .branch-intro__title {
    margin: 0;
    max-width: 220px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #4a4a4a;
    letter-spacing: 0;
}

.category-branch-page .branch-intro__col--content {
    min-width: 0;
    padding-top: 0;
}

@media (min-width: 768px) {
    .category-branch-page .branch-intro__col--content {
        padding-top: 4px;
    }
}

.category-branch-page .branch-intro__desc {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.65;
    color: #333;
    text-align: left;
    white-space: pre-line;
    word-break: break-word;
}

.category-branch-page .branch-section__title {
    margin: 0 0 18px;
    padding: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    border-bottom: 2px solid var(--branch-border);
    color: #1a1a1a;
}

.category-branch-page .branch-section__title--parent {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.category-branch-page .branch-section__title-name {
    font-weight: 700;
    color: #1a1a1a;
}

.category-branch-page .branch-section__title-total {
    font-weight: 700;
    font-size: 18px;
    color: var(--branch-accent);
}

.category-branch-page .branch-section__title--decor {
    position: relative;
    padding-left: 16px;
}

.category-branch-page .branch-section__title--decor::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    width: 4px;
    height: 1.1em;
    border-radius: 2px;
    background: var(--branch-accent);
}

/* 分类子项：三列网格 + 蓝色链接（对齐参考稿） */
.category-branch-page .branch-section--subcats .branch-sub-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px 28px;
    margin: 0;
    padding: 20px 0 0;
    border-top: 1px solid #eee;
    list-style: none;
}

@media (min-width: 576px) {
    .category-branch-page .branch-section--subcats .branch-sub-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .category-branch-page .branch-section--subcats .branch-sub-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.category-branch-page .branch-sub-list__item {
    margin: 0;
    padding: 0;
    border: none;
}

.category-branch-page .branch-sub-list__link {
    display: block;
    text-align: left;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #333333;
    text-decoration: none;
    word-break: break-word;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.category-branch-page .branch-sub-list__link:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

.category-branch-page .branch-sub-list__link:visited {
    color: #333333;
}

.category-branch-page .branch-sub-list__count {
    font-weight: 700;
    color: var(--branch-accent);
}

.category-branch-page .branch-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (min-width: 576px) {
    .category-branch-page .branch-product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .category-branch-page .branch-product-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

.category-branch-page .branch-product-card {
    margin: 0;
    padding: 0;
    background: transparent;
}

.category-branch-page .branch-product-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 10px;
    text-decoration: none;
    color: inherit;
    min-height: 100%;
    height: 100%;
    border-radius: 6px;
    border: 1px solid var(--branch-border);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-branch-page .branch-product-card__link:hover {
    border-color: var(--branch-accent);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.category-branch-page .branch-product-card__img-wrap {
    width: 100%;
    max-width: 112px;
    margin: 0 auto 12px;
}

.category-branch-page .branch-product-card__img {
    display: block;
    width: 100%;
    max-height: 112px;
    margin: 0 auto;
    object-fit: contain;
}

.category-branch-page .branch-product-card__img--empty {
    width: 100%;
    aspect-ratio: 1;
    background: #f1f5f9;
    border-radius: 4px;
}

.category-branch-page .branch-product-card__pn {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-branch-page .branch-product-card__mfg {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--branch-muted);
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-branch-page .branch-product-card__price {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.3;
}

.category-branch-page .branch-mfg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
}

@media (min-width: 768px) {
    .category-branch-page .branch-mfg-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .category-branch-page .branch-mfg-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.category-branch-page .branch-mfg-grid__cell {
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--branch-border);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cat-text, #333);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.category-branch-page .branch-mfg-grid__cell:hover {
    border-color: var(--branch-accent);
    background: #fff;
}

.category-branch-page .branch-mfg-grid__name {
    display: block;
}

.category-branch-page .branch-mfg-grid__link {
    color: inherit;
    text-decoration: none;
}

.category-branch-page .branch-mfg-grid__link:hover {
    color: var(--branch-accent, #2563eb);
    text-decoration: underline;
}

/* ----- 单页 /{lang}/page/{id}.html：与分类页共用 cat-body__inner 宽度 ----- */
.category-branch-page .branch-panel.single-page-panel {
    border: none;
    box-shadow: none;
}

.category-branch-page .single-page__cover {
    margin: 0 0 24px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.category-branch-page .single-page__cover-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
}

.category-branch-page .single-page__body {
    font-size: 1rem;
    line-height: 1.75;
    color: #333;
    word-break: break-word;
}

.category-branch-page .single-page__content {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* 单页富文本内容单独做作用域，避免继承分类页主体的通用排版规则 */
.category-branch-page .single-page__content,
.category-branch-page .single-page__content :where(*, *::before, *::after) {
    text-transform: none;
    letter-spacing: normal;
}

.category-branch-page .single-page__content :where(h1, h2, h3, h4, h5, h6) {
    margin: 0 0 1em;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
}

.category-branch-page .single-page__content :where(p, blockquote, pre, table, figure) {
    margin: 0 0 1em;
}

.category-branch-page .single-page__content :where(ul, ol) {
    margin: 0 0 1em 1.4em;
    padding-left: 1.2em;
}

.category-branch-page .single-page__content :where(ul) {
    list-style: disc;
}

.category-branch-page .single-page__content :where(ol) {
    list-style: decimal;
}

.category-branch-page .single-page__content :where(li) {
    margin-bottom: 0.35em;
}

.category-branch-page .single-page__content :where(a) {
    color: var(--branch-accent, #2563eb);
    text-decoration: underline;
}

.category-branch-page .single-page__content :where(table) {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

.category-branch-page .single-page__content :where(th, td) {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    vertical-align: top;
}

.category-branch-page .single-page__content :where(pre, code) {
    font-family: Consolas, "Courier New", monospace;
    text-transform: none;
}

.category-branch-page .single-page__content :where(pre) {
    padding: 12px 14px;
    overflow-x: auto;
    background: #f8fafc;
    border-radius: 6px;
}

.category-branch-page .single-page__body img {
    max-width: 100%;
    height: auto;
}

.category-branch-page .single-page-columns {
    display: block;
}

.category-branch-page .single-page-columns--with-aside {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
    align-content: start;
}

/* DOM 顺序：aside → main。窄屏单列：导航在上、正文在下 */
.category-branch-page .single-page-columns--with-aside .single-page-columns__aside,
.category-branch-page .single-page-columns--with-aside .single-page-columns__main {
    min-width: 0;
    align-self: start;
}

/* 侧栏内圆形图标向左略突出，勿裁切（grid 子项默认易截断溢出） */
.category-branch-page.single-page .single-page-columns--with-aside .single-page-columns__aside {
    overflow: visible;
}

/* ≥768px：左 260px 导航 + 右正文，与 DOM 顺序一致，顶对齐 */
@media (min-width: 768px) {
    .category-branch-page .single-page-columns--with-aside {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

/* 单页侧栏导航：正文向上滚动时吸顶。sticky 需祖先链上勿用 overflow:hidden（.cat-body 默认 hidden 会失效） */
.category-branch-page.single-page .cat-body {
    overflow: visible;
}

@media (min-width: 768px) {
    .category-branch-page .single-page-columns__aside .single-page-sibling-nav.branch-panel {
        position: sticky;
        top: 12px;
        z-index: 5;
        max-height: calc(100vh - 24px);
        /* overflow-y:auto 时横向也会参与裁切，靠 .single-page-sibling-nav 足够 padding-left 包住左突出的圆 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 单页侧栏：卡片 + 左侧圆形汉堡图标（与正文区 branch-panel 大块白底区分，外层弱化为透明） */
.category-branch-page .single-page-sibling-nav.branch-panel {
    margin: 0;
    /* 左内边距须 ≥ 图标向左突出量，避免圆在 overflow 裁切区内被切掉 */
    padding: 4px 2px 8px 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.category-branch-page .single-page-sibling-nav__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.category-branch-page .single-page-sibling-nav__item {
    position: relative;
    margin: 0 0 14px;
    line-height: 1.45;
    font-size: 14px;
}

.category-branch-page .single-page-sibling-nav__item:last-child {
    margin-bottom: 0;
}

/* 卡片主体：白底圆角阴影；左侧为圆形图标预留内边距 */
.category-branch-page .single-page-sibling-nav__card {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 10px 14px 10px 38px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    color: var(--cat-text, #333);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease, box-shadow 0.15s ease;
}

.category-branch-page .single-page-sibling-nav__link:hover {
    color: var(--branch-accent, #2563eb);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.category-branch-page .single-page-sibling-nav__link:focus-visible {
    outline: 2px solid var(--branch-accent, #2563eb);
    outline-offset: 2px;
}

/* 左侧圆形：略突出卡片左缘 */
.category-branch-page .single-page-sibling-nav__icon {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: -10px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    color: inherit;
}

/* 汉堡线：三横线，随 currentColor 变色 */
.category-branch-page .single-page-sibling-nav__hamburger {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.category-branch-page .single-page-sibling-nav__label {
    flex: 1;
    min-width: 0;
}

/* 当前页：图标与文案主题色（与 span.single-page-sibling-nav__current 对应） */
.category-branch-page .single-page-sibling-nav__card.single-page-sibling-nav__current {
    color: var(--branch-accent, #2563eb);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.12);
}

.category-branch-page .single-page-sibling-nav__current {
    cursor: default;
}

/* 手机端：兄弟单页导航改为横向可滑动的标签条（圆角 chip），避免竖向大块卡片占满屏宽 */
@media (max-width: 767px) {
    .category-branch-page .single-page-sibling-nav--mobile-tags.branch-panel {
        padding: 0 0 4px;
        margin: 0 -4px;
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px 4px 8px;
        margin: 0;
        list-style: none;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__item {
        flex: 0 0 auto;
        margin: 0;
        max-width: min(280px, 85vw);
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__card {
        min-height: 0;
        padding: 8px 14px;
        border-radius: 999px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
        white-space: nowrap;
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__icon {
        display: none;
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__label {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__card.single-page-sibling-nav__current {
        background: var(--branch-accent, #2563eb);
        color: #fff;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    }

    .category-branch-page .single-page-sibling-nav--mobile-tags .single-page-sibling-nav__link:hover {
        color: var(--branch-accent, #2563eb);
        background: #fff;
    }
}
