/* 瀑布流布局样式 */

/* 容器：固定 5 列，自适应宽度 */
.fttxtbody.waterfall-container,
.groupbodyin.waterfall-container {
    --waterfall-columns: 5;
    column-count: 5; /* 固定 5 列 */
    column-gap: 26px; /* 列间距 */
    width: calc(100% - 80px); /* 占满宽度，左右各留 40px 边距 */
    padding: 0;
    margin: 0 auto; /* 居中 */
}

/* 移动端响应式布局 */
@media (max-width: 1100px) {
    .fttxtbody.waterfall-container,
    .groupbodyin.waterfall-container {
        --waterfall-columns: 3;
        column-count: 3; /* 平板：3 列 */
    }
}

@media (max-width: 768px) {
    .fttxtbody.waterfall-container,
    .groupbodyin.waterfall-container {
        column-count: 2; /* 小屏：2 列 */
    }
}

@media (max-width: 480px) {
    .fttxtbody.waterfall-container,
    .groupbodyin.waterfall-container {
        column-count: 1; /* 手机：1 列 */
        width: calc(100% - 32px); /* 手机上减少边距 */
    }
}

/* 电脑端使用独立列，分页加载仅增加列尾内容 */
.waterfall-container.waterfall-stable {
    display: grid;
    grid-template-columns: repeat(var(--waterfall-columns), minmax(0, 1fr));
    column-count: auto;
    align-items: start;
}

.waterfall-stable > .waterfall-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.waterfall-stable > :not(.waterfall-column) {
    grid-column: 1 / -1;
}

.waterfall-stable > .waterfall-pending {
    display: none !important;
}

/* 卡片在列内完整显示 */
.waterfall-container .newitem,
.waterfall-container .groupitem {
    float: none !important;
    display: inline-block;
    width: 100% !important; /* 占满列宽（列宽为 217px） */
    margin: 0 0 15px 0 !important; /* 只保留底部间距 */
    break-inside: avoid; /* 防止卡片内容被分割 */
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    height: auto !important; /* 高度自适应 */
    min-height: auto !important;
}

/* 调整图片容器高度自适应 - 使用宽高比 */
.waterfall-container .newitemtop,
.waterfall-container .groupitemtop {
    height: auto !important;
    position: relative;
    width: 100%;
}

/* 运营卡片特殊处理 - 只针对包含rightone/righttwo的newitem */
.waterfall-container .newitem:has(.rightone),
.waterfall-container .newitem:has(.righttwo) {
    /* 确保运营卡片容器正确 */
}

.waterfall-container .newitem .rightone,
.waterfall-container .newitem .righttwo {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 运营卡片头部背景 */
.waterfall-container .newitem .rightonebgtop {
    width: 100% !important;
    left: 0 !important;
}

/* 运营卡片内部元素 - 单独设置宽度避免遮挡 */
.waterfall-container .newitem .rightone .fttipbody,
.waterfall-container .newitem .righttwo .fttipbody2 {
    width: 100% !important;
    max-width: none !important;
}

.waterfall-container .newitem .rightone .fttipbodyin,
.waterfall-container .newitem .righttwo .fttipbodyin2 {
    width: 100% !important;
    max-width: none !important;
    padding: 10px !important;
    left: 0 !important;
    transform: none !important;
    position: relative !important;
}

/* 高度自适应 - 宽度固定为列宽，高度按原图比例自动撑开（完整显示，不裁切）*/
.waterfall-container .newitemtop {
    aspect-ratio: auto !important;
    height: auto !important;
}

.waterfall-container .groupitemtop {
    aspect-ratio: auto !important;
    height: auto !important;
}

/* 图片链接调整 */
.waterfall-container .newitemtop a,
.waterfall-container .groupitemtop a {
    display: block;
    height: auto !important;
    width: 100% !important;
}

/* 图片自适应 - 宽度固定，高度按原图比例自适应（完整显示）*/
.waterfall-container .newitemtop img,
.waterfall-container .groupitemtop img {
    width: 100% !important;
    height: auto !important;
    object-fit: unset;
    object-position: center;
    position: static !important; /* 重置定位 */
    left: auto !important; /* 清除left样式 */
    top: auto !important; /* 清除top样式 */
    transform: none !important; /* 清除transform */
    margin: 0 !important; /* 清除边距 */
    display: block; /* 避免行内元素造成的间隙 */
}

/* 长图封顶：PC 瀑布流卡片里的超长图最高 520px，超出部分按顶部对齐裁切（点开详情看全图）*/
.waterfall-container.waterfall-stable .newitemtop img,
.waterfall-container.waterfall-stable .groupitemtop img {
    max-height: 520px;
    object-fit: cover;
    object-position: center top;
}

/* 特别针对imgauto类的修复 */
.waterfall-container .imgauto {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 底部信息区域优化 */
.waterfall-container .newitembom {
    height: auto !important;
    min-height: auto !important; /* 移除最小高度限制，让高度由内容决定 */
    padding-bottom: 4px !important; /* 减少底部内边距 */
}


.waterfall-container .groupitembom {
    height: auto !important;
    min-height: 34px;
    padding-bottom: 8px;
}

/* 标题区域优化 */
.waterfall-container .newitemtitle {
    width: 100% !important; /* 自适应卡片宽度，避免过早换行 */
    height: auto !important;
    min-height: auto !important; /* 移除最小高度限制，让高度由内容决定 */
    max-height: 51px;
    line-height: 1.5;
    word-break: break-word;
    margin: 10px 0 !important;
}

/* 平滑过渡效果 */
.waterfall-container .newitem,
.waterfall-container .groupitem {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waterfall-container .newitem,
.waterfall-container .groupitem {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

/* 延迟动画效果 */
.waterfall-container .newitem:nth-child(1),
.waterfall-container .groupitem:nth-child(1) {
    animation-delay: 0.05s;
}

.waterfall-container .newitem:nth-child(2),
.waterfall-container .groupitem:nth-child(2) {
    animation-delay: 0.1s;
}

.waterfall-container .newitem:nth-child(3),
.waterfall-container .groupitem:nth-child(3) {
    animation-delay: 0.15s;
}

.waterfall-container .newitem:nth-child(4),
.waterfall-container .groupitem:nth-child(4) {
    animation-delay: 0.2s;
}

.waterfall-container .newitem:nth-child(5),
.waterfall-container .groupitem:nth-child(5) {
    animation-delay: 0.25s;
}

/* 视频播放按钮样式 */
.video-play-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    z-index: 10;
    pointer-events: none; /* 让点击穿透到下方的链接 */
}

.video-play-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

/* 菜单栏与卡片组对齐 */
.ftcommenttop {
    width: calc(100% - 80px); /* 与卡片容器保持一致 */
    margin-left: auto !important;
    margin-right: auto !important;
}
