/* テーマ別背景アニメーション */

/* 共通設定: bodyの最小高さを確保し、スクロール可能に */
body[class*="theme-"] {
    min-height: 100vh;
    position: relative;
}

/* メインコンテンツの背景は常に白 */
.main-content .container > *:not(.overlay):not(.loading) {
    background: #fff;
}

.entry-article,
.search-container,
.category-container {
    background: #fff !important;
}

/* 1. グラデーションウェーブ（淡い色調） */
.theme-gradient-wave {
    background: linear-gradient(-45deg, #ffeef8, #e8f4fd, #f0f8ff, #fff0f5);
    background-size: 400% 400%;
    animation: gradientWave 15s ease infinite;
    background-attachment: fixed;
}

@keyframes gradientWave {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 2. パーティクル（淡い背景） */
.theme-particles {
    background: #f8f9fa;
}

.theme-particles::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: 
        radial-gradient(circle, rgba(230, 0, 115, 0.1) 1px, transparent 1px),
        radial-gradient(circle, rgba(230, 0, 115, 0.05) 1px, transparent 1px);
    background-size: 50px 50px, 80px 80px;
    background-position: 0 0, 40px 40px;
    animation: particlesMove 20s linear infinite;
    pointer-events: none;
}

@keyframes particlesMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* 3. ネオンライト（淡い背景） */
.theme-neon {
    background: #fafafa;
}

.theme-neon::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        linear-gradient(45deg, transparent 30%, rgba(255, 0, 150, 0.03) 50%, transparent 70%),
        linear-gradient(-45deg, transparent 30%, rgba(0, 150, 255, 0.03) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: neonGlow 10s ease infinite;
    pointer-events: none;
}

@keyframes neonGlow {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* 4. 液体モーション（淡い背景） */
.theme-liquid {
    background: #f5f7fa;
}

.theme-liquid::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    animation: liquidMotion 20s ease infinite;
    pointer-events: none;
}

@keyframes liquidMotion {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(120deg) scale(1.1); }
    66% { transform: rotate(240deg) scale(0.9); }
}

/* 5. グリッチエフェクト（淡い背景） */
.theme-glitch {
    background: #f8f8f8;
}

.theme-glitch::before,
.theme-glitch::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 0, 150, 0.03) 2px,
            rgba(255, 0, 150, 0.03) 4px
        );
    animation: glitchEffect 2s steps(1) infinite;
    pointer-events: none;
}

.theme-glitch::after {
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0, 150, 255, 0.03) 2px,
            rgba(0, 150, 255, 0.03) 4px
        );
    animation-delay: 0.5s;
}

@keyframes glitchEffect {
    0%, 90% { opacity: 0; }
    95% { opacity: 1; }
}

/* 6. オーロラ（淡い背景） */
.theme-aurora {
    background: #f0f4f8;
}

.theme-aurora::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: -1;
    background: 
        radial-gradient(ellipse at top, rgba(120, 255, 150, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at bottom, rgba(255, 120, 255, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at left, rgba(120, 150, 255, 0.1) 0%, transparent 40%);
    animation: auroraWave 20s ease infinite;
    filter: blur(40px);
    pointer-events: none;
}

@keyframes auroraWave {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

/* ヘッダーアニメーション */
/* 1. タイピング */
.site-title.text-animation-typing {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3s steps(30) 1s 1 normal both;
}

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

/* 2. フェード */
.site-title.text-animation-fade {
    animation: fadeIn 2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 3. スライド */
.site-title.text-animation-slide {
    animation: slideIn 1s ease;
}

@keyframes slideIn {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 4. グロー */
.site-title.text-animation-glow {
    animation: glowText 2s ease infinite alternate;
}

@keyframes glowText {
    from { text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6); }
}

/* モバイル対応 */
@media (max-width: 768px) {
    /* アニメーションを軽量化 */
    .theme-particles::before,
    .theme-neon::before,
    .theme-liquid::before,
    .theme-glitch::before,
    .theme-glitch::after,
    .theme-aurora::before {
        animation-duration: 30s;
    }
}