/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #000000;
    --white: #ffffff;
    --gray-100: #fafafa;
    --gray-200: #f5f5f5;
    --gray-300: #e5e5e5;
    --gray-400: #d4d4d4;
    --gray-500: #a3a3a3;
    --gray-600: #737373;
    --gray-700: #525252;
    --gray-800: #404040;
    --gray-900: #171717;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-primary);
    font-weight: 300;
    line-height: 1.6;
    color: var(--gray-900);
    background-color: var(--white);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 开屏动画 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.loading-text {
    position: relative;
    z-index: 10;
    text-align: center;
}

#loading-title {
    font-size: 4rem;
    font-weight: 100;
    color: var(--white);
    letter-spacing: 0.5rem;
    opacity: 0;
    transform: translateY(2rem);
    animation: fadeInUp 1.5s ease-out 0.5s forwards;
}

.loading-bar {
    width: 0;
    height: 1px;
    background: var(--white);
    margin: 2rem auto;
    animation: expandWidth 2s ease-out 1s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandWidth {
    to {
        width: 10rem;
    }
}

/* 主页内容 */
.main-content {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-out;
}

.main-content.visible {
    opacity: 1;
    visibility: visible;
}

/* 滚动进度条 */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--black);
    z-index: 1000;
    transition: width 0.1s ease-out;
    opacity: 0;
}

.progress-bar.visible {
    opacity: 1;
}

/* 语言切换按钮 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem;
    border-radius: 2rem;
    border: 1px solid var(--gray-300);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
}

.language-switcher:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-700);
    font-size: 0.85rem;
    font-weight: 400;
    border-radius: 1.5rem;
    transition: var(--transition-smooth);
    min-width: 3rem;
}

.lang-btn:hover {
    color: var(--black);
    background: var(--gray-100);
}

.lang-btn.active {
    background: var(--black);
    color: var(--white);
}

.lang-btn.active:hover {
    background: var(--gray-800);
    color: var(--white);
}

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

.nav-logo span {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.1rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 300;
    transition: var(--transition-smooth);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--black);
    transition: width 0.3s ease;
}

.nav-menu a:hover {
    color: var(--black);
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    cursor: pointer;
}

.nav-toggle span {
    width: 1.5rem;
    height: 1px;
    background: var(--black);
    transition: var(--transition-smooth);
}

/* 英雄区域 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    margin-top: 4rem;
}

.hero-content {
    flex: 1;
    max-width: 60rem;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 100;
    line-height: 1.2;
    margin-bottom: 2rem;
}

.text-line {
    display: block;
    opacity: 0;
    transform: translateY(3rem);
    animation: fadeInUp 1s ease-out forwards;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-line:nth-child(1) {
    animation-delay: 0.2s;
}

.text-line:nth-child(2) {
    animation-delay: 0.4s;
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--gray-600);
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.6s forwards;
}

#typing-text {
    color: var(--gray-700);
    font-weight: 300;
}

#typing-cursor {
    display: inline-block;
    animation: blink 1s infinite;
    color: var(--gray-700);
    font-weight: 400;
}

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

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.8s forwards;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    text-decoration: none;
    font-weight: 400;
    letter-spacing: 0.05rem;
    transition: var(--transition-smooth);
    border: 1px solid var(--black);
}

.btn-primary {
    background: var(--black);
    color: var(--white);
}

.btn-primary:hover {
    background: transparent;
    color: var(--black);
}

.btn-secondary {
    background: transparent;
    color: var(--black);
}

.btn-secondary:hover {
    background: var(--black);
    color: var(--white);
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.geometric-shapes {
    position: relative;
    width: 400px;
    height: 400px;
}

.shape {
    position: absolute;
    border: 1px solid var(--gray-400);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    animation-delay: 2s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 20%;
    right: 20%;
    transform: rotate(30deg);
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0) rotate(0deg);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-20px) rotate(180deg);
    }
}

/* 关于我 */
.about {
    padding: 8rem 0;
    background: var(--gray-100);
}

.section-title {
    font-size: 3rem;
    font-weight: 200;
    text-align: center;
    margin-bottom: 4rem;
    color: var(--gray-900);
}

.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.about-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.skill-tag {
    padding: 0.4rem 0.8rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gray-700);
    transition: var(--transition-smooth);
}

.skill-tag:hover {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gray-300);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
    background: var(--white);
}

.profile-image:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: var(--gray-400);
}

/* 打字机容器样式 */
.typing-container {
    font-size: 1.4rem;
    line-height: 1.7;
    color: var(--gray-700);
    min-height: 3.5rem;
    max-height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
    margin-bottom: 1.5rem;
    text-align: center;
    overflow: hidden;
}

#about-typing-cursor {
    display: inline-block;
    animation: blink 1s infinite;
    color: var(--gray-700);
    font-weight: 400;
    margin-left: 2px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    max-width: 400px;
    height: auto;
    min-height: 2rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.dot.active {
    background: var(--gray-700);
    transform: scale(1.15);
    border-color: var(--gray-500);
}

.dot:hover {
    background: var(--gray-500);
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

/* 项目展示 */
.projects {
    padding: 8rem 0;
}

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

.project-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.project-image {
    height: 200px;
    background: var(--gray-100);
    position: relative;
    overflow: hidden;
}

.project-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--gray-200), var(--gray-300));
    position: relative;
}

