/* Academic Sidebar Theme */

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --text-color: #333;
    --bg-color: #ffffff;
    --sidebar-bg: #ffffff;
    --border-color: #eaeaea;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

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

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

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: none;
    padding: 60px 30px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    flex: 1;
}

.profile-photo-container {
    width: 160px;
    height: 160px;
    margin: 0 auto 25px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: white;
    padding: 5px;
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sidebar h1.name {
    font-size: 1.6em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.chinese-name {
    font-weight: 400;
    font-size: 0.9em;
    margin-left: 5px;
    color: #666;
}

.sidebar .title {
    text-align: center;
    font-weight: 500;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 4px;
}

.sidebar .affiliation {
    text-align: center;
    font-size: 0.85em;
    font-weight: 400;
    color: #888;
    margin-bottom: 40px;
}

/* Side Nav */
.side-nav ul {
    list-style: none;
    margin-top: 10px;
}

.side-nav li {
    margin-bottom: 5px;
}

.side-nav a {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.side-nav a:hover {
    color: var(--accent-color);
    background-color: #f0f0f0;
}

.side-nav a.active {
    color: var(--primary-color);
    font-weight: 700;
    background-color: transparent;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    text-align: center;
    padding-top: 30px;
}

.social-icons {
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 5px;
}

.social-icons a {
    color: #888;
    text-decoration: none;
    transition: color 0.2s ease;
}

.social-icons a:hover {
    color: var(--accent-color);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    padding: 80px 60px;
    background-color: white;
}

.section {
    margin-bottom: 60px;
    max-width: 800px;
}

.section h2 {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 5px;
    display: inline-block;
    letter-spacing: -0.01em;
}

.section h3 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--primary-color);
    margin: 40px 0 20px;
    letter-spacing: -0.01em;
}

.about-content p {
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #444;
}

/* News List */
.news-item {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.news-item .date {
    font-weight: 600;
    color: var(--accent-color);
    min-width: 90px;
}

/* Publication List */
.publication-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.publication-item h3 {
    font-size: 1.25em;
    margin: 0 0 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.publication-item .authors {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 5px;
}

.publication-item .venue {
    font-size: 0.95em;
    font-style: italic;
    color: #777;
    margin-bottom: 12px;
}

.pub-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
    margin-right: 15px;
    font-weight: 600;
}

.pub-links a:hover {
    text-decoration: underline;
}

/* Blogs Section */
.blog-preview-item {
    margin-bottom: 30px;
}

.blog-preview-item h3 {
    margin-bottom: 8px;
}

.blog-preview-item h3 a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.blog-preview-item h3 a:hover {
    color: var(--accent-color);
}

.blog-preview-item .date {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 10px;
}

.blog-preview-item .excerpt {
    color: #555;
}

.blog-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    max-width: 1100px;
}

.blog-reading-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 720px);
    gap: 42px;
    align-items: start;
    max-width: 1100px;
}

.blog-toc {
    position: sticky;
    top: 28px;
    padding-top: 8px;
}

.blog-toc-title {
    margin: 0 0 14px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a8a99;
}

.blog-toc-list {
    list-style: none;
    margin: 0;
    padding: 0 0 0 14px;
    border-left: 1px solid #e5ebf0;
}

.blog-toc-list li {
    margin: 0;
}

.blog-toc-list li + li {
    margin-top: 10px;
}

