/* 性能优化CSS - 关键渲染路径样式 */

/* 关键样式 - 页面首屏渲染必需 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-header {
    margin: 2rem 0 1.5rem;
}

.page-header h1 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

/* 项目卡片基础样式 */
.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.project-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* 新闻卡片基础样式 */
.news-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.news-card:hover {
    transform: translateY(-2px);
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
}

.news-content {
    padding: 1.5rem;
}

.news-title {
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
    color: #333;
}

/* 响应式网格 */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* 加载状态指示器 */
.loading-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 图片懒加载优化 */
.news-image[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.news-image[loading="lazy"].loaded {
    opacity: 1;
}

/* 关键字体优化 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* 最小化重绘和重排 */
.project-card,
.news-card {
    will-change: transform;
    backface-visibility: hidden;
}

/* 媒体查询优化 */
@media (max-width: 768px) {
    .project-list {
        grid-template-columns: 1fr;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
