/**
 * 豪华卡片网格样式 (4项)
 * 文件: snippets/assets/css/shortcode-luxury-cards-grid.css
 */

.chn-luxury-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    /* 两行布局：第一行左一大+右上，第二行左一大(续)+右下两小 */
    grid-template-rows: repeat(2, minmax(280px, auto));
    gap: 24px;
    width: 100%;
}

.chn-grid-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background-color: #f5f5f5;
    display: flex;
    align-items: flex-end;
    /* 内容底部对齐 */
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.chn-grid-item:hover {
    border-color: var(--e-global-color-primary);
    transform: none;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

/* 背景图片样式 */
.chn-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

/* 悬停放大效果 */
.chn-grid-item:hover .chn-grid-bg {
    transform: scale(1.08);
}

/* 渐变遮罩，增强文字可读性 */
.chn-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 60%);
    z-index: 2;
    transition: opacity 0.3s ease;
}

.chn-grid-item:hover .chn-grid-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 60%);
}

/* 内容布局 */
.chn-grid-content {
    position: relative;
    z-index: 3;
    padding: 24px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* 标签在顶，文字包裹在底 */
    align-items: flex-start;
    color: #fff;
}

.chn-grid-label {
    display: inline-block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    /* 改为深色半透明背景，自动适配亮色/暗色背景，增强白字对比度 */
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 3px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* 底部文字包裹容器 */
.chn-grid-text-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chn-grid-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
    color: #fff;
    font-family: var(--wd-entities-title-font, inherit);
}

/* 悬停显示的描述文本 - 使用 Grid 0fr->1fr 动画技术 */
.chn-grid-description {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
        grid-template-rows 0.5s ease-out,
        opacity 0.5s ease-out;
}

.chn-desc-inner {
    overflow: hidden;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    padding-top: 0px;
    /* 将间距放在内部，随 Grid 展开 */
}

.chn-desc-inner p {
    margin: 0;
    /* 防止段落默认间距干扰计算 */
}

.chn-grid-item:hover .chn-grid-description {
    grid-template-rows: 1fr;
    opacity: 1;
}

/* --- 网格区域 (12列) --- */

/* 卡片 1: 左侧 1/3 (占4列)，跨2行 */
/* 卡片 1: 左侧 1/3 (占4列)，跨2行 */
.chn-item-1 {
    grid-column: span 4;
    grid-row: span 2;
}

/* 强制左侧大图高度拉伸至 100% */
.chn-item-1 .chn-grid-bg {
    height: 100%;
    /* 保持 cover 以填充但不变形，如需强制拉伸变形请改为 fill */
    object-fit: cover;
}

/* 卡片 2: 右上 2/3 (占8列) */
.chn-item-2 {
    grid-column: span 8;
    grid-row: span 1;
}

/* 卡片 3 & 4: 右下平分 (各占4列) */
.chn-item-3,
.chn-item-4 {
    grid-column: span 4;
    grid-row: span 1;
}

/* --- 卡片 2, 3, 4 统一逻辑：白色背景，图片宽度100% 垂直居中 --- */

.chn-item-2,
.chn-item-3,
.chn-item-4 {
    background-color: #fff;
    /* 改为白色背景，配合图片留白 */
}

/* 强制这些图以宽度 100% 为准，并垂直居中 */
.chn-item-2 .chn-grid-bg,
.chn-item-3 .chn-grid-bg,
.chn-item-4 .chn-grid-bg {
    width: 100%;
    height: auto;
    top: 50%;
    transform: translateY(-50%);
    object-fit: unset;
}

/* 悬停时保持居中并放大 */
.chn-item-2:hover .chn-grid-bg,
.chn-item-3:hover .chn-grid-bg,
.chn-item-4:hover .chn-grid-bg {
    transform: translateY(-50%) scale(1.08);
}

/* --- 响应式适配 --- */

/* 平板 (竖屏) / 小屏幕笔记本 (< 1024px) */
@media (max-width: 1024px) {
    .chn-luxury-grid {
        gap: 24px;
        grid-template-rows: repeat(2, minmax(220px, auto));
    }

    .chn-grid-content {
        padding: 24px;
    }

    .chn-grid-title {
        font-size: 20px;
    }

    .chn-item-1 .chn-grid-title {
        font-size: 24px;
    }
}

/* 平板/手机端 (< 960px) - 统一为单列堆叠 */
@media (max-width: 960px) {
    .chn-luxury-grid {
        display: flex;
        flex-direction: column;
        gap: 24px;
        grid-template-columns: 1fr;
        /* 重置 Grid */
    }

    .chn-grid-item {
        width: 100%;
        height: 280px !important;
        /* 强制统一固定高度 */
        min-height: 280px;
    }

    .chn-item-1,
    .chn-item-2,
    .chn-item-3,
    .chn-item-4 {
        grid-column: auto;
        grid-row: auto;
        height: 280px !important;
        /* 确保所有卡片高度一致 */
        min-height: 280px;
    }
}