:root {
    /* Core Colors */
    --primary-color: #0071e3;
    --primary-dark: #0077ed;
    --white: #ffffff;
    
    /* Light Mode Defaults */
    --text-color: #1d1d1f;
    --text-light: #86868b;
    --bg-color: #ffffff;
    --bg-light: #f5f5f7;
    --bg-dark: #1a1a1a;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.98);
    --border-color: rgba(0, 0, 0, 0.1);
    --primary-soft: rgba(0, 123, 255, 0.12);
    
    /* Component Specific Defaults (Light) */
    --scrollbar-thumb: #d2d2d7;
    --scrollbar-thumb-hover: #86868b;
    --card-hover-bg: #ffffff;
    --social-hover-bg: #e5e5ea;
    --tag-bg: rgba(0, 0, 0, 0.05);
    --timeline-date-bg: rgba(0, 0, 0, 0.05);
    --card-footer-border: rgba(0, 0, 0, 0.05);
    --project-icon-bg: #ffffff;
    --project-card-shadow: 0 10px 30px rgba(0,0,0,0.06);
    
    /* Common */
    --transition: all 0.3s ease;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f5f5f7;
        --text-light: #a1a1a6;
        --bg-color: #000000;
        --bg-light: #1c1c1e;
        --card-bg: #1c1c1e;
        --nav-bg: rgba(28, 28, 30, 0.98);
        --border-color: rgba(255, 255, 255, 0.1);
        
        --scrollbar-thumb: #424245;
        --scrollbar-thumb-hover: #6e6e73;
        --card-hover-bg: #2c2c2e;
        --social-hover-bg: #2c2c2e;
        --tag-bg: rgba(255, 255, 255, 0.1);
        --timeline-date-bg: rgba(255, 255, 255, 0.1);
        --card-footer-border: rgba(255, 255, 255, 0.1);
        --project-icon-bg: #2c2c2e;
        --project-card-shadow: none;
    }
}

/* Forced Dark Mode Class */
html.dark-mode {
    --text-color: #f5f5f7;
    --text-light: #a1a1a6;
    --bg-color: #000000;
    --bg-light: #1c1c1e;
    --card-bg: #1c1c1e;
    --nav-bg: rgba(28, 28, 30, 0.98);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --scrollbar-thumb: #424245;
    --scrollbar-thumb-hover: #6e6e73;
    --card-hover-bg: #2c2c2e;
    --social-hover-bg: #2c2c2e;
    --tag-bg: rgba(255, 255, 255, 0.1);
    --timeline-date-bg: rgba(255, 255, 255, 0.1);
    --card-footer-border: rgba(255, 255, 255, 0.1);
    --project-icon-bg: #2c2c2e;
    --project-card-shadow: none;
}

/* Forced Light Mode Class */
html.light-mode {
    --text-color: #1d1d1f;
    --text-light: #86868b;
    --bg-color: #ffffff;
    --bg-light: #f5f5f7;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.98);
    --border-color: rgba(0, 0, 0, 0.1);
    
    --scrollbar-thumb: #d2d2d7;
    --scrollbar-thumb-hover: #86868b;
    --card-hover-bg: #ffffff;
    --social-hover-bg: #e5e5ea;
    --tag-bg: rgba(0, 0, 0, 0.05);
    --timeline-date-bg: rgba(0, 0, 0, 0.05);
    --card-footer-border: rgba(0, 0, 0, 0.05);
    --project-icon-bg: #ffffff;
    --project-card-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

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

html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 10px;
    border: 3px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

/* Selection Color */
::selection {
    background-color: rgba(0, 113, 227, 0.2);
    color: var(--primary-color);
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 980px;
    font-weight: 500;
    font-size: 17px;
    letter-spacing: -0.022em;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: transparent;
    opacity: 0.9;
}

.btn-outline {
    background-color: rgba(0, 113, 227, 0.1);
    color: var(--primary-color);
    border: 1px solid transparent;
}

.btn-outline:hover {
    background-color: rgba(0, 113, 227, 0.18);
    color: var(--primary-color);
    border-color: transparent;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: none;
    z-index: 1000;
    padding: 15px 0;
    transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    z-index: -1;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 22px;
    align-items: center;
    list-style: none;
}

.nav-link {
    font-weight: 500;
    color: var(--text-color);
    transition: var(--transition);
    margin-left: 0;
    padding: 8px 10px;
    border-radius: 10px;
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.08);
}

.menu-toggle {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: var(--transition);
    background-color: var(--text-color);
}

/* Hero 区域 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 60px;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.hero-text {
    flex: 1;
}

.hero-text h1 {
    font-size: clamp(2.2rem, 4.5vw, 3.2rem);
    line-height: 1.15;
    margin-bottom: 10px;
}

.highlight {
    color: var(--primary-color);
}

.hero-text h2 {
    font-size: clamp(1.15rem, 2.2vw, 1.55rem);
    color: var(--text-light);
    margin-bottom: 20px;
    font-weight: 400;
}

.hero-text p {
    margin-bottom: 30px;
    font-size: 1.1rem;
    max-width: 500px;
}

.hero-btns {
    display: flex;
    gap: 12px;
}

.hero-img {
    flex: 1;
    display: flex;
    justify-content: center;
}

.hero-avatar {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    animation: float 6s ease-in-out infinite;
    border: none;
    background-color: var(--card-bg);
    will-change: transform;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

/* 通用 Section 样式 */
.section {
    padding: clamp(60px, 8vh, 100px) 0;
}

