/*
 * HUICheng ECO
 * Mobile / iPad Global Gallery V1
 *
 * IMPORTANT:
 * - PC layout / interaction untouched.
 * - Activated only after JS confirms mobile/tablet touch device.
 */

#hcMobileGalleryV1 {
    display: none;
}

html.hc-mobile-gallery-open,
html.hc-mobile-gallery-open body {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

html.hc-touch-gallery-enabled #hcMobileGalleryV1 {
    position: fixed;
    inset: 0;
    z-index: 2147483600;

    display: none;

    background: rgba(0, 0, 0, .96);

    -webkit-user-select: none;
    user-select: none;

    -webkit-tap-highlight-color: transparent;
}

html.hc-touch-gallery-enabled #hcMobileGalleryV1.is-open {
    display: flex;

    align-items: center;
    justify-content: center;
}

#hcMobileGalleryV1 .hc-mg-stage {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    touch-action: pan-y pinch-zoom;
}

#hcMobileGalleryV1 .hc-mg-image {
    display: block;

    max-width: 100vw;
    max-height: 100vh;

    width: auto;
    height: auto;

    object-fit: contain;

    -webkit-user-drag: none;
    user-drag: none;

    transform: translate3d(0,0,0);
    opacity: 1;

    transition:
        transform .18s ease,
        opacity .18s ease;
}

#hcMobileGalleryV1 .hc-mg-image.is-swipe-left {
    transform: translate3d(-35px,0,0);
    opacity: .55;
}

#hcMobileGalleryV1 .hc-mg-image.is-swipe-right {
    transform: translate3d(35px,0,0);
    opacity: .55;
}

#hcMobileGalleryV1 .hc-mg-close {
    position: absolute;
    z-index: 4;

    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: rgba(20,20,20,.62);
    color: #fff;

    font-size: 30px;
    font-weight: 300;
    line-height: 1;

    cursor: pointer;

    -webkit-appearance: none;
    appearance: none;
}

#hcMobileGalleryV1 .hc-mg-count {
    position: absolute;
    z-index: 4;

    top: max(19px, calc(env(safe-area-inset-top) + 5px));
    left: 50%;

    transform: translateX(-50%);

    min-width: 54px;
    height: 32px;

    padding: 0 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 18px;

    background: rgba(20,20,20,.55);
    color: #fff;

    font-size: 14px;
    line-height: 32px;

    white-space: nowrap;
}

#hcMobileGalleryV1 .hc-mg-hint {
    position: absolute;
    z-index: 4;

    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));

    transform: translateX(-50%);

    padding: 7px 12px;

    border-radius: 16px;

    background: rgba(20,20,20,.48);
    color: rgba(255,255,255,.82);

    font-size: 12px;

    pointer-events: none;

    opacity: 1;
    transition: opacity .35s ease;
}

#hcMobileGalleryV1 .hc-mg-hint.is-hidden {
    opacity: 0;
}

/*
 * 只有真实触屏移动设备才显示 zoom-in。
 * PC 不改变 cursor。
 */
html.hc-touch-gallery-enabled
[data-hc-gallery] img,

html.hc-touch-gallery-enabled
.hc-provider-case-grid img,

html.hc-touch-gallery-enabled
.case-grid img,

html.hc-touch-gallery-enabled
#cases img,

html.hc-touch-gallery-enabled
.product-gallery img,

html.hc-touch-gallery-enabled
.product-images img,

html.hc-touch-gallery-enabled
.image-gallery img,

html.hc-touch-gallery-enabled
.photo-grid img {
    cursor: zoom-in;
}

/*
 * 手机/iPad由新的公共层接管。
 * 即使旧 Lightbox DOM 还保留，也不让它覆盖新层。
 */
html.hc-touch-gallery-enabled
#hcWorkerCaseLightboxV2.is-open,

html.hc-touch-gallery-enabled
#hcProviderLightbox.is-open {
    z-index: 2147483000 !important;
}


/*
 * HC_WORKER_OLD_LIGHTBOX_MOBILE_DISABLE_V2
 *
 * 手机/iPad已经统一由 Global Gallery 接管。
 * 旧 Worker Lightbox 只允许 PC 使用。
 */
html.hc-touch-gallery-enabled
#hcWorkerCaseLightboxV2 {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html.hc-touch-gallery-enabled
#hcWorkerCaseLightboxV2.is-open {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

