/*
Theme Name: Huyichan Theme
Author: Huyichan & Trae
Description: Custom theme for Huyichan.com
Version: 1.3
*/

:root {
    /* 白天模式 (樱花色调) */
    --bg-color: transparent; /* 背景交给 bg-image 处理 */
    --text-color: #5D4037; /* 深棕 */
    --accent-color: #FFB7C5; /* 樱花粉 */
    --header-bg: rgba(255, 192, 203, 0.85); /* 浅粉半透明 */
    --header-text: #fff;
    --link-color: #FF69B4; /* 热粉 */
    --card-bg: rgba(255, 255, 255, 0.85); /* 提高透明度适配背景 */
    --border-color: #FFE4E1;
    --shadow: 0 8px 16px rgba(255, 183, 197, 0.3);
    --petal-color: #ffb7c5;
    --mask-color: rgba(255, 253, 245, 0.4); /* 白天遮罩：暖白 */
    --mask-blur: blur(0px); /* 白天可以清晰一点 */
}

.dark-mode {
    /* 黑夜模式 (深蓝/月光色调) */
    --bg-color: transparent;
    --text-color: #e6e6e6; /* 更亮的银灰 */
    --accent-color: #1c2a4a; /* 稍亮的夜蓝 */
    --header-bg: rgba(15, 25, 45, 0.85); /* 半透明深蓝 */
    --header-text: #FFFACD; /* 月光黄 */
    --link-color: #FFB7C5; /* 夜樱粉 */
    --card-bg: rgba(16, 24, 40, 0.75); /* 更透明的黑夜卡片 */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    --petal-color: #ffe4e1;
    --mask-color: rgba(10, 15, 30, 0.6); /* 黑夜遮罩：深蓝黑 */
    --mask-blur: blur(2px); /* 黑夜稍微模糊一点增加朦胧感 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: color 0.5s ease;
    /* 移除 body 的 background-image */
}

/* 背景容器 */
#bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

#bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition: background-image 0.8s ease-in-out;
    transform: scale(1.05); /* 稍微放大防止边缘露白 */
}

#bg-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--mask-color);
    backdrop-filter: var(--mask-blur); /* 毛玻璃遮罩 */
    transition: background 0.5s ease, backdrop-filter 0.5s ease;
    z-index: -1;
}

/* 容器 */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 头部 */
header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 20px 0;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 100;
    transition: background 0.5s ease;
    backdrop-filter: blur(10px); /* 头部更强的毛玻璃 */
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

header h1 a {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    color: var(--header-text) !important;
}

/* 导航 */
nav ul {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

nav ul li {
    display: inline-block;
    margin: 0 15px;
}

nav ul li a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: all 0.2s;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* 增加文字阴影提高可读性 */
}

nav ul li a:hover {
    color: var(--header-text);
    text-decoration: underline;
    opacity: 1;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

/* 文章卡片 */
article {
    background: var(--card-bg);
    margin-bottom: 40px;
    padding: 30px;
    border-radius: 15px; /* 圆角 */
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.3s, background 0.5s;
    backdrop-filter: blur(5px); /* 卡片背景微模糊 */
}

article:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.95); /* 悬停时变不透明一点 */
}

.dark-mode article:hover {
    background: rgba(20, 30, 50, 0.9);
}

article h2 {
    margin-top: 0;
    color: var(--link-color);
}

article h2 a {
    text-decoration: none;
    color: inherit;
    transition: text-shadow 0.3s;
}

article h2 a:hover {
    text-shadow: 0 0 10px rgba(255, 183, 197, 0.6);
}

.entry-meta {
    font-size: 0.9rem;
    color: #666; /* 加深颜色提高对比度 */
    margin-bottom: 15px;
}
.dark-mode .entry-meta {
    color: #ccc;
}

.entry-content {
    color: var(--text-color); /* 确保正文颜色跟随主题 */
}

/* 底部 */
footer {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 20px 0;
    text-align: center;
    margin-top: 50px;
    transition: background 0.5s ease;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* 切换按钮 */
#theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s, background 0.5s;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* 樱花动效 */
.sakura-petal {
    position: fixed;
    top: -20px;
    background: var(--petal-color);
    border-radius: 100% 0 100% 0;
    opacity: 0.8; /* 稍微增加不透明度 */
    pointer-events: none;
    animation: fall linear forwards;
    z-index: 9999;
    transition: background 0.5s;
    box-shadow: 0 0 5px rgba(255,255,255,0.3);
}

@keyframes fall {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.9;
    }
    100% {
        transform: translate(100px, 100vh) rotate(360deg);
        opacity: 0;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 10px;
    }
    
    header h1 a {
        font-size: 1.8rem;
    }
    
    article {
        padding: 20px;
    }
}
