/* 基础重置和变量 */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f1f5f9;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-accent: #f1f5f9;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 深色模式变量 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-light: #9ca3af;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-accent: #374151;
        --border-color: #374151;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

body.loaded {
    opacity: 1;
}

/* 容器和布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
}

.floating-circle {
    position: absolute;
    border-radius: 50%;
    background: var(--gradient-primary);
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    right: -150px;
    animation-delay: 0s;
}

.circle-2 {
    width: 200px;
    height: 200px;
    bottom: 20%;
    left: -100px;
    animation-delay: -7s;
}

.circle-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 10%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
    }
    50% {
        transform: translateY(0px) rotate(180deg);
    }
    75% {
        transform: translateY(-10px) rotate(270deg);
    }
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
}

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

.nav-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.nav-link.active::after,
.nav-link:hover::after {
    width: 100%;
}

.language-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2px;
    margin-left: 1rem;
}

.lang-btn {
    background: none;
    border: none;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    width: 25px;
    height: 20px;
    justify-content: space-between;
}

.nav-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
    border-radius: 1px;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 主要内容 */
.main {
    margin-top: 80px;
}

/* 首页区域 */
.hero-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    position: relative;
    padding: 60px 0;
}

.hero-content {
    display: grid;
    grid-template-columns: minmax(400px, 1fr) 400px;
    gap: 80px;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.hero-text {
    min-width: 0;
    max-width: 100%;
}

.hero-greeting {
    margin-bottom: 1rem;
}

.greeting-text {
    display: inline-block;
    padding: 8px 16px;
    background: var(--gradient-accent);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: bounce-in 0.8s ease-out 0.5s both;
}

.hero-title {
    margin-bottom: 1.5rem;
}

.title-main {
    display: block;
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: slide-up 0.8s ease-out both;
}

.title-subtitle {
    display: block;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    animation: slide-up 0.8s ease-out 0.2s both;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
    min-height: 100px;
    max-height: 120px;
    overflow: hidden;
    animation: fade-in 0.8s ease-out 0.4s both;
    max-width: 100%;
    word-wrap: break-word;
    text-align: left;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    animation: slide-up 0.8s ease-out 0.6s both;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    min-width: 120px;
    height: 48px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

.hero-stats {
    display: flex;
    gap: 2rem;
    animation: fade-in 0.8s ease-out 0.8s both;
}

.stat-item {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    min-width: 100px;
    flex: 1;
}

.stat-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 图片区域 */
.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: float-in 1s ease-out 0.3s both;
}

.image-container {
    position: relative;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 8px solid white;
    background: var(--gradient-primary);
    cursor: pointer;
    transition: var(--transition);
}

.image-container:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: radial-gradient(ellipse at center bottom, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 40%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    color: white;
    padding: 20px;
    transform: translateY(65%);
    transition: var(--transition);
    border-radius: inherit;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
}

.image-container:hover .image-overlay {
    transform: translateY(0);
    background: radial-gradient(ellipse at center bottom, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.85) 50%, rgba(0, 0, 0, 0.6) 80%, transparent 100%);
}

/* 为圆形容器添加一个内阴影效果，增强层次感 */
.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 1;
    transition: var(--transition);
}

.image-container:hover::before {
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.2);
}

.image-caption {
    width: 100%;
    max-width: 200px;
}

.image-caption span {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.image-caption small {
    font-size: 0.8rem;
    opacity: 0.9;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

/* 区域样式 */
section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    min-height: 28px;
}

/* 关于区域 */
.about-section {
    background: var(--bg-secondary);
}

.about-content {
    display: grid;
    gap: 2rem;
}

.about-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition);
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.about-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.about-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.about-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 1rem;
    min-height: 30px;
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

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

.skill-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

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

.project-card {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(30px);
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

.project-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.project-image {
    height: 200px;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-placeholder {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    padding: 20px;
}

.project-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #000000;
    min-height: 30px;
}

.project-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    flex: 1;
    min-height: 50px;
}

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

.tag {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 联系区域 */
.contact-section {
    background: var(--bg-secondary);
}

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

.contact-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(30px);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.contact-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.contact-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.contact-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #000000;
    min-height: 30px;
}

.contact-card p {
    color: var(--text-secondary);
}

/* 页脚 */
.footer {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 40px 0 20px;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-text p {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.footer-text a {
    color: var(--bg-primary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-text a:hover {
    opacity: 0.8;
}

.footer-note {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: scale(0);
    transition: var(--transition);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.back-to-top:hover {
    transform: scale(1.1);
}

/* 动画关键帧 */
@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slide-up {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes float-in {
    0% {
        opacity: 0;
        transform: translateY(30px) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 2rem;
        transition: var(--transition);
        box-shadow: var(--shadow-xl);
        z-index: 999;
    }

    .nav-menu.show {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-image {
        order: -1;
    }

    .image-container {
        width: 250px;
        height: 250px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .btn {
        width: 200px;
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
        gap: 1.5rem;
    }

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

    .contact-info {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

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

    section {
        padding: 60px 0;
    }

    .hero-section {
        padding: 40px 0;
    }

    .title-main {
        font-size: 2.5rem;
    }

    .image-container {
        width: 200px;
        height: 200px;
    }

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

    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* 高DPI屏幕优化 */
@media (min-resolution: 2dppx) {
    .profile-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-circle {
        animation: none;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .back-to-top,
    .bg-decoration {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
    }
    
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
}

/* 文本处理工具类 */
.text-balance {
    text-wrap: balance;
}

.text-stable {
    word-break: keep-all;
    hyphens: none;
}

/* 无障碍辅助 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus样式 */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline-offset: 4px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .btn-secondary {
        background: white;
    }
}