/* 标题动态效果样式 */

/* 文章页面标题动态效果 */
.post-title {
    position: relative;
    display: inline-block;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 0.5rem;
    /* 确保在白色背景下可见 */
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

/* 为没有背景图片的页面添加标题背景 */
#page:has(.post-title) .post-title {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

#page:has(.post-title) .post-title::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: -1;
    filter: blur(8px);
    opacity: 0.7;
}

/* 标题下划线动画效果 */
.post-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #425AEF, #ff6b6b);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.post-title:hover::after {
    width: 100%;
}

/* 渐变动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 首页标题动态效果 */
#post-title {
    position: relative;
    overflow: hidden;
}

#post-title .post-title {
    position: relative;
    z-index: 1;
}

#post-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
    z-index: 0;
}

#post-title:hover::before {
    left: 100%;
}

/* 页面顶部大标题效果 */
.page-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    animation: titlePulse 2s ease-in-out infinite;
}

/* 脉冲动画 */
@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* 打字机效果 */
.typewriter-title {
    overflow: hidden;
    border-right: 3px solid #425AEF;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #425AEF }
}

/* 标题悬停发光效果 */
.glow-title {
    transition: all 0.3s ease;
}

.glow-title:hover {
    text-shadow: 0 0 10px #425AEF, 0 0 20px #425AEF, 0 0 30px #425AEF;
    transform: translateY(-2px);
}

/* 深色模式适配 */
[data-theme="dark"] .post-title {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 8px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .page-title {
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .post-title {
        font-size: 1.5rem;
        animation: none; /* 移动端关闭动画以提升性能 */
    }
    
    .page-title {
        font-size: 2rem;
        animation: none;
    }
}

/* 文章内容中的小标题效果 */
h2, h3, h4, h5, h6 {
    position: relative;
    padding-left: 1rem;
    margin-top: 2rem;
    border-left: 3px solid #425AEF;
    transition: all 0.3s ease;
}

h2:hover, h3:hover, h4:hover, h5:hover, h6:hover {
    border-left-color: #ff6b6b;
    transform: translateX(5px);
}

/* 标题数字动态效果 */
h1 .headerlink::before,
h2 .headerlink::before,
h3 .headerlink::before,
h4 .headerlink::before,
h5 .headerlink::before,
h6 .headerlink::before {
    content: attr(data-number);
    position: absolute;
    left: -2rem;
    color: #425AEF;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

h1:hover .headerlink::before,
h2:hover .headerlink::before,
h3:hover .headerlink::before,
h4:hover .headerlink::before,
h5:hover .headerlink::before,
h6:hover .headerlink::before {
    opacity: 1;
}

/* 标题滚动时的视差效果 */
.parallax-title {
    transition: transform 0.3s ease;
}

/* 加载动画 */
.title-loading {
    animation: titleLoading 1s ease-in-out;
}

@keyframes titleLoading {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}