/* ===== 主题定义 ===== */
:root,
[data-theme="blue"] {
    --primary: #3B82F6;
    --primary-rgb: 59, 130, 246;
    --primary-light: #BFDBFE;
    --secondary: #6366F1;
    --secondary-rgb: 99, 102, 241;
    --secondary-light: #C7D2FE;
    --accent: #0EA5E9;
    --accent-rgb: 14, 165, 233;
    --accent-light: #BAE6FD;
    --bg: #F0F4FF;
    --bg-card: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: rgba(59, 130, 246, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.72);
    --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.18);
    --shadow-lg: 0 12px 40px rgba(var(--primary-rgb), 0.25);
    --hero-from: #EFF6FF;
    --hero-to: #EEF2FF;
    --about-from: #F5F7FF;
    --about-to: #F8FAFC;
}

[data-theme="green"] {
    --primary: #10B981;
    --primary-rgb: 16, 185, 129;
    --primary-light: #A7F3D0;
    --secondary: #059669;
    --secondary-rgb: 5, 150, 105;
    --secondary-light: #6EE7B7;
    --accent: #14B8A6;
    --accent-rgb: 20, 184, 166;
    --accent-light: #99F6E4;
    --bg: #ECFDF5;
    --bg-card: #FFFFFF;
    --text: #134E4A;
    --text-light: #5F8B84;
    --border: rgba(16, 185, 129, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.72);
    --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.16);
    --shadow-lg: 0 12px 40px rgba(var(--primary-rgb), 0.22);
    --hero-from: #ECFDF5;
    --hero-to: #F0FDF4;
    --about-from: #F0FDF4;
    --about-to: #FAFAFA;
}

[data-theme="dark"] {
    --primary: #6EE7B7;
    --primary-rgb: 110, 231, 183;
    --primary-light: #064E3B;
    --secondary: #A78BFA;
    --secondary-rgb: 167, 139, 250;
    --secondary-light: #2E1065;
    --accent: #67E8F9;
    --accent-rgb: 103, 232, 249;
    --accent-light: #164E63;
    --bg: #0F172A;
    --bg-card: #1E293B;
    --text: #E2E8F0;
    --text-light: #94A3B8;
    --border: rgba(110, 231, 183, 0.1);
    --nav-bg: rgba(15, 23, 42, 0.80);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --hero-from: #0F172A;
    --hero-to: #1A1033;
    --about-from: #0F172A;
    --about-to: #1A1A2E;
}

[data-theme="orange"] {
    --primary: #F59E0B;
    --primary-rgb: 245, 158, 11;
    --primary-light: #FDE68A;
    --secondary: #D97706;
    --secondary-rgb: 217, 119, 6;
    --secondary-light: #FCD34D;
    --accent: #FB923C;
    --accent-rgb: 251, 146, 60;
    --accent-light: #FED7AA;
    --bg: #FFFBF0;
    --bg-card: #FFFFFF;
    --text: #3E2723;
    --text-light: #8D6E63;
    --border: rgba(245, 158, 11, 0.14);
    --nav-bg: rgba(255, 255, 255, 0.75);
    --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.18);
    --shadow-lg: 0 12px 40px rgba(var(--primary-rgb), 0.25);
    --hero-from: #FFFBEB;
    --hero-to: #FFF7ED;
    --about-from: #FFFBF0;
    --about-to: #FFFBF5;
}

[data-theme="indigo"] {
    --primary: #8B5CF6;
    --primary-rgb: 139, 92, 246;
    --primary-light: #DDD6FE;
    --secondary: #6D28D9;
    --secondary-rgb: 109, 40, 217;
    --secondary-light: #C4B5FD;
    --accent: #A78BFA;
    --accent-rgb: 167, 139, 250;
    --accent-light: #E0E7FF;
    --bg: #F5F0FF;
    --bg-card: #FFFFFF;
    --text: #2E1065;
    --text-light: #7C6F9A;
    --border: rgba(139, 92, 246, 0.12);
    --nav-bg: rgba(255, 255, 255, 0.72);
    --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.18);
    --shadow-lg: 0 12px 40px rgba(var(--primary-rgb), 0.25);
    --hero-from: #F5F3FF;
    --hero-to: #EDE9FE;
    --about-from: #F5F0FF;
    --about-to: #FAF5FF;
}

