/* ===== 分类 / 标签 统一归档页面样式 ===== */

/* ===== 整体布局：主体 80% + 右侧边栏 20% ===== */
.category-page-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    width: 100%;
}

.category-page-main-content {
    flex: 0 0 calc(80% - 16px); /* 80% 减去 gap 的一半 */
    max-width: calc(80% - 16px);
    min-width: 0; /* 防止 flex 子项溢出 */
}

.category-page-sidebar {
    flex: 0 0 calc(20% - 16px); /* 20% 减去 gap 的一半 */
    max-width: calc(20% - 16px);
    min-width: 0;
}

/* ===== 第一行：标题1 ===== */
.category-page-title {
    /*font-size: 28px;*/
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a1a;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    word-break: break-word;
}

/* 当前分类名颜色高亮 */
.category-page-title-cat {
    color: #354574;
    margin: 0 4px;
}

/* ===== 卡片列表网格（3 列，使卡片更窄） ===== */
.category-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ===== 卡片 ===== */
.category-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.category-card-cover-link {
    display: block;
    text-decoration: none !important;
    color: inherit;
}

/* --- 封面图区域（3:2 比例） --- */
.category-card-cover {
    position: relative;
    width: 100%;
    padding-top: 66.67%;
    overflow: hidden;
}

.category-card-cover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-card:hover .category-card-cover-img {
    transform: scale(1.05);
}

/* --- 内容区域 --- */
.category-card-content {
    display: flex;
    flex-direction: column;
    padding: 20px 20px 18px;
    flex: 1;
}

/* --- 标题 --- */
.category-card-title {
    /*font-size: 18px;*/
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.category-card-title a:hover {
    color: #354574;
}

/* --- 分类 --- */
.category-card-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.category-card-cat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    padding: 3px 10px;
    background: rgba(53, 69, 116, 0.08); /* #354574 浅色背景 */
    color: #354574;
    border-radius: 12px;
    line-height: 1.5;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.category-card-cat .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    flex-shrink: 0;
}

.category-card-cat:hover {
    background: #354574;
    color: #fff;
    text-decoration: none;
}

/* --- 标签 --- */
.category-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
}

.category-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    padding: 3px 10px;
    background: #f5f5f5;
    color: #666;
    border-radius: 12px;
    line-height: 1.5;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.category-card-tag .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    flex-shrink: 0;
}

.category-card-tag:hover {
    background: #e5e5e5;
    color: #333;
    text-decoration: none;
}

/* --- 底部按钮：居中 --- */
.category-card-bottom {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.category-card-bottom .wp-block-button {
    margin: 0;
}

.category-card-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    width: auto !important; /* 不占满全宽，跟随文字长度自适应 */
    /* 不设置 background/color，继承主题 .wp-block-button__link 默认样式 */
}

.category-card-btn-arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.category-card:hover .category-card-btn-arrow {
    transform: translateX(2px);
}

/* ===== 空状态 ===== */
.category-no-posts {
    text-align: center;
    color: #888;
    padding: 40px 0;
}

/* ===== 分页 ===== */
.category-pagination {
    margin-top: 40px;
    text-align: center;
}

.category-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
}

.category-pagination .page-numbers:hover {
    border-color: #354574;
    color: #354574;
    text-decoration: none;
}

.category-pagination .page-numbers.current {
    background: #354574;
    color: #fff;
    border-color: #354574;
}

.category-pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ===== 右侧边栏（无白色卡片背景，直接显示在页面背景上） ===== */
.category-sidebar-block {
    /* 去除白色卡片背景、圆角、内边距、阴影 */
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 32px;
    box-shadow: none;
}

.category-sidebar-block:last-child {
    margin-bottom: 0;
}

.category-sidebar-title {
    /*font-size: 16px;*/
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #354574;
    display: inline-block;
}

/* --- 分类目录列表（含子目录，不折叠） --- */
.category-sidebar-cat-list,
.category-sidebar-cat-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-sidebar-cat-list ul {
    /* 子分类缩进 */
    padding-left: 16px;
    margin-top: 6px;
    border-left: 2px solid #f0f0f0;
}

.category-sidebar-cat-list li {
    margin: 0;
    padding: 0;
}

.category-sidebar-cat-list a {
    display: block;
    padding: 8px 10px;
    color: #555;
    font-size: 16px;
    line-height: 1.5;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.category-sidebar-cat-list a:hover {
    background: #f7f8fa;
    color: #354574;
    text-decoration: none;
}

/* 当前分类高亮 */
.category-sidebar-cat-list .current-cat > a {
    background: #354574;
    color: #fff;
    font-weight: 600;
}

/* 当前分类的祖先分类高亮 */
.category-sidebar-cat-list .current-cat-parent > a,
.category-sidebar-cat-list .current-cat-ancestor > a {
    color: #354574;
    font-weight: 600;
}

/* --- 标签云（显示所有标签） --- */
.category-sidebar-tag-cloud {
    line-height: 2.2;
}

.category-sidebar-tag {
    display: inline-block;
    margin: 3px 4px 3px 0;
    padding: 4px 10px;
    background: #f5f5f5;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.category-sidebar-tag:hover {
    background: #354574;
    color: #fff;
    text-decoration: none;
}

/* 当前标签反色高亮（与分类当前态一致：深蓝底白字） */
.category-sidebar-tag.current-tag {
    background: #354574;
    color: #fff;
    font-weight: 600;
}

.category-sidebar-tag.current-tag:hover {
    background: #354574;
    color: #fff;
}

/* 空状态 */
.category-no-tags {
    color: #888;
    font-size: 13px;
    margin: 0;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .category-page-main-content,
    .category-page-sidebar {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .category-page-layout {
        gap: 24px;
    }

    .category-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .category-page-title {
        font-size: 22px;
    }

    .category-card-grid {
        grid-template-columns: 1fr;
    }

    /* 手机端：按钮保持自适应宽度（不占满全宽），仍居中 */
    .category-card-btn {
        width: auto !important;
        justify-content: center;
    }

    .category-pagination .page-numbers {
        padding: 6px 10px;
    }
}
