/* ==========================================================================
 * 详情页 Hero：深色占位 + 移动端圆角卡片
 * ========================================================================== */

.media.media-parent,
.media-parent {
    background-color: #1a1d24;
}

.media-parent picture {
    display: block;
    width: 100%;
    height: 100%;
}

.media-parent #mbg.image,
.media-parent .image.top-main-bg,
.media-parent .image.top-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #1a1d24;
}

.media-parent #bgvideo,
.media-parent video.wp-video-shortcode {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #1a1d24;
}

.nice-dark-mode .media.media-parent,
.nice-dark-mode .media-parent,
.nice-dark-mode .media-parent #mbg.image {
    background-color: #12151a;
}

/* 覆层默认隐藏，仅移动端展示 */
.detail-hero-overlay {
    display: none;
}

/* Hero 下方正文：收紧与上方卡片的间距 */
.site-main {
    padding-top: 0.5rem;
}

@media (max-width: 767.98px) {
    .site-main {
        padding-top: 0.35rem;
    }
}

/* --------------------------------------------------------------------------
 * Mobile：圆角卡片 + 点赞/分享 + 底部信息
 * -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    /*
     * 与正文 .container > .post.card 同宽：
     * 使用站点 --bs-gutter-x（与 .container 左右 gutter 一致）
     */
    .detail-hero-wrap,
    .col-12.detail-hero-wrap {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding-top: 10px;
        padding-left: var(--bs-gutter-x, .75rem);
        padding-right: var(--bs-gutter-x, .75rem);
        padding-bottom: 8px;
        box-sizing: border-box;
    }

    .detail-hero-wrap > .media.media-parent,
    .detail-hero.media-parent,
    .media.media-parent.detail-hero {
        position: relative;
        height: 30vh;
        min-height: 168px;
        max-height: 240px;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 10px 28px rgba(15, 18, 28, 0.14);
        background-color: #1a1d24;
    }

    /* 避免主题 .media:after 百分比撑高干扰卡片高度 */
    .detail-hero.media-parent:after,
    .detail-hero-wrap .media:after {
        display: none !important;
        content: none !important;
        padding: 0 !important;
    }

    .detail-hero.media-parent > picture,
    .detail-hero.media-parent > #mbg,
    .detail-hero.media-parent > video {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .detail-hero.media-parent > picture > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .detail-hero-overlay {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 2;
        pointer-events: none;
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.18) 0%,
            rgba(0, 0, 0, 0) 32%,
            rgba(0, 0, 0, 0.12) 55%,
            rgba(0, 0, 0, 0.62) 100%
        );
    }

    .detail-hero-actions {
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 5;
        display: flex;
        flex-direction: column;
        gap: 10px;
        pointer-events: auto;
    }

    .detail-hero-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        color: #fff;
        text-decoration: none;
        background: rgba(20, 22, 28, 0.42);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
        transition: transform 0.15s ease, background 0.15s ease;
        pointer-events: auto;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        z-index: 6;
        cursor: pointer;
    }

    .detail-hero-btn:active {
        transform: scale(0.94);
    }

    .detail-hero-btn .iconfont {
        font-size: 1.15rem;
        line-height: 1;
        color: #fff;
    }

    .detail-hero-btn.btn-action-like.current,
    .detail-hero-btn.btn-action-like.current .iconfont {
        color: #ff6b6b;
    }

    .detail-hero-foot {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px;
        padding: 18px 16px 16px;
        pointer-events: none;
    }

    .detail-hero-copy {
        min-width: 0;
        flex: 1 1 auto;
        max-width: calc(100% - 64px);
    }

    .detail-hero-title {
        margin: 0 0 10px;
        color: #fff;
        font-size: 1.05rem;
        font-weight: 700;
        line-height: 1.35;
        letter-spacing: 0.01em;
        text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
    }

    .detail-hero-author {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        pointer-events: auto;
    }

    .detail-hero-avatar {
        flex: 0 0 auto;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        object-fit: cover;
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
    }

    .detail-hero-provider {
        color: rgba(255, 255, 255, 0.95);
        font-size: 0.8125rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    }

    .detail-hero-stats {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 12px;
        color: rgba(255, 255, 255, 0.95);
        font-size: 0.8125rem;
        line-height: 1;
        padding-bottom: 2px;
        text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    }

    .detail-hero-stat {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
    }

    .detail-hero-stat .iconfont {
        font-size: 0.9rem;
        line-height: 1;
        opacity: 0.95;
    }

    /* 标题已在 Hero 展示，正文区避免重复 */
    .post.card .card-body > .meta-title {
        display: none;
    }
}

@media (max-width: 380px) {
    .detail-hero-title {
        font-size: 0.98rem;
    }

    .detail-hero-btn {
        width: 36px;
        height: 36px;
    }
}

/* --------------------------------------------------------------------------
 * 全屏图片预览
 * -------------------------------------------------------------------------- */
.dh-preview {
    --dh-dim: 0.92;
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) 12px env(safe-area-inset-bottom, 0);
    background: rgba(8, 10, 14, var(--dh-dim));
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.dh-preview.is-open {
    opacity: 1;
    visibility: visible;
}

.dh-preview.is-closing {
    opacity: 0;
    visibility: hidden;
}

.dh-preview-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: max(12px, env(safe-area-inset-right, 12px));
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    padding: 0;
    color: #fff;
    font-size: 0;
    line-height: 0;
    background: rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.dh-preview-close-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.dh-preview-close:active {
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.22);
}

.dh-preview-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
    height: min(82vh, 100%);
    transform: translate3d(0, 12px, 0) scale(0.96);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.dh-preview.is-open .dh-preview-stage {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.dh-preview-stage.is-dragging {
    transition: none;
}

.dh-preview-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: auto;
}

.dh-preview-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease 0.12s;
}

.dh-preview.is-open .dh-preview-hint {
    opacity: 1;
}

html.dh-preview-open,
body.dh-preview-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* 整页禁用双击放大（配合 viewport maximum-scale） */
html.dh-no-dblzoom,
body.dh-no-dblzoom {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

html.dh-no-dblzoom {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Hero 内图片不直接接收触摸，避免 iOS 对 <img> 双击放大 */
.detail-hero,
.detail-hero picture,
.detail-hero #mbg,
.detail-hero .image.top-main-bg,
.detail-hero img {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.detail-hero picture,
.detail-hero #mbg,
.detail-hero .image.top-main-bg,
.detail-hero > picture img {
    pointer-events: none;
}

.detail-hero {
    cursor: zoom-in;
    pointer-events: auto;
}

.detail-hero .detail-hero-actions,
.detail-hero .detail-hero-btn,
.detail-hero .detail-hero-author {
    pointer-events: auto;
    touch-action: manipulation;
}
