/*
Theme Name: 清新资讯主题
Theme URI: https://example.com
Author: Your Name
Author URI: https://example.com
Description: 一个基于截图设计的清新资讯WordPress主题，使用浅蓝色调，适合资讯、博客类网站
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qingxin-theme
Tags: blog, news, two-columns, responsive-layout, custom-colors
*/

/* ===========================
   全局样式
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #5a9fd4;
}

/* 自动锚文本样式 */
a.auto-anchor-link {
    color: #5a9fd4;
    font-weight: 500;
    border-bottom: 1px dotted #5a9fd4;
}

a.auto-anchor-link:hover {
    color: #4a8fc4;
    border-bottom-style: solid;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* ===========================
   容器布局
   =========================== */
.site-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.content-wrapper {
    display: flex;
    gap: 20px;
    padding: 20px 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
}

/* ===========================
   顶部导航
   =========================== */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* CLS 优化：固定高度防止内容加载时布局偏移 */
    min-height: 70px;
    contain: layout style;
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    gap: 30px;
}

.site-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    background: transparent !important;
}

.site-logo .logo-link,
.site-logo .custom-logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: transparent !important;
}

.site-logo .site-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.site-logo .custom-logo {
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: transparent !important;
    /* CLS 优化：预留 Logo 空间 */
    min-width: 100px;
    min-height: 30px;
}

.site-logo .custom-logo:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.site-logo .custom-logo-link {
    display: inline-flex;
    align-items: center;
    max-height: 100%;
    padding: 5px 0;
}

.site-logo img {
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

/* 主导航菜单 */
.main-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.main-navigation::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.nav-menu {
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
    justify-content: flex-end;
}

.nav-menu li {
    position: relative;
    list-style: none;
    flex-shrink: 0;
}

.nav-menu li a {
    display: block;
    padding: 10px 18px;
    color: #555;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.3px;
}

/* 悬停效果 */
.nav-menu li a:hover {
    color: #5a9fd4;
    background-color: #f0f7fc;
    transform: translateY(-1px);
}

/* 当前页面/选中状态 */
.nav-menu li.current-menu-item a,
.nav-menu li.current_page_item a {
    color: #fff;
    background: linear-gradient(135deg, #5a9fd4 0%, #4a8fc4 100%);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(90, 159, 212, 0.3);
}

/* 当前页面悬停效果 */
.nav-menu li.current-menu-item a:hover,
.nav-menu li.current_page_item a:hover {
    background: linear-gradient(135deg, #4a8fc4 0%, #3a7fb4 100%);
    box-shadow: 0 4px 12px rgba(90, 159, 212, 0.4);
    transform: translateY(-2px);
}

/* 菜单项底部指示器（可选） */
.nav-menu li a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 2px;
    background-color: #5a9fd4;
    border-radius: 2px;
    transition: transform 0.3s ease;
}

.nav-menu li.current-menu-item a::after,
.nav-menu li.current_page_item a::after {
    display: none;
}

.nav-menu li a:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* 侧边栏搜索框样式 */
.sidebar-widget .search-form {
    display: flex;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.sidebar-widget .search-form:focus-within {
    border-color: #cfe4fa;
    box-shadow: 0 2px 8px rgba(207, 228, 250, 0.5);
}

.sidebar-widget .search-form input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #333;
}

.sidebar-widget .search-form input[type="text"]::placeholder {
    color: #999;
}

.sidebar-widget .search-form button {
    padding: 10px 15px;
    border: none;
    background-color: #5a9fd4;
    cursor: pointer;
    color: #fff;
    transition: background-color 0.3s ease;
    min-width: 50px;
}

.sidebar-widget .search-form button:hover {
    background-color: #4a8fc4;
}

.sidebar-widget .search-form button svg {
    width: 18px;
    height: 18px;
}

/* ===========================
   文章列表样式
   =========================== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-item {
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e5e5e5;
    transition: box-shadow 0.3s ease;
    /* CLS 优化：固定最小高度防止内容加载时布局偏移 */
    min-height: 150px;
}

.post-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-thumbnail {
    flex-shrink: 0;
    width: 180px;
    height: 120px;
    overflow: hidden;
    border-radius: 5px;
    background-color: #f0f0f0;
    position: relative;
    /* CLS 优化：固定宽高比防止图片加载时布局偏移 */
    aspect-ratio: 180 / 120;
    contain: layout style;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-category-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
}

.post-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0;
}

