/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* IBM 颜色变量 */
:root {
    --ibm-red: #a2191f;
}

.text-ibm-red {
    color: var(--ibm-red);
}

/* 基础骨架 */
html, body { height: 100%; margin: 0; }

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'IBM Plex Sans', sans-serif;
    background-color: #f9fafb;
}

.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: #a2191f;
    font-weight: bold;
    font-size: 20px;
    text-decoration: none;
}

nav ul {
    display: flex;
    gap: 24px;
    list-style: none;
}

nav a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
}

nav a:hover {
    color: #a2191f;
}

.content-grow {
    flex: 1 0 auto; /* 核心：撑开页面，确保 Footer 被推到底部 */
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 5rem 1rem 5rem; /* 增加顶部和底部内边距，避免被固定header和footer遮挡 */
    visibility: visible !important; /* 彻底删掉之前的 hidden 逻辑 */
}

.page-title {
    font-size: 30px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 32px;
}

/* 底部栏固定：模仿 Header 逻辑 */
.footer-fixed {
    flex-shrink: 0; /* 严禁被压缩 */
    background: #161616;
    color: white;
    padding: 24px 0;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 16px;
}

/* 瀑布流布局 */
.masonry-grid { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 32px; }
.masonry-column { flex: 1; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* 响应式：控制列的显示 */
@media (max-width: 768px) { #col-2, #col-3, #col-4 { display: none; } }

/* 图片：拒绝裁剪 */
.ibm-card img {
    width: 100%;
    height: auto; /* 允许图片完整显示 */
    display: block;
    object-fit: contain;
    background: #f4f4f4;
}

/* 新闻卡片 */
.ibm-card {
    background: white;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    break-inside: avoid;
}

.ibm-card.visible {
    opacity: 1;
}

.ibm-card-content {
    padding: 16px;
}

.ibm-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

.ibm-card-date {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.ibm-card-description {
    font-size: 16px;
    color: #4b5563;
    margin-bottom: 16px;
}

.ibm-card-link {
    color: #a2191f;
    text-decoration: none;
    font-weight: 500;
}

.ibm-card-link:hover {
    text-decoration: underline;
}

/* 主内容区域布局 */
.main-content-container {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
}

/* 左侧新闻区域（2列） */
.news-section-left {
    flex: 1;
    order: 1;
}

/* 右侧视频 + 新闻区域（2列） */
.news-section-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    order: 2;
}

/* 左侧瀑布流（2列） */
.masonry-grid-left {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 右侧瀑布流（2列） */
.masonry-grid-right {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 轮播图片 */
.image-carousel {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 0;
}

.carousel-container {
    position: relative;
    width: 100%;
    /* 横屏图片比例 */
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    cursor: pointer;
    z-index: 1;
    pointer-events: none;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-slide .slide-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px;
    font-size: 16px;
    font-weight: 500;
}

.carousel-controls {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

.carousel-controls button {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.carousel-controls button:hover {
    background: rgba(255, 255, 255, 1);
}

.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.carousel-indicator {
    pointer-events: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-indicator.active {
    background: rgba(255, 255, 255, 1);
}

/* 视频播放器模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 0;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

.video-player-container {
    margin-bottom: 20px;
    border-radius: 0;
    overflow: hidden;
    background-color: #000;
}

#modal-video {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

.video-selector {
    margin-top: 20px;
}

.video-selector h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.video-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.video-option {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-option:hover {
    background-color: #e0e0e0;
}

.video-option.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 平板布局：视频在右侧占1列，左侧1列 */
@media (max-width: 1024px) {
    .main-content-container {
        flex-direction: row;
    }
    
    /* 左侧瀑布流容器：只显示第一列 */
    .masonry-grid-left {
        display: flex;
        flex-direction: column;
        gap: 24px;
        width: 100%;
    }
    
    /* 右侧瀑布流容器：只显示第三列 */
    .masonry-grid-right {
        display: flex;
        flex-direction: column;
        gap: 24px;
        width: 100%;
    }
    
    /* 隐藏不需要的列 */
    #col-2,
    #col-4 {
        display: none;
    }
    
    /* 确保右侧瀑布流在视频下方显示 */
    .news-section-right {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
    
    /* 确保显示的列占满空间 */
    #col-1,
    #col-3 {
        width: 100%;
    }
}

/* 手机布局：视频在顶部全屏，下方1列 */
@media (max-width: 768px) {
    .main-content-container {
        flex-direction: column;
    }
    
    /* 在手机布局中，调整order属性，确保视频在顶部 */
    .news-section-left {
        order: 2;
        margin-top: 24px;
    }
    
    .news-section-right {
        order: 1;
    }
    
    .carousel-container {
        max-width: 100%;
        max-height: 80vh;
    }
    
    .carousel-caption h3 {
        font-size: 16px;
    }
    
    .carousel-caption p {
        font-size: 12px;
    }
    
    #col-2,
    #col-3,
    #col-4 {
        display: none;
    }
    
    /* 确保瀑布流容器正确显示 */
    .masonry-grid-left,
    .masonry-grid-right {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
}

/* About页面内容样式 */
.about-content {
    max-width: 800px;
    line-height: 1.6;
    color: #333;
}

.about-content p {
    margin-bottom: 1.5rem;
    font-size: 16px;
    text-align: left;
}

/* 加载状态 */
#loading-status {
    text-align: center;
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #a2191f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #a2191f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}