#back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #555;
    color: white;
    font-size: 16px;
    padding: 12px 16px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 99;
    opacity: 0.5;
    transition: opacity 0.3s ease-in-out;
}

#back-to-top:hover {
    background-color: #333;
    opacity: 1;
}
.copy-btn {
    position: absolute; 
    top: 4px; 
    right: 4px;
    display: inline-block;
    background-color: #555;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    z-index: 9999;
}

/* ========== Section Navigation ========== */

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.section-nav a {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.section-nav a:hover {
    background: #f0f0f0;
    color: #222;
}

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

.home-section {
    padding-top: 0.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.home-section:last-child {
    border-bottom: none;
}

.home-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #333;
    padding-bottom: 0.3rem;
}

.home-section ul {
    margin: 0;
    padding-left: 1.2em;
}

.home-section ol {
    margin: 0;
    padding-left: 1.4em;
}

.home-section li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

.home-section p {
    line-height: 1.7;
}

html {
    scroll-behavior: smooth;
}

.home-section[id]::before {
    content: "";
    display: block;
    height: 60px;
    margin-top: -60px;
    visibility: hidden;
    pointer-events: none;
}

/* ========== Publication Cards ========== */

.pub-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pub-year {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin: 0.5rem 0 0;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #eee;
}

.pub-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1rem 1.2rem;
    border-left: 3px solid #ddd;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.pub-card:hover {
    border-left-color: #0066cc;
    background: #fafbfc;
}

.pub-card__thumb {
    flex-shrink: 0;
    width: 240px;
    height: 180px;
    overflow: hidden;
    border-radius: 4px;
}

.pub-card__thumb img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 4px;
    object-fit: cover;
}

.pub-card__body {
    flex: 1;
    min-width: 0;
}

.pub-card__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    color: #222;
}

.pub-card__title a {
    color: #222;
    text-decoration: none;
}

.pub-card__title a:hover {
    color: #0066cc;
}

.pub-card__authors {
    margin: 0 0 0.3rem;
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
}

.pub-card__authors strong {
    color: #222;
}

.pub-card__venue {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.pub-card__links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pub-card__links a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    color: #fff;
    background: #0066cc;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.pub-card__links a:hover {
    background: #004fa3;
}

.pub-card__links a.pub-link--outline {
    color: #555;
    background: transparent;
    border: 1px solid #ddd;
}

.pub-card__links a.pub-link--outline:hover {
    background: #f0f0f0;
    color: #333;
}

@media (max-width: 600px) {
    .pub-card {
        flex-direction: column;
    }

    .pub-card__thumb {
        width: 100%;
    }
}

/* ========== Publication Detail Page ========== */

.page__title:empty {
    display: none;
    margin: 0;
    padding: 0;
}

#main:has(.pub-detail) .page {
    width: 100%;
    float: none;
    margin: 0 auto;
    padding: 0 1em;
}

.pub-detail {
    max-width: 960px;
    margin: 0 auto;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pub-detail__header {
    text-align: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.pub-detail__title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a2e;
    margin: 0 0 1.2rem;
    letter-spacing: -0.02em;
}

.pub-detail__authors {
    font-size: 1.1rem;
    color: #333;
    line-height: 2;
    margin: 0 0 0.15rem;
}

.pub-detail__authors strong {
    color: #1a1a2e;
    font-weight: 600;
}

.pub-detail__authors sup {
    font-size: 0.65em;
    color: #888;
    margin-left: 1px;
}

.pub-detail__affiliations {
    font-size: 0.92rem;
    color: #555;
    margin: 0.3rem 0 0.2rem;
    line-height: 1.5;
}

.pub-detail__affiliations sup {
    font-size: 0.65em;
    color: #888;
    margin-right: 2px;
}

.pub-detail__venue {
    font-size: 1rem;
    color: #555;
    font-style: italic;
    margin: 0.8rem 0 1.2rem;
}

.pub-detail__links {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.pub-detail__links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1.1rem;
    font-size: 0.9rem;
    color: #fff;
    background: #0066cc;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}

.pub-detail__links a:hover {
    background: #004fa3;
    transform: translateY(-1px);
}

.pub-detail__links a.pub-link--outline {
    color: #555;
    background: transparent;
    border: 1px solid #ccc;
}

.pub-detail__links a.pub-link--outline:hover {
    background: #f0f0f0;
    color: #333;
    transform: translateY(-1px);
}

.pub-detail__teaser {
    margin: 0 0 2rem;
    border-radius: 6px;
    overflow: hidden;
}

.pub-detail__teaser img {
    width: 100%;
    height: auto;
    display: block;
}

.pub-detail h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 2.2rem 0 0.8rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid #eee;
}

.pub-detail p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #333;
    text-align: justify;
}

.pub-detail__bibtex {
    background: #f6f8fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    color: #333;
}

@media (max-width: 768px) {
    .pub-detail__title {
        font-size: 1.5rem;
    }

    .pub-detail__authors {
        font-size: 0.95rem;
    }

    .pub-detail h2 {
        font-size: 1.3rem;
    }

    .pub-detail p {
        font-size: 1rem;
    }
}

