/* ===== product.css - 拉链页面专属样式 ===== */

/* ===== 左侧分类列表 ===== */
.zip-category-wrapper {
    padding: 0px 10px 12px 0;
    border-right: 1px solid #e8e8e8;
    max-height: 600px;
    overflow-y: auto;
}

.zip-category-wrapper::-webkit-scrollbar {
    width: 4px;
}

.zip-category-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.zip-category-wrapper::-webkit-scrollbar-thumb {
    background: #c0392b;
    border-radius: 4px;
}

.zip-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

/* ===== 父级分类 ===== */
.zip-category-list .parent-category {
    padding: 0px 16px;
    font-size: 17px;
    font-weight: 600;
    line-height: normal;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    margin: 0 0 28px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    color: #1a1a1a;
    position: relative;
    user-select: none;
}

.zip-category-list .parent-category .arrow-icon {
    font-size: 12px;
    margin-left: 4px;
    display: inline-block;
    transition: transform 0.3s ease;
    color: #999;
}

.zip-category-list .parent-category.active .arrow-icon {
    transform: rotate(180deg);
    color: #c0392b;
}

.zip-category-list .parent-category:hover {
    color: #c0392b;
}

.zip-category-list .parent-category.active {
    color: #c0392b;
}

/* ===== 子分类列表 ===== */
.zip-category-list .sub-category-list {
    list-style: none;
    padding: 0;
    margin: -16px 0 16px 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}

.zip-category-list .sub-category-list.open {
    max-height: 400px;
    opacity: 1;
    margin: -6px 0 16px 0;
}

/* ===== 子分类 ===== */
.zip-category-list .sub-category {
    padding: 4px 16px 4px 20px;
    font-size: 13px;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    color: #999;
    margin: 0 0 10px 0;
    border-left: 2px solid transparent;
    user-select: none;
}

.zip-category-list .sub-category:hover {
    color: #666;
    background: #f5f5f5;
}

.zip-category-list .sub-category.active {
    color: #c0392b;
    font-weight: 500;
}

/* ===== 右侧产品卡片（九宫格） ===== */
.zip-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    /* 纵向弹性布局并撑满单元格，兜底保证同一行格子等高 */
    display: flex;
    flex-direction: column;
    height: 100%;
}

.zip-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
}

