/* ========================================
   Style: Bento Box / Apple-Style Modular
   Design Philosophy: Modular grid layout,
   rounded modules, clean Apple aesthetics
   ======================================== */

:root {
    /* Light Theme - 纯白简约 */
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f7f7;

    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #8a8a8a;

    --accent-primary: #1a1a1a;
    --accent-secondary: #333333;
    --accent-tertiary: #555555;
    --accent-gradient: none;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.05);

    /* Typography */
    --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 5rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    /* 圆角收紧 */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-full: 9999px;

    /* Bento */
    --bento-gap: 14px;
    --bento-padding: 28px;
    --module-bg: var(--bg-card);
}

/* ---- 基础重置 ---- */
* { -webkit-tap-highlight-color: transparent; }
[data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
::selection { background: var(--text-primary); color: #fff; }

/* Dark Theme - 低调深灰 */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #1f1f1f;
    --bg-tertiary: #222222;
    --bg-card: #1f1f1f;
    --bg-card-hover: #262626;

    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background var(--transition-base), color var(--transition-base);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

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

img {
    max-width: 100%;
    display: block;
}

/* ========================================
   Navbar
   ======================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md) var(--space-xl);
    transition: all var(--transition-base);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .navbar.scrolled {
    background: rgba(26, 26, 26, 0.85);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.nav-logo {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 2px;
    border-bottom: none;
}

.nav-logo:hover { border-bottom: none; }

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

.nav-links {
    display: flex;
    gap: var(--space-lg);
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: none;
    transition: color var(--transition-fast);
    letter-spacing: 0.01em;
}

.nav-links a:hover {
    color: var(--text-primary);
    border-bottom: none;
}

.nav-controls {
    display: flex;
    align-items: center;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

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

.nav-btn-icon {
    width: 16px;
    height: 16px;
}

.nav-btn-label {
    font-weight: 500;
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon,
:root:not([data-theme]) .sun-icon { display: none; }
[data-theme="light"] .moon-icon,
:root:not([data-theme]) .moon-icon { display: block; }

.theme-label::after { content: ''; }
[data-theme="dark"] .theme-label::after { content: ''; }

/* ========================================
   Hero
   ======================================== */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(80px + var(--space-2xl)) var(--space-xl) var(--space-2xl);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.grid-overlay {
    display: none;
}

.gradient-orb {
    display: none;
}

.orb-1, .orb-2 { display: none; }

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 380px;  /* 右侧列加宽，给大照片留空间 */
    gap: var(--space-2xl);
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-sm);
}

.hero-greeting {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.hero-name {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.hero-title {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: var(--space-lg);
}

.hero-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 540px;
    margin-bottom: var(--space-xl);
}

.hero-description p {
    margin-bottom: 1.5em;
}
.hero-description p:last-child {
    margin-bottom: 0;
}

.highlight {
    color: var(--text-primary);
    font-weight: 600;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
}

/* 按钮改为中性风格 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

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

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

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

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

/* Hero Image */
.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-frame {
    width: 360px;        /* 原 320px，改大 */
    height: 420px;       /* 原 380px，改大 */
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.image-placeholder svg {
    width: 60px;
    height: 60px;
    opacity: 0.3;
}

/* ========================================
   Sections
   ======================================== */

.section {
    padding: var(--space-md) var(--space-xl);
}

.section-container {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--bento-padding);
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-base), border-color var(--transition-base);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xl);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.title-icon {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 1.1rem;
}

/* ========================================
   Publications
   ======================================== */

.publications-list {
    display: flex;
    flex-direction: column;
    gap: var(--bento-gap);
}

.pub-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.pub-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.pub-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    padding-top: 2px;
}

.pub-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.pub-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
}

.pub-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.pub-links {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.pub-link {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 3px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.pub-link:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.pub-authors {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.pub-venue {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   Projects
   ======================================== */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--bento-gap);
}

.project-card {
    padding: var(--space-lg);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.project-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.project-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.project-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.01em;
}

[data-theme="dark"] .tag {
    background: transparent;
}

/* ========================================
   News
   ======================================== */

.news-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.news-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.news-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.news-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 2px;
    min-width: 70px;
}

.news-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.news-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--text-primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ========================================
   Experience
   ======================================== */

.experience-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.exp-category h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.exp-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.exp-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.exp-period {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 2px;
}

.exp-details h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.exp-details p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   Contact
   ======================================== */

.contact-content {
    text-align: center;
    padding: var(--space-xl) 0;
}

.contact-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.contact-content p:first-child {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    padding: var(--space-xl) var(--space-xl);
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-2xl);
}

.footer-content p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ========================================
   Scroll Animations
   ======================================== */

.scroll-animate {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Back to Top
   ======================================== */

.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-base);
    z-index: 900;
    color: var(--text-secondary);
    font-size: 1rem;
}

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

.back-to-top:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    :root {
        --bento-padding: 20px;
        --bento-gap: 12px;
    }

    .navbar {
        padding: var(--space-sm) var(--space-md);
    }

    .nav-links {
        display: none;
    }

    .hero {
        padding: calc(70px + var(--space-xl)) var(--space-md) var(--space-xl);
    }

    .hero-content {
        grid-template-columns: 1fr;
        padding: var(--space-xl) var(--space-lg);
        text-align: center;
    }

    .hero-name {
        font-size: 2rem;
    }

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

    .hero-cta {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-image {
        order: -1;
    }

    .image-frame {
        width: 240px;    /* 原 180px，改大 */
        height: 280px;   /* 原 210px，改大 */
    }

    .section {
        padding: var(--space-sm) var(--space-md);
    }

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

    .pub-card {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .pub-header {
        flex-direction: column;
        gap: var(--space-sm);
    }

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

    .exp-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .news-item {
        flex-direction: column;
        gap: var(--space-sm);
    }

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-animate {
        opacity: 1;
        transform: none;
    }
}

:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

.skip-link { position: absolute; top: -40px; left: 0; background: var(--text-primary); color: var(--bg-primary); padding: 8px 16px; z-index: 9999; font-size: 0.875rem; transition: top 0.2s; }
.skip-link:focus { top: 0; }
