/* ---------- 新闻列表页（Bento 网格版式） ---------- */
.news-bento {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 150px;
    gap: 16px;
    grid-auto-flow: row dense;   /* 后续新闻增减时自动填洞，不打乱时间顺序 */
}

/* 卡片底座：图片铺满 + 底部渐变压暗叠字 */
.bento-item {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.bento-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* 跨格规则由构建按条数动态计算（build.mjs），任意条数都恰好铺满、无空洞：
   bento-feat = 2×2 头条；bento-wide = 横幅宽卡；bento-flex2/3/4 = 末卡自适应跨度 */
.bento-feat {
    grid-column: span 2;
    grid-row: span 2;
}
.bento-wide,
.bento-flex2 {
    grid-column: span 2;
}
.bento-flex3 { grid-column: span 3; }
.bento-flex4 { grid-column: span 4; }

.bento-link {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    color: var(--white);
}
.bento-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.bento-item:hover .bento-img {
    transform: scale(1.06);
}
.bento-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 20, 36, 0.05) 35%, rgba(10, 20, 36, 0.82) 100%);
}

/* 日期胶囊：左上角毛玻璃小签 */
.bento-date {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.bento-date b {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.bento-date i {
    font-style: normal;
    font-size: 0.72rem;
    opacity: 0.85;
}

/* 文字区：默认只露标题；头条与宽卡额外显示摘要 */
.bento-text {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.bento-text h3 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--white);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.bento-item:hover .bento-text h3 {
    color: var(--accent-light);
}
.bento-text p {
    display: none;   /* 小方卡不显示摘要，保持清爽 */
}

/* 头条（2×2）：大标题 + 摘要 */
.bento-feat .bento-text h3 {
    font-size: 1.4rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
}
.bento-feat .bento-text p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.85);
}

/* 宽卡 / 末卡：单行标题 + 两行摘要 */
.bento-wide .bento-text h3,
.bento-flex2 .bento-text h3,
.bento-flex3 .bento-text h3,
.bento-flex4 .bento-text h3 {
    -webkit-line-clamp: 1;
}
.bento-wide .bento-text p,
.bento-flex2 .bento-text p,
.bento-flex3 .bento-text p,
.bento-flex4 .bento-text p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.88rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- 平板：两列 ---------- */
@media (max-width: 900px) {
    .news-bento {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 145px;
        gap: 12px;
    }
    /* 两列下统一收敛跨度：宽卡/末卡占满整行（构建已保证总格数为偶数，恰好铺满） */
    .bento-wide,
    .bento-flex2,
    .bento-flex4 {
        grid-column: span 2;
    }
    .bento-flex3 {
        grid-column: span 1;
    }
}

/* ---------- 手机：单列，全部恢复常规卡 ---------- */
@media (max-width: 560px) {
    .news-bento {
        grid-template-columns: 1fr;
        grid-auto-rows: 165px;
        gap: 12px;
    }
    .bento-wide,
    .bento-flex2,
    .bento-flex3,
    .bento-flex4 {
        grid-column: auto;
    }
    .bento-wide .bento-text h3,
    .bento-flex2 .bento-text h3,
    .bento-flex3 .bento-text h3,
    .bento-flex4 .bento-text h3 {
        -webkit-line-clamp: 2;
    }
    .bento-wide .bento-text p,
    .bento-flex2 .bento-text p,
    .bento-flex3 .bento-text p,
    .bento-flex4 .bento-text p {
        display: none;
    }
}

/* 新闻页内容较多，底部留白与联系页保持一致，拉开与页脚的距离 */
#news {
    padding-bottom: 320px;
}
@media (max-width: 768px) {
    #news { padding-bottom: 120px; }
}

/* ---------- 左侧竖向时间线：仅超宽屏显示，填充网格两侧留白 ---------- */
/* JS 按视觉行生成刻度（取每行首卡日期）：年份大字 + 月.日 小字 */
.news-bento-wrap {
    position: relative;
}
.news-rail {
    display: none;
}
@media (min-width: 1480px) {
    .news-rail {
        display: block;
        position: absolute;
        top: 6px;
        bottom: 6px;
        right: calc(100% + 32px);
        width: 78px;
    }
    .news-rail::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        right: 10px;
        width: 2px;
        background: linear-gradient(180deg, transparent 0%, var(--border) 10%, var(--border) 90%, transparent 100%);
    }
    .news-rail-marker {
        position: absolute;
        right: 0;
        text-align: right;
        padding-right: 28px;
        white-space: nowrap;
    }
    .news-rail-marker::after {
        content: '';
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: var(--accent);
        box-shadow: 0 0 0 3px rgba(240, 138, 30, 0.18);
    }
    .news-rail-marker .nr-year {
        display: block;
        font-size: 1.45rem;
        font-weight: 800;
        line-height: 1.15;
        color: var(--primary);
        letter-spacing: 0.5px;
    }
    .news-rail-marker .nr-month {
        display: block;
        font-size: 0.8rem;
        color: var(--text-light);
        letter-spacing: 0.5px;
    }
}