.blog-toc-list a {
    display: block;
    margin-left: -15px;
    padding-left: 14px;
    border-left: 2px solid transparent;
    color: #7a8a99;
    text-decoration: none;
    font-size: 0.8em;
    line-height: 1.35;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.blog-toc-list a:hover,
.blog-toc-list a.active {
    color: var(--primary-color);
    border-left-color: var(--accent-color);
}

.blog-toc-list .toc-h3 a {
    padding-left: 28px;
    font-size: 0.74em;
}

.language-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.lang-btn {
    background: white;
    border: none;
    padding: 5px 12px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: #f5f5f5;
}

.lang-btn.active {
    background: var(--accent-color);
    color: white;
}

.back-button {
    background: none;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.back-button:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Standard Markdown Styling (GitHub Style) */
.markdown-body {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 720px;
    margin: 0;
    padding: 0;
    background-color: transparent;
    font-family: var(--font-main) !important;
    font-size: 16px;
    line-height: 1.75;
}

.markdown-body h1 {
    font-size: 2.55em;
    line-height: 1.12;
    margin-bottom: 0.7em;
    color: var(--primary-color);
    letter-spacing: -0.035em;
}

.markdown-body h2,
.markdown-body h3 {
    scroll-margin-top: 24px;
}

.markdown-body h2 {
    margin-top: 2.6em;
    margin-bottom: 0.75em;
    font-size: 1.55em;
    font-weight: 700;
    border-bottom: none;
}

.markdown-body h3 {
    margin-top: 1.9em;
    margin-bottom: 0.65em;
    font-size: 1.18em;
    font-weight: 500;
}

.markdown-body p,
.markdown-body li {
    color: #43515e;
}

.markdown-body strong {
    color: #2f3f50;
}

.markdown-body a {
    color: #1c6fa8;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.14em;
}

.markdown-body blockquote {
    margin: 1.6rem 0;
    padding: 0.2rem 0 0.2rem 1rem;
    border-left: 3px solid #d4e0ea;
    color: #5a6978;
    background: transparent;
}

.markdown-body table {
    display: table;
    width: 100%;
    margin: 1.8rem 0;
    border-collapse: collapse;
    font-size: 0.93em;
}

.markdown-body th,
.markdown-body td {
    padding: 10px 12px;
    border: 1px solid #e6edf2;
}

.markdown-body thead th {
    background: #f7fafc;
}

.markdown-body pre {
    border-radius: 10px;
    padding: 18px;
}

.markdown-body img {
    border-radius: 10px;
}

.anchored-heading {
    position: relative;
}

.heading-anchor {
    color: #b7c2cc;
    text-decoration: none;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.anchored-heading:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor:hover {
    color: var(--accent-color);
}

.reference-list {
    margin-top: 1.2rem;
    padding-left: 0 !important;
    list-style: none !important;
}

.reference-item {
    position: relative;
    margin-bottom: 14px;
    padding-left: 42px;
    color: #556372;
}

.reference-item::before {
    content: "[" attr(data-reference-number) "]";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 600;
    color: #6b7d8f;
}

.reference-item p {
    margin: 0;
}

@media (max-width: 767px) {
    .blog-reading-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .blog-toc {
        position: static;
        padding-top: 0;
    }

    .blog-toc-list {
        border-left: none;
        padding-left: 0;
    }

    .blog-toc-list a,
    .blog-toc-list .toc-h3 a {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .markdown-body {
        font-size: 15px;
    }

    .markdown-body h1 {
        font-size: 2em;
    }
}

/* Ensure sidebar fonts don't get overridden by library */
.sidebar, .footer {
    font-family: var(--font-main);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px;
    background-color: var(--bg-color);
    color: #888;
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
}

/* Resource Card for Blog Posts */
.resource-card {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
    gap: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-decoration: none !important;
    transition: all 0.3s ease;
    cursor: pointer;
}

.resource-card:hover {
    background-color: #edf2f7;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.resource-icon {
    font-size: 2.2em;
    color: var(--accent-color);
    min-width: 50px;
    text-align: center;
}

.resource-info {
    flex: 1;
}

.resource-title {
    margin: 0 0 5px 0 !important;
    font-size: 1.1em !important;
    font-weight: 600 !important;
    color: var(--primary-color);
}

.resource-description {
    margin: 0 !important;
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

/* Add a chevron icon on the right */
.resource-card::after {
    content: "\f054"; /* FontAwesome chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #cbd5e0;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.resource-card:hover::after {
    color: var(--accent-color);
    transform: translateX(5px);
}

@media (max-width: 600px) {
    .resource-card {
        padding: 20px 15px;
    }
    .resource-card::after {
        display: none;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 40px 20px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .profile-photo-container {
        width: 100px;
        height: 100px;
        margin-bottom: 15px;
    }

    .sidebar h1.name {
        font-size: 1.5em;
    }

    .sidebar .affiliation {
        margin-bottom: 20px;
    }

    .side-nav {
        width: 100%;
    }

    .side-nav ul {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }

    .side-nav li {
        margin-bottom: 0;
    }

    .side-nav a {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .sidebar-footer {
        margin-top: 20px;
        padding-top: 15px;
        border-top: 1px solid #f5f5f5;
        width: 100%;
    }

    .main-content {
        padding: 40px 20px;
    }

    .blog-header-actions,
    .blog-reading-layout {
        max-width: none;
    }
}