.project-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border: 1px solid var(--gray-400);
    transform: translate(-50%, -50%) rotate(45deg);
}

.project-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: var(--transition-smooth);
}

.rotating-logo {
    animation: spinInAndSlowDown 3s ease-out forwards;
}

@keyframes spinInAndSlowDown {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) rotate(720deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(1080deg) scale(1);
        opacity: 1;
    }
}

.project-card:hover .project-logo {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.fade-in-logo {
    animation: fadeInFloat 2.5s ease-out forwards;
}

@keyframes fadeInFloat {
    0% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0;
        filter: blur(8px);
    }
    50% {
        transform: translate(-50%, -40%) scale(0.9);
        opacity: 0.7;
        filter: blur(2px);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.text-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-200);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: var(--transition-smooth);
    animation: logoReveal 2.2s ease-out forwards;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    line-height: 1.2;
}

.text-logo .logo-pseudo {
    color: #1976d2;
    font-size: 18px;
}

.text-logo .logo-code {
    color: #424242;
    font-size: 20px;
    font-weight: 800;
}

.text-logo .logo-ide {
    color: #9e9e9e;
    font-size: 16px;
    font-weight: 600;
}

@keyframes logoReveal {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0.3);
        opacity: 0;
        border-color: transparent;
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
    40% {
        transform: translate(-50%, -50%) rotate(180deg) scale(0.8);
        opacity: 0.6;
        border-color: var(--gray-300);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
    70% {
        transform: translate(-50%, -50%) rotate(270deg) scale(1.1);
        opacity: 0.9;
        border-color: var(--gray-200);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
        opacity: 1;
        border-color: var(--gray-200);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
}

.project-card:hover .text-logo {
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
    border-color: var(--gray-300);
}

.project-card:hover .text-logo .logo-pseudo {
    color: #1565c0;
}

.project-card:hover .text-logo .logo-code {
    color: #212121;
}

.project-card:hover .text-logo .logo-ide {
    color: #616161;
}

.project-content {
    padding: 2rem;
}

.project-content h3 {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--gray-900);
}

.project-content p {
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.project-link {
    color: var(--black);
    text-decoration: none;
    font-weight: 400;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.project-link:hover {
    gap: 1rem;
}

/* GitHub 探索更多按钮 */
.github-explore {
    text-align: center;
    margin-top: 4rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.github-explore.visible {
    opacity: 1;
    transform: translateY(0);
}

.github-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: var(--black);
    color: var(--white);
    text-decoration: none;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.05rem;
    border-radius: 3rem;
    transition: var(--transition-smooth);
    border: 2px solid var(--black);
    position: relative;
    overflow: hidden;
}

.github-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.github-btn:hover::before {
    left: 100%;
}

.github-btn:hover {
    background: transparent;
    color: var(--black);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.github-icon {
    transition: transform 0.3s ease;
}

.github-btn:hover .github-icon {
    transform: rotate(10deg) scale(1.1);
}

/* 联系方式 */
.contact {
    padding: 8rem 0;
    background: var(--black);
    color: var(--white);
}

.contact .section-title {
    color: var(--white);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.contact-text p {
    font-size: 1.3rem;
    font-weight: 200;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.contact-item {
    margin-bottom: 1.5rem;
}

.contact-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--gray-400);
    margin-bottom: 0.5rem;
}

.contact-item a {
    color: var(--white);
    text-decoration: none;
    font-weight: 300;
    transition: var(--transition-smooth);
}

.contact-item a:hover {
    color: var(--gray-400);
}

.social-links {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.social-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 300;
    transition: var(--transition-smooth);
    position: relative;
}

.social-link::after {
    content: '';
    position: absolute;
    bottom: -0.3rem;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--white);
    transition: width 0.3s ease;
}

.social-link:hover::after {
    width: 100%;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        top: 15px;
        right: 15px;
        padding: 0.2rem;
        gap: 0.3rem;
    }

    .lang-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        min-width: 2.5rem;
    }

    .nav-menu {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-visual {
        margin-top: 3rem;
    }

    .geometric-shapes {
        width: 300px;
        height: 300px;
    }

    .about-content {
        gap: 2rem;
        padding: 0 1rem;
    }

    .profile-image {
        width: 180px;
        height: 180px;
    }

    .typing-container {
        font-size: 1.2rem;
        min-height: 3rem;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-buttons {
        justify-content: center;
    }

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

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

    .github-explore {
        margin-top: 3rem;
    }

    .github-btn {
        padding: 0.8rem 2rem;
        font-size: 0.9rem;
        gap: 0.5rem;
    }

    .github-btn svg {
        width: 18px;
        height: 18px;
    }

    #loading-title {
        font-size: 2.5rem;
        letter-spacing: 0.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .nav-container {
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.3;
    }

    .text-line {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .section-title {
        font-size: 2rem;
    }

    .geometric-shapes {
        width: 200px;
        height: 200px;
    }

    .shape-1 {
        width: 100px;
        height: 100px;
    }

    .shape-2 {
        width: 150px;
        height: 150px;
    }

    .shape-3 {
        width: 80px;
        height: 80px;
    }
}