:root {
    --primary-color: #5e8bff; /* 主色调 - 柔和的蓝色 */
    --secondary-color: #6a7c98; /* 辅助色 - 灰蓝色 */
    --background-color: #0a192f; /* 背景色 - 深海军蓝 */
    --text-color: #ccd6f6; /* 主要文本颜色 - 淡灰蓝 */
    --heading-color: #ffffff; /* 标题颜色 - 白色 */
    --card-bg-color: #112240; /* 卡片背景 - 略深的蓝色 */
    --shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
    --border-radius: 8px;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    background: rgba(10, 25, 47, 0.85);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: top 0.3s;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: auto;
    padding: 0 2rem;
}

nav .logo h1 {
    margin: 0;
    font-weight: 700;
    color: var(--heading-color);
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 30px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--primary-color);
}

nav i {
    margin-right: 8px;
    color: var(--primary-color);
}

main {
    max-width: 1000px;
    margin: 4rem auto;
    padding: 0 2rem;
}

section {
    background: transparent;
    margin-bottom: 6rem;
    padding: 2rem 0;
    border-radius: 0;
    box-shadow: none;
    visibility: hidden; /* For scroll animation */
}

h2 {
    color: var(--heading-color);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}
h2::after {
    content: "";
    display: block;
    position: relative;
    top: 0px;
    width: 200px;
    height: 1px;
    margin-left: 20px;
    background-color: var(--secondary-color);
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#hero {
    background: linear-gradient(-45deg, #0a192f, #112240, #5e8bff, #0a192f);
    background-size: 400% 400%;
    animation: gradient-animation 15s ease infinite;
    color: #fff;
    text-align: left;
    padding: 8rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 0 auto 6rem;
    max-width: 1200px; /* Hero can be wider */
}

#hero h2 {
    font-size: 3.5rem;
    color: var(--heading-color);
    border: none;
}
#hero h2::after {
    display: none;
}

#hero p {
    font-size: 1.2rem;
    color: var(--text-color);
    max-width: 600px;
}

#about {
    padding: 2rem;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.skills ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.skills li {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.skills li:hover {
    transform: translateY(-5px);
    color: var(--primary-color);
}

.skills i {
    color: var(--primary-color);
    margin-right: 10px;
    font-size: 1.2rem;
}

#projects {
    text-align: center;
}
#projects h2 {
    justify-content: center;
}

.projects-cta p {
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.cta-button {
    color: var(--primary-color);
    background-color: transparent;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.cta-button:hover {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 5px 15px -5px var(--primary-color);
}

#contact {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
#contact h2 {
    justify-content: center;
}
#contact h2::after {
    display: none;
}
#contact a {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-bottom: 2px;
}
#contact a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}
#contact a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.contact-info p {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.contact-info i {
    color: var(--text-color);
}

footer {
    text-align: center;
    padding: 2rem 0;
    background: transparent;
    color: var(--secondary-color);
    margin-top: 4rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: var(--primary-color);
}

/* Scroll Fade-in Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.visible {
    visibility: visible;
    animation: fadeIn 0.8s ease-out forwards;
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    body {
        line-height: 1.5;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    main {
        margin: 2rem auto;
        padding: 0 1rem;
    }

    h2 {
        font-size: 1.8rem;
    }
    h2::after {
        width: 100px;
    }

    #hero {
        padding: 4rem 1.5rem;
        margin-bottom: 4rem;
    }
    #hero h2 {
        font-size: 2.5rem;
    }
    #hero p {
        font-size: 1.1rem;
    }

    section {
        margin-bottom: 4rem;
    }

    #about, #contact, #projects .project-card {
        padding: 1.5rem;
    }

    .skills ul {
        justify-content: center;
    }
}
