/*
Theme Name: 新闻主题
Theme URI: http://example.com/xinzhuti
Author: Theme Author
Author URI: http://example.com
Description: 一个简洁的新闻资讯类WordPress主题，支持响应式设计、AJAX加载更多、侧边栏推荐和排行榜功能。
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: xinzhuti
Tags: news, blog, responsive, ajax, chinese
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
}
.header {
    background-color: #2b2b2b;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header .container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 40px;
}
.logo {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}
.logo a {
    color: #fff;
    text-decoration: none;
}
/* 让包含图片的段落 取消缩进、顶格显示 */



/* 桌面导航 */
.nav {
    display: flex;
    gap: 30px;
}
.nav-link {
    color: rgba(255, 255, 255, .5);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.nav-link:hover {
    color: #fff;
}
.nav-link.active {
    color: #fff;
    font-weight: 600;
}

/* 移动端导航 */
.mobile-nav {
    display: none;
    background: #2b2b2b;
    padding: 10px 20px;
    border-top: 1px solid #444;
}
.mobile-nav .nav-link {
    display: block;
    padding: 12px 0;
    font-size: 16px;
}
.mobile-nav.show {
    display: block;
}

.main {
    padding: 20px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
}

.article-header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.article-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    margin-bottom: 12px;
}

.article-meta {
    color: #999;
    font-size: 14px;
}

.article-content {
    line-height: 1.8;
    color: #333;
    font-size: 16px;
}

.article-content p {
    margin-bottom: 16px;
    text-indent: 2em;
}

.article-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 24px 0 12px;
}

.article-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 20px 0 10px;
}

/* 图片段落取消缩进 */
p:has(img),
.pic:has(img) {
    text-indent: 0 !important;
    text-align: center !important;
}

.article-content p img,
.article-content img {
    max-width: 100%;
}
.news-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.news-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.news-item a {
    display: flex;
    gap: 16px;
    padding: 16px;
    text-decoration: none;
    flex-wrap: nowrap;
}

.article-main {
    flex: 1;
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.related-news {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.related-news h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.related-list {
    list-style: none;
}

.related-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.related-item:hover {
    background-color: #fafafa;
}

.related-img {
    width: 100px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.related-title {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    flex: 1;
}

.related-time {
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
}
.news-img {
    width: 180px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.news-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.news-title {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.news-time {
    font-size: 12px;
    color: #999;
}
.sidebar {
    width: 380px;
    flex-shrink: 0;
}
.sidebar-section {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}
.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
}
.quick-read-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 固定两列 */
    gap: 12px;
    row-gap: 25px;
}
.quick-item a {
    display: block;
    text-decoration: none;
}
.quick-item {
    transition: transform 0.2s ease;
}
.quick-item:hover {
    transform: translateY(-2px);
}
.quick-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}
.quick-title {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    margin-top: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.rank-list {
    list-style: none;
}
.rank-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.1s;
}
.rank-item:last-child {
    border-bottom: none;
}
.rank-item:hover {
    background-color: #fafafa;
}
.rank-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.rank-1 .rank-num {
    background: #ff4d4f;
    color: #fff;
}
.rank-2 .rank-num {
    background: #ff7a45;
    color: #fff;
}
.rank-3 .rank-num {
    background: #ffc069;
    color: #fff;
}
ol, ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
li {
    list-style: none;
    border: none;
    border-bottom: none;
}
a {
    text-decoration: none !important;
}
.rank-title a {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    transition: color 0.2s;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.rank-item:hover .rank-title a {
    color: #2483ff;
}
.load-more-btn {
    width: 100%;
    padding: 14px;
    text-align: center;
    background: #fff;
    color: #2483ff;
    border: 1px solid #2483ff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
    transition: background-color 0.2s, color 0.2s;
}
.load-more-btn:hover {
    background-color: #2483ff;
    color: #fff;
}
.footer {
    background-color: #2b2b2b;
    padding: 20px 0;
    margin-top: 30px;
}
.footer-text {
    color: #999;
    font-size: 16px;
    
}

/* 广告容器样式 */
.ad-outer {
    width: 100%;
    margin: 16px 0;
    overflow: hidden;
    clear: both;
}

/* 文章列表中的广告 */
.news-list .ad-outer {
    width: 100%;
    margin: 12px 0;
}

/* 侧边栏中的广告 */
.sidebar .ad-outer {
    width: 100%;
    margin: 16px 0;
}

/* 文章内容中的广告 */
.article-main .ad-outer,
.related-news .ad-outer {
    width: 100%;
    margin: 20px 0;
}

.ad-outer ._esevs85yfaj {
    width: 100%;
    min-height: 90px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        width: 300px;
    }
    .news-img {
        width: 150px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none !important;
    }
    .menu-toggle {
        display: flex !important;
    }
    .content-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .news-img {
        width: 120px;
        height: 80px;
    }
    /* 保持移动端两列布局 */
    .quick-read-grid {
        grid-template-columns: 1fr 1fr;
    }
    /* 移动端广告间距调整 */
    .ad-outer {
        margin: 10px 0;
    }
}

@media (max-width: 480px) {
    .news-img {
        width: 100px;
        height: 70px;
    }
    /* 480px 下也保持两列 */
    .quick-read-grid {
        grid-template-columns: 1fr 1fr;
    }
}
  .read-more {
            display: block;
            width: 120px;
            padding: 10px;
            text-align: center;
            background: #2483ff;
            color: #fff;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            margin: 20px auto;
        }


/*手机导航栏*/
/* 汉堡按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
}
.menu-toggle span {
    width: 26px;
    height: 3px;
    /* 灰色 */
    background: #ccc !important;
    margin: 3px 0;
    border-radius: 2px;
    transition: 0.3s;
}

/* PC 端导航 */
.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}
.nav-link {
    color: rgba(255,255,255,.5);
    text-decoration: none;
    font-size: 16px;
}

/* 移动端导航（你要的全部在这里） */
@media (max-width: 768px) {
    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }

    /* 导航整体靠左 */
    .nav {
        display: none !important;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(33, 37, 41, 0.98) !important;
        padding: 10px 0;
        z-index: 999;
        text-align: left !important;
        align-items: flex-start !important; /* 整个导航靠左 */
    }

    .nav.active {
        display: flex !important;
    }

    /* a 标签全部靠左 */
    .nav-link {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        text-align: left !important;
        color: rgba(255,255,255,.5) !important;
        font-size: 16px;
        text-decoration: none;
        width: 100%;
        box-sizing: border-box;
    }

    /* 当前分类高亮 */
    .nav-link.current-cat {
        color: #fff !important;
    }

    .menu-toggle {
        display: flex;
    }
}
/* 高亮当前分类 */
.nav-link.active {
    color: #fff !important;
}
