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

:root {
    --primary-color: #000000;
    --secondary-color: #86868b;
    --background-color: #ffffff;
    --section-background: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --accent-color: #0071e3;
    --spacing-unit: 20px;
    --max-width: 1200px;
    --nav-height: 64px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--background-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: var(--nav-height);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background 0.3s ease;
}

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

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

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

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 17px;
    font-weight: 400;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--text-primary);
    transition: width 0.3s ease;
}

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

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

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

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

/* Hero区域样式 */
.hero {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 0 80px;
    background: linear-gradient(to bottom, var(--background-color), var(--section-background));
}

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

.hero-avatar {
    margin: 0 auto 32px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--background-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--section-background);
}

.hero-avatar:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-title {
    font-size: 64px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--text-primary);
    line-height: 1.1;
}

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

.hero-subtitle {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.hero-description {
    font-size: 21px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 48px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    font-size: 17px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 22px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

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

.btn-secondary:hover {
    background: var(--section-background);
    border-color: var(--text-primary);
}

.hero-contact {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 17px;
}

.contact-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: var(--accent-color);
}

.divider {
    color: var(--text-secondary);
    margin: 0 8px;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    flex-direction: column;
}

/* 章节样式 */
.section {
    padding: 100px 0;
    scroll-margin-top: var(--nav-height);
}

.section:nth-child(even) {
    background: var(--section-background);
}

.section-title {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 60px;
    color: var(--text-primary);
    text-align: center;
}

/* 工作经历样式 */
.experience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.experience-card {
    background: var(--background-color);
    padding: 32px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
}

.experience-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--accent-color);
}

.experience-more {
    position: absolute;
    bottom: 16px;
    right: 16px;
    font-size: 14px;
    color: var(--accent-color);
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.experience-card:hover .experience-more {
    opacity: 1;
}

.experience-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.experience-company {
    font-size: 17px;
    color: var(--accent-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.experience-date {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.experience-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* 项目卡片样式 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.project-card {
    background: var(--background-color);
    padding: 32px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.project-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.project-date {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.project-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

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

.tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--section-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-primary);
}

/* 作品展示样式 */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    justify-items: center;
}

.portfolio-item {
    background: var(--background-color);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: center;
    aspect-ratio: 1;
    width: 100%;
    max-width: 260px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.portfolio-more {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 13px;
    color: var(--accent-color);
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.portfolio-item:hover .portfolio-more {
    opacity: 1;
}

.portfolio-image {
    width: 85px;
    height: 85px;
    margin: 18px auto 12px;
    overflow: hidden;
    background: var(--section-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.portfolio-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-img {
    transform: scale(1.05);
}

.portfolio-content {
    padding: 0 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    overflow: visible;
}

.portfolio-title {
    font-size: 16px; /* 默认大小，会被JavaScript动态调整 */
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.5;
    overflow: visible;
    word-wrap: break-word;
    white-space: normal;
    min-height: auto;
    flex-shrink: 0;
    transition: font-size 0.3s ease;
}

.portfolio-description {
    font-size: 13px; /* 默认大小，会被JavaScript动态调整 */
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 10px;
    flex: 1;
    overflow: visible;
    display: block;
    word-wrap: break-word;
    min-height: 0;
    transition: font-size 0.3s ease;
}

.portfolio-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-top: auto;
}

.portfolio-date {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 爱好网格样式 */
.hobbies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.hobby-item {
    text-align: center;
    padding: 32px 24px;
    background: var(--background-color);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.hobby-item:hover {
    transform: translateY(-4px);
}

.hobby-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.hobby-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.hobby-description {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: var(--background-color);
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    z-index: 2001;
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--section-background);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 2002;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: var(--border-color);
    transform: rotate(90deg);
}

.modal-header {
    padding: 40px 40px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.modal-company {
    font-size: 20px;
    color: var(--accent-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-date {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.modal-body {
    padding: 32px 40px 40px;
}

.modal-body h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    margin-top: 24px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.modal-body ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.modal-body li {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
    padding-left: 24px;
    position: relative;
    margin-bottom: 12px;
}

.modal-body li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: var(--accent-color);
    font-weight: bold;
}

.modal-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* 页脚样式 */
.footer {
    padding: 60px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    background: var(--section-background);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: var(--nav-height);
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 32px 0;
        gap: 24px;
        border-bottom: 1px solid var(--border-color);
    }

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

    .nav-toggle {
        display: flex;
    }

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

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

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

    .hero-avatar {
        width: 120px;
        height: 120px;
        margin-bottom: 24px;
    }

    .hero-title {
        font-size: 40px;
    }

    .hero-subtitle {
        font-size: 22px;
    }

    .hero-description {
        font-size: 18px;
    }

    .section-title {
        font-size: 36px;
    }

    .section {
        padding: 60px 0;
    }

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

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

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 100%;
        justify-items: center;
    }

    .portfolio-item {
        aspect-ratio: 1;
        max-width: 100%;
    }

    .portfolio-image {
        width: 80px;
        height: 80px;
        margin: 20px auto 14px;
    }

    .portfolio-content {
        padding: 0 16px 16px;
        overflow: visible;
        justify-content: flex-start;
    }

    .portfolio-title {
        font-size: 15px;
        margin-bottom: 8px;
        line-height: 1.4;
        overflow: visible;
        word-wrap: break-word;
        white-space: normal;
    }

    .portfolio-description {
        font-size: 12px;
        overflow: visible;
        display: block;
        margin-bottom: 10px;
        line-height: 1.4;
        word-wrap: break-word;
    }

    .portfolio-meta {
        padding-top: 10px;
        margin-top: auto;
    }

    .portfolio-date {
        font-size: 12px;
    }

    .hobbies-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-contact {
        flex-direction: column;
        gap: 8px;
    }

    .divider {
        display: none;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .hero-avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .hero-title {
        font-size: 32px;
    }

    .section-title {
        font-size: 28px;
    }

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

    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 32px 24px 20px;
    }

    .modal-title {
        font-size: 24px;
    }

    .modal-company {
        font-size: 18px;
    }

    .modal-body {
        padding: 24px;
    }

    .modal-close {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}