/**
 * 大气优雅的标题样式
 * 为子主题设计的自定义标题样式
 * 包含三种不同的样式选项
 */

/* 所有标题的基本样式 - 仅在启用标题样式时生效 */
body.heading-style1 .wp-posts-content h1,
body.heading-style1 .wp-posts-content h2,
body.heading-style1 .wp-posts-content h3,
body.heading-style1 .wp-posts-content h4,
body.heading-style1 .wp-posts-content h5,
body.heading-style1 .wp-posts-content h6,
body.heading-style2 .wp-posts-content h1,
body.heading-style2 .wp-posts-content h2,
body.heading-style2 .wp-posts-content h3,
body.heading-style2 .wp-posts-content h4,
body.heading-style2 .wp-posts-content h5,
body.heading-style2 .wp-posts-content h6,
body.heading-style3 .wp-posts-content h1,
body.heading-style3 .wp-posts-content h2,
body.heading-style3 .wp-posts-content h3,
body.heading-style3 .wp-posts-content h4,
body.heading-style3 .wp-posts-content h5,
body.heading-style3 .wp-posts-content h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    margin: 1.8em 0 0.8em;
    font-weight: 600;
    color: #333;
    letter-spacing: -0.01em;
}

/* 深色模式调整 */
body.dark-theme.heading-style1 .wp-posts-content h1,
body.dark-theme.heading-style1 .wp-posts-content h2,
body.dark-theme.heading-style1 .wp-posts-content h3,
body.dark-theme.heading-style1 .wp-posts-content h4,
body.dark-theme.heading-style1 .wp-posts-content h5,
body.dark-theme.heading-style1 .wp-posts-content h6,
body.dark-theme.heading-style2 .wp-posts-content h1,
body.dark-theme.heading-style2 .wp-posts-content h2,
body.dark-theme.heading-style2 .wp-posts-content h3,
body.dark-theme.heading-style2 .wp-posts-content h4,
body.dark-theme.heading-style2 .wp-posts-content h5,
body.dark-theme.heading-style2 .wp-posts-content h6,
body.dark-theme.heading-style3 .wp-posts-content h1,
body.dark-theme.heading-style3 .wp-posts-content h2,
body.dark-theme.heading-style3 .wp-posts-content h3,
body.dark-theme.heading-style3 .wp-posts-content h4,
body.dark-theme.heading-style3 .wp-posts-content h5,
body.dark-theme.heading-style3 .wp-posts-content h6 {
    color: #f0f0f0;
}

/* 样式1：现代简约渐变风格 */
.heading-style1 .wp-posts-content h1 {
    font-size: 32px;
    font-weight: 800;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    padding-bottom: 0.3em;
    position: relative;
    color: #333;
    letter-spacing: -0.5px;
    line-height: 1.5;
}

.heading-style1 .wp-posts-content h1:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #6a11cb, #2575fc);
    border-radius: 2px;
}

.heading-style1 .wp-posts-content h2 {
    font-size: 28px;
    color: #333;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    padding-bottom: 0.2em;
    position: relative;
    letter-spacing: -0.3px;
    line-height: 1.5;
}

.heading-style1 .wp-posts-content h2:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, #2575fc, #6a11cb);
    opacity: 0.6;
    border-radius: 1px;
}

/* 增强style1 H3的选择器特异性 */
body.heading-style1 .wp-posts-content h3,
.heading-style1 .wp-posts-content > h3,
.heading-style1 article .wp-posts-content h3 {
    font-size: 24px;
    color: #444;
    font-weight: 600;
    position: relative;
    padding-left: 15px;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.5;
    border-left: 4px solid #6a11cb; /* 提供一个基础边框颜色作为后备 */
    box-shadow: -1px 0 0 #2575fc; /* 增加阴影效果增强视觉体验 */
    background-color: rgba(106, 17, 203, 0.02); /* 很淡的背景增加区分度 */
}

