/* ============================================
   前台深色主题样式 - 仿 blogdlx.com 三栏布局
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg-primary: #1a1a1a;
    --bg-sidebar: #252525;
    --bg-card: #2d2d2d;
    --bg-code: #1e1e1e;
    --bg-hover: #353535;
    --bg-input: #333;

    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-muted: #666;
    --text-link: #4a9eff;

    --accent: #4a9eff;
    --accent-hover: #6bb3ff;
    --accent-dim: rgba(74, 158, 255, 0.15);

    --border: #333;
    --border-light: #3a3a3a;

    --red: #ff5f56;
    --yellow: #ffbd2e;
    --green: #27c93f;

    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;

    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);

    --sidebar-width: 260px;
    --right-sidebar-width: 240px;

    --font-body: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-code: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;

    --transition: all 0.3s ease;
}

/* ---------- CSS Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: var(--transition);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

input {
    font-family: inherit;
    border: none;
    outline: none;
}

/* ---------- 自定义滚动条（深色） ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox 滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 var(--bg-primary);
}

/* ---------- 三栏 Grid 布局 ---------- */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--right-sidebar-width);
    min-height: 100vh;
}

.main-content {
    padding: 30px 30px 60px;
    max-width: 100%;
    overflow: hidden;
}

/* ---------- 左侧导航栏 ---------- */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* 头像区域 */
.sidebar-profile {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-avatar {
    display: inline-block;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-light);
    transition: var(--transition);
}

.sidebar-avatar:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-avatar .avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--bg-secondary);
}

.sidebar-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 15px;
    line-height: 1.4;
}

.sidebar-name a {
    color: var(--text-primary);
}

.sidebar-name a:hover {
    color: var(--accent);
}

.sidebar-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.5;
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active,
.nav-item.active .nav-link {
    background-color: var(--accent-dim);
    color: var(--accent);
}

.nav-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

/* 随机文案 */
.sidebar-yiyan {
    margin-top: 20px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    transition: border-color 0.3s;
}

.sidebar-yiyan:hover {
    border-color: var(--accent);
}

.yiyan-icon {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
    opacity: 0.7;
}

.yiyan-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
    min-height: 40px;
    transition: opacity 0.3s;
}

.yiyan-text.loading {
    opacity: 0.4;
}

.yiyan-refresh {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.3s;
}

.yiyan-refresh:hover {
    color: var(--accent);
    transform: rotate(180deg);
}

/* 搜索框 */
.sidebar-search {
    margin-top: 20px;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.search-btn {
    position: absolute;
    right: 10px;
    color: var(--text-secondary);
    padding: 4px;
    transition: var(--transition);
}

.search-btn:hover {
    color: var(--accent);
}

/* ---------- 右侧栏 ---------- */
.right-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    padding: 30px 20px;
    overflow-y: auto;
}

/* 站点信息卡片 */
.site-info-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.site-info-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-weight: 500;
}

.site-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.site-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.site-info-item .label {
    color: var(--text-secondary);
}

.site-info-item .value {
    color: var(--accent);
    font-weight: 600;
}

/* 建站时间 */
.site-build-time {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.site-build-time .build-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.site-build-time p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.site-build-time .build-date {
    color: var(--accent);
    font-weight: 500;
}

/* 文章目录 TOC */
.toc-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.toc-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-weight: 500;
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toc-item {
    position: relative;
}

.toc-link {
    display: block;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 2px solid var(--border);
    transition: var(--transition);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-link:hover {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.toc-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background-color: var(--accent-dim);
}

.toc-link[data-level="3"] {
    padding-left: 24px;
    font-size: 0.8rem;
}

/* ---------- 页面标题 ---------- */
.page-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.page-title .title-icon {
    margin-right: 10px;
    color: var(--accent);
}

/* ---------- 文章列表卡片 ---------- */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid transparent;
    animation: fadeInUp 0.4s ease forwards;
}

.post-card-cover {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
}

.post-card-cover img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.post-card:hover .post-card-cover img {
    transform: scale(1.03);
}

.post-card-body {
    padding: 20px 24px 24px;
}

.post-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.post-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 10px;
    color: var(--text-primary);
    transition: color 0.2s;
}

