/**
 * Sukkah Murals - customer photo galleries
 *
 * Two galleries rendered by Mural_Woo_Order_Customer_Gallery:
 *   1. the flickity carousel in the product page sidebar
 *   2. the masonry grid on the /customer-gallery page
 *
 * Loaded only on single product pages and the customer gallery page, which
 * is the same condition that loads flickity and lightbox2.
 *
 * Design tokens come from site-style.css, declared as a dependency.
 *
 * @package  Mural Woo Order
 */

/* ==========================================================================
   Product page carousel
   The section is rendered twice - once inside
   .product-customer-gallery-outer-desktop and once outside it - and the copy
   that does not suit the viewport is hidden. Both copies are in the DOM.
   ========================================================================== */

.customer-images-section {
    display: block;
    margin-bottom: 3em;
}

.product-customer-gallery-outer-desktop {
    margin-top: 2em;
}

.product-customer-gallery-outer-desktop .customer-images-section {
    display: none;
}

@media (min-width: 1025px) {
    .customer-images-section {
        display: none;
    }

    .product-customer-gallery-outer-desktop .customer-images-section {
        display: block;
    }
}

.customer-image-wrapper {
    width: 150px;
    height: 150px;
    margin-right: 1em;
    overflow: hidden;
    position: relative;
}

.customer-image-wrapper img {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    object-fit: cover;
}

/* ==========================================================================
   Customer gallery page - masonry grid
   Column widths are also read by assets/js/masonry-init.js, which uses
   .customer-gallery-image-wrapper as both itemSelector and columnWidth.
   ========================================================================== */

.customer-gallery-images-section {
    display: block;
}

/* One column on mobile, three from 768px up */
.customer-gallery-image-wrapper {
    width: calc(100% - 20px);
    margin: 10px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .customer-gallery-image-wrapper {
        width: calc(33.33% - 20px);
    }
}

.customer-gallery-image-wrapper a {
    cursor: zoom-in;
}

.customer-gallery-image-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.customer-gallery-image-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1em;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.customer-gallery-image-wrapper:hover .customer-gallery-image-overlay {
    opacity: 1;
}

/* No hover on touch devices, so the overlay is always visible */
@media (max-width: 767px) {
    .customer-gallery-image-overlay {
        opacity: 1;
    }
}

.customer-gallery-image-overlay h4 {
    color: #fff;
    margin: 0;
    padding: 0;
}

.customer-gallery-image-order-btn {
    background-color: var(--sukkah-cream);
    color: var(--sukkah-ink);
    padding: .3em 1em;
    margin-top: 10px;
    border: none;
    text-decoration: none;
    cursor: pointer !important;
}
