/* Page Design Blocks Common Styles */

/* ── CSS 變數（preview_style 可覆蓋以切換 PC 模式）── */
:root {
    --product-grid-cols: repeat(2, 1fr);
    --h-scroll-item-w: clamp(100px, 45%, 200px);
}

@media (min-width: 992px) {
    :root {
        --product-grid-cols: repeat(4, 1fr);
        --h-scroll-item-w: 250px;
    }
}

#blocksContainer {
    background: #fff;
    min-height: 400px;
}

/* Block Universal */
.block-unit {
    position: relative;
}

.block-title-wrap {
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

.block-content-inner {
    width: 100%;
    transition: padding 0.2s;
}

/* Banner */
.swiper-banner {
    position: relative;
    background: #eee;
    overflow: hidden;
}

.swiper-banner .swiper-slide img {
    width: 100%;
    display: block;
}

/* Video */
.video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: var(--product-grid-cols);
    gap: 10px;
    margin: 0;
    container-type: inline-size; /* 讓 @container 依格線寬度觸發，非 viewport */
}

/* Menu */
.menu-wrapper {
    display: flex;
    align-items: stretch;
    width: 100%;
    flex-wrap: wrap;
}

.menu-item img {
    width: 100%;
    display: block;
    object-fit: contain;
}

/* Horizontal Scroll Products */
.h-scroll-wrap {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 0;
}

.h-scroll-wrap::-webkit-scrollbar {
    height: 0;
}

.h-scroll-item {
    flex: 0 0 auto;
    width: var(--h-scroll-item-w);
    margin-right: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    /* container-type 故意不加：h-scroll 永遠窄，加了 @container 會一直觸發手機 layout */
}

.h-scroll-item .tk-product-card { flex: 1; min-width: 0; }

.h-scroll-item .product-img-wrap {
    border-radius: 8px;
    overflow: hidden;
}

.h-scroll-item .product-img-wrap img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.h-scroll-item .product-cart-btn {
    padding: 4px 0;
}

.h-scroll-item .product-price-row {
    flex-wrap: wrap;
    gap: 2px 4px;
    min-width: 0;
}

.h-scroll-item .product-price {
    font-size: 12px;
    min-width: 0;
    word-break: keep-all;
    overflow-wrap: break-word;
}