@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&family=Kalam:wght@300;400;700&display=swap');

/* =========================
   Base Styles
========================= */
body {
    font-family: 'Inter', sans-serif;
    color: #0f172a; /* slate-900 */
    background-color: #f8fafc; /* slate-50 */
    line-height: 1.6;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Text', serif;
}

.font-serif {
    font-family: 'Crimson Text', serif;
}

.font-sans {
    font-family: 'Inter', sans-serif;
}

/* =========================
   Glassmorphism Navigation
========================= */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.nav-item {
    position: relative;
    font-weight: 500;
    color: #475569; /* slate-600 */
    transition: color 0.2s;
}

.nav-item:hover {
    color: #1e293b; /* slate-800 */
}

.nav-item::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: #d4a562; /* accent */
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

/* =========================
   Hero / Section Styling
========================= */
.profile-image-container {
    position: relative;
    z-index: 10;
}

section {
    position: relative;
}

.section-header h2 {
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 40%;
    height: 3px;
    background-color: rgba(212, 165, 98, 0.3); /* accent with opacity */
    z-index: -1;
}

/* =========================
   Main Layout Grid
========================= */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .grid-layout {
        grid-template-columns: 320px 1fr;
        gap: 4rem;
        align-items: start;
    }
}

/* =========================
   Cards hover behavior
========================= */
.news-card, .research-card, .contact-card {
    transition: all 0.3s ease;
}

.news-card:hover, .research-card:hover, .contact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1; /* slate-300 */
}

/* =========================
   Scrollbar
========================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================
   Utility
========================= */
.text-accent {
    color: #d4a562;
}

.bg-accent {
    background-color: #d4a562;
}

.border-accent {
    border-color: #d4a562;
}

.hover\:text-accent:hover {
    color: #d4a562;
}

details summary {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: justify;
}

/* =========================
   New Publication List Styles
========================= */
.pub-year-group {
    margin-bottom: 2rem;
}

.pub-year-header {
    font-family: 'Inter', sans-serif; /* Wider than Crimson Text */
    font-size: 1.35rem; /* Slightly larger */
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.05em; /* Add spacing for wider look */
    color: #1e293b;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.25rem;
    display: inline-block;
}

.pub-list-ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}

.pub-list-item {
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.pub-line-1 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
}

.pub-venue-tag {
    font-weight: 700;
    margin-right: 0.5rem;
}

.pub-title-text {
    font-weight: 600;
    color: #1e293b;
}

.pub-link-btn {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #475569;
    margin-left: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
    vertical-align: middle;
    background-color: white;
}

.pub-link-btn:hover {
    border-color: #d4a562;
    color: #d4a562;
    background-color: #fffbeb;
}

.tag-arxiv {
    color: #2563eb; /* Blue for Arxiv */
}

.tag-conference {
    color: #dc2626; /* Red for Conference/Journal */
}