.post-title a {
    color: #333;
}

.post-title a:hover {
    color: #5a9fd4;
}

.post-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #999;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ===========================
   侧边栏样式
   =========================== */
.sidebar-widget {
    background-color: #fff;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e5e5e5;
    /* CLS 优化：使用 contain 隔离布局 */
    contain: layout style;
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #cfe4fa;
    color: #333;
}

/* 广告位 */
.ad-widget {
    background-color: #cfe4fa;
    padding: 20px;
    text-align: center;
    border-radius: 5px;
}

.ad-widget img {
    margin: 0 auto;
}

/* 热门文章 */
.popular-posts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popular-post-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.popular-post-item:hover {
    background-color: #f8f8f8;
}

.popular-post-thumb {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 5px;
    overflow: hidden;
    background-color: #f0f0f0;
    /* CLS 优化：固定宽高比防止图片加载时布局偏移 */
    aspect-ratio: 80 / 60;
    contain: layout style;
}

.popular-post-thumb img {
    width: 80px;
    height: 60px;
}

.popular-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.popular-post-title {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-post-views {
    font-size: 12px;
    color: #999;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px 0;
    justify-content: flex-start; /* 左对齐 */
}

.tag-cloud-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 85px;
    height: 28px;
    padding: 0 8px 0 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    cursor: pointer;
    --tooltip-offset: 35px;
}

/* 标签前添加 # 符号 */
.tag-cloud-link::before {
    content: '#';
    margin-right: 3px;
    font-weight: 600;
    opacity: 0.6;
    flex-shrink: 0;
}

/* 悬停效果 */
.tag-cloud-link:hover {
    background-color: #cfe4fa;
    color: #5a9fd4;
    border-color: #cfe4fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 自定义 Tooltip 样式 */
.tag-cloud-link[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: var(--tooltip-offset);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background-color: #333;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    word-break: break-all;
    white-space: normal;
    animation: tooltip-fade-in 0.3s ease;
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 搜索框小工具优化 */
.sidebar-widget:has(.search-form) {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e5e5e5;
}

/* 侧边栏广告样式 */
.sidebar-ad-widget {
    overflow: hidden;
}

.sidebar-ad-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    transition: transform 0.3s ease;
    /* CLS 优化：固定宽高比防止图片加载时布局偏移 */
    aspect-ratio: 270 / 200;
    object-fit: cover;
}

.sidebar-ad-widget a:hover .sidebar-ad-image {
    transform: scale(1.05);
}

/* ===========================
   分页样式
   =========================== */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination ul.page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination ul.page-numbers li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    color: #666;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fff;
}

.pagination a.page-numbers:hover {
    background-color: #cfe4fa;
    border-color: #cfe4fa;
    color: #5a9fd4;
}

.pagination .page-numbers.current {
    background-color: #5a9fd4;
    border-color: #5a9fd4;
    color: #fff;
}

.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* 加载更多按钮 */
.load-more-wrapper {
    text-align: center;
    margin-top: 30px;
    padding: 30px 0;
}

.load-more-button {
    display: inline-block;
    padding: 12px 40px;
    background-color: #5a9fd4;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-button:hover:not(:disabled) {
    background-color: #4a8fc4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.load-more-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 14px;
}

/* ===========================
   单篇文章样式
   =========================== */
.single-post {
    background-color: #fff;
    padding: 30px;
    border-radius: 5px;
    border: 1px solid #e5e5e5;
}

.single-post-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
}

.single-post-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 15px;
    color: #333;
}

.single-post-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #999;
}

.single-post-content {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

.single-post-content p {
    margin-bottom: 15px;
}

.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
    margin: 25px 0 15px;
    color: #333;
    font-weight: 600;
}

.single-post-content h2 {
    font-size: 20px;
}

.single-post-content h3 {
    font-size: 18px;
}

.single-post-content h4 {
    font-size: 16px;
}

