/* 基础样式 */
body {
    margin: 0;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #181a1b;
    color: #f3f3f3;
    transition: background 0.3s, color 0.3s;
}

/* reserve space for the fixed topbar */
:root {
    --topbar-height: 60px;
}
body {
    padding-top: var(--topbar-height);
}

a {
    color: #4ea1f7;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #1e90ff;
}

/* 顶部栏 */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(35,39,46, 0.9);
    padding: 0 1.2rem;
    height: 60px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13), 0 1.5px 4px rgba(0,0,0,0.10);
    backdrop-filter: blur(4px);
    min-width: 0;
    box-sizing: border-box;
}

.site-title {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* allow site title to grow and use available space */
    flex: 1 1 auto;
    min-width: 0;
    color: inherit; /* ensure visible in both themes */
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* keep the right-side controls at their intrinsic width so title can expand */
    flex: 0 0 auto;
}

.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    min-width: 0;
    flex-shrink: 1;
}

.navbar a {
    font-size: 1rem;
    color: #f3f3f3;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
    min-width: 0;
    flex-shrink: 1;
    white-space: nowrap;
}
.navbar a:hover {
    background: #353b48;
}


#theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ffd700;
    transition: color 0.2s, transform 0.2s;
    border-radius: 0;
    padding: 0 0.3em;
    box-shadow: none;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
#theme-toggle:hover {
    color: #fff;
    background: none;
    transform: scale(1.15);
}

/* 布局 */
.container {
    display: flex;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
    gap: 2rem;
}

/* 侧边栏 */
.sidebar {
    flex: 0 0 260px;
    background: #23272e;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 4px 32px rgba(0,0,0,0.18), 0 1.5px 4px rgba(0,0,0,0.10);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.sidebar-photo {
    position: absolute;
    top: -90px; /* 头像高度一半 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.sidebar-photo img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #4ea1f7;
    /* margin-bottom: 1rem;  移除原有 margin-bottom */
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}



.sidebar-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    margin-top: 100px;
}

.sidebar-role {
    font-size: 0.95rem;
    color: #e6eef8;
    text-align: left;
    margin-bottom: 1.1rem; /* 增加与下方列表的间距 */
}

.sidebar-bio {
    font-size: 0.98rem;
    color: #b0b8c1;
    margin-bottom: 1.2rem;
    text-align: center;
}

.sidebar-info {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    font-size: 0.97rem;
}
.sidebar-info li {
    margin-bottom: 0.7rem;
    word-break: break-all;
}

/* 给侧边栏第一个信息项一点上间距，避免与角色信息紧贴 */
.sidebar-info li:first-child {
    margin-top: 0.25rem;
}

/* 主内容区 */
.main-content {
    flex: 1 1 0;
    background: #23272e;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.main-content h1 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 1.2rem;
}
.main-content h2 {
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}
.main-content p {
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

/* 亮色模式 */
body.light-mode {
    background: #f7f7fa;
    color: #23272e;
}
body.light-mode .topbar,
body.light-mode .sidebar,
body.light-mode .main-content {
    background: #fff;
    color: #23272e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
body.light-mode .sidebar-bio {
    color: #6c757d;
}
body.light-mode .navbar a {
    color: #23272e;
}
body.light-mode .navbar a:hover {
    background: #e6f0fa;
}
body.light-mode #theme-toggle {
    color: #23272e;
}
body.light-mode #theme-toggle:hover {
    color: #ff9800;
}
body.light-mode .sidebar-photo img {
    border-color: #1e90ff;
}

/* 亮色模式：侧边栏角色文本使用深色，避免在白色背景上不可见 */
body.light-mode .sidebar-role {
    color: #23272e;
}

body.light-mode .topbar,
body.light-mode .sidebar,
body.light-mode .main-content {
    /* ...existing code... */
    box-shadow: 0 4px 24px rgba(30,144,255,0.08), 0 1.5px 4px rgba(0,0,0,0.06);
}

