/* ========================================
   Nature 风格个人主页样式
   核心理念：有机形态 + 流体运动 + 粒子系统
   ======================================== */

/* === 全局重置与基础 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 自然色彩系统 - 浅色模式 */
    --color-primary: #4A8C7D;
    --color-secondary: #5B8FB9;
    --color-accent: #B07A7A;
    --color-bg-start: #E8F5E9;
    --color-bg-end: #E1F5FE;
    --color-text-primary: #1A3A3A;
    --color-text-secondary: #3E5A5A;
    --color-glass: rgba(255, 255, 255, 0.6);
    --color-glass-border: rgba(255, 255, 255, 0.4);
    
    /* 有机运动参数 */
    --breath-duration: 8s;
    --morph-duration: 12s;
    --ripple-duration: 2s;
}

/* 深色模式配色 */
[data-theme="dark"] {
    --color-primary: #6BBFA8;
    --color-secondary: #7BA8C9;
    --color-accent: #C98A8A;
    --color-bg-start: #0F1419;
    --color-bg-end: #1A2332;
    --color-text-primary: #E8F5E9;
    --color-text-secondary: #A8C8C8;
    --color-glass: rgba(30, 40, 50, 0.6);
    --color-glass-border: rgba(255, 255, 255, 0.1);
}

/* 自动检测系统偏好 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-primary: #6BBFA8;
        --color-secondary: #7BA8C9;
        --color-accent: #C98A8A;
        --color-bg-start: #0F1419;
        --color-bg-end: #1A2332;
        --color-text-primary: #E8F5E9;
        --color-text-secondary: #A8C8C8;
        --color-glass: rgba(30, 40, 50, 0.6);
        --color-glass-border: rgba(255, 255, 255, 0.1);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    color: var(--color-text-primary);
    transition: background 0.6s ease, color 0.6s ease;
}

/* === 粒子系统背景画布 === */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* === 水波纹容器 === */
#rippleContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, 
        rgba(139, 198, 184, 0.4) 0%, 
        rgba(139, 198, 184, 0.1) 50%, 
        transparent 100%);
    transform: scale(0);
    animation: ripple-animation var(--ripple-duration) ease-out forwards;
    pointer-events: none;
}

@keyframes ripple-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(15);
        opacity: 0;
    }
}

/* === 主容器 === */
.container {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* === 背景装饰性有机形状 (Blob) === */
.organic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.3;
    animation: float-and-morph var(--morph-duration) ease-in-out infinite;
    will-change: transform; /* GPU加速 */
}

/* 移动端性能优化：禁用所有动画 */
@media (max-width: 768px) {
    .blob {
        filter: blur(60px);
        opacity: 0.2;
        animation: none;
    }
    
    .avatar-wrapper {
        animation: none;
    }
    
    .profile-card {
        animation: none;
    }
    
    .avatar-glow {
        animation: none;
    }
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--color-primary);
    top: -100px;
    left: -100px;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--color-secondary);
    bottom: -150px;
    right: -150px;
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    animation-delay: -4s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: var(--color-accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%;
    animation-delay: -8s;
}

/* 桌面端：复杂的形态变换动画 */
@keyframes float-and-morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
        transform: translate(20px, -30px) rotate(90deg);
    }
    50% {
        border-radius: 50% 50% 30% 70% / 30% 70% 70% 30%;
        transform: translate(-20px, 20px) rotate(180deg);
    }
    75% {
        border-radius: 70% 30% 50% 50% / 40% 50% 60% 50%;
        transform: translate(30px, 10px) rotate(270deg);
    }
}

/* === 液态融合效果容器 === */
.gooey-container {
    filter: url('#gooey-filter');
}

/* === 个人资料卡片 === */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    width: 100%;
    animation: breath var(--breath-duration) ease-in-out infinite;
}

@keyframes breath {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* === 头像容器 === */
.avatar-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    animation: organic-rotate 20s linear infinite;
}

@keyframes organic-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, 
        var(--color-primary) 0%, 
        transparent 70%);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: glow-morph 8s ease-in-out infinite;
    filter: blur(20px);
    opacity: 0.6;
}

@keyframes glow-morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        opacity: 0.6;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
        opacity: 0.8;
    }
}

.avatar {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-glass);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(139, 198, 184, 0.3);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

/* === 个人信息文字 === */
.profile-name {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--color-text-primary);
    text-align: center;
    letter-spacing: 0.5px;
    margin-top: 10px; /* 增加与头像的间距 */
    margin-bottom: 8px;
    line-height: 1.2;
}

