/* --- Global Variables & Reset --- */
:root {
    --primary-color: #0056b3;
    --accent-color: #eef4fb;
    --text-main: #222;
    --text-secondary: #555;
    --bg-body: #fcfcfc;
    --sidebar-width: 250px;
    --sidebar-bg: #fff;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-main);
    color: var(--text-main);
    background-color: var(--bg-body);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary-color); text-decoration: none; transition: all 0.2s ease; }
a:hover { text-decoration: underline; color: #003d82; }

/* --- Layout Container --- */
.container {
    display: flex;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100vh;
}

/* --- Left Sidebar (Fixed) --- */
.sidebar {
    width: var(--sidebar-width);
    padding: 40px 20px;
    text-align: center;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 优化 1: 照片调整 */
.profile-img {
    width: 140px;       /* 略微缩小 */
    height: 180px;
    object-fit: cover;
    object-position: 50% 25%; /* 调整垂直位置，让头部显示更完整 */
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.sidebar h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
}

.sidebar p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.link-btn {
    display: block;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

.link-btn:hover {
    background-color: var(--accent-color);
    border-color: #d0e1f5;
    color: var(--primary-color);
    text-decoration: none;
}

/* --- Right Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 50px 60px;
    background-color: #fff;
}

section { margin-bottom: 40px; }

h2 {
    font-size: 1.4rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
    margin-bottom: 25px;
    color: #111;
    letter-spacing: -0.5px;
}

/* 优化 2: About Me 间距调整 */
.about-text p {
    margin-bottom: 10px; /* 减小段落间距 */
}


/* --- Paper Card Style --- */
.paper {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.paper img {
    width: 140px;
    height: auto;
    min-width: 140px;
    border-radius: 6px;
    border: 1px solid #eee;
    align-self: flex-start;
}

.paper-content h3 {
    font-size: 1rem; /* 调整后的字号，现在更小 */
    font-weight: 600;
    margin-bottom: 6px;
    color: #000;
}

.paper-authors { color: var(--text-secondary); margin-bottom: 4px; font-size: 0.95rem; }
.paper-venue { font-style: italic; font-weight: 500; color: #333; margin-bottom: 6px; font-size: 0.9rem; }
.paper-links { font-size: 0.85rem; }
.paper-links a { margin-right: 12px; text-transform: uppercase; font-weight: 600; font-size: 0.75rem; letter-spacing: 0.5px; }

.view-all-wrapper {
    margin-top: 10px; 
}
.view-all-btn {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
}

/* --- 优化 3.1: Experience 扁平化 --- */
.exp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px; /* 缩小间距 */
}

.exp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px; /* 减小垂直内边距 */
    border: 1px solid #eee;
    border-radius: 8px;
    transition: transform 0.2s;
    /* 增加 position 和 z-index 来初始化堆叠上下文，为悬停做准备 */
    position: relative;
    z-index: 1; 
}
.exp-item:hover { 
    transform: translateY(-2px); 
    border-color: #ddd; 
    /* 关键修复：悬停时将当前条目的层级提到最高 */
    z-index: 1000; 
}

.exp-item img { 
    width: 36px; /* 缩小图标尺寸 */
    height: 36px; 
    object-fit: contain; 
}

.exp-info {
    position: relative;
}
.exp-info strong { display: block; font-size: 0.85rem; line-height: 1.2; }
.exp-info span { font-size: 0.75rem; color: #777; }


/* --- 优化 3.2: Experience 和 Awards 左右排列 --- */
.two-col-layout {
    display: flex;
    gap: 40px;
}

/* 核心修改：调整左右两栏的宽度比例 */
.two-col-layout > section {
    margin-bottom: 40; 
}

/* 添加针对特定 section 的 flex 属性 */
.two-col-layout .experience {
    flex: 1; /* 相对较窄，作为基准 */
    min-width: 300px; /* 确保内容不会过于拥挤 */
}

.two-col-layout .awards {
    flex: 1.5; /* 相对较宽，比 Experience 宽 50% */
}

/* --- Tooltip Styling (最终修订，解决穿透问题) --- */
.exp-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 999; /* 关键修改：大幅提高层级，确保在最顶层，彻底解决文字穿透问题 */
    width: 350px;
    background: #1a1a1a; 
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    margin-top: 10px;
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.4;
    /* 保持 Tooltip 内容的字体样式 */
    /* pointer-events: none; 可选：如果希望鼠标能点击到Tooltip下面的内容，则添加 */
}

.exp-item:hover .exp-tooltip {
    opacity: 1;
    visibility: visible;
}

.exp-tooltip strong { color: #ffe568; font-weight: 700; }
.exp-tooltip i { font-style: italic; }


/* 针对 Services Section 内容的简单字体调整 */
.section.services p {
    font-size: 0.95rem; /* 调整段落内容字体大小 */
    line-height: 1.6;
    color: var(--text-secondary); /* 使用辅助文本颜色 */
}

/* 调整 Conference Reviewer/Teaching Assistant 标题的字体大小 */
.section.services h3 {
    font-size: 1.1rem; /* 比主标题 h2 略小，比段落大 */
    font-weight: 600;
    color: var(--text-main);
    margin-top: 15px; /* 增加 Reviewer/TA 标题与上一个元素的间距 */
    margin-bottom: 5px;
}


@media (max-width: 992px) { 
    /* 关键修复 1: 强制容器垂直堆叠 */
    .container {
        flex-direction: column; 
        min-height: auto; 
    }

    /* 2. 侧边栏样式调整：调整头像与 About Me 之间的垂直间隙 */
    .sidebar { 
        position: relative; 
        width: 100%; 
        height: auto; 
        border-right: none; 
        border-bottom: 1px solid #eaeaea; 
        /* 关键修改：减少侧边栏底部 padding (15px)，缩小与主内容区的间隙 */
        padding: 30px 20px 15px 20px; 
    }
    
    /* 3. 主内容区移除左侧边距 */
    .main-content { 
        margin-left: 0; 
        /* 关键修改：减少主内容区顶部 padding (15px)，缩小与侧边栏的间隙 */
        padding: 15px 20px 30px 20px; 
    }
    
    /* 4. 核心修复：将双栏布局 (Experience/Awards) 强制转为单栏垂直堆叠 */
    .two-col-layout { 
        flex-direction: column; 
        /* 关键修改 3：Experience 和 Awards 之间的垂直间隙，从 30px 调整为 20px */
        gap: 20px; 
        /* 关键修改 4：Awards (双栏布局末尾) 和 Services 之间的间隙，从 60px 减小到 30px */
        margin-bottom: 30px; 
    }
    
    /* 5. 统一 Section 间距 */
    .main-content section {
        /* 控制 Services 和 Footer 之间的间隙 */
        margin-bottom: 30px; 
    }
    
    /* 6. 重置 Experience 和 Awards 的 flex 属性 */
    .two-col-layout > section {
        flex: none; 
        width: 100%; 
        min-width: unset; 
        margin-bottom: 0; /* 确保 .two-col-layout 内部的 section 没有额外的底部 margin */
    }

    /* 7. 其他移动端优化 */
    .exp-tooltip { 
        display: none; 
    }
    .paper { 
        flex-direction: column; 
    }
    .paper img { 
        width: 100%; 
        max-width: 300px; 
        align-self: flex-start; 
    }
    .exp-grid {
        grid-template-columns: 1fr; 
    }
}