/* ===========================
   0. 新增：FOUC 防闪烁机制
   =========================== */
/* 在 JS 执行前，利用 CSS 属性选择器先把带有 |v 标记的图片隐藏 */
/* 这样页面刚加载时，它们是透明的，不会显示出变形的样子 */
.post-content img[alt*="|v"], 
.post-content img[title*="|v"] {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

/* 定义淡入动画关键帧，让排版好的图片优雅地浮现 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   1. 基础容器与通用设置
   =========================== */
.article-image-wrapper {
    position: relative;
    margin: 15px 0 0 0; 
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 6px;
    z-index: 0;
    
    /* 新增：应用淡入动画 */
    animation: fadeIn 0.5s ease-out forwards;
}

/* 强力控制图片下方文字间距 */
.article-image-wrapper + p {
    margin-top: 8px !important; 
}

.article-image-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    transition: opacity 0.5s ease-in-out; 
    opacity: 1; 
    position: relative;
    z-index: 2; 
}

/* ===========================
   2. 氛围模式 (电脑端：单张竖图带模糊)
   =========================== */
.article-image-wrapper.is-cinematic {
    padding: 30px 0; 
    background: #f0f0f0; 
    overflow: hidden; 
}
@media (prefers-color-scheme: dark) {
    .article-image-wrapper.is-cinematic { background: #222; }
}

.article-image-wrapper.is-cinematic::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: var(--bg-url);
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.75);
    transform: scale(1.2);
    z-index: 1;
}

.article-image-wrapper.is-cinematic img {
    max-height: 90vh; 
    width: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative !important;
    z-index: 10 !important;
}

/* ===========================
   3. 双拼模式 (电脑端：两张竖图并排)
   =========================== */
.article-image-wrapper.is-double-grid {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch; 
    gap: 6px; 
    background: transparent; 
    width: 100% !important; 
    margin-top: 15px !important;
    margin-bottom: -37px !important; 
    padding: 0;
    overflow: visible;
}

.article-image-wrapper.is-double-grid .double-item {
    flex: 1; 
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 4px;
    z-index: 2;
    height: 80vh; 
}

.article-image-wrapper.is-double-grid img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; 
    border-radius: 4px;
    max-height: none !important;
}

/* ===========================
   4. 标题遮罩层
   =========================== */
.image-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 13px 10px;
    border-radius: 0px 0px 4px 4px;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    box-sizing: border-box;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    text-align: center;
    z-index: 20;
}

.article-image-wrapper:not(.is-double-grid):hover .image-info-overlay,
.double-item:hover .image-info-overlay {
    transform: translateY(0);
}

.image-info-overlay p {
    margin: 5px 0;
    line-height: 1.4;
    font-size: 1rem; 
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

.image-title-text {
    font-size: 1rem;
}

/* ===========================
   5. 移动端适配 (常规手机 < 768px)
   =========================== */
@media (max-width: 768px) {

    .image-info-overlay {
        display: none !important;
    }
        
    /* --- 双拼模式适配 --- */
    .article-image-wrapper.is-double-grid {
        gap: 4px; 
        margin-bottom: -37px !important; 
        flex-wrap: nowrap !important;
        align-items: flex-start !important; 
    }

    .article-image-wrapper.is-double-grid .double-item {
        flex: 0 0 calc(50% - 2px) !important;
        width: calc(50% - 2px) !important;
        max-width: calc(50% - 2px) !important;
        height: 250px !important; 
        min-height: 250px !important;
        max-height: 250px !important;
    }

    /* --- 单张竖图适配：移除氛围特效 --- */
    .article-image-wrapper.is-cinematic {
        padding: 0 !important; 
        background: transparent !important; 
        margin-bottom: 0 !important; 
    }
    .article-image-wrapper.is-cinematic::before {
        display: none !important;
    }
    .article-image-wrapper.is-cinematic img {
        box-shadow: none !important; 
        max-height: 85vh !important; 
        width: auto;
        border-radius: 4px;
    }
}

/* ===========================
   6. 超小屏适配 (< 400px)
   =========================== */
@media (max-width: 400px) {
    .article-image-wrapper.is-double-grid .double-item {
        height: 180px !important; 
        min-height: 180px !important;
        max-height: 180px !important;
    }
}