/* ===== 基础变量（不随主题变化） ===== */
:root {
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;
    --font: 'Nunito', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 全局重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: color 0.4s, background 0.4s;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ===== 装饰元素 ===== */
.decorations { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.float-star {
    position: absolute;
    opacity: 0.18;
    animation: floatStar 6s ease-in-out infinite;
}
.star-1 { top: 8%; left: 5%; font-size: 26px; animation-delay: 0s; }
.star-2 { top: 16%; right: 7%; font-size: 32px; animation-delay: 2s; }
.star-3 { top: 68%; left: 10%; font-size: 20px; animation-delay: 4s; }

.float-cloud {
    position: absolute;
    opacity: 0.10;
    font-size: 56px;
    animation: floatCloud 20s linear infinite;
}
.cloud-1 { top: 22%; left: -80px; animation-delay: 0s; }
.cloud-2 { top: 52%; right: -80px; animation-delay: 10s; }

.decor-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.06;
    transition: background 0.4s;
}
.circle-1 {
    width: 300px; height: 300px;
    background: var(--primary);
    top: -60px; right: -80px;
}
.circle-2 {
    width: 200px; height: 200px;
    background: var(--secondary);
    bottom: 20%; left: -50px;
}
.circle-3 {
    width: 150px; height: 150px;
    background: var(--accent);
    top: 50%; right: 10%;
}

@keyframes floatStar {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-18px) rotate(12deg); }
}
@keyframes floatCloud {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 200px)); }
}

/* ===== 主题切换器 ===== */
.theme-switcher {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.theme-toggle-btn {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
    position: relative; z-index: 2;
}
.theme-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
}
.theme-panel {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    border: 1.5px solid var(--border);
    opacity: 0; visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    margin-bottom: 4px;
}
.theme-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }

.theme-option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    background: none;
    font-family: var(--font); font-size: 14px; font-weight: 600;
    color: var(--text);
    transition: all 0.2s;
    white-space: nowrap;
}
.theme-option:hover { background: rgba(var(--primary-rgb), 0.06); }
.theme-option.active { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.06); }

.theme-dot {
    width: 22px; height: 22px; border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.dot-blue { background: linear-gradient(135deg, #3B82F6, #6366F1); }
.dot-green { background: linear-gradient(135deg, #10B981, #059669); }
.dot-dark { background: linear-gradient(135deg, #1E293B, #6EE7B7); }
.dot-orange { background: linear-gradient(135deg, #F59E0B, #D97706); }
.dot-indigo { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }

/* ===== 导航栏 ===== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border);
    transition: box-shadow 0.3s, background 0.4s, border 0.4s;
}
.navbar.scrolled { box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06); }

.nav-container {
    max-width: 1100px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links { display: flex; gap: 8px; }

.nav-link {
    padding: 8px 18px; border-radius: 24px;
    font-size: 15px; font-weight: 600; color: var(--text-light);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--primary); background: rgba(var(--primary-rgb), 0.08);
}

.menu-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 4px;
}
.menu-toggle span {
    display: block; width: 24px; height: 2.5px;
    background: var(--text); border-radius: 4px;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; flex-direction: column;
        position: absolute; top: 64px; left: 0; right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(16px);
        padding: 16px 24px; gap: 4px;
        border-bottom: 1px solid var(--border);
    }
    .menu-toggle { display: flex; }
}

/* ===== Hero ===== */
.hero {
    position: relative; z-index: 1;
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    text-align: center; padding: 120px 24px 80px;
    background: linear-gradient(160deg, var(--hero-from) 0%, var(--hero-to) 60%, var(--bg) 100%);
    transition: background 0.4s;
}

.hero-content { max-width: 640px; position: relative; z-index: 2; }

.hero-badge {
    display: inline-block; padding: 6px 20px;
    background: rgba(var(--primary-rgb), 0.08); color: var(--primary);
    border-radius: 24px; font-size: 14px; font-weight: 700;
    margin-bottom: 24px;
}

.hero-title {
    font-size: clamp(32px, 6vw, 52px); font-weight: 800;
    line-height: 1.25; margin-bottom: 16px;
    color: var(--text);
}
.highlight {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px; color: var(--text-light);
    margin-bottom: 36px; line-height: 1.8;
}

.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center;
    padding: 14px 32px; border-radius: 28px;
    font-size: 16px; font-weight: 700;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer; border: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.35);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(var(--primary-rgb), 0.45);
}
.btn-secondary {
    background: rgba(var(--primary-rgb), 0.06); color: var(--primary);
    border: 2px solid rgba(var(--primary-rgb), 0.2);
}
.btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.12);
    transform: translateY(-3px);
}

.hero-wave {
    position: absolute; bottom: -2px; left: 0; width: 100%;
    line-height: 0;
}
.hero-wave svg { width: 100%; height: 100px; }
.hero-wave path { fill: var(--bg-card); transition: fill 0.4s; }

[data-theme="dark"] .hero-wave path { fill: var(--bg); }

/* ===== Section 通用 ===== */
.section-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

.section-header { text-align: center; margin-bottom: 56px; }

.section-emoji { font-size: 40px; display: block; margin-bottom: 12px; }

.section-title {
    font-size: clamp(28px, 4vw, 38px); font-weight: 800;
    margin-bottom: 12px; color: var(--text);
}

.section-desc { font-size: 17px; color: var(--text-light); }

/* ===== 项目卡片 ===== */
.projects {
    position: relative; z-index: 1;
    padding: 80px 0 100px;
    background: var(--bg-card);
    transition: background 0.4s;
}

.project-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 28px;
}

.project-card {
    position: relative; overflow: hidden;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid var(--border);
}
.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), 0.25);
}

.card-shine {
    position: absolute; top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.04), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}
