/* =============================================
   Typecho-Five-Theme - Main Stylesheet (字体统一版)
   Author: RAO | https://qi.loc.cc/
   Version: 1.3.0
   ============================================= */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 响应式根字体 */
html {
    font-size: 15px;
    scroll-behavior: smooth;
}
@media (max-width: 768px) {
    html { font-size: 14px; }
}
@media (min-width: 1200px) {
    html { font-size: 16px; }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    background: #f5f5f5;
}

a {
    color: #2c5faa;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: #1a3f7a; }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol { list-style: none; }
input, textarea, button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
}

/* === Layout === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}
.content-wrap {
    display: flex;
    gap: 25px;
    padding: 30px 0;
    align-items: flex-start;
}
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 260px; flex-shrink: 0; }

/* === Header === */
.site-header {
    background: #1a1a2e;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    height: 50px;
    gap: 20px;
}
.header-logo a {
    color: #fff;
    font-size: 1.467rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}
.header-logo .logo-img { height: 36px; width: auto; max-width: 160px; object-fit: contain; }
.header-logo .logo-text {
    color: #fff;
    font-size: 1.467rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* 汉堡菜单按钮（默认隐藏） */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* 桌面端菜单样式 */
.header-nav { flex: 1; }
.header-nav > ul { display: flex; gap: 5px; align-items: center; }
.header-nav ul li { position: relative; }
.header-nav ul li a {
    color: #ccc;
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 0.867rem;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-nav ul li a:hover,
.header-nav ul li.active > a {
    color: #4a9eff;
    background: rgba(74,158,255,0.1);
}
.header-nav li.has-dropdown > a .fa-angle-down {
    font-size: 0.733rem;
    transition: transform 0.2s;
}
.header-nav li.has-dropdown:hover > a .fa-angle-down { transform: rotate(180deg); }
.header-nav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #252540;
    min-width: 130px;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 200;
    padding: 5px 0;
    flex-direction: column;
}
.header-nav li.has-dropdown:hover .dropdown-menu { display: flex; }
.header-nav .dropdown-menu li { width: 100%; }
.header-nav .dropdown-menu li a {
    padding: 8px 16px;
    display: block;
    color: #bbb;
    font-size: 0.8rem;
    white-space: nowrap;
}
.header-nav .dropdown-menu li a:hover,
.header-nav .dropdown-menu li.active a {
    background: rgba(74,158,255,0.15);
    color: #4a9eff;
}

/* 搜索框 */
.header-search {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.header-search .search-form { display: flex; align-items: center; }
.header-search input {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-right: none;
    color: #fff;
    padding: 0 10px;
    border-radius: 3px 0 0 3px;
    width: 150px;
    height: 30px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.header-search input::placeholder { color: #888; }
.header-search button {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    width: 34px;
    height: 30px;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-search button:hover { background: rgba(255,255,255,0.3); color: #fff; }

/* 桌面端强制菜单显示，搜索框靠右 */
@media (min-width: 769px) {
    .mobile-menu-toggle { display: none !important; }
    .header-nav { display: block !important; }
    .header-search { margin-left: auto; }
}

/* 移动端汉堡菜单布局 */
@media (max-width: 768px) {
    .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        height: auto;
        padding: 8px 15px;
        gap: 10px;
    }
    .mobile-menu-toggle { display: block; order: 1; flex-shrink: 0; }
    .header-logo { order: 2; flex: 1; text-align: center; }
    .header-logo a { justify-content: center; }
    .header-search { order: 3; flex-shrink: 1; max-width: 130px; }
    .header-search input { width: 90px; font-size: 0.75rem; padding: 0 6px; }
    .header-search button { width: 30px; }
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #1a1a2e;
        z-index: 200;
        max-height: calc(100vh - 50px);
        overflow-y: auto;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    }
    .header-nav.open { display: block; }
    .header-nav > ul { flex-direction: column; gap: 0; padding: 10px 0; }
    .header-nav ul li { width: 100%; }
    .header-nav ul li a {
        display: block;
        padding: 10px 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .header-nav .dropdown-menu {
        position: static;
        background: #252540;
        box-shadow: none;
        padding-left: 20px;
        display: none;
    }
    .header-nav li.has-dropdown.open .dropdown-menu { display: block; }
    .header-nav li.has-dropdown > a .fa-angle-down { float: right; margin-top: 4px; }
}

/* === 文章列表 (index.php / archive.php) === */
.post-list { display: flex; flex-direction: column; gap: 0; }
.post-card {
    background: #fff;
    padding: 20px 25px;
    margin-bottom: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}
.post-card-title {
    font-size: 1.467rem;   /* 22px */
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.5;
}
.post-card-title a { color: #1a3f7a; }
.post-card-title a:hover { color: #2c5faa; }
.post-card-meta {
    font-size: 0.867rem;   /* 13px */
    color: #888;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.post-card-meta span { display: flex; align-items: center; gap: 4px; }
.post-card-body { display: flex; gap: 18px; align-items: flex-start; }
.post-card-thumb {
    flex-shrink: 0;
    width: 150px;
    height: 120px;
    overflow: hidden;
    border-radius: 3px;
}
.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.post-card-thumb:hover img { transform: scale(1.05); }
.post-card-excerpt { flex: 1; min-width: 0; }
.post-card-excerpt p {
    color: #555;
    line-height: 1.8;
    font-size: 0.933rem;   /* 14px */
    margin-bottom: 12px;
}
.read-more-btn {
    display: inline-block;
    background: #1a1a2e;
    color: #fff;
    padding: 6px 18px;
    border-radius: 3px;
    font-size: 0.8rem;      /* 12px */
    float: right;
    transition: background 0.2s;
}
.read-more-btn:hover { background: #2c5faa; color: #fff; }

/* 移动端文章卡片调整 */
@media (max-width: 768px) {
    .post-card-title { font-size: 1.286rem; }   /* 18px */
    .post-card-meta { font-size: 0.857rem; }    /* 12px */
    .post-card-excerpt p { font-size: 1rem; }   /* 14px */
    .read-more-btn { display: none; }           /* 移动端隐藏阅读更多 */
    .post-card-body { flex-direction: row; gap: 12px; }
    .post-card-thumb { width: 100px; height: 80px; }
}

/* === 分页 === */
.pagination {
    background: #fff;
    padding: 15px 25px;
    border-radius: 4px;
    border: 1px solid #eee;
    margin-top: 5px;
}
.pagination .pager-outer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.pagination .pager-wrap,
.pagination ul.pager-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}
.pagination .pager-wrap li { display: inline-flex; }
.pagination .pager-wrap a,
.pagination .pager-wrap span,
.pagination .pager-wrap li a,
.pagination .pager-wrap li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 0.933rem;
    color: #444;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s;
    text-decoration: none;
}
.pagination .pager-wrap a:hover,
.pagination .pager-wrap li a:hover {
    background: #2c5faa;
    border-color: #2c5faa;
    color: #fff;
}
.pagination .pager-wrap span.current,
.pagination .pager-wrap a.current,
.pagination .pager-wrap li.current a,
.pagination .pager-wrap li.current span,
.pagination .pager-wrap li span.current,
.pagination .pager-wrap li a.current {
    background: #2c5faa !important;
    border-color: #2c5faa !important;
    color: #fff !important;
    font-weight: 600;
    cursor: default;
}
.pagination .pager-outer > a,
.pagination .pager-wrap a.prev,
.pagination .pager-wrap a.next {
    font-size: 0.867rem;
}

/* === 文章详情页 === */
.post-single {
    background: #fff;
    padding: 30px;
    border-radius: 4px;
    border: 1px solid #eee;
}
.post-title {
    font-size: 1.6rem;     /* 24px */
    font-weight: 400;
    color: #1a3f7a;
    line-height: 1.5;
    margin-bottom: 12px;
}
.post-meta {
    font-size: 0.867rem;   /* 13px */
    color: #888;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.post-meta span { display: flex; align-items: center; gap: 4px; }
.post-content {
    font-size: 1rem;
    line-height: 1.9;
    color: #444;
    margin-bottom: 25px;
}
.post-content p { margin-bottom: 1em; }
.post-content h2 { font-size: 1.5em; margin: 1.5em 0 0.5em; }
.post-content h3 { font-size: 1.3em; }
.post-content h4 { font-size: 1.1em; }
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1em 0;
}
.post-content blockquote {
    border-left: 4px solid #2c5faa;
    padding: 10px 20px;
    background: #f8f9ff;
    margin: 1em 0;
}
.post-content pre {
    background: #1a1a2e;
    color: #e8e8e8;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.867rem;
}
.post-content code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}
.post-tags {
    margin: 20px 0;
    padding: 12px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    font-size: 0.867rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.post-tag {
    background: #f0f0f0;
    color: #555;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.post-tag:hover { background: #2c5faa; color: #fff; }
.post-prev-next {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
}
.post-prev, .post-next { flex: 1; font-size: 0.933rem; }
.post-prev { text-align: left; }
.post-next { text-align: right; }
.nav-label { display: block; font-size: 0.8rem; color: #999; margin-bottom: 3px; }
.related-posts { margin: 20px 0; }
.section-title {
    font-size: 1.067rem;
    font-weight: 700;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 3px solid #2c5faa;
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.related-post-item { border: 1px solid #eee; border-radius: 4px; overflow: hidden; }
.related-post-thumb { display: block; height: 160px; overflow: hidden; }
.related-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.related-post-thumb:hover img { transform: scale(1.05); }
.related-post-info { padding: 10px; }
.related-post-title {
    display: block;
    font-size: 0.867rem;
    color: #333;
    font-weight: 500;
    line-height: 1.5;
}
.related-post-title:hover { color: #2c5faa; }
.related-post-meta { font-size: 0.733rem; color: #aaa; display: flex; justify-content: space-between; }

/* === 独立页面 === */
.page-single {
    background: #fff;
    padding: 30px;
    border-radius: 4px;
    border: 1px solid #eee;
}
.page-title {
    font-size: 1.733rem;
    font-weight: 400;
    color: #1a3f7a;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #2c5faa;
}
.page-content { font-size: 1rem; line-height: 1.9; color: #444; }
.page-content p { margin-bottom: 1em; }

/* === 评论 === */
.comments-section {
    background: #fff;
    padding: 25px 30px;
    border-radius: 4px;
    border: 1px solid #eee;
    margin-top: 15px;
}
.comment-form-wrap {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 18px 20px;
    margin-bottom: 25px;
}
.comment-form-fields { display: flex; gap: 12px; margin-bottom: 12px; }
.comment-form-fields input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 8px 12px;
    font-size: 0.933rem;
}
.comment-form-textarea textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px 12px;
    font-size: 0.933rem;
    resize: vertical;
}
.comment-submit-btn {
    background: #2c5faa;
    color: #fff;
    padding: 8px 20px;
    border-radius: 3px;
    font-size: 0.933rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.comment-submit-btn:hover { background: #1a3f7a; }
.comment-cancel-btn {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 0.867rem;
    cursor: pointer;
}
.comment-list { display: flex; flex-direction: column; }
.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}
.comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8edf5;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; }
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.comment-author { font-weight: 600; font-size: 0.933rem; }
.comment-badge-author {
    font-size: 0.733rem;
    background: #2c5faa;
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
}
.comment-reply-to { font-size: 0.8rem; color: #888; background: #f0f0f0; padding: 1px 8px; border-radius: 10px; }
.comment-floor { font-size: 0.733rem; color: #2c5faa; background: rgba(44,95,170,0.08); padding: 1px 6px; border-radius: 4px; }
.comment-date { font-size: 0.8rem; color: #bbb; white-space: nowrap; }
.comment-content { font-size: 0.933rem; line-height: 1.75; margin-bottom: 6px; }
.comment-reply-link { font-size: 0.8rem; color: #aaa; padding: 2px 8px; border-radius: 10px; }
.comment-reply-link:hover { color: #2c5faa; background: #f0f4ff; }
.comment-children { margin-top: 8px; margin-left: 28px; padding-left: 14px; border-left: 2px solid #eef0f5; }
.no-comments { text-align: center; padding: 30px 0; color: #bbb; font-size: 0.933rem; }

/* === 侧边栏 - 统一字体 0.867rem (13px) === */
.widget {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
    padding: 18px;
    margin-bottom: 18px;
}
.widget-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5faa;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hot-posts-list { display: flex; flex-direction: column; gap: 12px; }
.hot-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}
.hot-post-title {
    flex: 1;
    font-size: 0.867rem;
    color: #333;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hot-post-title:hover { color: #2c5faa; }
.hot-post-comments {
    font-size: 0.733rem;
    color: #999;
    white-space: nowrap;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item {
    font-size: 0.8rem;
    color: #555;
    padding: 3px 8px;
    background: #f5f5f5;
    border-radius: 2px;
    transition: all 0.2s;
}
.tag-item:hover { background: #2c5faa; color: #fff; }
.archive-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.867rem;
}
.archive-list span { color: #bbb; font-size: 0.8rem; }
.friend-links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.friend-link-item {
    display: block;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.867rem;
    color: #555;
    text-align: center;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-link-item:hover { background: #2c5faa; color: #fff; }

/* 移动端侧边栏字体调整 */
@media (max-width: 768px) {
    .hot-post-title,
    .hot-post-comments,
    .tag-item,
    .archive-list li,
    .archive-list span,
    .friend-link-item {
        font-size: 0.857rem;   /* 12px */
    }
}

/* === 页脚 === */
.site-footer {
    background: #1a1a2e;
    color: #888;
    padding: 16px 0;
    margin-top: 10px;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.867rem;
}
.footer-right a { color: #aaa; transition: color 0.2s; }
.footer-right a:hover { color: #fff; }

/* === 返回顶部 === */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: #2c5faa;
    color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: #1a3f7a; transform: translateY(-3px); }

/* === 其他页面 === */
.search-header, .error-page, .archive-header {
    background: #fff;
    padding: 20px 25px;
    border-radius: 4px;
    border: 1px solid #eee;
    margin-bottom: 15px;
}
.error-page { text-align: center; }
.error-page h1 { font-size: 5rem; color: #ddd; }
.error-page h2 { font-size: 1.467rem; }
.archive-header h1 { font-size: 1.333rem; color: #1a3f7a; }

/* === 滚动条 === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* === 响应式布局 === */
@media (max-width: 900px) {
    .content-wrap { flex-direction: column; }
    .sidebar { width: 100%; }
    .related-posts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .related-posts-grid { grid-template-columns: 1fr; }
    .post-title { font-size: 1.333rem; }
}