/* ===== Base ===== */
:root {
    --text: #222;
    --text-muted: #555;
    --link: #0066cc;
    --link-hover: #004499;
    --bg: #fff;
    --border: #ddd;
    --accent-bg: #f8f9fa;
    --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ===== Layout ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-layout {
    display: flex;
    max-width: 1160px;
    margin: 0 auto;
    padding: 80px 20px 0;
    gap: 48px;
    align-items: flex-start;
}

.page-content {
    flex: 1;
    min-width: 0;
    padding-bottom: 40px;
    overflow-x: hidden;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 36px 0;
}

section {
    margin-bottom: 8px;
}

h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text);
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 56px;
}

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

.nav-name {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.nav-name:hover {
    text-decoration: none;
    color: var(--link);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 24px;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
}

/* ===== Profile Sidebar ===== */
.profile-sidebar {
    position: sticky;
    top: 80px;
    flex-shrink: 0;
    width: 200px;
    text-align: center;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 14px;
}

.profile-name {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.3;
}

.profile-role {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.profile-org {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.profile-icons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.profile-email {
    font-size: 0.78rem;
    margin-top: 14px;
    letter-spacing: 0.02em;
}

.profile-email a {
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.profile-email a:hover {
    color: var(--link);
    text-decoration: none;
}

.profile-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    filter: grayscale(100%) opacity(0.5);
    transition: filter 0.25s ease;
}

.profile-icons a:hover .profile-icon {
    filter: grayscale(0%) opacity(1);
}

.profile-icons a:hover {
    text-decoration: none;
}

.profile-bio p {
    margin-bottom: 12px;
}

/* ===== Highlights ===== */
.hl-table {
    width: 100%;
    border-collapse: collapse;
}

.hl-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.hl-table tr:last-child {
    border-bottom: none;
}

.hl-table td {
    padding: 14px 0;
    vertical-align: middle;
    font-size: 0.95rem;
    line-height: 1.7;
}

.hl-thumb {
    width: 170px;
    padding-right: 18px !important;
}

.hl-thumb img {
    width: 150px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--accent-bg);
}

.hl-date {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 4px;
}

/* ===== Open Source ===== */
.os-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.os-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--accent-bg);
    border-radius: 8px;
    font-size: 0.95rem;
}

.os-logo {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    object-fit: contain;
}

/* ===== Publications Table ===== */
.section-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.pub-table {
    width: 100%;
    border-collapse: collapse;
}

.pub-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.pub-table tr:last-child {
    border-bottom: none;
}

.pub-table td {
    padding: 14px 0;
    vertical-align: top;
    font-size: 0.95rem;
    line-height: 1.6;
}

.pub-table a {
    margin-right: 6px;
    font-size: 0.85rem;
}

/* ===== Citation Map ===== */
.citation-map-container {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
    margin-bottom: 24px;
    position: relative;
}

.citation-map-iframe {
    width: 100%;
    height: 480px;
    border: none;
    display: block;
}

.citation-map-fullscreen {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}

.citation-map-fullscreen:hover {
    background: #fff;
    color: var(--text);
}

.citation-map-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.citation-map-overlay.active {
    display: flex;
}

.citation-map-overlay-iframe {
    width: 95vw;
    height: 92vh;
    border: none;
    border-radius: 8px;
}

.citation-map-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: background 0.2s;
}

.citation-map-close:hover {
    background: #fff;
}

/* ===== Awards ===== */
.awards-list {
    list-style: disc;
    padding-left: 20px;
}

.awards-list li {
    padding: 5px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.awards-list a {
    font-size: 0.85rem;
}


/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Scroll Animations ===== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        padding: 12px 20px;
        gap: 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        padding: 8px 0;
    }

    .nav-toggle {
        display: block;
    }

    .page-layout {
        flex-direction: column;
        gap: 24px;
    }

    .profile-sidebar {
        position: static;
        width: 100%;
    }

    .profile-icon {
        width: 28px;
        height: 28px;
        padding: 3px;
    }

    .profile-icons {
        gap: 20px;
    }

    .hl-thumb {
        width: 120px;
        padding-right: 12px !important;
    }

    .hl-thumb img {
        width: 100px;
        height: 60px;
    }

    .citation-map-iframe {
        height: 340px;
    }

    .citation-map-overlay-iframe {
        width: 100vw;
        height: 85vh;
        border-radius: 0;
    }

    .pub-table td,
    .hl-table td {
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .page-layout {
        padding: 72px 14px 0;
        gap: 16px;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
    }

    .profile-name {
        font-size: 1.15rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .hl-thumb {
        display: none;
    }

    .citation-map-iframe {
        height: 260px;
    }

    .os-item {
        font-size: 0.88rem;
        padding: 10px 12px;
    }

    .awards-list li {
        font-size: 0.88rem;
    }

    hr {
        margin: 24px 0;
    }
}
