/**
 * Garnr grouped product page: palette + filters + grouped product list.
 *
 * Extracted from storefront-garnr assets/app.css and made self-contained:
 * the desktop column widths that used to come from the Storefront parent
 * theme are now included here (see "Grid layout" below), so nothing in
 * this file depends on Storefront or Blocksy internals.
 */

/* ------------------------------------------------------------------ */
/* Grid layout for the grouped product list (and palette list)        */
/* ------------------------------------------------------------------ */

ul.grouped-products {
    display: flex !important;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin-left: -10px;
    margin-right: -10px;
}

ul.grouped-products .product {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 15px;
    transition: box-shadow 0.3s, background 0.3s;
    text-align: center;
}

/* Desktop: 5 columns (previously provided by Storefront's .columns-5) */
ul.grouped-products.columns-5 .product {
    flex: 1 0 20%;
    max-width: 20%;
}

.woocommerce-grouped-product-list .image-wrapper img {
    height: 290px !important;
}

@media (max-width: 960px) {
    ul.grouped-products .product {
        flex: 1 0 33.3333333333% !important;
        max-width: 33.3333333333% !important;
        padding: 0 !important;
    }
}

@media (max-width: 700px) {
    ul.grouped-products .product {
        flex: 1 0 50% !important;
        max-width: 50% !important;
        padding: 0 !important;
    }
}