.profile-bio {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-align: center;
    line-height: 1.5;
    max-width: 450px;
    margin-bottom: 20px;
    min-height: 1.6em; /* 防止打字时高度抖动 */
    display: inline-block;
    position: relative;
}

/* 打字机光标 */
.profile-bio::after {
    content: '|';
    margin-left: 2px;
    font-weight: 300;
    color: var(--color-primary);
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === 社交图标容器 === */
.socials-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* === 社交图标按钮 === */
.social-icon-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-glass-border);
    border-radius: 12px; /* 圆角正方形 */
    color: var(--color-text-secondary); /* 从 text-primary 改为 secondary 保持稳重 */
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.social-icon-btn:hover {
    transform: translateY(-5px) scale(1.1);
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-primary);
    box-shadow: 0 8px 20px rgba(139, 198, 184, 0.3);
    border-color: var(--color-primary);
}

.social-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

/* === 链接列表 === */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    padding: 20px;
}

/* === 单个链接卡片 === */
.link-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 24px;
    background: var(--color-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--color-glass-border);
    border-radius: 16px; /* 修改为圆角矩形 */
    text-decoration: none;
    color: var(--color-text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    cursor: pointer;
}

/* 移除之前的不规则形状 */
.link-item:nth-child(odd),
.link-item:nth-child(even) {
    border-radius: 16px;
}

/* 悬停时的反馈 */
.link-item:hover {
    transform: translateY(-5px) scale(1.02);
    border-radius: 16px; /* 保持圆角矩形 */
    box-shadow: 0 10px 25px rgba(139, 198, 184, 0.25);
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.8);
}

/* 点击时的弹性效果 */
.link-item:active {
    transform: translateY(-4px) scale(0.98);
    transition: all 0.1s ease-out;
}

/* 链接图标 */
.link-icon {
    font-size: 1.8rem;
    color: var(--color-primary);
    flex-shrink: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-item:hover .link-icon {
    transform: rotate(20deg) scale(1.2);
}

/* 链接文字 */
.link-title {
    flex: 1;
    text-align: center;
}

/* === 磁力吸引效果 (通过 JS 实现) === */
.link-item.magnetic {
    transition: transform 0.3s ease-out;
}

/* === 呼吸光晕效果 === */
.link-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transform: translateX(-100%);
    transition: 0.6s;
    z-index: 1;
}

.link-item:hover::before {
    transform: translateX(100%);
}

/* === 页脚样式 === */
.site-footer {
    width: 100%;
    margin-top: 60px;
    padding-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInUp 1s ease-out 1s backwards; /* 延迟出现 */
}

/* 装饰性分割线：像一条纤细的草茎 */
.footer-divider {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--color-primary), 
        transparent);
    border-radius: 2px;
    opacity: 0.5;
}

.footer-motto {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--color-text-secondary);
    opacity: 0.7;
    letter-spacing: 1px;
}

.footer-meta {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-dot {
    font-size: 1.2rem;
    line-height: 0;
    color: var(--color-primary);
}

/* 呼吸的种子图标 */
.footer-seed {
    margin-top: 10px;
    color: var(--color-primary);
    animation: seed-breath 3s ease-in-out infinite;
}

.footer-seed svg {
    width: 18px;
    height: 18px;
}

@keyframes seed-breath {
    0%, 100% {
        transform: scale(1) translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.2) translateY(-3px);
        opacity: 0.8;
    }
}

/* === 主题切换按钮 === */
.theme-toggle {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--color-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--color-text-secondary);
    transition: all 0.3s ease;
}

/* 图标切换动画 */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* === 响应式设计 === */
@media (max-width: 768px) {
    .theme-toggle {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
    
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .container {
        padding: 40px 15px;
    }
    
    .profile-card {
        padding: 30px 20px;
    }
    
    .profile-name {
        font-size: 1.6rem;
    }
    
    .avatar-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .avatar {
        width: 120px;
        height: 120px;
    }
    
    .link-item {
        padding: 16px 24px;
        font-size: 1rem;
    }
    
    .link-icon {
        font-size: 1.5rem;
    }
}

/* === 加载动画 === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-card,
.link-item {
    animation: fadeInUp 0.8s ease-out backwards;
}

.link-item:nth-child(1) { animation-delay: 0.1s; }
.link-item:nth-child(2) { animation-delay: 0.2s; }
.link-item:nth-child(3) { animation-delay: 0.3s; }
.link-item:nth-child(4) { animation-delay: 0.4s; }
.link-item:nth-child(5) { animation-delay: 0.5s; }
.link-item:nth-child(6) { animation-delay: 0.6s; }
.link-item:nth-child(7) { animation-delay: 0.7s; }
.link-item:nth-child(8) { animation-delay: 0.8s; }
