/*
Theme Name: CC News Grid
Theme URI: http://localhost:9090
Description: 精美的新闻资讯主题,采用现代化设计,支持无限滚动
Version: 2.0
Author: Custom
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

a {text-decoration: none; color: inherit;}

.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {padding: 20px 0;}

.site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 700;
    font-size: 28px;
}

.logo-icon {font-size: 36px;}

.site-tagline {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    margin-top: 5px;
    margin-left: 48px;
}

.main-navigation {display: flex;}
.nav-menu {display: flex; list-style: none; gap: 5px;}
.menu-item a {
    display: block;
    padding: 10px 20px;
    color: rgba(255,255,255,0.95);
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.menu-item a:hover {background: rgba(255,255,255,0.2); color: #fff;}

.site-main {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 30px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 30px; /* 只保留左右间距30px，上下间距由post-card的margin-bottom控制 */
}

/* 当屏幕宽度不够时，改为单列布局 */
@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 0; /* 单列时不需要gap，间距由post-card的margin-bottom控制 */
    }
    
    /* 单列布局时，限制图片容器最大宽度 */
    .post-thumbnail-container {
        max-width: 300px; /* 图片最多300px宽 */
    }
}

.post-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-bottom: 30px; /* 每个卡片下方留30px间距 */
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.card-link {
    display: flex;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* 有图片的卡片 - 横向布局 */
.post-card.has-image .card-link {
    flex-direction: row;
}

/* 没有图片的卡片 - 纵向布局 */
.post-card.no-image .card-link {
    flex-direction: column;
}

/* 图片悬停效果 */
.post-card:hover .post-thumbnail {
    transform: scale(1.08);
}

.image-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.post-card:hover .image-overlay {opacity: 1;}

.post-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 24px;
}

/* 有图片的卡片 - 内容区域padding */
.post-card.has-image .post-content-wrapper {
    padding: 20px 24px;
}

/* 没有图片的卡片 - 内容占满整个卡片 */
.post-card.no-image .post-content-wrapper {
    padding: 32px 28px;
}

.post-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.post-category-badge {
    display: inline-block;
    padding: 5px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.post-date {font-size: 13px; color: #999;}

.post-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.5;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card:hover .post-title {color: #667eea;}

.post-excerpt {
    font-size: 14px;
    line-height: 1.7;
    color: #666;
    margin-bottom: 16px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #999;
}

.read-more-arrow {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.post-card:hover .read-more-arrow {transform: translateX(4px);}

.loading-spinner {text-align: center; padding: 60px 20px; display: none;}
.loading-spinner.active {display: block;}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-more-posts {display: none; text-align: center; padding: 60px 20px;}
.no-more-posts.active {display: flex; align-items: center; justify-content: center; gap: 20px;}

.end-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    max-width: 200px;
}

.no-posts {grid-column: 1 / -1; text-align: center; padding: 100px 20px;}
.no-posts-icon {font-size: 80px; margin-bottom: 20px; opacity: 0.5;}

.site-footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin-top: 80px;
    padding: 40px 30px;
}

.footer-content {max-width: 1400px; margin: 0 auto; text-align: center;}
.footer-info h3 {font-size: 24px; margin-bottom: 10px;}
.footer-info p {font-size: 14px; opacity: 0.9; margin-bottom: 5px;}
.copyright {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
    opacity: 0.8;
}

@media (max-width: 900px) {
    .header-container {flex-direction: column; padding: 20px;}
    .site-branding {text-align: center; padding: 10px 0;}
    .site-tagline {margin-left: 0;}
    .main-navigation {width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;}
    .nav-menu {padding: 10px 0; min-width: max-content; justify-content: flex-start;}
    .menu-item a {padding: 8px 16px; font-size: 14px; white-space: nowrap;}
}

@media (max-width: 768px) {
    .site-main {padding: 0 16px; margin: 20px auto;}
    .posts-grid {grid-template-columns: 1fr; gap: 0;} /* 移除gap，使用post-card的margin-bottom */
    .post-content-wrapper {padding: 20px;}
    .post-title {font-size: 18px;}
    .site-footer {margin-top: 40px; padding: 30px 20px;}
}

@media (max-width: 480px) {
    .site-logo {font-size: 24px;}
    .logo-icon {font-size: 30px;}
    .post-content-wrapper {padding: 16px;}
}

/* Hero轮播区 */
.hero-carousel {
    position: relative;
    width: 100%;
    height: 450px;
    margin-bottom: 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: flex-end;
}

.hero-slide.active {opacity: 1; z-index: 1;}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-no-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-placeholder-icon {font-size: 120px; opacity: 0.3; color: #fff;}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    color: #fff;
    max-width: 800px;
}

.hero-category {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.hero-title a {color: #fff; transition: opacity 0.3s ease;}
.hero-title a:hover {opacity: 0.9;}

.hero-excerpt {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 12px;
    opacity: 0.95;
}

.hero-date {
    font-size: 14px;
    opacity: 0.8;
}

.hero-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    border: none;
    color: #fff;
    font-size: 48px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hero-nav:hover {
    background: rgba(255,255,255,0.5);
    transform: translateY(-50%) scale(1.1);
}

.hero-prev {left: 20px;}
.hero-next {right: 20px;}

.hero-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.hero-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-indicator.active {
    background: #fff;
    width: 32px;
    border-radius: 6px;
}

/* 横向卡片布局的缩略图容器 */
.post-thumbnail-container {
    flex-shrink: 0;
    width: 240px;
    max-width: 300px; /* 最大宽度300px，防止图片太大 */
    height: 160px;
    overflow: hidden;
    border-radius: 12px 0 0 12px;
}

.post-thumbnail-container .post-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* 如果图片加载失败，隐藏alt文本 */
.post-thumbnail-container img:not([src]),
.post-thumbnail-container img[src=""] {
    display: none;
}

.post-card:hover .post-thumbnail {transform: scale(1.1);}

.post-card.has-image .post-content-wrapper {
    flex: 1;
    padding: 20px 24px;
}

.post-card.no-image .post-content-wrapper {
    padding: 24px;
}

@media (max-width: 900px) {
    .hero-carousel {height: 350px;}
    .hero-content {padding: 30px;}
    .hero-title {font-size: 24px;}
    .hero-excerpt {font-size: 14px;}
    .hero-nav {width: 50px; height: 50px; font-size: 36px;}
}

@media (max-width: 768px) {
    .hero-carousel {
        height: 300px;
        margin-bottom: 30px;
        border-radius: 12px;
    }
    .hero-content {padding: 20px;}
    .hero-title {font-size: 20px;}
    .hero-excerpt {display: none;}
    .hero-nav {display: none;}
    
    /* 移动端卡片纵向排列 */
    .post-card.has-image .card-link,
    .post-card.no-image .card-link {
        flex-direction: column !important;
    }
    
    .post-thumbnail-container {
        width: 100%;
        height: 180px;
        border-radius: 12px 12px 0 0;
    }
    
    .post-card.has-image .post-content-wrapper {padding: 20px;}
}

@media (max-width: 480px) {
    .hero-carousel {height: 250px;}
    .hero-content {padding: 16px;}
    .hero-title {font-size: 18px;}
    .hero-category {font-size: 11px; padding: 4px 12px;}
}