.pub-title-link {
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.pub-title-link:hover {
    color: #d4a562; /* accent */
    border-bottom-color: #d4a562;
}

.pub-line-2 {
    font-size: 0.95rem;
    color: #4b5563; /* neutral-600 */
    margin-bottom: 0.1rem;
}

.pub-line-2 strong, .pub-line-2 b {
    color: #1e293b; /* primary */
    font-weight: 600;
}

.pub-line-3 {
    font-size: 0.9rem;
    color: #64748b; /* slate-500 */
    font-style: italic;
}

/* =========================
   Publication Card Typography (Legacy/Unused for now)
   NOTE: kept as reference version
========================= */
.pub-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b; /* primary */
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.pub-authors {
    font-size: 0.95rem;
    color: #64748b; /* muted */
    margin-bottom: 0.5rem;
}

.pub-venue {
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b; /* muted */
    margin-bottom: 1rem;
    font-style: italic;
}

.pub-highlight {
    font-size: 0.85rem;
    color: #d97706; /* amber-600 */
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* =========================
   Publication CCF Ranks and Badges (reference)
========================= */
.pub-badge-highlight {
    display: inline-block;
    background-color: #ef4444; /* Red */
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    vertical-align: middle;
    line-height: 1.2;
}

.ccf-rank {
    font-weight: 700;
    margin-left: 0.3rem;
}

.ccf-a {
    color: #dc2626; /* Red-600 */
}

.ccf-b {
    color: #2563eb; /* Blue-600 */
}

.ccf-c {
    color: #16a34a; /* Green-600 */
}

.publication:hover {
    border-color: #d4a562; /* accent */
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

/* Venue Logo - Hidden for Text-Only Style */
.venue-logo {
    display: none;
}

/* =========================
   News list (legacy dashed style)
========================= */
.news-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1.5rem;
    align-items: baseline;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #e2e8f0;
}

.news-date {
    font-family: 'Kalam', cursive; /* Cleaner, wider handwriting font */
    font-weight: 400; 
    font-size: 0.9rem; 
    color: #64748b;
    white-space: nowrap;
}

.news-content {
    font-family: 'Kalam', cursive; /* Cleaner, wider handwriting font */
    font-size: 0.95rem; 
    color: #334155;
    line-height: 1.5;
}

.news-item:last-child {
    border-bottom: none;
}

/* =========================
   Formal Text
========================= */
.formal-font {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* =========================
   Service Section (legacy)
========================= */
.service-category {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 1.5rem;
}

.service-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.service-category h3 {
    font-size: 1rem; /* Match education header size */
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.35rem;
    font-family: 'Inter', sans-serif;
}

.service-items {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem; /* Match education text size (approx) */
    color: #475569;
    line-height: 1.5;
}

/* =========================
   Honors Section (legacy) - reference version
========================= */
.honor-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1.5rem;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.honor-year {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: #d4a562; /* accent */
    text-align: right;
    white-space: nowrap;
}

.honor-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b; /* primary */
}

/* =========================
   Publication Thumbnail & Layout (reference)
========================= */
.pub-content-wrapper {
    width: 100%;
}

.pub-list-item.with-thumbnail-expanded {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1rem;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pub-thumbnail-box {
    width: 200px; /* Fixed width for thumbnail */
    flex-shrink: 0;
    order: -1; /* Move to the left */
    border: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.pub-thumbnail-box img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pub-list-item.with-thumbnail-expanded .pub-content-wrapper {
    flex-grow: 1;
}

/* Adjust text spacing in expanded mode */
.pub-list-item.with-thumbnail-expanded .pub-line-1 {
    margin-bottom: 0.5rem;
}

.pub-list-item.with-thumbnail-expanded .pub-title-text {
    font-size: 1.1rem; /* Larger title in expanded mode */
}

.pub-btn-preview {
    cursor: pointer;
}

.pub-btn-preview.active {
    background-color: #1e293b;
    color: white;
    border-color: #1e293b;
}

/* Make sure mobile layout stacks */
@media (max-width: 640px) {
    .pub-list-item.with-thumbnail-expanded {
        flex-direction: column;
    }
    .pub-thumbnail-box {
        width: 100%;
        max-width: 300px;
        margin-top: 0.5rem;
    }
}

/* ============================================================
   ========== Additions kept from your original (unique) ==========
   (No selector duplicates with reference; internal duplicates removed)
============================================================ */

/* Force section title style (avoid being overridden by other global css) */
.section-title {
    font-family: "Crimson Text", serif;
    font-weight: 700;
    font-size: 1.875rem;
    line-height: 1.2;
    color: #0f172a;
}

/* =========================
   News scroll grid (your new style)
========================= */
.news-scroll {
    max-height: 260px;          /* 想更高就改这里 */
    overflow-y: auto;
    padding-right: 6px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .news-scroll { grid-template-columns: 1fr 1fr; }
}

.news-tile {
    position: relative;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(226,232,240,0.9);
    border-radius: 16px;
    padding: 14px 14px 12px 14px;
    transition: box-shadow .2s ease, transform .2s ease;
}

.news-tile:hover {
    box-shadow: 0 6px 16px rgba(15,23,42,0.06);
    transform: translateY(-1px);
}

.news-tile .news-date {
    font-size: 12px;
    color: #64748b;
    font-family: "Inter", sans-serif;
}

.news-text {
    margin-top: 6px;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    font-family: "Inter", sans-serif;
}

.news-link {
    margin-left: 8px;
    color: #b88a4d;
    font-weight: 600;
    text-decoration: none;
}

.news-link:hover { color: #d4a562; }

.news-pin {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(212,165,98,0.15);
    border: 1px solid rgba(212,165,98,0.35);
    color: #b88a4d;
}

/* ===== Scrollable News Container ===== */
.news-scroll-box {
    max-height: 200px !important; /* 你想要的最大高度，按需调 */
    overflow-y: auto;             /* 超出后滚动 */
    padding-right: 10px;          /* 给滚动条留空间 */
    overscroll-behavior: contain; /* 防止滚动穿透到整个页面（可选） */
    scroll-behavior: smooth;      /* 滚动更柔和（可选） */
}

/* =========================
   Publications cards (your final badge style)
   NOTE:
   - Reference defines .pub-title/.pub-authors/.pub-venue.
   - To preserve your card visuals without overriding reference selectors,
     card typography is applied with higher-specificity selectors:
     .pub-card .pub-title / .pub-card .pub-authors / .pub-card .pub-venue
========================= */
.pub-year {
    font-family: "Crimson Text", serif;
    font-weight: 700;
    font-size: 28px;
    color: #1e293b;
    border-bottom: 1px solid rgba(226,232,240,0.9);
    padding-bottom: 8px;
}

/* Card */
.pub-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 22px;
    padding: 18px;
    display: flex;
    gap: 18px;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.pub-card:hover {
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
    transform: translateY(-1px);
    border-color: rgba(212,165,98,0.35);
}

/* Left image block */
.pub-left {
    position: relative;
    flex: 0 0 260px;
    width: 260px;
    overflow: visible; /* allow badge to protrude */
}

.pub-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 18px;
    border: 0.5px solid rgba(226,232,240,0.9);
    background: #f1f5f9;
    display: block;
}

.pub-img-placeholder {
    width: 100%;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 22px;
    border-radius: 18px;
    border: 1px solid rgba(226,232,240,0.9);
    background: #f1f5f9;
}

/* Badge */
.pub-badge {
    position: absolute;
    top: 12px;
    left: -10px;
    z-index: 3;

    display: inline-flex;
    align-items: center;

    padding: 5px 9px;
    border-radius: 6px;

    background: #c90d1c;
    color: #fff;

    font-family: "Inter", sans-serif;
    font-weight: 800;
    font-size: 12px;
    line-height: 1;

    box-shadow: 0 10px 18px rgba(2,6,23,0.14);
    border: 1px solid rgba(255,255,255,0.12);
}

.pub-badge.ccf-a { background: rgba(220, 38, 38, 1.0); }
.pub-badge.ccf-b { background: rgba(37, 99, 235, 1.0); }
.pub-badge.ccf-c { background: rgba(22, 163, 74, 1.0); }

/* Right side */
.pub-right { flex: 1; min-width: 0; }

/* Card typography (scoped; does NOT override reference .pub-title etc) */
.pub-card .pub-title {
    font-family: "Crimson Text", serif;
    font-weight: 700;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 0; /* neutralize legacy margin if needed */
}

.pub-card .pub-authors {
    font-family: "Inter", sans-serif;
    margin-top: 8px;
    color: #334155;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Venue line (scoped) */
.pub-card .pub-venue {
    font-family: "Inter", sans-serif;
    margin-top: 10px;
    font-size: 14px;
    color: #475569;

    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0; /* spacing via punctuation */
    margin-bottom: 0;
}

.pub-card .pub-venue-full {
    font-style: italic;
    color: #334155;
}

.pub-card .pub-venue-short {
    color: #b88a4d;
    font-weight: 800;
    font-style: italic;
    margin-left: 0;
}

/* Only when full name exists, prepend comma */
.pub-card .pub-venue.has-full .pub-venue-short::before {
    content: ", ";
    color: #94a3b8;
    font-weight: 400;
    font-style: normal;
}

/* Note */
.pub-note {
    font-family: "Inter", sans-serif;
    margin-top: 10px;
    color: #e11d48;
    font-weight: 700;
    font-size: 13px;
}

/* Links */
.pub-links {
    font-family: "Inter", sans-serif;
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
}

.pub-links a {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(226,232,240,0.9);
    background: rgba(255,255,255,0.85);
    color: #334155;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease, transform .2s ease, background .2s ease;
}

.pub-links a:hover {
    color: #b88a4d;
    border-color: rgba(212,165,98,0.45);
    background: rgba(255,251,235,0.8);
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 640px) {
    .pub-card { flex-direction: column; }
    .pub-left { width: 100%; flex: 0 0 auto; }
    .pub-img, .pub-img-placeholder { height: 200px; }
    .pub-badge { left: 12px; }
}

/* =========================================================
   Hover underline + color change for links in:
   - About bio (markdownified content inside #homepage .prose)
   - Publication authors line (.pub-authors)
========================================================= */
#homepage .prose a,
#publications .pub-card .pub-authors a {
  text-decoration: none; /* remove default underline */

  /* underline "appears" by expanding background */
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;

  transition: color .18s ease, background-size .18s ease;
}

#homepage .prose a:hover,
#publications .pub-card .pub-authors a:hover {
  color: #d4a562;        /* accent */
  background-size: 100% 2px;
}
