/* Base styles */
body {
    font-family: 'Crimson Text', Georgia, serif;
    line-height: 1.7;
    max-width: 850px;
    margin: 0 auto;
    padding: 2rem;
    background-color: #fdfaf4; /* Even subtler warm tone */
    color: #1a1a1a;
    padding-top: 3rem;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 1rem;
    padding: 2rem 0 1rem;
}

.name {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.5rem 0;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.chinese-name {
    font-family: 'KaiTi', '楷体', serif;
}

/* Section styles */
.section {
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid #e5e5e5;
}

/* Publications styles */
.publications {
    list-style-type: none;
    padding: 0;
}

.publications li {
    margin-bottom: 0rem;
}

.title {
    position: relative; /* For positioning the loading bar */
    font-weight: 600;
    cursor: pointer;
    color: #1a1a1a;
    font-family: 'Crimson Text', Georgia, serif;
    transition: color 0.2s ease;
}

.title::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, #1a1a1a, #595959);
    opacity: 0;
    transform-origin: left;
}

/* Make loading bar animation work on all screen sizes */
.publication-item:hover .title::after {
    opacity: 1;
    animation: loadingBar 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.publication-item:not(:hover) .title::after {
    animation: none;
    opacity: 0;
    width: 0;
}

@keyframes loadingBar {
    0% {
        width: 0;
        opacity: 0.7;
    }
    100% {
        width: 100%;
        opacity: 1;
    }
}

.title:hover {
    color: #595959;
}

/* Details section */
.details {
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #e5e5e5;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #595959;
    opacity: 0;
    height: 0;
    overflow: hidden;
    pointer-events: auto;
}

/* Show details on hover */
.publication-item:hover .details {
    animation: showDetails 0.3s ease 0.5s forwards;
}

/* Hide details when not hovered AND not expanded */
.publication-item:not(:hover):not(.expanded) .details {
    animation: none;
    opacity: 0;
    height: 0;
}

@keyframes showDetails {
    from {
        opacity: 0;
        height: 0;
    }
    to {
        opacity: 1;
        height: auto;
    }
}

/* Show details when expanded (for click) - ensures it stays open */
.publication-item.expanded .details {
    opacity: 1;
    height: auto;
    animation: none;
        /* Ensure no conflicting animation */
}

/* Headings */
h3 {
    color: #1a1a1a;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Emoji */
.emoji {
    font-size: 1.2rem;
}

/* Awards list */
ul:not(.publications) li {
    padding: 0.2rem 0;
    color: #1a1a1a;
}

/* Links */
a {
    color: #1a1a1a;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: #595959;
}

/* Add before the closing style tag */
@media (max-width: 768px) {
    body {
        padding: 1.5rem;
    }
    
    .name {
        font-size: 1.8rem;
    }
}

.view-toggle {
    margin-bottom: 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toggle-link {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: #595959;
    font-size: 1rem;
}

.toggle-link:hover {
    color: #1a1a1a;
}

.toggle-link.active {
    color: #1a1a1a;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Add/modify these styles */
.header-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
}

/* Add media query for mobile devices */
@media (max-width: 600px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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

    .social-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .social-links a {
        margin: 0 0.5rem;
    }
}

.events {
    list-style-type: none;
    padding: 0;
}

.events li {
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.event-date {
    font-weight: bold;
}

.event-link {
    color: #1a1a1a;
    text-decoration: underline;
}

.event-link:hover {
    color: #595959;
}

/* Add new styles for layout */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Default gap for narrow screens */
}

.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* Default gap for narrow screens */
}

.bio {
    flex: 1;
    margin-top: 0;
}

/* For wider screens */
@media (min-width: 599px) {
    .main-container {
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 2rem;
    }

    .header-container {
        flex-direction: column;
        align-items: center;
        flex: 1;
        max-width: 300px;
    }

    .bio {
        flex: 2;
    }
}

/* For screens under 700px */
@media (max-width: 599px) {
    .header-container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .main-container {
        flex-direction: column;
        align-items: center;
    }
}

.expandable-text {
    position: relative;
    cursor: pointer;
}

.expandable-text .full-text {
    display: none;
}

.expandable-text:hover .short-text {
    display: none;
}

.expandable-text:hover .full-text {
    display: inline;
}

/* Add these styles for the publication links */
.details .links {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    pointer-events: auto;
}

.details .links a {
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.details .links a:hover {
    color: #1a1a1a;
}

/* Modify the publication item styles */
.publication-item {
    position: relative;
    padding: 0.3rem 0.5rem;
    transition: color 0.2s ease;
}

.publication-item:hover {
    background-color: transparent;
}

/* Keep the color transition for the title */
.title {
    font-weight: 600;
    color: #1a1a1a;
    font-family: 'Crimson Text', Georgia, serif;
    transition: color 0.2s ease;
}

.publication-item:hover .title {
    color: #595959;
}
/* Author styles */
.authors {
    color: #595959;
    /* Grey color for all authors by default */
}

.highlight-name {
    color: #1a1a1a;
    font-weight: 600;
}
.hidden {
    display: none;
}

.show-more-button {
    display: block;
    margin: 1rem auto;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #595959;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.show-more-button:hover {
    color: #1a1a1a;
}

.event-item {
    margin-bottom: 0.5rem;
}
/* Footnote popup styles */
.footnote-popup {
    position: absolute;
    z-index: 100;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
}

.footnote-popup.active {
    opacity: 1;
    transform: translateY(0);
}

.footnote-content {
    background-color: white;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    border: 1px solid #e5e5e5;
    position: relative;
}

.footnote-close {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #777;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.footnote-close:hover {
    color: #000;
}

.footnote-trigger {
    position: relative;
    cursor: pointer;
}