/*=========================================================
  Hestia 炫彩动效系统 v4.0 - 极致稳定版
  修复：selection白字、文章标题点击、上滑动效
=========================================================*/

/* ===== 1. 粒子背景画布 ===== */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ===== 2. 阅读进度条 ===== */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  z-index: 999999;
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b59b6, #ff6b6b);
  background-size: 300% 100%;
  animation: progressGlow 2s ease infinite;
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5), 0 0 20px rgba(77, 150, 255, 0.3);
  transition: width 0.1s ease-out;
}

@keyframes progressGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 3. 自定义彩色光标 ===== */
html {
  cursor: none;
}

#custom-cursor {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999999;
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #f093fb, #667eea, #4facfe, #43e97b, #ffd93d);
  background-size: 300% 300%;
  animation: cursorGradient 1s ease infinite, cursorPulse 2s ease infinite;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, background 0.3s ease;
  box-shadow: 0 0 20px rgba(240, 147, 251, 0.5), 0 0 40px rgba(102, 126, 234, 0.3);
}

#custom-cursor.hover {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle at 30% 30%, #f093fb, #667eea, #4facfe, #43e97b, #ffd93d, #ff6b6b);
  box-shadow: 0 0 30px rgba(240, 147, 251, 0.7), 0 0 60px rgba(102, 126, 234, 0.5);
}

#custom-cursor.click {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 40px rgba(255, 107, 107, 0.8), 0 0 80px rgba(240, 147, 251, 0.5);
}

@keyframes cursorGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes cursorPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

#cursor-trail-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999998;
}

/* ===== 4. 渐变文本动画 ===== */
.gradient-text {
  background: linear-gradient(135deg, #f093fb, #f5576c, #4facfe, #43e97b, #f093fb);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 5. 滚动进入动画（修复：支持动态内容） ===== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(35px);
  transition: opacity 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal.reveal-fail-safe {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 6. 浮动光晕背景 ===== */
.floating-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  z-index: -1;
  pointer-events: none;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #667eea, transparent);
  top: -100px;
  left: -100px;
  animation: floatOrb1 20s ease-in-out infinite;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #f093fb, transparent);
  bottom: -50px;
  right: -50px;
  animation: floatOrb2 25s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #4facfe, transparent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: floatOrb3 18s ease-in-out infinite;
}

.orb-4 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #43e97b, transparent);
  top: 30%;
  right: 15%;
  animation: floatOrb4 22s ease-in-out infinite;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(200px, 150px) scale(1.2); }
  50% { transform: translate(100px, 300px) scale(0.9); }
  75% { transform: translate(300px, 100px) scale(1.1); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-150px, -100px) scale(1.3); }
  50% { transform: translate(-300px, -200px) scale(0.8); }
  75% { transform: translate(-100px, -300px) scale(1.1); }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  33% { transform: translate(-40%, -60%) scale(1.3) rotate(120deg); }
  66% { transform: translate(-60%, -40%) scale(0.8) rotate(240deg); }
}

@keyframes floatOrb4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-80px, -80px) scale(1.2); }
  66% { transform: translate(60px, -120px) scale(0.9); }
}

/* ===== 7. 文章页 ===== */

