/* ============================================================
   products-v2 产品卡片配图覆盖样式
   仅在 products-v2.html 中引入，不影响原 products.html / style.css
   ============================================================ */

/* 产品卡片缩略区：高度由 JS 根据图片实际比例动态设置，消除白边 */
.product-card-thumb {
    height: auto !important;
    min-height: unset !important;
    background: #d8e6d2 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* JS 动态比例占位：通过 padding-top 实现 */
.product-card-thumb.ratio-set {
    display: block !important;
}

.product-card-thumb .thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    z-index: 0;
    transition: transform 0.45s ease;
    cursor: zoom-in;
}

/* 悬停轻微放大 */
.product-card-item:hover .product-card-thumb .thumb-img {
    transform: scale(1.04);
}

/* 确保「热销」等角标始终位于图片与流光之上 */
.product-card-thumb .thumb-label {
    z-index: 2;
}

/* 流光效果保持可见 */
.product-card-thumb::after {
    z-index: 1;
}

/* 无图卡片的图标保持居中（4 个配套方案卡片） */
.product-card-thumb .thumb-icon {
    position: relative;
    z-index: 0;
}

/* ============================================================
   图片点击放大 Lightbox
   ============================================================ */
.product-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 8, 18, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.product-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.product-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform 0.3s ease;
}

.product-lightbox.active img {
    transform: scale(1);
}

.product-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.product-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* 尊重系统减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    .product-card-thumb .thumb-img {
        transition: none;
    }
    .product-card-item:hover .product-card-thumb .thumb-img {
        transform: none;
    }
    .product-lightbox,
    .product-lightbox img {
        transition: none;
    }
    .product-lightbox.active img {
        transform: none;
    }
}

/* 小屏适配 */
@media (max-width: 640px) {
    .product-lightbox {
        padding: 16px;
    }
    .product-lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
}
