/* Shop and product category pages. Loaded only on product archives. */

.ast-woo-shop-archive {
    --mv-ink: #510000;
    --mv-ink-2: #6e2f2c;
    --mv-muted: #8f6f6b;
    --mv-line: #e4d9cf;
    --mv-peach: #ffc2b0;
}

/* Top of the page: the Customizer's Additional CSS adds 40px (!important) to the container
   and to the WooCommerce wrapper on top of Astra's 60px; keep only the 60px here. */
body.ast-woo-shop-archive:not(.fl-builder) #content.site-content > .ast-container {
    margin-top: 0 !important;
    margin-bottom: 0;
}

.ast-woo-shop-archive .ast-container .site-main .ast-woocommerce-container {
    margin-top: 0 !important;
    margin-bottom: 0;
}

.ast-woo-shop-archive #primary {
    margin-top: 60px;
    margin-bottom: 80px;
}

.ast-woo-shop-archive .woocommerce-breadcrumb {
    margin-bottom: 12px;
}

.ast-woo-shop-archive .woocommerce-products-header__title.page-title {
    margin: 0 0 24px;
    color: var(--mv-ink);
}

/* Category intro: readable line length. */
.ast-woo-shop-archive .term-description {
    max-width: 70ch;
    margin: 0 0 36px;
}

.ast-woo-shop-archive .term-description p:last-child {
    margin-bottom: 0;
}

/* Result count and sorting on one line. */
.ast-woo-shop-archive .woocommerce-result-count,
.ast-woo-shop-archive .woocommerce-ordering {
    margin: 0 0 28px;
    line-height: 40px;
}

.ast-woo-shop-archive .woocommerce-ordering select {
    height: 40px;
    line-height: 40px;
    padding-top: 0;
    padding-bottom: 0;
}

/* Product grid. Astra sets card display, widths and nth-child margins per breakpoint,
   hence the !important on those once the list is a grid. */
.ast-woo-shop-archive ul.products {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 48px 28px;
    margin: 0 0 48px;
}

.ast-woo-shop-archive ul.products::before,
.ast-woo-shop-archive ul.products::after {
    content: none;
}

.ast-woo-shop-archive ul.products li.product {
    display: flex !important;
    flex-direction: column;
    float: none;
    clear: none;
    width: auto !important;
    margin: 0 !important;
}

.ast-woo-shop-archive ul.products li.product a img {
    margin: 0 0 14px;
}

.ast-woo-shop-archive ul.products li.product .astra-shop-summary-wrap {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
}

.ast-woo-shop-archive ul.products li.product .ast-woo-product-category {
    max-width: 100%;
    margin: 0 0 4px;
    overflow: hidden;
    color: var(--mv-muted);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 1;
}

.ast-woo-shop-archive ul.products li.product .ast-loop-product__link {
    display: block;
}

.ast-woo-shop-archive ul.products li.product .woocommerce-loop-product__title {
    margin: 0 0 6px;
    line-height: 1.3;
}

.ast-woo-shop-archive ul.products li.product .price {
    display: block;
    margin: 0 0 16px;
}

/* Buttons sit on the bottom edge of the card, so a row ends on one line. */
.ast-woo-shop-archive ul.products li.product .button {
    margin: auto 0 0;
}

/* "Akcija" is longer than Astra's round badge was made for, so a pill. */
.ast-woo-shop-archive ul.products li.product .onsale {
    top: 12px;
    right: 12px;
    left: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 28px;
}

/* Pagination as pills, like the buttons. */
.ast-woo-shop-archive nav.woocommerce-pagination {
    text-align: center;
}

.ast-woo-shop-archive nav.woocommerce-pagination ul {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    border: 0;
}

.ast-woo-shop-archive nav.woocommerce-pagination ul li {
    float: none;
    margin: 0;
    border: 0;
    overflow: visible;
}

.ast-woo-shop-archive nav.woocommerce-pagination ul li a,
.ast-woo-shop-archive nav.woocommerce-pagination ul li span {
    min-width: 42px;
    padding: 11px 14px;
    border: 1.5px solid var(--mv-line);
    border-radius: 999px;
    background: #fff;
    color: var(--mv-ink);
    line-height: 1;
    transition: border-color 0.15s, background-color 0.15s;
}

.ast-woo-shop-archive nav.woocommerce-pagination ul li a:hover,
.ast-woo-shop-archive nav.woocommerce-pagination ul li a:focus {
    border-color: var(--mv-ink-2);
    background: #fff;
    color: var(--mv-ink);
}

.ast-woo-shop-archive nav.woocommerce-pagination ul li span.current {
    border-color: var(--mv-peach);
    background: var(--mv-peach);
    color: var(--mv-ink);
    font-weight: 700;
}

/* Tablet: Astra's tablet breakpoint and column count. */
@media (max-width: 921px) {
    .ast-woo-shop-archive #primary {
        margin-top: 40px;
        margin-bottom: 60px;
    }

    .ast-woo-shop-archive ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 40px 24px;
    }
}

/* Phones: two columns, no category line, full-width buttons. */
@media (max-width: 544px) {
    .ast-woo-shop-archive #primary {
        margin-top: 32px;
    }

    .ast-woo-shop-archive .woocommerce-products-header__title.page-title {
        margin-bottom: 16px;
    }

    .ast-woo-shop-archive .woocommerce-result-count,
    .ast-woo-shop-archive .woocommerce-ordering {
        float: none;
        margin-bottom: 8px;
    }

    .ast-woo-shop-archive .woocommerce-ordering {
        margin-bottom: 24px;
    }

    .ast-woo-shop-archive ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 14px;
    }

    .ast-woo-shop-archive ul.products li.product .ast-woo-product-category {
        display: none;
    }

    .ast-woo-shop-archive ul.products li.product a img {
        margin-bottom: 10px;
    }

    .ast-woo-shop-archive ul.products li.product .price {
        margin-bottom: 12px;
    }

    .ast-woo-shop-archive ul.products li.product .button {
        align-self: stretch;
        padding-right: 10px;
        padding-left: 10px;
        text-align: center;
    }
}
