/* 主题变量定义 - 玻璃拟态和赛博朋克风格混搭 */
:root {
    /* 亮色主题 (默认) */
    --bg-main: #f0f2f5;
    --bg-secondary: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --accent-primary: #4361ee;
    --accent-secondary: #3f37c9;
    --accent-glow: rgba(67, 97, 238, 0.4);
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --navbar-height: 72px;

    /* 品牌色 */
    --html-color: #E34F26;
    --css-color: #1572B6;
    --js-color: #F7DF1E;
    --react-color: #61DAFB;

    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 暗色主题 */
.dark-theme {
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-primary: #38bdf8;
    --accent-secondary: #818cf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --nav-bg: rgba(15, 23, 42, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
canvas,
video,
pre,
code {
    max-width: 100%;
}

body {
    font-family: 'Poppins', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.16), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(129, 140, 248, 0.16), transparent 26%),
        radial-gradient(circle at 50% 90%, rgba(236, 72, 153, 0.10), transparent 30%);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

/* 背景粒子容器 */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    pointer-events: none;
}

/* 全站增强效果 */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    z-index: 2000;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), #ff00c1);
    box-shadow: 0 0 16px var(--accent-glow);
    transition: width 0.1s linear;
}

.cursor-glow {
    position: fixed;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.18;
    background: radial-gradient(circle, var(--accent-primary), transparent 65%);
    transform: translate(-50%, -50%);
    filter: blur(18px);
    mix-blend-mode: screen;
}

.back-to-top {
    position: fixed;
    right: 26px;
    bottom: 28px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--accent-primary);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    z-index: 1001;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: translateY(16px) scale(0.9);
    pointer-events: none;
    transition: var(--transition);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--accent-primary);
    color: #fff;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 28px var(--accent-glow);
}

.site-record {
    width: 100%;
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.28);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.site-record a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.site-record a:hover {
    color: var(--accent-primary);
}

.site-record .divider {
    display: inline-block;
    margin: 0 0.65rem;
    opacity: 0.55;
}

/* 通用组件 */
.text-center { text-align: center; }
.section { padding: 5rem 2rem; position: relative; }

.section-header { margin-bottom: 4rem; }
.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.underline {
    height: 4px;
    width: 80px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
    margin: 10px auto 20px;
    border-radius: 2px;
}

/* 玻璃态卡片通用类 */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    overflow: hidden;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--accent-glow);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent-primary);
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
}

/* ===== 导航栏 ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    min-height: var(--navbar-height);
    display: grid;
    grid-template-columns: minmax(230px, 1fr) auto minmax(120px, 1fr);
    align-items: center;
    gap: 1.5rem;
    padding: 0 5%;
    background: var(--nav-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.navbar.scrolled {
    padding: 0 5%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
    white-space: nowrap;
}

.logo i { color: var(--accent-primary); }
.logo span { color: var(--accent-primary); }

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 0.35rem;
    justify-self: center;
    min-height: var(--navbar-height);
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    height: 42px;
    padding: 0 0.85rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.10);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 42%;
}

/* 主题切换开关 */
.theme-switch {
    position: relative;
    justify-self: end;
    display: flex;
    align-items: center;
}

.theme-toggle-checkbox { display: none; }