.project-card:hover .card-shine { left: 120%; }

.card-icon {
    font-size: 48px; margin-bottom: 16px;
    display: block;
}

.card-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.tag {
    padding: 4px 14px; border-radius: 16px;
    font-size: 12px; font-weight: 700;
}
.tag-primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.tag-secondary { background: rgba(var(--secondary-rgb), 0.1); color: var(--secondary); }
.tag-accent { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }

.card-title {
    font-size: 22px; font-weight: 800; margin-bottom: 8px;
    color: var(--text);
}

.card-desc {
    font-size: 15px; color: var(--text-light);
    margin-bottom: 16px; line-height: 1.75;
}

.card-features {
    margin-bottom: 20px;
    display: flex; flex-direction: column; gap: 8px;
}
.card-features li {
    font-size: 14px; color: var(--text);
    padding-left: 4px;
}

.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    transition: border 0.4s;
}

.card-stack { font-size: 12px; color: var(--text-light); }

.card-status {
    padding: 4px 14px; border-radius: 14px;
    font-size: 12px; font-weight: 700;
}
.status-live { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-dev { background: rgba(var(--accent-rgb), 0.14); color: var(--accent); }

@media (max-width: 860px) {
    .project-cards { grid-template-columns: 1fr; }
}

/* ===== 关于我 ===== */
.about {
    position: relative; z-index: 1;
    padding: 80px 0 100px;
    background: linear-gradient(180deg, var(--about-from) 0%, var(--about-to) 100%);
    transition: background 0.4s;
}

.about-card {
    max-width: 580px; margin: 0 auto; text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1.5px solid var(--border);
    transition: background 0.4s, border 0.4s;
}

.about-avatar { margin-bottom: 16px; }
.avatar-img {
    width: 100px; height: 100px;
    border-radius: 50%; object-fit: cover;
    border: 3px solid var(--primary-light);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.2);
    transition: border 0.4s, box-shadow 0.4s;
}

.about-name { font-size: 24px; font-weight: 800; margin-bottom: 8px; }

.about-bio {
    font-size: 15px; color: var(--text-light);
    margin-bottom: 24px; line-height: 1.75;
}

.about-stack { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.stack-item {
    padding: 6px 16px;
    background: rgba(var(--primary-rgb), 0.04);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px; font-weight: 600;
    color: var(--text);
    transition: background 0.4s, border 0.4s;
}

/* ===== 页脚 ===== */
.footer {
    position: relative; z-index: 1;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 28px 24px;
    transition: background 0.4s, border 0.4s;
}

.footer-container {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}

.footer-text { font-size: 14px; color: var(--text-light); }

.footer-links { display: flex; gap: 16px; }
.footer-link { font-size: 22px; transition: var(--transition); }
.footer-link:hover { transform: translateY(-3px); }

/* ===== 滚动渐现 ===== */
[data-reveal] {
    opacity: 0; transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-reveal].revealed { opacity: 1; transform: translateY(0); }

/* ===== 移动端响应 ===== */
@media (max-width: 480px) {
    .hero { padding: 100px 16px 60px; }
    .project-card { padding: 24px 20px 20px; }
    .card-title { font-size: 19px; }
    .about-card { padding: 28px 20px; }
    .footer-container { flex-direction: column; gap: 12px; }
    .theme-switcher { bottom: 16px; right: 16px; }
}