/* 响应式 */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .sidebar {
        flex-direction: row;
        align-items: flex-start;
        padding: 1rem;
        gap: 1.5rem;
        position: relative; /* allow avatar to flow with layout */
    }
    .sidebar-photo {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        margin-right: 0.8rem;
        align-self: center;
    }
    .sidebar-photo img {
        width: 140px;
        height: 140px;
        margin-bottom: 0;
        margin-right: 1rem;
        border-width: 3px;
    }
    .sidebar-name {
        margin-top: 0.25rem;
    }
}

@media (max-width: 600px) {
    .topbar {
        /* keep topbar in one row and allow horizontal scroll for nav */
        flex-direction: row;
        align-items: center;
        height: auto;
        padding: 0.5rem 0.8rem;
        gap: 0.5rem;
    }
    /* slightly larger topbar on mobile but still one row */
    /* reduce reserved top space on mobile to bring header-banner closer to the top */
    :root { --topbar-height: 48px; }
    .topbar-right {
        justify-content: flex-end;
        /* keep intrinsic width so title can use available space on small screens */
        width: auto;
    }

    .site-title {
        font-size: 1.1rem;
    }
    .container {
        /* 给手机端留出左右间距，避免圆角容器紧贴屏幕边缘 */
        padding: 0 1rem;
    }
    .main-content {
        padding: 1rem;
    }
    .sidebar {
        /* 占满可用宽度并在左右留出小内边距，避免内容贴屏 */
        flex-direction: column;
        align-items: center;
        padding: 1.5rem 0.75rem 1rem; /* reduce horizontal padding so centering is accurate */
        position: relative;
        width: 100%;
        box-sizing: border-box;
        max-width: none;
    }
    /* 在移动端让头像绝对定位并向上偏移，部分覆盖头图（与桌面一致）
       and ensure it's visually centered regardless of sidebar padding */
    .sidebar-photo {
        position: absolute;
        top: -60px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        z-index: 2;
        margin-left: 0;
    }
    .sidebar-photo img {
        width: 120px;
        height: 120px;
        border-width: 3px;
        display: block; /* avoid inline-image whitespace offsets */
        margin: 0;
    }
    .sidebar-role {
        font-size: 0.9rem;
        line-height: 1.25;
        margin-bottom: 0.6rem;
        text-align: left;
        width: 100%;
    }
    /* Ensure sidebar-body and name are full-width and left-aligned on mobile */
    .sidebar-body {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        /* 增加左侧内边距，让文本在移动端往右偏移一点，避免与头像重叠 */
        padding: 0 0.5rem 0 5rem; /* top right bottom left — increased left padding */
    }
    .sidebar-name {
        width: 100%;
        text-align: left;
        margin-top: 70px; /* 给出头像绝对定位后的顶部间距 */
    }
}

/* 平板专用：601px 到 900px — 头像左侧，文本区右侧垂直堆叠 */
@media (min-width: 601px) and (max-width: 900px) {
    .container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .sidebar {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        padding: 1rem;
        gap: 1.5rem;
        position: relative;
    }

    .sidebar-photo {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        margin-right: 0.8rem;
    }

    .sidebar-photo img {
        width: 180px;
        height: 180px;
        border-width: 4px;
    }

    .sidebar-body {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        align-items: flex-start;
        width: calc(100% - 200px); /* 头像 180px + 间距 20px */
    }

    .sidebar-name,
    .sidebar-role,
    .sidebar-bio,
    .sidebar-info {
        width: 100%;
        text-align: left;
    }

    .sidebar-info {
        display: block;
        margin-top: 0.2rem;
    }
}

.header-banner img {
    width: 100%;
    /* taller on mobile to avoid looking cropped */
    height: clamp(220px, 30vh, 380px);
    object-fit: cover;
    /* center the crop so top/bottom gaps are minimized on different aspect ratios */
    object-position: center;
    display: block;
}

.header-banner {
    overflow: hidden;
    background-color: #121416;
}

/* Reduce header-banner vertical height on small screens */
@media (max-width: 600px) {
    .header-banner img {
        /* smaller but responsive on very short/tall phones */
        height: clamp(120px, 22vh, 180px);
    }
}