/* ============================================================
   Qi Liu's Homepage
   Layout: modern responsive (previous version, restored)
   Typography: browser defaults, matching the original site
   http://staff.ustc.edu.cn/~qiliuql/
   - Font: "Times New Roman" (Latin) + Microsoft YaHei/微软雅黑 (Chinese)
   - Size: 16px base, no custom sizes on text elements
   - Color: pure black #000 text, default blue links
   - Spacing: browser default line-height and margins, untouched
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --primary: #5B4B9E;
    --primary-light: #7B6BC4;
    --primary-dark: #4A3D82;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --border: #c9c9d4;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 10px;
    --max-width: 960px;
    --transition: 0.25s ease;
    --font-serif: "Times New Roman", Verdana, Arial, Helvetica, "Microsoft YaHei", "微软雅黑", sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    font-size: 16px;
}

body {
    font-family: var(--font-serif);
    background: var(--bg);
    color: #000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout Container --- */
#container {
    background: var(--surface);
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: left;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* --- Header --- */
#header {
    background: linear-gradient(180deg, #0A5BB5 0%, #004CA1 100%);
    width: 100%;
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #003A7D;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.header-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px 10px;
}

.ustc-logo {
    background: rgba(255,255,255,0.85);
    border-radius: 5px;
    padding: 3px 7px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.ustc-logo img {
    height: 24px;
    display: block;
    opacity: 0.92;
}

.headerText {
    font-size: 1.75rem;
    text-align: center;
    padding: 0;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: none;
    flex: 1;
}

DIV.center {
    text-align: center;
}

/* --- Navigation Menu --- */
.menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    background: rgba(0,0,0,0.18);
    width: 100%;
    color: #fff;
    font-weight: 600;
    padding: 8px 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 0.9rem;
}

.menu a {
    background: transparent;
    color: #fff;
    padding: 6px 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    white-space: nowrap;
}

.menu a:hover,
.menu a:active {
    background: rgba(255,255,255,0.22);
    color: #fff;
    text-decoration: none;
    padding: 6px 16px;
}

/* --- Content Area --- */
#content {
    background: var(--surface);
    color: #000;
    padding: 0;
}

/* --- Main Body Text ---
   IMPORTANT: fonts, sizes, colors and spacing of all text below
   (p, li, a, u, i, b, strong, hr) are NOT styled here on purpose.
   They use browser defaults, exactly like the original site:
   Times New Roman + 宋体, 16px, black text, blue links,
   default line-height and paragraph margins. Do not override. --- */
#bodytext {
    background: var(--surface);
    font-family: var(--font-serif);
    padding: 5px 25px 30px;
    text-align: left;
    color: #000;
    margin: 0;
}

/* Name line: keep English and Chinese names on one line */
#bodytext p.name-line {
    white-space: nowrap;
}

/* Administrative position note: right-aligned, kept on one line */
#bodytext .pos-note {
    text-align: right;
    white-space: nowrap;
}

/* --- Profile Image --- */
.imageobject {
    float: left;
    height: 220px;
    width: 170px;
    margin: 0 25px 15px 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 3px solid #fff;
    overflow: hidden;
}

.imageobject img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Footer --- */
.footer {
    background: linear-gradient(180deg, #004CA1 0%, #003A7D 100%);
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    color: #fff;
    padding: 16px 20px;
    font-size: 0.85rem;
    text-align: center;
    border-top: 3px solid #0A5BB5;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* White USTC logo watermark on the right of the footer */
.footer::after {
    content: "";
    position: absolute;
    right: -15px;
    bottom: -12px;
    width: 250px;
    height: 48px;
    background: url("images/ustc-logo.svg") no-repeat center / contain;
    filter: brightness(0) invert(1);
    opacity: 0.15;
    pointer-events: none;
}

.footer a {
    background: none;
    color: #fff;
    padding: 0 2px;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: #004CA1;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: 0 3px 12px rgba(0,76,161,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: #003A7D;
    transform: translateY(-3px);
    box-shadow: 0 5px 18px rgba(0,76,161,0.55);
}

/* --- ClustrMaps Widget --- */
#clustrmaps-widget {
    margin-top: 20px;
    text-align: center;
}

/* --- Responsive (layout only; text fonts/sizes/spacing unchanged) --- */
@media (max-width: 768px) {
    :root {
        --max-width: 100%;
    }

    #container {
        border-radius: 0;
        box-shadow: none;
    }

    .header-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px 12px 8px;
    }

    .ustc-logo {
        padding: 4px 10px;
    }

    .ustc-logo img {
        height: 34px;
    }

    .headerText {
        font-size: 1.2rem;
        flex-basis: 100%;
        padding: 0;
    }

    .menu {
        gap: 2px;
        font-size: 0.82rem;
        padding: 6px 5px;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .menu a {
        padding: 5px 10px;
        flex-shrink: 0;
    }

    #bodytext {
        padding: 5px 15px 20px;
    }

    .imageobject {
        float: none;
        margin: 0 auto 15px;
        width: 150px;
        height: 195px;
    }

    #bodytext p.name-line {
        white-space: normal;
    }

    #bodytext .pos-note {
        white-space: normal;
    }

    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
}

/* --- Print Styles --- */
@media print {
    #header, .menu, #back-to-top {
        display: none;
    }

    #container {
        box-shadow: none;
        max-width: 100%;
    }

    #bodytext {
        padding: 0;
    }
}
