/* ============================================
   博客页面样式 - 基于 BEM 架构
   ============================================
   职责：定义博客列表页和分类页专属样式
   依赖：base.css, components.css, inStyle.css
   命名规范：使用 `ss-` 前缀，遵循 BEM 命名法
   ============================================ */

/* ============================================
   1. 页面容器
   ============================================ */
/* 使用更高优先级，确保样式正确应用 */
body.category .ss-page--blog,
body.archive .ss-page--blog,
body.blog .ss-page--blog,
.ss-page--blog {
    background: #f8f8f8;
    min-height: 100vh;
    overflow-x: hidden;
}

body.category .ss-page--blog .ss-container,
body.archive .ss-page--blog .ss-container,
body.blog .ss-page--blog .ss-container,
.ss-page--blog .ss-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
    width: 100%;
}

/* ============================================
   2. Banner 区域
   ============================================ */
.ss-blog-banner {
    position: relative;
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ss-blog-banner__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.ss-blog-banner__title {
    position: relative;
    color: #fff;
    font-size: 56px;
    font-weight: 700;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0;
}

/* ============================================
   3. 面包屑导航
   ============================================ */
.ss-blog-breadcrumb {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    margin-top: 0 !important; /* 移除margin-top，body的padding-top已为fixed header留出空间 */
    padding-top: 0 !important; /* 确保没有额外的padding-top */
}

/* 面包屑容器：去掉 ss-container 的上下 padding，避免高度叠加到 80px 上 */
.ss-blog-breadcrumb .ss-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.ss-blog-breadcrumb__inner {
    font-size: 14px;
    color: #888;
    height: 35px;
    padding: 0;
    display: flex;
    align-items: center;
}

.ss-blog-breadcrumb__inner a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ss-blog-breadcrumb__inner a:hover {
    color: var(--primary-color, #e91e63);
}

.ss-blog-breadcrumb__inner span {
    color: #333;
    font-weight: 500;
}

/* ============================================
   4. 分类描述
   ============================================ */
.ss-blog-category-desc {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 16px;
    line-height: 1.7;
    color: #666;
    text-align: center;
}

.ss-blog-category-desc p {
    margin: 0 0 15px 0;
}

.ss-blog-category-desc p:last-child {
    margin-bottom: 0;
}

/* ============================================
   5. 博客网格
   ============================================ */
body.category .ss-blog-grid,
body.archive .ss-blog-grid,
body.blog .ss-blog-grid,
.ss-blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* 从 380px 改为 320px，适应更小屏幕 */
    justify-items: stretch; /* 防止被其它全局样式改成居中，导致卡片/图片看起来偏右 */
    gap: 20px; /* 减小间距，避免在小屏幕上挤压 */
    margin-top: 20px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px; /* 添加内边距，避免内容贴边 */
}

/* ============================================
   6. 博客卡片
   ============================================ */
/* 使用更高的选择器优先级，确保覆盖 main.css 中的旧样式 */
.ss-page--blog .ss-blog-card,
body.category .ss-blog-card,
body.archive .ss-blog-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.ss-page--blog .ss-blog-card:hover,
body.category .ss-blog-card:hover,
body.archive .ss-blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

 
    .ss-blog-card__image {
        position: relative;
        width: 100%;
        height: 240px;  /* 修改为固定高度240px */
        overflow: hidden;
        background: #f0f0f0;
        box-sizing: border-box;
    }

.ss-blog-card__image a {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    box-sizing: border-box;
    margin: 0;
}

.ss-blog-card__img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
    box-sizing: border-box;
    margin: 0;
}

.ss-blog-card:hover .ss-blog-card__img {
    transform: scale(1.08);
}

.ss-blog-card__content {
    padding: 28px;
}

.ss-blog-card__meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: #999;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.ss-blog-card__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ss-blog-card__meta-icon {
    font-size: 16px;
    opacity: 0.7;
}

.ss-blog-card__title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.5;
    color: #222;
    min-height: 66px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ss-blog-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ss-blog-card__title a:hover {
    color: var(--primary-color, #e91e63);
}

.ss-blog-card__excerpt {
    font-size: 15px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ss-blog-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    gap: 15px;
}

.blog-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
}

.blog-card__time {
    color: #999;
}

.blog-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    flex: 1;
}