/* ========== Project Cards ========== */

.project-cards {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.project-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1rem;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    background: #fff;
}

.project-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.project-card__image {
    flex-shrink: 0;
    width: 220px;
    overflow: hidden;
    border-radius: 6px;
}

.project-card__image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.project-card:hover .project-card__image img {
    transform: scale(1.03);
}

.project-card__body {
    flex: 1;
    min-width: 0;
}

.project-card__title {
    margin: 0 0 0.3rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.project-card__title a {
    color: #333;
    text-decoration: none;
}

.project-card__title a:hover {
    color: #0066cc;
}

.project-card__meta {
    margin: 0 0 0.6rem;
    font-size: 0.88rem;
    color: #777;
    font-style: italic;
}

.project-card__links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-card__links a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.82rem;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.project-card__links a:hover {
    background: #f0f0f0;
    color: #333;
}

.project-card__links a i {
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .project-card {
        flex-direction: column;
    }

    .project-card__image {
        width: 100%;
    }
}

/* ========== Blog Cards ========== */

.blog-card {
    display: flex;
    align-items: stretch;
    gap: 1.2rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.blog-card:hover {
    border-color: #ccc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.blog-card__thumb {
    flex-shrink: 0;
    width: 200px;
    overflow: hidden;
    border-radius: 6px;
    background: #f5f5f5;
}

.blog-card__thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card__thumb img {
    transform: scale(1.05);
}

.blog-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-card__title {
    margin: 0 0 0.4rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: #222;
    line-height: 1.35;
}

.blog-card:hover .blog-card__title {
    color: #0066cc;
}

.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

.blog-card__meta i {
    margin-right: 0.2rem;
}

.blog-card__tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    color: #666;
    background: #f0f0f0;
    border-radius: 3px;
}

.blog-card__excerpt {
    margin: 0;
    font-size: 0.88rem;
    color: #666;
    line-height: 1.6;
}

.archive__subtitle {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin: 1.5rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #eee;
}

.tag-button {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    color: #fff;
    background: #52b3d9;
    border-radius: 4px;
    text-decoration: none;
    margin-right: 0.3rem;
    transition: background 0.15s ease;
}

.tag-button:hover {
    background: #3498db;
    color: #fff;
}

@media (max-width: 600px) {
    .blog-card {
        flex-direction: column;
    }

    .blog-card__thumb {
        width: 100%;
        height: 180px;
    }
}

.pub-detail__bibtex-wrap {
    position: relative;
    margin-top: 0.5rem;
}

.pub-detail__bibtex {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 1.2rem 1.4rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    color: #24292e;
    margin: 0;
}

.pub-bibtex-copy {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.5;
}

.pub-bibtex-copy:hover {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
}

.pub-bibtex-copy.copied {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

/* ========== Search Page ========== */

#search-page {
    max-width: 780px;
    margin: 2rem auto;
    padding: 0 1.2rem;
}

.search-bar-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    padding: 0.5rem 0 0.8rem;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
    background: #fff;
}

.search-bar__icon {
    color: #999;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-bar:focus-within .search-bar__icon {
    color: #0066cc;
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    color: #333;
    padding: 0;
}

#search-input::placeholder {
    color: #aaa;
}

.search-bar__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: #ddd;
    color: #666;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.search-bar__clear:hover {
    background: #bbb;
    color: #333;
}

.search-status {
    font-size: 0.88rem;
    color: #777;
    margin: 0.6rem 0 1rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-result {
    display: block;
    padding: 0.9rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.search-result:hover {
    background: #f5f7fa;
    border-left-color: #0066cc;
}

.search-result__head {
    margin-bottom: 0.3rem;
}

.search-result__tag {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 3px;
    text-transform: uppercase;
}

.search-result__tag--pub {
    background: #e8f0fe;
    color: #1a56db;
}

.search-result__tag--blog {
    background: #f0fdf4;
    color: #16a34a;
}

.search-result__title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.search-result:hover .search-result__title {
    color: #0066cc;
}

.search-result__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    color: #888;
}

.search-result__venue {
    font-style: italic;
    color: #777;
}

.search-result__authors {
    color: #666;
}

.search-result__date {
    color: #999;
}

.search-result__tag-item {
    display: inline-block;
    padding: 0.08rem 0.4rem;
    font-size: 0.72rem;
    background: #f0f0f0;
    color: #666;
    border-radius: 3px;
}

.search-result__snippet {
    font-size: 0.88rem;
    color: #666;
    line-height: 1.6;
}

.search-result mark {
    background: #fff3a8;
    color: inherit;
    padding: 0.05em 0.15em;
    border-radius: 2px;
}

.search-empty {
    text-align: center;
    color: #999;
    padding: 2rem 0;
    font-size: 0.95rem;
}

/* Search icon in masthead */
.masthead__search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 1rem;
    padding: 0.3rem;
    margin-left: 0.4rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s;
}

.masthead__search-toggle:hover {
    color: #333;
}

