/**
 * 首頁／分類頁商品區：靜態 grid（無輪播）
 * 桌機 6 欄 · 平板 4 欄 · 手機 2 欄
 */
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 22px 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid__empty {
    grid-column: 1 / -1 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card-item-wrap,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

body.store-front-container .product-slider-section-container .wx-section-more-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 28px 0 4px;
}
body.store-front-container .product-slider-section-container .wx-section-more-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 168px;
    padding: 10px 28px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--pos-highlight, var(--primary-color, #587493));
    color: var(--pos-highlight, var(--primary-color, #587493));
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
body.store-front-container .product-slider-section-container .wx-section-more-link:hover {
    background: var(--pos-highlight, var(--primary-color, #587493));
    border-color: var(--pos-highlight, var(--primary-color, #587493));
    color: #ffffff;
    filter: none;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    --wx-cover-stage-pad: 0;
    --wx-card-content-inset-x: 8px;
    --wx-cover-stage-radius: 14px;
    --wx-card-unit-radius: 0;
    --wx-card-btn-radius: 14px;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-img-box,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-img-wrapper,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-image-wrapper {
    display: block !important;
    position: relative !important;
    padding: 0 !important;
    margin: 0 0 var(--wx-card-media-info-gap, 8px) 0 !important;
    overflow: hidden !important;
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    background: var(--wx-cover-stage-bg, #ffffff) !important;
    border: var(--wx-cover-stage-border, 1px solid rgba(148, 155, 162, 0.28)) !important;
    border-radius: var(--wx-cover-stage-radius, 14px) !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-img-box .wx-card-detail-link--media,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-img-wrapper .wx-card-detail-link--media,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-image-wrapper .wx-card-detail-link--media {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-img-box img,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-img-wrapper img,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-image-wrapper img,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-img-box .img-fluid,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .wx-card-detail-link--media img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    border-radius: var(--wx-cover-stage-radius, 14px) !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .wx-card-content-col {
    border-radius: 0 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-img-box,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-img-wrapper,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-image-wrapper {
    border: var(--wx-cover-stage-border, 1px solid rgba(148, 155, 162, 0.28)) !important;
    border-radius: var(--wx-cover-stage-radius, 14px) !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-btn,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .btn-submit-order {
    border-radius: var(--wx-card-btn-radius, 14px) !important;
}

@media (min-width: 768px) and (max-width: 1199px) {
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767px) {
    /* 手機 2 欄只在這檔寫；分類／phase1 不要再 !important 覆寫同一組 */
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card {
        overflow: visible !important;
        justify-content: flex-start !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .product-action-btn-wrap {
        margin-top: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (min-width: 768px) {
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col .product-info-content,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col .card-body {
        padding-left: var(--wx-card-content-inset-x, 6px) !important;
        padding-right: var(--wx-card-content-inset-x, 6px) !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .product-action-btn-wrap {
        display: block !important;
        margin-left: calc(-1 * var(--wx-card-btn-bleed, 4px)) !important;
        margin-right: calc(-1 * var(--wx-card-btn-bleed, 4px)) !important;
        width: calc(100% + (2 * var(--wx-card-btn-bleed, 4px))) !important;
        max-width: calc(100% + (2 * var(--wx-card-btn-bleed, 4px))) !important;
        margin-top: auto !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-title-row .card-title,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-title-row .product-title {
        font-size: 14px !important;
        line-height: 1.35 !important;
        min-height: var(--wx-card-title-block, 2.8em) !important;
        max-height: var(--wx-card-title-block, 2.8em) !important;
        text-align: center !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .card-price,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .product-price {
        font-size: 16px !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .card-btn,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .btn-submit-order {
        min-height: 36px !important;
        height: 36px !important;
        max-height: 36px !important;
        font-size: 13px !important;
        line-height: 1 !important;
        padding: 0 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .platform-badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-title-row .wx-channel-status-badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }
}

@media (min-width: 768px) {
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card:hover,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card:hover .wx-card-content-col {
        box-shadow: none !important;
        background: transparent !important;
    }
}

/* 同一列卡片等高，按鈕貼底對齊（不受平台標／品名行數影響） */
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid {
    align-items: stretch !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card-item-wrap,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card-wrapper {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .wx-card-content-col {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .wx-card-content-col .product-info-content,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .wx-card-content-col .card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-action-btn-wrap {
    margin-top: auto !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-title-row .card-title,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-title-row .product-title {
    min-height: var(--wx-card-title-block, 2.8em) !important;
    max-height: var(--wx-card-title-block, 2.8em) !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-price,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-price {
    min-height: var(--wx-card-price-row-h, 28px) !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 17px !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-price:not(.card-price--inquiry),
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-price:not(.card-price--inquiry) {
    color: var(--wx-card-price-color, #d1434f) !important;
    font-weight: 700 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-price--inquiry,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .product-price.card-price--inquiry {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-height: 22px !important;
    height: 22px !important;
    padding: 0 11px !important;
    border-radius: 999px !important;
    border: 1px solid var(--wx-card-inquiry-border, var(--pos-highlight, #587493)) !important;
    background: var(--wx-card-inquiry-bg, transparent) !important;
    color: var(--wx-card-inquiry-color, var(--pos-highlight, #587493)) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em !important;
    line-height: 1 !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-btn,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .btn-submit-order,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .btn-preorder {
    border: 1px solid var(--pos-highlight, var(--primary-color, #587493)) !important;
    background: var(--pos-highlight, var(--primary-color, #587493)) !important;
    color: #ffffff !important;
    border-radius: var(--wx-card-btn-radius, 14px) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
}

:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .card-btn:hover,
:is(
    body.store-front-container .product-slider-section-container.wx-home-section-grid,
    body.wx-static-body .catalog-theme-page,
    body.wx-static-body .preorder-list-container
) .wx-home-product-grid .product-card .btn-submit-order:hover {
    background: color-mix(in srgb, var(--pos-highlight, var(--primary-color, #587493)) 82%, #1e293b) !important;
    border-color: color-mix(in srgb, var(--pos-highlight, var(--primary-color, #587493)) 82%, #1e293b) !important;
    color: #ffffff !important;
    box-shadow: none !important;
    filter: none !important;
}

@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-areas: "media" "info" !important;
        row-gap: var(--wx-card-media-info-gap, 8px) !important;
        column-gap: 0 !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col > .product-action-btn-wrap {
        grid-area: media !important;
        align-self: end !important;
        justify-self: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: 4 !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card:hover .wx-card-content-col > .product-action-btn-wrap,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card:focus-within .wx-card-content-col > .product-action-btn-wrap {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col > .product-action-btn-wrap .card-btn,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col > .product-action-btn-wrap .btn-submit-order,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col > .product-action-btn-wrap .card-btn:hover,
    :is(
        body.store-front-container .product-slider-section-container.wx-home-section-grid,
        body.wx-static-body .catalog-theme-page,
        body.wx-static-body .preorder-list-container
    ) .wx-home-product-grid .product-card .wx-card-content-col > .product-action-btn-wrap .btn-submit-order:hover {
        border-radius: var(--wx-card-btn-overlay-radius, 0 0 14px 14px) !important;
    }
}
