/* Consistent product-photo frames, independent of uploaded image dimensions. */
.woocommerce.single-product div.product div.images {
    --gk-photo-height: clamp(300px, 55vh, 440px);
    max-width: 560px;
}
.woocommerce.single-product div.product div.images:has(.flex-control-thumbs) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    column-gap: 12px;
    align-items: start;
}
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image,
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image--placeholder {
    height: var(--gk-photo-height);
    background: #f8f6fa;
    border-radius: 18px;
    overflow: hidden;
}
.woocommerce.single-product div.product div.images .flex-viewport {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    height: var(--gk-photo-height) !important;
    border-radius: 18px;
}
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image > a {
    display: block;
    width: 100%;
    height: 100%;
}
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image img:not(.zoomImg),
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image--placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: scale-down;
    object-position: center;
    border-radius: 0;
}
.woocommerce.single-product div.product div.images .flex-control-thumbs {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
    max-height: var(--gk-photo-height);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    margin: 0;
    padding: 0;
}
.woocommerce.single-product div.product div.images .flex-control-thumbs li {
    float: none;
    width: 64px;
    flex: 0 0 64px;
    margin: 0;
}
.woocommerce.single-product div.product div.images .flex-control-thumbs li img {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: #f8f6fa;
    border-radius: 8px;
}
.woocommerce.single-product div.product div.images:has(.flex-control-thumbs) .woocommerce-product-gallery__trigger {
    right: 86px;
}
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__trigger {
    top: 10px;
    z-index: 10;
    width: 40px;
    height: 40px;
    background: #fff;
    box-shadow: 0 2px 12px #30203d22;
}
.woocommerce.single-product div.product div.images .woocommerce-product-gallery__image img.zoomImg {
    max-width: none !important;
    max-height: none !important;
    border-radius: 0;
    pointer-events: none;
}
.gk-gallery-help {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #75677e;
}
.gk-gallery-help .gk-touch-help { display: none; }
@media (hover: none), (pointer: coarse) {
    .gk-gallery-help .gk-mouse-help { display: none; }
    .gk-gallery-help .gk-touch-help { display: inline; }
}
.pswp .pswp__button {
    min-width: 44px;
    min-height: 44px;
    border-radius: 0;
    transform: none;
}

/* Home, shop, category and related-product cards share a square image area. */
.woocommerce ul.products li.product a img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    object-position: center;
    background: #f8f6fa;
}

/* Classic cart and mini-cart thumbnails stay compact. */
.woocommerce table.shop_table .product-thumbnail { width: 96px; }
.woocommerce table.shop_table .product-thumbnail img {
    display: block;
    width: 72px;
    height: 72px;
    max-width: 100%;
    object-fit: contain;
    background: #f8f6fa;
    border-radius: 8px;
}
.woocommerce ul.cart_list li img,
.woocommerce ul.product_list_widget li img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #f8f6fa;
    border-radius: 8px;
}
.quick-layout img {
    height: 360px;
    min-height: 0;
    object-fit: contain;
    background: #f8f6fa;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .woocommerce.single-product div.product div.images {
        --gk-photo-height: clamp(280px, 52vh, 400px);
        max-width: 48%;
    }
}
@media (max-width: 768px) {
    .woocommerce.single-product div.product div.images {
        --gk-photo-height: min(400px, calc(100vw - 24px));
        float: none;
        width: 100%;
        max-width: 420px;
        margin: 0 auto 24px;
    }
    .woocommerce.single-product div.product div.images:has(.flex-control-thumbs) { display: block; }
    .woocommerce.single-product div.product div.images .flex-control-thumbs {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        margin-top: 10px;
        padding-bottom: 4px;
    }
    .woocommerce.single-product div.product div.images:has(.flex-control-thumbs) .woocommerce-product-gallery__trigger { right: 10px; }
    .woocommerce.single-product div.product div.summary {
        float: none;
        width: 100%;
        min-width: 0;
    }
    .woocommerce.single-product div.product div.images .flex-control-thumbs li,
    .woocommerce.single-product div.product div.images .flex-control-thumbs li img {
        width: 60px;
        height: 60px;
        flex-basis: 60px;
    }
    .woocommerce table.shop_table .product-thumbnail img { width: 56px; height: 56px; }
    .woocommerce table.shop_table_responsive tr td.product-thumbnail {
        display: block;
        width: auto;
        text-align: left !important;
    }
    .woocommerce table.shop_table_responsive tr td.product-thumbnail::before { display: none; }
    .quick-layout img { height: min(320px, calc(100vw - 36px)); max-height: 320px; }
}