@media (max-width: 350px) {
    ul.grouped-products .product {
        flex: 1 0 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
}

ul.grouped-products .product > * {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 0 !important;
}

ul.grouped-products .product > *:first-child {
    padding-top: 10px;
}

ul.grouped-products .product:hover {
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
    background: #fff;
}

ul.grouped-products .product .price {
    width: 100%;
    margin: 0 !important;
    font-size: 18px;
    font-weight: 400;
}

@media (max-width: 1024px) {
    ul.grouped-products .product .price {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    ul.grouped-products .product .price {
        font-size: 14px;
    }
}

ul.grouped-products .product .stock {
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Grouped product list + palette: shared item styles                 */
/* ------------------------------------------------------------------ */

.woocommerce-grouped-product-list.hide-out-of-stock .product.outofstock {
    display: none;
}

.woocommerce-grouped-product-list,
.palette {
    clear: both;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item form,
.palette .woocommerce-grouped-product-list-item form {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item img,
.palette .woocommerce-grouped-product-list-item img {
    order: 1;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item__label,
.palette .woocommerce-grouped-product-list-item__label {
    order: 2;
    margin-bottom: 5px;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item__label a,
.palette .woocommerce-grouped-product-list-item__label a {
    color: inherit;
    font-weight: inherit;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item__quantity,
.palette .woocommerce-grouped-product-list-item__quantity {
    order: 3;
    margin-bottom: 5px;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item .single_add_to_cart_button,
.palette .woocommerce-grouped-product-list-item .single_add_to_cart_button {
    order: 4;
}

.woocommerce-grouped-product-list .woocommerce-grouped-product-list-item__stock,
.palette .woocommerce-grouped-product-list-item__stock {
    order: 5;
    margin-top: 5px;
}

.woocommerce-grouped-product-list .added_to_cart,
.palette .added_to_cart {
    display: none;
}

.woocommerce-grouped-product-list .image-wrapper,
.palette .image-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

.woocommerce-grouped-product-list .image-wrapper img,
.palette .image-wrapper img {
    margin: 0 !important;
}

/* ------------------------------------------------------------------ */
/* Palette buttons inside the product list                            */
/* ------------------------------------------------------------------ */

.woocommerce-grouped-product-list .add-to-palette {
    position: absolute;
    top: 10px;
    right: 10px;
    height: 50px;
    width: 50px;
    background-color: transparent;
    background-image: url("./images/palette-white.svg");
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    border: 0 !important;
    padding: 0 !important;
    appearance: none;
    cursor: pointer;
}

.woocommerce-grouped-product-list .remove-from-palette,
.woocommerce-grouped-product-list .move-up,
.woocommerce-grouped-product-list .move-down {
    display: none;
}

.woocommerce-grouped-product-list .palette-confirmation {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    text-align: center;
    padding: 10px 10px;
    margin: 0;
    z-index: 1;
    transform: translateY(100%);
    transition: transform 200ms;
}

.woocommerce-grouped-product-list .added-to-palette .palette-confirmation {
    transform: translateY(0%);
}

/* ------------------------------------------------------------------ */
/* Custom controls (toggle switches + sort select)                    */
/* ------------------------------------------------------------------ */

.custom-control {
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 15px;
}

.custom-control.filter-out-of-stock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 10px;
}

.custom-control.filter-out-of-stock .product-children-in-stock-count {
    font-weight: 400;
    text-transform: initial;
    font-style: italic;
    flex-grow: 1;
    text-align: left;
}

.custom-control .label {
    vertical-align: middle;
}

.custom-control .switch {
    display: inline-block;
    position: relative;
    height: 30px;
    width: 60px;
    border: 1px solid #5b5b5a !important;
    background-color: transparent;
    border-radius: 15px;
    vertical-align: middle;
    margin: 0 35px 0 5px;
    text-transform: uppercase;
    color: inherit;
    cursor: pointer;
}

.custom-control .switch::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-color: #5b5b5a;
    border-radius: 50%;
    transition: left 100ms;
}

.custom-control .switch .on,
.custom-control .switch .off {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}

.custom-control .switch .on {
    display: none;
}

.custom-control .switch .off {
    display: inline-block;
}

.storefront-sorting.custom-control {
    float: none;
    position: relative;
    font-size: 14px;
    margin: 0 0 10px 0 !important;
    padding: 0;
}

/* Switch "on" state */
.toggle-mode-on .switch::after {
    left: calc(100% - 24px);
}

.toggle-mode-on .switch .on {
    display: inline-block;
}

.toggle-mode-on .switch .off {
    display: none;
}

/* ------------------------------------------------------------------ */
/* Filter bar                                                         */
/* ------------------------------------------------------------------ */

section.filter {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: start;
}

@media (max-width: 639px) {
    section.filter > *:last-child {
        margin-bottom: 0 !important;
    }
}

@media (min-width: 640px) {
    section.filter {
        flex-direction: row !important;
        align-items: center !important;
    }
}

/* ------------------------------------------------------------------ */
/* Palette section                                                    */
/* ------------------------------------------------------------------ */

.palette {
    border: 1px solid #ccc;
    padding: 0 10px;
    margin-bottom: 20px;
	margin-top: 30px;
	background-color: #fff;
}

@media (min-width: 701px) {
    .palette {
        padding: 0 20px;
    }
}

.palette .top-bar {
    margin: 20px 0;
    padding-left: 10px;
    padding-right: 10px;
}

@media (min-width: 701px) {
    .palette .top-bar {
        display: flex;
        align-items: center;
        margin: 10px 0;
    }
}

.palette .top-bar .instructions {
    padding: 60px 0 15px;
    position: relative;
    margin-right: auto;
    margin-bottom: 0;
    flex: 1;
    max-width: 800px;
}

@media (min-width: 701px) {
    .palette .top-bar .instructions {
        padding: 20px 40px 20px 65px;
    }
}

.palette .top-bar .instructions::before {
    content: "";
    display: inline-block;
    height: 50px;
    width: 50px;
    background-image: url("./images/palette-black.svg");
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

@media (min-width: 701px) {
    .palette .top-bar .instructions::before {
        height: 60px;
        width: 60px;
        top: 50%;
        left: -10px;
        transform: translateY(-50%);
    }
}

.palette .top-bar .instructions p {
    margin: 0;
}

.palette .top-bar .instructions .step-2 {
    display: none;
}

/* The contrast mode toggle is only shown once items are in the palette */
.palette .top-bar .contrast-mode {
    display: none;
}

.palette .grouped-products {
    margin: 0;
}

.palette .grouped-products img {
    transition: filter 100ms;
}

.palette .grouped-products .add-to-palette,
.palette .grouped-products .palette-confirmation {
    display: none;
}

.palette .grouped-products .remove-from-palette {
    position: absolute;
    top: 10px;
    right: 10px;
    height: 40px;
    width: 40px;
    background-color: #fff;
    border: 0 !important;
    padding: 0 !important;
    appearance: none;
    z-index: 1;
    opacity: 0.6;
    cursor: pointer;
}

.palette .grouped-products .remove-from-palette::before,
.palette .grouped-products .remove-from-palette::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: calc(50% - 1px);
    width: 2px;
    background-color: #333;
}

.palette .grouped-products .remove-from-palette::before {
    transform: rotate(45deg);
}

.palette .grouped-products .remove-from-palette::after {
    transform: rotate(-45deg);
}

.palette .grouped-products .move-up,
.palette .grouped-products .move-down {
    position: absolute;
    height: 40px;
    width: 40px;
    background-color: #fff;
    border: 0 !important;
    padding: 0 !important;
    appearance: none;
    z-index: 1;
    opacity: 0.6;
    cursor: pointer;
}

.palette .grouped-products .move-up::after,
.palette .grouped-products .move-down::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: calc(50% - 8px);
    left: calc(50% - 8px);
    height: 16px;
    width: 16px;
    border-top: 2px solid #000;
    border-right: 2px solid #000;
}

.palette .grouped-products .move-up {
    bottom: 60px;
    right: 10px;
}

.palette .grouped-products .move-up::after {
    margin-left: 0;
    margin-top: 5px;
    transform: rotate(-45deg);
}

@media (min-width: 351px) {
    .palette .grouped-products .move-up::after {
        margin-left: 5px;
        margin-top: 0;
        transform: rotate(-135deg);
    }
}

.palette .grouped-products .move-down {
    bottom: 10px;
    right: 10px;
}

.palette .grouped-products .move-down::after {
    margin-left: 0;
    margin-top: -5px;
    transform: rotate(135deg);
}

@media (min-width: 351px) {
    .palette .grouped-products .move-down::after {
        margin-left: -5px;
        margin-top: 0;
        transform: rotate(45deg);
    }
}

.palette.items-added .top-bar .contrast-mode {
    display: block;
}

.palette.items-added .top-bar .instructions .step-1 {
    display: none;
}

.palette.items-added .top-bar .instructions .step-2 {
    display: block;
}

.palette.toggle-mode-on .grouped-products img {
    filter: grayscale(100%);
}