.blog-card__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e6e6e6;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blog-card__action-btn:hover {
    transform: translateY(-1px);
    border-color: var(--primary-color, #e91e63);
    color: var(--primary-color, #e91e63);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ss-blog-card__footer .ss-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================
   7. 分页样式
   ============================================ */
.ss-blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 60px 0 40px;
    padding: 10px 0;
}

.ss-blog-pagination a,
.ss-blog-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 45px;
    padding: 0 10px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ss-blog-pagination a:hover {
    background: var(--primary-color, #e91e63);
    color: #fff;
    border-color: var(--primary-color, #e91e63);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.ss-blog-pagination .current {
    background: var(--primary-color, #e91e63);
    color: #fff;
    border-color: var(--primary-color, #e91e63);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.ss-blog-pagination .dots {
    border: none;
    background: transparent;
    color: #999;
    cursor: default;
}

.ss-blog-pagination .prev,
.ss-blog-pagination .next {
    padding: 0 14px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================
   8. 空状态
   ============================================ */
.ss-blog-empty {
    text-align: center;
    color: #999;
    font-size: 18px;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   9. 响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .ss-blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .ss-blog-banner {
        height: 200px;
    }
    
    .ss-blog-banner__title {
        font-size: 40px;
    }
    
    .ss-blog-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-left: 0;
        margin-right: 0;
    }

    /* 移动端同样需要防横向溢出（有些机型宽度 >480 也会出现偏右） */
    .ss-blog-card,
    .ss-blog-card__image,
    .ss-blog-card__image a,
    .ss-blog-card__img {
        max-width: 100%;
        box-sizing: border-box;
    }

    .ss-blog-card__image a,
    .ss-blog-card__img {
        display: block;
        margin: 0;
    }
    
    .ss-blog-card__title {
        font-size: 20px;
        min-height: auto;
    }
    
    .ss-blog-pagination a,
    .ss-blog-pagination span {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .ss-blog-pagination .prev,
    .ss-blog-pagination .next {
        padding: 0 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ss-blog-card__image {
        height: 200px !important;
    }
    
    .ss-blog-card__img {
        height: 100% !important; /* 确保图片填满容器高度 */
        object-fit: cover; /* 保持图片比例并裁剪以填充容器 */
    }
}

@media (max-width: 480px) {
    .ss-blog-breadcrumb__inner {
        padding: 20px 0;
        font-size: 13px;
    }
    
    .ss-blog-category-desc {
        padding: 15px;
        font-size: 14px;
    }
    
    .ss-blog-card__content {
        padding: 20px;
    }

    /* 防止卡片/图片造成横向溢出导致"盒子偏右" */
    .ss-blog-grid {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .ss-blog-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }
    
    .ss-blog-card__image {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .ss-blog-card__image a {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: block !important;
    }

    .ss-blog-card__img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        display: block;
        box-sizing: border-box !important;
        object-fit: cover;
    }
    
    .blog-card__footer {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .blog-card__meta {
        flex-shrink: 0;
    }

    .blog-card__actions {
        flex: 1;
        justify-content: flex-end;
    }
    
    .ss-blog-card__footer .ss-btn {
        width: 100%;
        text-align: center;
    }
    
    .ss-blog-pagination {
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
        margin-top:20px;
        margin-bottom:20px;
    }
    
    .ss-blog-pagination a,
    .ss-blog-pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }
    
    .ss-blog-pagination .prev,
    .ss-blog-pagination .next {
        padding: 0 10px;
        font-size: 12px;
    }
}

/* ============================================
   10. 动画效果
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ss-blog-card {
    animation: fadeInUp 0.6s ease-out;
}

.ss-blog-card:nth-child(1) {
    animation-delay: 0.1s;
}

.ss-blog-card:nth-child(2) {
    animation-delay: 0.2s;
}

.ss-blog-card:nth-child(3) {
    animation-delay: 0.3s;
}

.ss-blog-card:nth-child(n+4) {
    animation-delay: 0.4s;
}

/* 隐藏桌面端汉堡菜单按钮 */
@media (min-width: 992px) {
  .tw-header .tw-header__hamburger,
  .tw-header__hamburger,
  button.tw-header__hamburger,
  button#menu-toggle,
  #menu-toggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* 修复：确保产品分类下拉菜单的图片卡在右边（不是下方） */
header .menu-item.product-category > .sub-menu.sub-menu-product-category .sf-mega-inner {
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  display: flex !important;
}

header .menu-item.product-category > .sub-menu.sub-menu-product-category .sf-mega-cards {
  flex: 0 0 calc(220px * 2 + 20px) !important;
  width: calc(220px * 2 + 20px) !important;
}