.theme-toggle-label {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    height: 30px;
    width: 60px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.theme-toggle-label .fa-sun { color: #f39c12; font-size: 14px; margin-left: 3px; z-index: 1;}
.theme-toggle-label .fa-moon { color: #f1c40f; font-size: 14px; margin-right: 3px; z-index: 1;}

.theme-toggle-label .ball {
    background-color: var(--accent-primary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 24px;
    width: 24px;
    transform: translateX(0px);
    transition: transform 0.3s linear;
    z-index: 2;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .ball {
    transform: translateX(30px);
}

.hamburger { display: none; cursor: pointer; font-size: 1.5rem; }

/* ===== 英雄首屏区 ===== */
.hero {
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2rem, 5vw, 5rem);
    padding: 0 6%;
    padding-top: var(--navbar-height);
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1 1 520px;
    max-width: 600px;
    z-index: 10;
}

.badge-tag {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(67, 97, 238, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.typewriter {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    min-height: 36px;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
}

.hero-image {
    flex: 1 1 420px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* 代码装饰块 */
.code-block {
    background: #1e1e1e;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    width: 400px;
    position: relative;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

.code-block pre {
    margin-top: 20px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.95rem;
    color: #d4d4d4;
    white-space: pre-wrap;
}

.keyword { color: #569cd6; }
.variable { color: #4fc1ff; }
.string { color: #ce9178; }
.property { color: #9cdcfe; }
.number { color: #b5cea8; }
.operator { color: #d4d4d4; }
.function { color: #4ec9b0; }
.method { color: #dcdcaa; }

/* 悬浮图标 */
.tech-icons i {
    position: absolute;
    font-size: 3.5rem;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.2));
}

.html-icon { color: var(--html-color); top: -20px; right: 50px; }
.css-icon { color: var(--css-color); bottom: 20px; left: -20px; }
.js-icon { color: var(--js-color); top: 50px; left: -30px; }
.react-icon { color: var(--react-color); bottom: -10px; right: 20px; }


/* ===== 时间轴 (路线图) ===== */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background: var(--accent-glow);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    border-radius: 2px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    margin-bottom: 30px;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-icon {
    position: absolute;
    width: 50px;
    height: 50px;
    right: -25px;
    background: linear-gradient(135deg, #E34F26, #FF7B54);
    border: 4px solid var(--bg-main);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

.timeline-item:nth-child(even) .timeline-icon {
    left: -25px;
}

.timeline-content {
    padding: 20px 30px;
    position: relative;
    transition: transform 0.3s;
}

.timeline-content:hover {
    transform: translateY(-5px);
}

.timeline-content .date {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.timeline-content h3 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.timeline-content p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.read-more:hover {
    gap: 10px;
    color: var(--accent-secondary);
}

/* ===== 环形进度条统计 ===== */
.stats-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.circular-progress {
    position: relative;
    height: 120px;
    width: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--clr) 0deg, var(--bg-main) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: background 1s ease-out;
}

.circular-progress::before {
    content: "";
    position: absolute;
    height: 100px;
    width: 100px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
}

.progress-value {
    position: relative;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
}


/* ===== 页脚 ===== */
.footer {
    background-color: var(--bg-secondary);
    padding: 4rem 2rem 1rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
}

.footer-brand { flex: 2; min-width: 300px; }
.footer-brand h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-brand h3 i { color: var(--accent-primary); }
.footer-brand p { color: var(--text-secondary); margin-bottom: 1.5rem; max-width: 300px; }

.social-links { display: flex; gap: 1rem; }
.social-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.social-icon:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
}

.footer-links, .footer-contact { flex: 1; min-width: 200px; }
.footer-links h4, .footer-contact h4 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.footer-links h4::after, .footer-contact h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--accent-primary);
}

.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 0.8rem; }
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}
.footer-links a:hover {
    color: var(--accent-primary);
    padding-left: 5px;
}

.footer-contact p {
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-contact i { color: var(--accent-primary); width: 20px;}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}


/* ===== 响应式适配 ===== */
@media screen and (max-width: 992px) {
    .navbar {
        grid-template-columns: auto 1fr auto auto;
        gap: 1rem;
    }
    .theme-switch { grid-column: 3; }
    .hamburger { grid-column: 4; justify-self: end; }
    .hero h1 { font-size: 3rem; }
    .timeline::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
    .timeline-item:nth-child(even) { left: 0%; }
    .timeline-icon { left: 15px; right: auto; width: 32px; height: 32px; font-size: 14px; border-width: 2px; top: 24px; }
    .timeline-item:nth-child(even) .timeline-icon { left: 15px; }
}

@media screen and (max-width: 768px) {
    :root { --navbar-height: 64px; }

    .cursor-glow { display: none; }

    .navbar {
        min-height: var(--navbar-height);
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 0.75rem;
        padding: 0 1rem;
    }

    .navbar.scrolled { padding: 0 1rem; }

    .logo {
        font-size: 1.05rem;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .theme-switch { grid-column: 2; }
    .theme-toggle-label { width: 52px; height: 28px; }
    .theme-toggle-label .ball { width: 22px; height: 22px; }
    .theme-toggle-checkbox:checked + .theme-toggle-label .ball { transform: translateX(24px); }

    .hamburger {
        display: grid;
        place-items: center;
        color: var(--text-primary);
        width: 38px;
        height: 38px;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        background: var(--glass-bg);
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        min-height: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--nav-bg);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        padding: 0;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
    }

    .nav-links.active {
        max-height: calc(100vh - var(--navbar-height));
        overflow-y: auto;
    }

    .nav-links li {
        text-align: center;
        border-top: 1px solid var(--border-color);
        width: 100%;
    }

    .nav-links a {
        width: 100%;
        height: auto;
        min-height: 52px;
        padding: 0.9rem 1rem;
        justify-content: center;
        border-radius: 0;
        font-size: 0.98rem;
    }

    .nav-links a::after { display: none; }

    .section { padding: 3.5rem 1rem; }
    .section-header h2 { font-size: clamp(1.8rem, 8vw, 2.4rem); }

    .hero {
        width: 100%;
        flex-direction: column;
        text-align: center;
        padding: calc(var(--navbar-height) + 42px) 1rem 3rem;
        gap: 2rem;
    }

    .hero h1 { font-size: clamp(2rem, 11vw, 3rem); }
    .typewriter { font-size: 1.05rem; }
    .hero-content,
    .hero-image { width: 100%; min-width: 0; margin-bottom: 0; }
    .hero-buttons { justify-content: center; flex-wrap: wrap; gap: 1rem; }
    .hero-buttons .btn { width: min(100%, 280px); }
    .code-block { width: 100%; max-width: 340px; padding: 1.2rem; }
    .code-block pre { font-size: 0.78rem; overflow-x: auto; }
    .tech-icons i { font-size: 2.4rem; }
    .footer-content { text-align: center; justify-content: center; }
    .footer-brand p { margin-left: auto; margin-right: auto; }
    .footer-brand h3,
    .social-links,
    .footer-contact p { justify-content: center; }
    .footer-links h4::after,
    .footer-contact h4::after { left: 50%; transform: translateX(-50%); }
    .site-record {
        padding: 0.9rem 1rem;
        font-size: 0.78rem;
        line-height: 1.8;
    }
    .site-record .divider {
        margin: 0 0.35rem;
    }
    .back-to-top { right: 16px; bottom: 18px; width: 42px; height: 42px; }
}

@media screen and (max-width: 420px) {
    .logo span { display: none; }
    .navbar { gap: 0.5rem; padding: 0 0.75rem; }
    .theme-toggle-label { width: 48px; }
    .theme-toggle-checkbox:checked + .theme-toggle-label .ball { transform: translateX(20px); }
    .btn { width: 100%; padding: 0.8rem 1rem; text-align: center; }
    .badge-tag { font-size: 0.78rem; }
    .code-block { max-width: 310px; }
}