.single-post-content img {
    margin: 20px 0;
    border-radius: 5px;
    /* CLS 优化：保持图片比例 */
    max-width: 100%;
    height: auto;
}

/* 移动端隐藏特色图片以优化LCP性能 */
@media (max-width: 768px) {
    .single-post-thumbnail {
        display: none !important;
    }
}

/* 特色图片样式 */
.single-post-featured-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 20px;
    /* CLS 优化：固定宽高比防止图片加载时布局偏移 */
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* CLS 优化：特色图片容器预留空间 */
.single-post-thumbnail {
    width: 100%;
    min-height: 200px;
    contain: layout style;
}

.single-post-content ul,
.single-post-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.single-post-content ul li {
    list-style: disc;
    margin-bottom: 8px;
}

.single-post-content ol li {
    list-style: decimal;
    margin-bottom: 8px;
}

.single-post-content blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    background-color: #f8f8f8;
    border-left: 4px solid #cfe4fa;
    color: #666;
}

.single-post-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 13px;
}

.single-post-content pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 15px 0;
}

.single-post-content pre code {
    background: none;
    padding: 0;
}

/* 文章底部标签 */
.post-tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.post-tags-title {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
}

.post-tags a {
    display: inline-block;
    padding: 5px 12px;
    margin-right: 8px;
    margin-bottom: 8px;
    background-color: #f5f5f5;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
    border: 1px solid #e5e5e5;
}

.post-tags a:hover {
    background-color: #cfe4fa;
    color: #5a9fd4;
    border-color: #cfe4fa;
}

/* 相关文章 */
.related-posts {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 5px;
}

.related-posts-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.related-posts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

/* ===========================
   页脚样式
   =========================== */
.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 30px 0 20px;
    margin-top: 40px;
}

.footer-content {
    text-align: center;
}

.footer-text {
    font-size: 13px;
    color: #bdc3c7;
    line-height: 1.8;
}

.footer-text a {
    color: #cfe4fa;
}

.footer-text a:hover {
    color: #fff;
}

/* ===========================
   响应式设计
   =========================== */
@media (max-width: 968px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .header-main {
        gap: 15px;
    }
    
    .main-navigation {
        justify-content: flex-start;
    }
    
    .nav-menu {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .post-item {
        flex-direction: column;
    }
    
    .post-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .single-post {
        padding: 20px 15px;
    }
    
    .single-post-title {
        font-size: 20px;
    }
    
    .header-main {
        padding: 10px 0;
    }
    
    .nav-menu li a {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .tag-cloud-link {
        min-width: 70px;
        height: 28px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .site-logo .site-name {
        font-size: 16px;
    }
    
    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .post-title {
        font-size: 15px;
    }
    
    .post-excerpt {
        font-size: 12px;
    }
    
    .post-meta {
        font-size: 11px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .load-more-button {
        width: 100%;
        max-width: 300px;
    }
}

/* ===========================
   加载动画
   =========================== */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ===========================
   无内容提示
   =========================== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background-color: #fff;
    border-radius: 5px;
    border: 1px solid #e5e5e5;
}

.no-results-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
}

.no-results-text {
    color: #999;
    font-size: 14px;
}

/* ===========================
   面包屑导航
   =========================== */
.breadcrumbs {
    padding: 15px 0;
    font-size: 13px;
    color: #999;
}

.breadcrumbs a {
    color: #666;
}

.breadcrumbs a:hover {
    color: #5a9fd4;
}

.breadcrumbs span {
    margin: 0 5px;
}

/* ===========================
   工具类
   =========================== */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ===========================
   首页内容区域样式
   =========================== */
.page-intro-section {
    background-color: #fff;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.page-intro-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 20px 0;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #cfe4fa;
}

.page-intro-summary {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
}

.page-intro-summary p {
    margin-bottom: 15px;
}

.page-intro-summary p:last-child {
    margin-bottom: 0;
}

.page-intro-summary strong {
    color: #5a9fd4;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-intro-section {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .page-intro-title {
        font-size: 20px;
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .page-intro-summary {
        font-size: 14px;
        line-height: 1.7;
    }
}

@media (max-width: 480px) {
    .page-intro-title {
        font-size: 18px;
    }
    
    .page-intro-summary {
        font-size: 13px;
    }
}