.zip-card-media {
    background: #F5F5F5;
    /* 高度与内边距随列宽连续缩放，clamp 区间覆盖原 170/120/80/64px 四个断点值，避免跳变 */
    height: clamp(64px, 12vw, 170px);
    padding: clamp(8px, 1.15vw, 16px) 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zip-card-media img {
    /* 相对媒体盒自适应缩放，取代原先 140/80/50/40px 的硬编码 */
    max-height: 100%;
    max-width: calc(100% - 16px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.zip-card-title {
    /* 字号随视口连续缩放，覆盖原 18/15/13/11px 四个断点值 */
    font-size: clamp(12px, 0.62vw + 9.6px, 18px);
    font-weight: 500;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.4;
    /* 标题强制单行，超出部分自动省略号（全文由 th:title 悬停展示）；
       单行高度恒定，既避免换行撑高卡片，也不预留第 2 行空白 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.4em;
}

/* 标题外层链接与卡片等高联动 */
.product-item > a {
    display: block;
    height: 100%;
}

/* 产品九宫格行间距：UIkit 的行距靠 JS 给换行首元素注入 .uk-grid-margin，
   本网格未生效，导致列间距 15px、行间距 0px（第二行卡片边框与上一行紧贴），
   这里用 row-gap 显式补齐，与 .uk-grid-small 的 15px 列间距对齐 */
#product-grid {
    row-gap: 15px;
}
#product-grid > .uk-grid-margin {
    /* 行距已由 row-gap 接管，若 UIkit 后续注入该类不再叠加 */
    margin-top: 0;
}

.zip-card .uk-card-media-top {
    flex: 0 0 auto;
}

.zip-card .uk-card-body {
    /* 内边距随视口缩放，覆盖原 10px/6px 两个固定值 */
    padding: clamp(6px, 0.75vw, 10px) 6px;
    flex: 1 1 auto;
}

/* ===== 分类筛选动画 ===== */
.product-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-item.hidden {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

/* ===== 响应式适配 ===== */

/* 平板 */
@media (max-width: 960px) {
    .zip-category-wrapper {
        max-height: 500px;
    }
    .zip-category-list .parent-category {
        font-size: 14px;
        padding: 0px 12px;
        margin-bottom: 16px;
    }
    .zip-category-list .sub-category {
        font-size: 12px;
        padding: 3px 12px 3px 20px;
        margin-bottom: 5px;
    }
    .zip-category-list .sub-category-list.open {
        margin: -4px 0 12px 0;
    }
    /* 卡片尺寸与字号已由基础规则的 clamp() 连续缩放接管，此处不再重复固定值 */
}

/* 手机 */
@media (max-width: 640px) {
    .maxw1400 {
        margin-top: 0 !important;
    }
    /* 左侧分类改为横向滚动标签 */
    .zip-category-wrapper {
        padding: 8px 0;
        border-radius: 6px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        max-height: none;
        border: 1px solid #e8e8e8;
        border-right: 1px solid #e8e8e8;
        background: #fafafa;
    }

    .zip-category-wrapper::-webkit-scrollbar {
        height: 3px;
    }

    .zip-category-wrapper::-webkit-scrollbar-thumb {
        background: #c0392b;
        border-radius: 4px;
    }

    .zip-category-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        margin: 0;
        padding: 0 12px;
        white-space: nowrap;
        float: none;
        width: auto;
        align-items: center;
    }

    /* 手机端隐藏子分类（简化显示） */
    .zip-category-list .sub-category-list {
        display: none;
    }

    .zip-category-list .parent-category {
        display: inline-block;
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 20px;
        flex-shrink: 0;
        background: transparent;
        margin: 4px 0;
        text-align: center;
        text-transform: none;
        border: 1px solid #e0e0e0;
    }

    .zip-category-list .parent-category .arrow-icon {
        display: none;
    }

    .zip-category-list .parent-category:hover {
        background: #e8ecf1;
    }

    .zip-category-list .parent-category.active {
        background: #c0392b;
        color: #fff;
        border-color: #c0392b;
    }

    /* 手机卡片：尺寸/字号/内边距均由上方 clamp() 连续缩放接管，此处不再重复固定值 */

    /* 窄屏收紧 gutter（UIkit 基础为 15px），下方 6px 为本模板实际生效的列间距 */
    .uk-grid-small > * {
        padding-left: 6px;
    }

    /* 行间距跟随列间距，否则窄屏会出现列 6px / 行 15px 的不对称 */
    #product-grid {
        row-gap: 6px;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    /* 小屏卡片：尺寸与字号由 clamp() 连续缩放接管 */
    .zip-category-list .parent-category {
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* ===== 容器 ===== */
.maxw1400 {
    max-width: 1200px;
    margin-top: 30px;
}

.uk-card-default {
    background: #F5F5F5;
    box-shadow: none;
}


/* ===== 左侧列宽调窄 ===== */
@media (min-width: 960px) {
    .uk-width-1-4\@m {
        width: 18% !important;
    }
    .uk-width-3-4\@m {
        width: 80% !important;
    }
}

@media (min-width: 640px) and (max-width: 959px) {
    .uk-width-1-3\@s {
        width: 25% !important;
    }
    .uk-width-2-3\@s {
        width: 75% !important;
    }
}

/* ===== Sticky Footer ===== */
body > main {
    min-height: calc(100vh - 228px);
}

/* ===== Zip Detail Page ===== */
.zip-detail-page {
    background: #fff;
}

.detail-container {
    max-width: 960px;
    padding-right: 0;
    padding-bottom: 56px;
    padding-left: 0;
}

.detail-sticky-bar {
    z-index: 900;
    padding-top: 12px;
    background: #fff;
}

.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin-bottom: 14px;
    background: rgba(245, 245, 245, 0.47);
    box-shadow: 0 0 0 100vmax rgba(245, 245, 245, 0.47);
    clip-path: inset(0 -100vmax);
    color: #9a9a9a;
    font-size: 15px;
}

.detail-breadcrumb a {
    color: #9a9a9a;
    text-decoration: none;
}

.detail-breadcrumb a:hover {
    color: #c0392b;
}

.detail-breadcrumb .current {
    color: #3D3D3D;
}

.detail-tabs {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 58px;
    margin-bottom: 30px;
    padding: 0 22px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(22, 42, 98, .18);
}

.detail-tabs a {
    display: inline-flex;
    align-items: center;
    height: 58px;
    padding: 0 28px;
    color: #333;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.detail-tabs a.active {
    color: #c0392b;
    border-bottom-color: #e51c36;
}

.detail-tabs .quote-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    margin-left: auto;
    padding: 0 22px;
    border: 0;
    border-radius: 4px;
    background: #1f56e6;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.detail-tabs .quote-button:hover {
    background: #1647c5;
    color: #fff;
}

.detail-hero {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

.detail-gallery p {
    margin: 0 0 16px;
    color: #555;
    font-size: 14px;
    text-align: center;
}

.detail-gallery img {
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* 单图场景：图片铺满列宽，更大幅展示 */
.detail-gallery.single-image img {
    max-width: 100%;
    border-radius: 8px;
}

.detail-copy {
    color: #535353;
    font-size: 14px;
    line-height: 1.75;
}

.detail-copy h1 {
    margin: 0 0 14px;
    color: #444;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.25;
}

.detail-copy h2 {
    margin: 22px 0 6px;
    color: #333;
    font-size: 15px;
    font-weight: 700;
}

.detail-copy p {
    margin: 0 0 8px;
}

/* 平板设备：标题字号中间断点 */
@media (max-width: 768px) {
    .detail-copy h1 {
        font-size: 28px;
    }
}

.detail-diagram {
    margin-top: 24px;
}

.detail-diagram img {
    display: block;
    width: 100%;
    max-width: 430px;
}

.small-diagram img {
    max-width: 160px;
}

/* ===== Related Products ===== */
.relate-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-top: 22px;
}

.relate-card {
    /* 弹性列布局并撑满栅格行高，保证同一行卡片等高 */
    display: flex;
    flex-direction: column;
    height: 100%;
    /* UIkit 未做全局 border-box 重置，而本元素是普通 <a>；
       不加此声明时 height:100% 仅锁定内容高，padding 会额外撑出 28px 使上下行卡片交叠 */
    box-sizing: border-box;
    padding: clamp(8px, 0.8vw, 10px) clamp(8px, 0.8vw, 10px) clamp(12px, 1.4vw, 18px);
    background: #f4f4f4;
    color: #3d3d3d;
    text-align: center;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.relate-card:hover {
    color: #c0392b;
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .1);
}

.relate-card img {
    display: block;
    width: 100%;
    aspect-ratio: 300 / 160;
    object-fit: cover;
    flex: 0 0 auto;
    margin-bottom: clamp(8px, 1vw, 14px);
}

.relate-card span {
    /* 标题固定预留 2 行（2 × line-height 1.5 = 3em，随字号自动缩放），超出省略号截断 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    min-height: 3em;
    max-height: calc(3em + 1px);
    color: inherit;
    /* 字号随视口连续缩放 */
    font-size: clamp(13px, 0.55vw + 9px, 15px);
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.relate-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin: 30px 0 0;
}

.relate-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #dcdcdc;
    border-radius: 3px;
    background: #fff;
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.relate-pagination a.active {
    border-color: #777;
    color: #333;
}

.relate-pagination a.disabled {
    color: #cfcfcf;
    pointer-events: none;
}

/* 分页省略号 */
.relate-pagination .relate-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #999;
    font-size: 13px;
    user-select: none;
    pointer-events: none;
}

@media (max-width: 960px) {
    .detail-sticky-bar {
        padding-top: 10px;
    }

    .detail-breadcrumb {
        position: static;
        top: auto;
    }

    .detail-hero {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* 移动端 gallery 图片居中，限制最大宽度 */
    .detail-gallery img {
        max-width: 480px;
        margin: 0 auto;
    }

    .detail-copy h1 {
        font-size: 28px;
    }

    .relate-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .detail-container {
        /*padding-top: 14px;*/
        padding-right: 15px;
        padding-bottom: 36px;
        padding-left: 15px;
    }

    .detail-breadcrumb {
        flex-wrap: wrap;
        margin-bottom: 16px;
    }

    .detail-tabs {
        flex-wrap: wrap;
        gap: 0;
        padding: 0 12px 12px;
    }

    .detail-tabs a {
        height: 48px;
        padding: 0 12px;
        font-size: 14px;
    }

    .detail-tabs .quote-button {
        width: 100%;
        height: 44px;
        justify-content: center;
        margin-top: 10px;
        margin-left: 0;
    }

    .detail-copy h1 {
        font-size: 26px;
    }

    .relate-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .relate-pagination {
        justify-content: center;
    }
}

/* ===== Mobile Footer Bottom ===== */
@media (max-width: 959px) {
    html {
        height: 100%;
        min-height: 100%;
    }

    body {
        display: flex !important;
        min-height: 100vh;
        min-height: 100svh;
        flex-direction: column;
    }

    body > main {
        flex: 1 0 auto !important;
        min-height: 0 !important;
    }

    body > .site-footer {
        flex: 0 0 auto;
        margin-top: auto;
    }
}
