/* =============================================
   Haoran MO - Personal Homepage Shared Styles
   Modern, clean academic design
   ============================================= */

/* --- Fonts (using system fonts for fast loading in China) --- */

/* --- CSS Variables --- */
:root {
    --color-primary: #1e3a5f;
    --color-primary-light: #2c5282;
    --color-accent: #0d9488;
    --color-accent-hover: #0f766e;
    --color-warm: #e85d04;
    --color-ccf: #dc2626;
    --color-text: #1a202c;
    --color-text-secondary: #4a5568;
    --color-text-muted: #718096;
    --color-bg: #f7f8fc;
    --color-card: #ffffff;
    --color-border: #e2e8f0;
    --color-section-line: #0d9488;
    --color-highlight-bg: #fefce8;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    --font-heading: Georgia, 'Times New Roman', 'Noto Serif SC', 'SimSun', serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --max-width: 1100px;
    --transition: 0.25s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

p {
    margin-top: 0;
    margin-bottom: 0;
}

span {
    margin-top: 0;
    margin-bottom: 0;
    display: inline-block;
}

/* --- Page Container --- */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 24px 40px;
}

/* --- Navigation --- */
.top-nav {
    background: var(--color-primary);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.top-nav .nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.top-nav .nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 14px 0;
    text-decoration: none;
    font-family: var(--font-body);
    letter-spacing: 0.3px;
}

.top-nav .nav-links {
    display: flex;
    gap: 6px;
}

.top-nav .nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.top-nav .nav-links a:hover,
.top-nav .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

/* --- Profile Header --- */
.profile-header {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px;
    margin-bottom: 32px;
    display: flex;
    gap: 36px;
    align-items: flex-start;
}

.profile-header .profile-photo {
    flex-shrink: 0;
}

.profile-header .profile-photo img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-accent);
    box-shadow: var(--shadow-sm);
}

.profile-header .profile-info {
    flex: 1;
}

/* --- Captions (Name) --- */
.caption {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-body);
    line-height: 1.2;
}

.caption-1 {
    font-size: 28px;
    font-weight: 400;
    color: var(--color-text-secondary);
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    line-height: 1.2;
}

.caption-2 {
    font-size: 16px;
    font-family: var(--font-body);
    font-weight: 600;
    color: #900;
}

.caption-3 {
    font-size: 16px;
    font-family: var(--font-body);
    font-weight: 600;
    color: #f00;
}

.caption-4 {
    font-size: 16px;
    font-family: var(--font-body);
    color: #900;
}

/* --- Content Text --- */
.content {
    margin-top: 4px;
    font-size: 16px;
    font-family: var(--font-body);
    text-align: justify;
    line-height: 1.7;
    color: var(--color-text);
}

.content a {
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition);
}

.content a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.content2 {
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--color-text-muted);
    text-align: justify;
}

.content2 a {
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--color-text-muted);
}

.content3 {
    display: none;
    margin: 8px 0 8px 0;
    padding: 16px 20px;
    font-size: 14px;
    font-family: var(--font-body);
    text-align: justify;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fafbff;
    line-height: 1.3;
}

.content4 {
    display: none;
    margin: 10px 0 8px 0;
    padding: 16px 20px;
    font-size: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    text-align: left;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.content-bg {
    margin-top: 8px;
    margin-left: -10px;
    font-size: 15px;
    font-family: var(--font-body);
    text-align: justify;
    background-color: var(--color-highlight-bg);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.content-bg em {
    font-style: normal;
}

.content strong a {
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--color-accent);
}

/* --- Buttons --- */
a.mybutton {
    width: auto;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    padding: 6px 14px;
    margin: 4px 4px 4px 0;
    color: var(--color-accent);
    background-color: var(--color-card);
    border: 1.5px solid var(--color-accent);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    letter-spacing: 0.2px;
    line-height: 1;
}

a.mybutton svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

a.mybutton:hover {
    color: #fff !important;
    background-color: var(--color-accent);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(13,148,136,0.3);
    transform: translateY(-1px);
}

a.mybutton:hover svg {
    fill: #fff;
}

/* --- Heading (paper titles) --- */
heading {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.4;
    display: block;
    margin-bottom: 6px;
}

/* --- Section Titles --- */
.title-small {
    font-size: 22px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-primary);
    margin: 28px 0 12px;
}

.title-large {
    font-size: 26px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-primary);
    margin: 40px 0 16px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--color-section-line);
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-large a {
    color: var(--color-accent);
    font-size: 18px;
    font-family: var(--font-body);
    font-weight: 500;
}

.title-large a:hover {
    text-decoration: underline;
}

/* --- Margins / Spacers --- */
.margin {
    font-size: 8px;
    line-height: 8px;
}