h1, h2, h3, h4, h5, h6, .section-title {
    letter-spacing: -0.02em;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    position: relative;
    letter-spacing: 0.5px;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
    margin: 10px auto 0;
}

/* 关于我 & 技能 */
.about-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.about-text {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.skills-container {
    text-align: center;
}

.skills-container h3 {
    margin-bottom: 20px;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.skill-tag {
    background-color: var(--bg-light);
    padding: 12px 24px;
    border-radius: 980px;
    font-weight: 500;
    box-shadow: none;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: default;
}

.skill-tag i {
    color: var(--primary-color);
    transition: var(--transition);
}

.skill-tag:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.skill-tag:hover i {
    color: var(--white);
}

/* 项目区域 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.project-card {
    background-color: var(--bg-light);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    border: 1px solid transparent;
    height: 100%;
}

.project-card:hover {
    background-color: var(--card-hover-bg);
    box-shadow: var(--project-card-shadow);
    transform: translateY(-4px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.project-icon {
    width: 56px;
    height: 56px;
    background-color: var(--project-icon-bg);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.project-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    background-color: rgba(0, 113, 227, 0.1);
    color: var(--primary-color);
    border-radius: 980px;
}

.card-body {
    flex: 1;
}

.card-body h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.card-body p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.project-tags span {
    font-size: 12px;
    font-weight: 500;
    background-color: var(--tag-bg);
    color: var(--text-light);
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.card-footer {
    padding-top: 20px;
    border-top: 1px solid var(--card-footer-border);
    transition: border-color 0.3s ease;
}

.project-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: var(--transition);
}

.project-link i {
    margin-left: 6px;
    font-size: 0.85em;
    transition: transform 0.2s ease;
}

.project-link:hover {
    opacity: 0.8;
}

.project-link:hover i {
    transform: translateX(4px);
}

/* 博客 CTA */
.blog-cta {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
    padding: 0;
}

.blog-cta h2 {
    margin-bottom: 15px;
}

.blog-cta p {
    margin-bottom: 22px;
    color: var(--text-light);
}

/* 联系区域 */
.contact-content {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
}

.contact-content p {
    color: var(--text-light);
}

.social-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.social-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 18px 24px;
    border-radius: 16px;
    border: none;
    background-color: var(--bg-light);
    color: var(--text-color);
    transition: var(--transition);
    font-weight: 500;
    font-size: 17px;
    -webkit-tap-highlight-color: transparent;
}

.social-link i {
    font-size: 1.4rem;
    margin-bottom: 0;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.social-link:hover {
    background-color: var(--social-hover-bg);
    transform: none;
    color: var(--text-color);
}

.social-link span {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* 页脚 */
footer {
    background-color: var(--bg-color);
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 34px 0;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.beian {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-light);
}

.beian p {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.beian a {
    color: var(--text-light);
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.beian a:hover {
    color: var(--text-color);
    border-bottom-color: var(--border-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-menu {
        position: absolute;
        left: 0;
        top: 100%;
        flex-direction: column;
        background-color: var(--nav-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        width: 100%;
        text-align: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
        padding: 0;
        gap: 0;
        transform: translateY(-100%);
        z-index: -2;
        opacity: 0;
        pointer-events: none;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    
    .nav-menu li {
        width: 100%;
        display: block;
    }

    .nav-link {
        margin: 0;
        display: block;
        padding: 16px 0;
        font-size: 17px;
        width: 100%;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu li:last-child .nav-link {
        border-bottom: none;
    }

    .social-links {
        grid-template-columns: 1fr;
    }

    .social-link {
        justify-content: center;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-text {
        margin-top: 40px;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-btns {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .btn-outline {
        margin-left: 0;
    }

    .hero-avatar {
        width: 180px;
        height: 180px;
    }
}

/* 主题切换按钮 */
.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    font-family: inherit;
    color: var(--text-color);
    -webkit-tap-highlight-color: transparent;
}

/* 移动端点击/长按高亮与方框优化 */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a,
.btn,
.nav-link,
.social-link,
.theme-btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.btn:active,
.nav-link:active,
.social-link:active,
.theme-btn:active {
    background-image: none;
}

.btn:focus,
.nav-link:focus,
.social-link:focus,
.theme-btn:focus,
button:focus,
a:focus {
    outline: none;
}

.btn:focus-visible,
.nav-link:focus-visible,
.social-link:focus-visible,
.theme-btn:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 12px;
}

.theme-btn:hover {
    background-color: rgba(0, 123, 255, 0.08);
    color: var(--primary-color);
}

/* Timeline Styles */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 2px;
    background: var(--border-color);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    padding-left: 50px;
    margin-bottom: 40px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: 15px;
    top: 0;
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 0 4px var(--bg-color);
    z-index: 1;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.timeline-content {
    background: var(--bg-light);
    padding: 24px;
    border-radius: 24px;
    transition: var(--transition);
}

.timeline-content:hover {
    background-color: var(--card-hover-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-header h3 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-light);
    background: var(--timeline-date-bg);
    padding: 2px 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.timeline-content p {
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.timeline-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.timeline-link::after {
    content: '\f105'; /* FontAwesome angle-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 6px;
    font-size: 0.9em;
    transition: transform 0.2s ease;
}

.timeline-link:hover {
    opacity: 0.7;
    text-decoration: none;
}

.timeline-link:hover::after {
    transform: translateX(4px);
}
