/* ============================================
   科技感深色主题 - 个人主页样式
   ============================================ */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --text-primary: #e0e0f0;
    --text-secondary: #8888aa;
    --accent: #6c5ce7;
    --accent-glow: #a29bfe;
    --gradient-1: linear-gradient(135deg, #6c5ce7, #00cec9);
    --gradient-2: linear-gradient(135deg, #6c5ce7, #fd79a8);
    --border: rgba(108, 92, 231, 0.2);
    --font-mono: 'Consolas', 'Monaco', monospace;
}

/* ============================================
   全局重置与基础样式
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============================================
   背景画布
   ============================================ */

canvas#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* ============================================
   导航栏
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.navbar a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.3s, text-shadow 0.3s;
    position: relative;
}

.navbar a:hover,
.navbar a.active {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.navbar a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 100%;
    height: 2px;
    background: var(--gradient-1);
    transition: transform 0.3s ease;
}

.navbar a:hover::after,
.navbar a.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* ============================================
   Section 通用样式
   ============================================ */

section {
    min-height: 100vh;
    padding: 80px 10%;
    position: relative;
}

section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
    width: 100%;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--gradient-1);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-glow), 0 0 20px rgba(108, 92, 231, 0.4);
}

/* ============================================
   Hero 区域
   ============================================ */

#hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 120px;
}

#hero img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    background-image: var(--gradient-1);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.4);
    margin-bottom: 2rem;
}

#hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

#hero .title {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
}

#hero .title::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

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

#hero .bio {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================
   Skills 区域
   ============================================ */

#skills .skill-group {
    margin-bottom: 3rem;
}

#skills .skill-group h3 {
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skill-tag {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    min-width: 180px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.skill-level {
    display: block;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.skill-fill {
    display: block;
    height: 100%;
    background: var(--gradient-1);
    border-radius: 2px;
    width: 0;
    transition: width 1s ease;
}

/* ============================================
   Projects 区域
   ============================================ */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(108, 92, 231, 0.2);
    border-color: var(--accent);
}

.project-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.project-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-glow);
}

.project-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s, letter-spacing 0.3s;
}

.project-link:hover {
    color: var(--accent-glow);
    letter-spacing: 1px;
}

/* ============================================
   Contact 区域
   ============================================ */

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.contact-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.3);
    transform: translateY(-4px);
}

.contact-icon {
    font-size: 2rem;
    line-height: 1;
}

.contact-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   滚动动画
   ============================================ */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   邮箱弹窗
   ============================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(108, 92, 231, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.popup-overlay.show .popup-box {
    transform: translateY(0);
}

.popup-box h3 {
    font-size: 1.2rem;
    color: var(--accent-glow);
    margin-bottom: 1rem;
}

.popup-email {
    font-size: 1.3rem;
    color: var(--text-primary);
    background: rgba(108, 92, 231, 0.1);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
    word-break: break-all;
}

.popup-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.popup-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.popup-btn-copy {
    background: var(--gradient-1);
    color: #fff;
}

.popup-btn-copy:hover {
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
}

.popup-btn-close {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.popup-btn-close:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ============================================
   响应式：平板 (≤768px)
   ============================================ */

@media (max-width: 768px) {
    section {
        padding: 60px 5%;
    }

    #hero {
        padding-top: 100px;
    }

    #hero h1 {
        font-size: 2.5rem;
    }

    section h2 {
        font-size: 2rem;
    }

    .project-card {
        padding: 1.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .skill-tag {
        min-width: 140px;
    }

    .navbar a {
        font-size: 0.85rem;
    }

    .navbar {
        gap: 1rem;
    }
}

/* ============================================
   响应式：手机 (≤480px)
   ============================================ */

@media (max-width: 480px) {
    section {
        padding: 40px 16px;
    }

    #hero {
        padding-top: 90px;
    }

    #hero h1 {
        font-size: 2rem;
    }

    #hero img {
        width: 120px;
        height: 120px;
    }

    .contact-item {
        padding: 1rem 1.5rem;
    }

    .navbar {
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        padding: 0.8rem 1rem;
    }

    .navbar a {
        flex-shrink: 0;
    }
}

/* 备案号页脚 */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-size: 13px;
}

.site-footer a {
    color: #888;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #5b21b6;
}

/* 备案图标 */
.beian-icon {
    vertical-align: middle;
    margin-right: 12px;
    width: auto;
    height: 20px;
    display: inline-block;
}

/* 备案行:两块各自独立一行，垂直居中对齐 */
.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.beian-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.8;
}