.post-card:hover .post-card-title {
    color: var(--accent);
}

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.post-card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-card-meta .meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tag-badge {
    display: inline-block;
    padding: 2px 10px;
    background-color: var(--accent-dim);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.78rem;
    transition: var(--transition);
}

.tag-badge:hover {
    background-color: var(--accent);
    color: #fff;
}

/* ---------- 文章详情页 ---------- */
.post-header {
    margin-bottom: 30px;
}

/* 文章封面图 */
.post-cover {
    margin-bottom: 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-cover img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-lg);
}

.post-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 15px;
}

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.post-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-meta .meta-item svg {
    width: 15px;
    height: 15px;
    opacity: 0.6;
}

/* 文章内容 */
.post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--text-primary);
    margin-top: 2em;
    margin-bottom: 1em;
    font-weight: 600;
    line-height: 1.4;
}

.post-content h2 {
    font-size: 1.5rem;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.post-content h3 {
    font-size: 1.25rem;
}

.post-content h4 {
    font-size: 1.1rem;
}

.post-content p {
    margin-bottom: 1.2em;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: var(--accent-hover);
}

.post-content blockquote {
    margin: 1.5em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--accent);
    background-color: var(--bg-card);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content ul,
.post-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin-bottom: 0.5em;
    line-height: 1.7;
}

.post-content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.9rem;
}

.post-content th,
.post-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.post-content th {
    background-color: var(--bg-card);
    font-weight: 600;
}

.post-content tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

.post-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.post-content em {
    color: var(--text-secondary);
}

/* ---------- macOS 风格代码块 ---------- */
.post-content pre {
    position: relative;
    margin: 1.5em 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--bg-code) !important;
    border: 1px solid var(--border);
}

/* code-block 容器内的 pre 去掉独立样式，由容器统一控制 */
.code-block pre {
    margin: 0;
    border-radius: 0;
    border: none;
    background-color: transparent !important;
}

/* 代码块容器 */
.code-block {
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    background-color: #1e1e1e;
    border: 1px solid #3d3d3d;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* 代码块顶部栏 */
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 40px;
    background-color: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.code-block-dots {
    display: flex;
    gap: 8px;
}

.code-block-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}

.code-block-dots span::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 3px;
    width: 4px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}

.code-block-dots span:nth-child(1) {
    background-color: #ff5f56;
}

.code-block-dots span:nth-child(2) {
    background-color: #ffbd2e;
}

.code-block-dots span:nth-child(3) {
    background-color: #27c93f;
}

.code-block-lang {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-code);
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.code-copy-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.code-copy-btn.copied {
    color: var(--green);
    border-color: var(--green);
}

.code-copy-btn svg {
    width: 14px;
    height: 14px;
}

.post-content pre code {
    display: block;
    padding: 16px 20px;
    overflow-x: auto;
    font-family: var(--font-code);
    font-size: 0.88rem;
    line-height: 1.6;
    background-color: transparent !important;
}

/* 代码块折叠功能 */
.code-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapse-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.collapse-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.code-block.collapsed pre {
    max-height: 300px;
    overflow: hidden;
    position: relative;
}

.code-block.collapsed pre::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--bg-code));
    pointer-events: none;
}

.code-block.collapsed .collapse-btn::before {
    content: '▼ ';
    font-size: 0.65rem;
}

.code-block:not(.collapsed) .collapse-btn::before {
    content: '▲ ';
    font-size: 0.65rem;
}

/* 行内代码 */
.post-content code:not([class*="language-"]):not(pre code) {
    display: inline;
    padding: 2px 6px;
    background-color: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-code);
    font-size: 0.88em;
    color: var(--accent);
}

/* ---------- 上下篇导航 ---------- */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.post-nav-item {
    padding: 16px 20px;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    transition: var(--transition);
}

.post-nav-item:hover {
    background-color: var(--bg-hover);
}

.post-nav-item.next {
    text-align: right;
}

.post-nav-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.post-nav-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 归档页时间轴 ---------- */
.archives-list {
    position: relative;
    padding-left: 30px;
}

.archives-list::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border);
}

.archive-year {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 30px;
    margin-bottom: 20px;
    position: relative;
}