.single-post-wrap .entry-title,
.blog-post-wrapper .hestia-title {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #667eea 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}

.entry-content img {
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.entry-content img:hover {
  transform: scale(1.02) translateY(-4px);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.18);
}

.image-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.image-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.image-lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-lightbox-overlay.active img {
  transform: scale(1);
}

.image-lightbox-overlay .lightbox-close {
  position: absolute;
  top: 30px;
  right: 40px;
  color: #fff;
  font-size: 36px;
  opacity: 0.7;
  transition: all 0.3s ease;
  background: none;
  border: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox-overlay .lightbox-close:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.single-post-wrap blockquote {
  position: relative;
  border-left: 4px solid;
  border-image: linear-gradient(180deg, #667eea, #764ba2, #f093fb) 1;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border-radius: 0 16px 16px 0;
  padding: 24px 32px;
  margin: 32px 0;
  font-style: italic;
  font-size: 1.15em;
}

.single-post-wrap blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 16px;
  font-size: 60px;
  line-height: 1;
  background: linear-gradient(135deg, #667eea, #f093fb);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.3;
}

.single-post-wrap h2,
.single-post-wrap h3 {
  position: relative;
  padding-bottom: 12px;
}

.single-post-wrap h2::after,
.single-post-wrap h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
  animation: titleUnderline 3s ease infinite;
}

@keyframes titleUnderline {
  0%, 100% { width: 60px; }
  50% { width: 120px; }
}

.single-post-wrap pre,
.single-post-wrap code {
  border-radius: 12px;
}

.single-post-wrap pre {
  background: #1a1a2e;
  border: 1px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.single-post-wrap pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b59b6);
  background-size: 300% 100%;
  animation: progressGlow 3s ease infinite;
}

.single-post-wrap pre code {
  background: transparent;
  color: #e0e0e0;
}

.single-post-wrap table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.single-post-wrap th {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-weight: 600;
  padding: 14px 20px;
}

.single-post-wrap td {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.single-post-wrap tr:last-child td {
  border-bottom: none;
}

.single-post-wrap tr:hover td {
  background: rgba(102, 126, 234, 0.05);
}

/* ===== 8. 首页 ===== */

.front-page .section-title,
.front-page .hestia-title {
  background: linear-gradient(135deg, #f093fb, #f5576c, #4facfe, #43e97b, #f093fb);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease infinite;
}

.front-page .card,
.hestia-blogs .card-blog {
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              box-shadow 0.5s ease;
  position: relative;
}

.front-page .card::before,
.hestia-blogs .card-blog::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #f5576c, #667eea);
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: gradientShift 4s ease infinite;
}

.front-page .card:hover::before,
.hestia-blogs .card-blog:hover::before {
  opacity: 1;
}

.front-page .card:hover,
.hestia-blogs .card-blog:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.front-page .btn,
.page .btn {
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
}

.front-page .btn::before,
.page .btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s ease;
}

.front-page .btn:hover::before,
.page .btn:hover::before {
  left: 100%;
}

/* ===== 9. 导航栏 ===== */
.navbar {
  transition: all 0.4s ease;
}

.navbar:not(.hestia_left):not(.hestia_right) {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.navbar .nav li a {
  position: relative;
  transition: all 0.3s ease;
}

.navbar .nav li a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.navbar .nav li a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* ===== 10. 页脚 ===== */
.footer {
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c, #4facfe, #667eea);
  background-size: 300% 100%;
  animation: progressGlow 3s ease infinite;
}

/* ===== 11. 侧边栏 ===== */
.sidebar .widget {
  border-radius: 16px;
  border: 1px solid rgba(102, 126, 234, 0.1);
  transition: all 0.4s ease;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
}

.sidebar .widget:hover {
  border-color: rgba(102, 126, 234, 0.3);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1);
  transform: translateY(-4px);
}

.sidebar .widget-title {
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== 12. 文章卡片 ===== */
.hestia-blogs .card-blog .card-image {
  overflow: hidden;
  border-radius: 12px;
}

.hestia-blogs .card-blog .card-image img {
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hestia-blogs .card-blog:hover .card-image img {
  transform: scale(1.08);
}

.hestia-blogs .card-blog .card-title a {
  transition: all 0.3s ease;
}

.hestia-blogs .card-blog:hover .card-title a {
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== 13. 文章元数据 ===== */
.blog-post-wrapper .meta,
.hestia-blogs .card-blog .card-meta {
  opacity: 0.8;
  transition: all 0.3s ease;
}

.blog-post-wrapper .meta a,
.hestia-blogs .card-blog .card-meta a {
  position: relative;
  color: #667eea;
}

.blog-post-wrapper .meta a::after,
.hestia-blogs .card-blog .card-meta a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.blog-post-wrapper .meta a:hover::after,
.hestia-blogs .card-blog .card-meta a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.reading-time-badge {
  display: inline-block;
  padding: 3px 12px;
  margin-left: 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.15));
  color: #667eea;
  font-size: 0.85em;
  border: 1px solid rgba(102,126,234,0.15);
  transition: all 0.3s ease;
}

.reading-time-badge:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

/* ===== 14. Tags标签 ===== */
.tags a {
  display: inline-block;
  padding: 6px 16px;
  margin: 4px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
  font-size: 0.85em;
}

.tags a:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* ===== 15. 相关文章 ===== */
.hestia-related-posts .card-blog {
  border: 1px solid rgba(102, 126, 234, 0.08);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.4s ease;
}

.hestia-related-posts .card-blog:hover {
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
}

/* ===== 16. 选中文本（修复：复制变白） ===== */
::selection {
  background: #667eea;
  color: #fff;
}

::-moz-selection {
  background: #667eea;
  color: #fff;
}

/* ===== 17. 滚动条 ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #667eea, #764ba2, #f093fb);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #764ba2, #f093fb, #f5576c);
}

/* ===== 18. 标签云 ===== */
.widget_tag_cloud .tag-cloud-link {
  display: inline-block;
  padding: 4px 14px;
  margin: 3px;
  border-radius: 16px;
  background: rgba(102, 126, 234, 0.08);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.15);
  transition: all 0.3s ease;
}

.widget_tag_cloud .tag-cloud-link:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
}

/* ===== 19. 评论 ===== */
.comments-area {
  border-radius: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.comments-area .comment-respond {
  border-radius: 12px;
  padding: 20px;
  background: rgba(102, 126, 234, 0.03);
}

.comments-area input[type="submit"] {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  border-radius: 25px;
  padding: 12px 32px;
  transition: all 0.3s ease;
}

.comments-area input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* ===== 20. 文章内链接 ===== */
.entry-content a:not(.wp-block-button__link) {
  position: relative;
  color: #667eea;
  text-decoration: none;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.entry-content a:not(.wp-block-button__link):hover {
  color: #764ba2;
  border-bottom-color: #764ba2;
}

/* ===== 21. 分页 ===== */
.pagination {
  gap: 6px;
}

.pagination a,
.pagination span {
  border-radius: 50%;
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.pagination .current {
  background: linear-gradient(135deg, #667eea, #764ba2);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.pagination a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* ===== 22. 搜索高亮 ===== */
.search-highlight {
  background: linear-gradient(135deg, rgba(102,126,234,0.3), rgba(240,147,251,0.3));
  border-radius: 4px;
  padding: 0 4px;
  animation: highlightPulse 2s ease infinite;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0.3); }
  50% { box-shadow: 0 0 8px 4px rgba(102,126,234,0.2); }
}

/* ===== 23. 打字机光标 ===== */
.typing-cursor {
  color: #667eea;
  font-weight: 100;
  animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

/* ===== 24. 浮动装饰 ===== */
.float-decoration {
  will-change: transform;
}

/* ===== 25. 涟漪 ===== */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ===== 26. 响应式 ===== */
@media (max-width: 768px) {
  .floating-orb {
    display: none;
  }

  .reading-progress-bar {
    height: 3px;
  }

  #custom-cursor,
  #cursor-trail-canvas {
    display: none;
  }

  html {
    cursor: auto;
  }

  .float-decoration {
    display: none;
  }

  .image-lightbox-overlay .lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 28px;
  }
}