.margin-small {
    font-size: 4px;
    line-height: 4px;
}

.margin-large {
    font-size: 16px;
    line-height: 16px;
}

/* --- Links --- */
a:link {
    text-decoration: none;
}

a:visited {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:active {
    text-decoration: underline;
    color: #06f;
}

strong a:active {
    text-decoration: underline;
    color: #06f;
}

/* --- Profile Image --- */
.profile {
    border-radius: 50%;
}

/* --- Section Cards --- */
.section-card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px 32px 32px;
    margin-bottom: 24px;
    transition: box-shadow var(--transition);
}

.section-card:hover {
    box-shadow: var(--shadow-md);
}

/* Reduce top margin of first heading inside card */
.section-card > .title-large:first-child,
.section-card > p.title-large:first-child {
    margin-top: 0;
}

/* --- Publication Table --- */
.pub-table {
    width: 100%;
    border-collapse: collapse;
}

.pub-table tr:not(:first-child) td {
    border-top: 1px solid var(--color-border);
}

.pub-table tr.first-visible td {
    border-top: none !important;
}

.pub-table tr td {
    padding-top: 20px;
    padding-bottom: 20px;
}

.pub-table tr:first-child td {
    padding-top: 8px;
}

.pub-table tr:last-child td {
    padding-bottom: 0;
}

.pub-table td {
    vertical-align: middle;
}

.pub-table .pub-thumb {
    width: 260px;
    padding-right: 20px;
}

.pub-table .pub-thumb img {
    width: 260px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.pub-table .pub-thumb img:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.pub-table .pub-info {
    vertical-align: middle;
}

/* --- Experience & Education Tables --- */
.exp-table {
    width: 100%;
    border-collapse: collapse;
}

.exp-table tr:not(:first-child) td {
    border-top: 1px solid var(--color-border);
}

.exp-table tr td {
    padding-top: 16px;
    padding-bottom: 16px;
}

.exp-table tr:first-child td {
    padding-top: 4px;
}

.exp-table tr:last-child td {
    padding-bottom: 0;
}

.exp-table td {
    vertical-align: middle;
}

.exp-table .exp-logo {
    width: 180px;
    padding-right: 20px;
}

.exp-table .exp-logo img {
    width: 180px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.exp-table .exp-logo img:hover {
    box-shadow: var(--shadow-sm);
}

/* --- Lists --- */
.section-card ul,
.content ul {
    padding-left: 20px;
    margin: 8px 0;
}

.section-card ul li,
.content ul li {
    margin-bottom: 8px;
}

/* --- Bio Link --- */
.bio-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--color-accent);
    font-size: 16px;
    margin-bottom: 16px;
    text-decoration: none;
    transition: var(--transition);
}

.bio-link:hover {
    color: var(--color-accent-hover);
    text-decoration: none;
}

/* --- Back Link --- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--color-accent);
    font-size: 16px;
    margin-top: 24px;
    text-decoration: none;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--color-accent-hover);
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid var(--color-border);
}

.site-footer .content2 {
    color: var(--color-text-muted);
}

.site-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--color-accent);
}

/* --- Category Navigation (all_papers) --- */
.category-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-nav .cat-btn {
    flex: 1 1 auto;
    white-space: nowrap;
    padding: 10px 12px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    border-radius: 0;
    box-shadow: none;
    text-align: center;
}

.category-nav .cat-btn:hover {
    color: var(--color-primary);
    background: rgba(13, 148, 136, 0.04);
}

.category-nav .cat-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: transparent;
    box-shadow: none;
}

/* --- Year Separator (all_papers) --- */
.year-badge {
    display: inline-block;
    font-size: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-primary);
    background: linear-gradient(135deg, #e0f2fe, #f0fdfa);
    padding: 6px 20px;
    border-radius: 20px;
    margin: 24px 0 8px;
    border: 1px solid var(--color-border);
}

/* --- CCF Badge --- */
font[color="#F56A6A"] {
    color: var(--color-ccf) !important;
}

/* --- GitHub Badge Images --- */
.imgbadge {
    vertical-align: middle;
    margin-left: 6px;
    height: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
        gap: 20px;
    }

    .profile-header .profile-photo img {
        width: 160px;
        height: 160px;
    }

    .pub-table .pub-thumb {
        width: 100%;
        padding-right: 0;
        padding-bottom: 12px;
    }

    .pub-table .pub-thumb img {
        width: 100%;
        max-width: 280px;
    }

    .exp-table .exp-logo {
        width: 120px;
    }

    .exp-table .exp-logo img {
        width: 120px;
    }

    .top-nav .nav-inner {
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px;
    }

    .section-card {
        padding: 20px;
    }

    .caption {
        font-size: 26px;
    }

    .caption-1 {
        font-size: 22px;
    }
}