.archive-year::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent);
    border: 2px solid var(--bg-primary);
}

.archive-year:first-child {
    margin-top: 0;
}

.archive-month {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 25px;
    margin-bottom: 12px;
    position: relative;
}

.archive-month::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--accent);
}

.archive-item {
    position: relative;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeInUp 0.4s ease forwards;
}

.archive-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

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

.archive-item-title {
    font-size: 0.95rem;
}

.archive-item-title a {
    color: var(--text-primary);
}

.archive-item-title a:hover {
    color: var(--accent);
}

.archive-item-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- 分类页样式 ---------- */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    border: 1px solid transparent;
    animation: fadeInUp 0.4s ease forwards;
}

.category-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.category-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.category-card-name a {
    color: var(--text-primary);
}

.category-card-name a:hover {
    color: var(--accent);
}

.category-card-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-card-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

/* ---------- 标签云 ---------- */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
}

.tag-cloud-item {
    display: inline-block;
    padding: 8px 18px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 25px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease forwards;
}

.tag-cloud-item:hover {
    background-color: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.tag-cloud-item .tag-count {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-left: 4px;
}

/* ---------- 友链卡片 ---------- */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    border: 1px solid transparent;
    animation: fadeInUp 0.4s ease forwards;
}

.friend-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.friend-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-name a {
    color: var(--text-primary);
}

.friend-name a:hover {
    color: var(--accent);
}

.friend-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 搜索结果 ---------- */
.search-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.search-info strong {
    color: var(--accent);
}

.search-highlight {
    color: var(--accent);
    font-weight: 600;
    background-color: var(--accent-dim);
    padding: 0 2px;
    border-radius: 2px;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background-color: var(--bg-card);
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--accent-dim);
}

.pagination .current {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination .disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .prev,
.pagination .next {
    font-size: 0.85rem;
}

/* ---------- 回到顶部按钮 ---------- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 42px;
    height: 42px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 999;
    box-shadow: var(--shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---------- 移动端侧边栏切换 ---------- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: var(--shadow);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 1px;
    transition: var(--transition);
}

.sidebar-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

/* ---------- 404 页面 ---------- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 20px;
}

.error-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.error-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: var(--transition);
}

.error-btn:hover {
    background-color: var(--accent-hover);
    color: #fff;
    transform: translateY(-2px);
}

/* ---------- 关于页面 ---------- */
.about-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    line-height: 1.8;
    animation: fadeInUp 0.4s ease forwards;
}

.about-content h1,
.about-content h2,
.about-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.about-content p {
    margin-bottom: 1em;
}

/* 关于页面表格 */
.about-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.92rem;
}

.about-content thead th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid var(--border);
}

.about-content tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.about-content tbody tr:last-child td {
    border-bottom: none;
}

.about-content tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.about-content code {
    background-color: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 0.88rem;
    color: var(--accent);
}

.about-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---------- 搜索结果为空 ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.5s ease;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ---------- 动画 ---------- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 页面切换淡入 */
.main-content {
    animation: fadeIn 0.4s ease;
}

/* ---------- 响应式断点 ---------- */

/* < 1024px：隐藏右侧栏 */
@media (max-width: 1024px) {
    .layout {
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    .right-sidebar {
        display: none;
    }
}

/* < 768px：单栏布局 */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    /* 侧边栏变为抽屉式 */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        z-index: 150;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        padding: 20px 16px 60px;
    }

    /* 文章详情 */
    .post-title {
        font-size: 1.4rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .post-nav {
        grid-template-columns: 1fr;
    }

    /* 分类/友链网格 */
    .categories-grid,
    .friends-grid {
        grid-template-columns: 1fr;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap;
    }

    /* 归档时间轴 */
    .archives-list {
        padding-left: 25px;
    }

    /* 404 */
    .error-code {
        font-size: 4rem;
    }

    /* 回到顶部 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
}

/* < 480px：更紧凑 */
@media (max-width: 480px) {
    :root {
        --sidebar-width: 240px;
    }

    .post-card {
        padding: 18px;
    }

    .post-title {
        font-size: 1.2rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .tag-cloud-item {
        padding: 6px 14px;
        font-size: 0.82rem;
    }
}