/* 添加一个可选的高级版本，使用border-image进行渐变效果，有兼容性的浏览器会优先使用这个 */
@supports (border-image: linear-gradient(to bottom, #6a11cb, #2575fc) 1) {
    body.heading-style1 .wp-posts-content h3,
    .heading-style1 .wp-posts-content > h3,
    .heading-style1 article .wp-posts-content h3 {
        border-left: 4px solid transparent;
        background-clip: padding-box;
        border-image: linear-gradient(to bottom, #6a11cb, #2575fc) 1;
    }
}

/* 确保移除原来的样式 */
.heading-style1 .wp-posts-content h3:before {
    display: none !important;
}

.heading-style1 .wp-posts-content h4 {
    font-size: 20px;
    color: #555;
    font-weight: 600;
    position: relative;
    padding-left: 16px;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.5;
}

.heading-style1 .wp-posts-content h4:before {
    content: "◆";
    position: absolute;
    left: 0;
    color: #2575fc;
    font-size: 14px;
}

.heading-style1 .wp-posts-content h5 {
    font-size: 18px;
    font-weight: 600;
    color: #666;
    position: relative;
    padding-left: 16px;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.5;
}

.heading-style1 .wp-posts-content h5:before {
    content: "◇";
    position: absolute;
    left: 0;
    color: #6a11cb;
    font-size: 14px;
}

.heading-style1 .wp-posts-content h6 {
    font-size: 16px;
    font-weight: 600;
    color: #777;
    font-style: italic;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.5;
}

/* 样式2：高对比度左侧彩条风格 */
.heading-style2 .wp-posts-content h1,
.heading-style2 .wp-posts-content h2,
.heading-style2 .wp-posts-content h3,
.heading-style2 .wp-posts-content h4,
.heading-style2 .wp-posts-content h5,
.heading-style2 .wp-posts-content h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    font-weight: 600;
    border-left: 5px solid;
    padding-left: 15px;
    margin-left: 0; /* 修复：移除负边距避免影响付费模块 */
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.heading-style2 .wp-posts-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: #222;
    border-left-color: #ff6b6b;
    background: linear-gradient(to right, rgba(255,107,107,0.1) 0%, rgba(255,107,107,0) 100%);
    padding-top: 5px;
    padding-bottom: 5px;
}

.heading-style2 .wp-posts-content h2 {
    font-size: 28px;
    color: #333;
    border-left-color: #ff9e40;
    background: linear-gradient(to right, rgba(255,158,64,0.1) 0%, rgba(255,158,64,0) 100%);
    padding-top: 4px;
    padding-bottom: 4px;
}

.heading-style2 .wp-posts-content h3 {
    font-size: 24px;
    color: #444;
    border-left-color: #4ecdc4;
    background: linear-gradient(to right, rgba(78,205,196,0.1) 0%, rgba(78,205,196,0) 100%);
    padding-top: 3px;
    padding-bottom: 3px;
}

.heading-style2 .wp-posts-content h4 {
    font-size: 20px;
    color: #555;
    border-left-color: #7159c1;
    background: linear-gradient(to right, rgba(113,89,193,0.1) 0%, rgba(113,89,193,0) 100%);
    padding-top: 2px;
    padding-bottom: 2px;
}

.heading-style2 .wp-posts-content h5 {
    font-size: 18px;
    color: #666;
    border-left-color: #45aaf2;
    background: linear-gradient(to right, rgba(69,170,242,0.1) 0%, rgba(69,170,242,0) 100%);
}

.heading-style2 .wp-posts-content h6 {
    font-size: 16px;
    color: #777;
    border-left-color: #a55eea;
    background: linear-gradient(to right, rgba(165,94,234,0.1) 0%, rgba(165,94,234,0) 100%);
}

/* 样式3：未来科技卡片风格 */
.heading-style3 .wp-posts-content h1,
.heading-style3 .wp-posts-content h2,
.heading-style3 .wp-posts-content h3,
.heading-style3 .wp-posts-content h4,
.heading-style3 .wp-posts-content h5,
.heading-style3 .wp-posts-content h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    font-weight: 600;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin-left: 0; /* 修复：移除负边距避免影响付费模块 */
    margin-right: 0; /* 修复：移除负边距避免影响付费模块 */
    position: relative;
    overflow: hidden;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.heading-style3 .wp-posts-content h1:before,
.heading-style3 .wp-posts-content h2:before,
.heading-style3 .wp-posts-content h3:before,
.heading-style3 .wp-posts-content h4:before,
.heading-style3 .wp-posts-content h5:before,
.heading-style3 .wp-posts-content h6:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.heading-style3 .wp-posts-content h1 {
    font-size: 32px;
    color: #222;
    background: linear-gradient(135deg, rgba(79,172,254,0.1) 0%, rgba(0,242,254,0.1) 100%);
}

.heading-style3 .wp-posts-content h1:before {
    background: linear-gradient(to bottom, #4facfe, #00f2fe);
}

.heading-style3 .wp-posts-content h2 {
    font-size: 28px;
    color: #333;
    background: linear-gradient(135deg, rgba(132,250,176,0.1) 0%, rgba(143,211,244,0.1) 100%);
}

.heading-style3 .wp-posts-content h2:before {
    background: linear-gradient(to bottom, #84fab0, #8fd3f4);
}

.heading-style3 .wp-posts-content h3 {
    font-size: 24px;
    color: #444;
    background: linear-gradient(135deg, rgba(255,182,185,0.1) 0%, rgba(250,227,217,0.1) 100%);
}

.heading-style3 .wp-posts-content h3:before {
    background: linear-gradient(to bottom, #ffb6b9, #fae3d9);
}

.heading-style3 .wp-posts-content h4 {
    font-size: 20px;
    color: #555;
    background: linear-gradient(135deg, rgba(161,196,253,0.1) 0%, rgba(194,233,251,0.1) 100%);
}

.heading-style3 .wp-posts-content h4:before {
    background: linear-gradient(to bottom, #a1c4fd, #c2e9fb);
}

.heading-style3 .wp-posts-content h5 {
    font-size: 18px;
    color: #666;
    background: linear-gradient(135deg, rgba(255,218,131,0.1) 0%, rgba(238,174,202,0.1) 100%);
}

.heading-style3 .wp-posts-content h5:before {
    background: linear-gradient(to bottom, #ffda83, #eeaeca);
}

.heading-style3 .wp-posts-content h6 {
    font-size: 16px;
    color: #777;
    background: linear-gradient(135deg, rgba(198,255,221,0.1) 0%, rgba(251,215,134,0.1) 100%);
}

.heading-style3 .wp-posts-content h6:before {
    background: linear-gradient(to bottom, #c6ffdd, #fbd786);
}

/* 标题悬停效果 */
body.heading-style1 .wp-posts-content h1:hover,
body.heading-style1 .wp-posts-content h2:hover,
body.heading-style2 .wp-posts-content h1:hover,
body.heading-style2 .wp-posts-content h2:hover,
body.heading-style3 .wp-posts-content h1:hover,
body.heading-style3 .wp-posts-content h2:hover {
    color: #2575fc;
    transition: color 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 768px) {
    body.heading-style1 .wp-posts-content h1,
    body.heading-style2 .wp-posts-content h1,
    body.heading-style3 .wp-posts-content h1 {
        font-size: 28px;
    }

    body.heading-style1 .wp-posts-content h2,
    body.heading-style2 .wp-posts-content h2,
    body.heading-style3 .wp-posts-content h2 {
        font-size: 24px;
    }

    body.heading-style1 .wp-posts-content h3,
    body.heading-style2 .wp-posts-content h3,
    body.heading-style3 .wp-posts-content h3 {
        font-size: 20px;
    }

    body.heading-style1 .wp-posts-content h4,
    body.heading-style2 .wp-posts-content h4,
    body.heading-style3 .wp-posts-content h4 {
        font-size: 18px;
    }

    body.heading-style1 .wp-posts-content h5,
    body.heading-style1 .wp-posts-content h6,
    body.heading-style2 .wp-posts-content h5,
    body.heading-style2 .wp-posts-content h6,
    body.heading-style3 .wp-posts-content h5,
    body.heading-style3 .wp-posts-content h6 {
        font-size: 16px;
    }
}

/* 古腾堡编辑器样式适配 */
body.heading-style1 .wp-block-post-content > h1,
body.heading-style1 .wp-block-post-content > h2,
body.heading-style1 .wp-block-post-content > h3,
body.heading-style1 .wp-block-post-content > h4,
body.heading-style1 .wp-block-post-content > h5,
body.heading-style1 .wp-block-post-content > h6,
body.heading-style2 .wp-block-post-content > h1,
body.heading-style2 .wp-block-post-content > h2,
body.heading-style2 .wp-block-post-content > h3,
body.heading-style2 .wp-block-post-content > h4,
body.heading-style2 .wp-block-post-content > h5,
body.heading-style2 .wp-block-post-content > h6,
body.heading-style3 .wp-block-post-content > h1,
body.heading-style3 .wp-block-post-content > h2,
body.heading-style3 .wp-block-post-content > h3,
body.heading-style3 .wp-block-post-content > h4,
body.heading-style3 .wp-block-post-content > h5,
body.heading-style3 .wp-block-post-content > h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    font-weight: 600;
    color: #333;
    letter-spacing: -0.01em;
}

/* 移除原有的before伪元素样式 */
body.heading-style1 .wp-posts-content > h1:not([class]):before,
body.heading-style1 .wp-posts-content > h2:not([class]):before,
body.heading-style1 .wp-posts-content > h3:not([class]):before,
body.heading-style1 .wp-posts-content > h4:not([class]):before,
body.heading-style1 .wp-posts-content > h1.wp-block-heading:before,
body.heading-style1 .wp-posts-content > h2.wp-block-heading:before,
body.heading-style1 .wp-posts-content > h3.wp-block-heading:before,
body.heading-style1 .wp-posts-content > h4.wp-block-heading:before,
body.heading-style2 .wp-posts-content > h1:not([class]):before,
body.heading-style2 .wp-posts-content > h2:not([class]):before,
body.heading-style2 .wp-posts-content > h3:not([class]):before,
body.heading-style2 .wp-posts-content > h4:not([class]):before,
body.heading-style2 .wp-posts-content > h1.wp-block-heading:before,
body.heading-style2 .wp-posts-content > h2.wp-block-heading:before,
body.heading-style2 .wp-posts-content > h3.wp-block-heading:before,
body.heading-style2 .wp-posts-content > h4.wp-block-heading:before,
body.heading-style3 .wp-posts-content > h1:not([class]):before,
body.heading-style3 .wp-posts-content > h2:not([class]):before,
body.heading-style3 .wp-posts-content > h3:not([class]):before,
body.heading-style3 .wp-posts-content > h4:not([class]):before,
body.heading-style3 .wp-posts-content > h1.wp-block-heading:before,
body.heading-style3 .wp-posts-content > h2.wp-block-heading:before,
body.heading-style3 .wp-posts-content > h3.wp-block-heading:before,
body.heading-style3 .wp-posts-content > h4.wp-block-heading:before {
    display: none;
}

/* 强制覆盖任何可能的冲突样式 */
.heading-style1 .wp-posts-content h3.entry-title + h3,
.heading-style1 .wp-posts-content h3,
.heading-style1 .wp-posts-content h3.entry-title ~ h3,
.heading-style1 .wp-posts-content h3.wp-block-heading,
.wp-posts-content h3.wp-heading-style1,
article .heading-style1 h3,
.heading-style1 .post-content h3 {
    border-left: 4px solid #6a11cb !important;
    padding-left: 15px !important;
    position: relative !important;
    background-color: rgba(106, 17, 203, 0.02) !important;
    box-shadow: -1px 0 0 #2575fc !important;
    display: block !important;
}

/* 确保所有伪元素样式被清除 */
.heading-style1 .wp-posts-content h3:before,
.heading-style1 .wp-posts-content h3:after,
.heading-style1 h3:before,
.heading-style1 h3:after {
    display: none !important;
}

/* ========================================
   付费模块和古腾堡区块兼容性修复
   确保标题样式不影响其他元素的布局
   ======================================== */

/* 确保付费模块的布局不受标题样式影响 */
.wp-posts-content .text-right,
.wp-posts-content .pay-box,
.wp-posts-content .pay-widget,
.wp-posts-content .cashier-link,
.wp-posts-content .pay-extra-hide {
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
}

/* 确保付费模块内的元素正常对齐 */
.wp-posts-content .text-right .cashier-link {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 确保付费模块的提示文字正常显示 */
.wp-posts-content .pay-extra-hide {
    text-align: right !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 修复可能的容器偏移问题 */
.wp-posts-content .text-right {
    text-align: right !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

/* 确保古腾堡区块的对齐不受影响 */
.wp-posts-content .wp-block-group,
.wp-posts-content .wp-block-columns,
.wp-posts-content .wp-block-column,
.wp-posts-content .wp-block-media-text,
.wp-posts-content .wp-block-cover,
.wp-posts-content .wp-block-quote,
.wp-posts-content .wp-block-pullquote,
.wp-posts-content .wp-block-image,
.wp-posts-content .wp-block-gallery,
.wp-posts-content .wp-block-video,
.wp-posts-content .wp-block-audio,
.wp-posts-content .wp-block-embed,
.wp-posts-content .wp-block-table,
.wp-posts-content .wp-block-button,
.wp-posts-content .wp-block-buttons,
.wp-posts-content .wp-block-separator,
.wp-posts-content .wp-block-spacer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
}

/* 确保居中对齐的古腾堡区块保持居中 */
.wp-posts-content .aligncenter,
.wp-posts-content .has-text-align-center,
.wp-posts-content .wp-block-group.aligncenter,
.wp-posts-content .wp-block-image.aligncenter,
.wp-posts-content .wp-block-gallery.aligncenter,
.wp-posts-content .wp-block-group.is-content-justification-center,
.wp-posts-content .wp-block-group.is-layout-flex.is-content-justification-center,
.wp-posts-content .wp-block-columns.is-content-justification-center {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: center !important;
    align-items: center !important;
}

/* 确保右对齐的古腾堡区块保持右对齐 */
.wp-posts-content .alignright,
.wp-posts-content .has-text-align-right,
.wp-posts-content .wp-block-group.alignright,
.wp-posts-content .wp-block-image.alignright {
    text-align: right !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* 确保左对齐的古腾堡区块保持左对齐 */
.wp-posts-content .alignleft,
.wp-posts-content .has-text-align-left,
.wp-posts-content .wp-block-group.alignleft,
.wp-posts-content .wp-block-image.alignleft {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* 特别保护zibll主题的自定义区块 */
.wp-posts-content .wp-block-zibllblock-feature,
.wp-posts-content .wp-block-zibllblock-button,
.wp-posts-content .wp-block-zibllblock-card,
.wp-posts-content .wp-block-zibllblock-tabs,
.wp-posts-content .wp-block-zibllblock-timeline,
.wp-posts-content .wp-block-zibllblock-notice,
.wp-posts-content .wp-block-zibllblock-collapse,
.wp-posts-content .feature,
.wp-posts-content .feature-default {
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
}

/* 确保flex布局的区块保持正确的对齐 */
.wp-posts-content .wp-block-group.is-layout-flex,
.wp-posts-content .wp-block-group.is-layout-grid,
.wp-posts-content .wp-container-core-group-is-layout-1,
.wp-posts-content .wp-block-group-is-layout-flex {
    display: flex !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
}

/* 确保flex居中对齐正常工作 */
.wp-posts-content .wp-block-group.is-layout-flex.is-content-justification-center {
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
}

/* 确保flex右对齐正常工作 */
.wp-posts-content .wp-block-group.is-layout-flex.is-content-justification-right {
    justify-content: flex-end !important;
    align-items: center !important;
    display: flex !important;
}

/* 确保flex左对齐正常工作 */
.wp-posts-content .wp-block-group.is-layout-flex.is-content-justification-left {
    justify-content: flex-start !important;
    align-items: center !important;
    display: flex !important;
}

/* 强制让所有zibll特色区块组合居中显示 */
.wp-posts-content .wp-block-group.is-layout-flex .wp-block-zibllblock-feature {
    margin: 0 auto !important;
}

/* 如果是包含多个特色区块的组合，让整个容器居中 */
.wp-posts-content .wp-block-group.is-layout-flex:has(.wp-block-zibllblock-feature) {
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    margin: 0 auto !important;
    text-align: center !important;
}

/* 备用方案：直接让包含feature的组合居中 */
.wp-posts-content .wp-block-group:has(.feature),
.wp-posts-content .wp-block-group:has(.wp-block-zibllblock-feature) {
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    margin: 0 auto !important;
    text-align: center !important;
}

/* 如果浏览器不支持:has()选择器，使用类名匹配 */
.wp-posts-content .wp-block-group.is-layout-flex {
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    margin: 0 auto !important;
    text-align: center !important;
}