:root {
    --moleskine-catalog-background: #fff;
    --moleskine-catalog-text: #171515;
    --moleskine-catalog-focus: #2458d3;
}

body.moleskine-category-active {
    background: var(--moleskine-catalog-background);
}

/* Keep the category toolbar flush with the header across Astra layouts.
 * Only reset the top spacing of content wrappers, never the header or cards.
 * Astra's layout/inline rules can otherwise restore their 4em top spacing.
 */
body.moleskine-category-active #content.site-content,
body.moleskine-category-active #content.site-content > .ast-container,
body.moleskine-category-active #primary,
body.moleskine-category-active #main.site-main,
body.moleskine-category-active .ast-woocommerce-container,
body.moleskine-category-active .moleskine-category-catalog {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.moleskine-category-active .site-content,
body.moleskine-category-active .site-content > .ast-container,
body.moleskine-category-active .ast-woocommerce-container,
body.moleskine-category-active .woocommerce-notices-wrapper {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

body.moleskine-category-active .site-content > .ast-container {
    display: block;
    padding: 0;
}

body.moleskine-category-active .ast-woocommerce-container {
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
}

body.moleskine-category-active #primary,
body.moleskine-category-active .moleskine-category-catalog {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
}

body.moleskine-category-active #secondary,
body.moleskine-category-active .woocommerce-breadcrumb,
body.moleskine-category-active .woocommerce-result-count,
body.moleskine-category-active .woocommerce-ordering {
    display: none !important;
}

body.moleskine-category-active .site-main,
body.moleskine-category-active .ast-woocommerce-container {
    overflow: hidden;
}

body.moleskine-category-active.woocommerce ul.products,
body.moleskine-category-active.woocommerce-page ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: calc(100% + 2px);
    margin: -1px !important;
    padding: 0 !important;
    list-style: none;
}

body.moleskine-category-active.woocommerce ul.products::before,
body.moleskine-category-active.woocommerce ul.products::after,
body.moleskine-category-active.woocommerce-page ul.products::before,
body.moleskine-category-active.woocommerce-page ul.products::after {
    display: none !important;
    content: none !important;
}

body.moleskine-category-active.woocommerce ul.products li.product.moleskine-product-card,
body.moleskine-category-active.woocommerce-page ul.products li.product.moleskine-product-card {
    position: relative;
    display: flex;
    float: none !important;
    flex-direction: column;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    padding: 32px !important;
    border: 1px solid #fff;
    background: var(--moleskine-catalog-background);
    color: var(--moleskine-catalog-text);
}

body.moleskine-category-active .moleskine-product-link {
    display: flex;
    flex: 1;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

body.moleskine-category-active .moleskine-product-visuals {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 16px;
    overflow: hidden;
    background: #fff;
}

body.moleskine-category-active .moleskine-product-image,
body.moleskine-category-active.woocommerce ul.products li.product .moleskine-product-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    object-fit: contain;
    object-position: center;
    transition: opacity 280ms ease;
}

body.moleskine-category-active .moleskine-product-image--primary {
    opacity: 1;
}

body.moleskine-category-active .moleskine-product-image--hover {
    opacity: 0;
}

body.moleskine-category-active .moleskine-product-card.has-secondary-image:hover .moleskine-product-image--primary,
body.moleskine-category-active .moleskine-product-card.has-secondary-image:focus-within .moleskine-product-image--primary {
    opacity: 0;
}

body.moleskine-category-active .moleskine-product-card.has-secondary-image:hover .moleskine-product-image--hover,
body.moleskine-category-active .moleskine-product-card.has-secondary-image:focus-within .moleskine-product-image--hover {
    opacity: 1;
}

body.moleskine-category-active.woocommerce ul.products li.product .moleskine-product-title,
body.moleskine-category-active.woocommerce-page ul.products li.product .moleskine-product-title {
    margin: 0;
    padding: 0;
    color: var(--moleskine-catalog-text);
    font-family: "Brandon Grotesque", BrandonGrotesque, var(--ast-body-font-family, sans-serif);
    /* Same responsive title size as Home Manager product cards. */
    font-size: clamp(15px, 1.2vw, 19px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
}

body.moleskine-category-active .moleskine-product-link:focus-visible {
    outline: 3px solid var(--moleskine-catalog-focus);
    outline-offset: -3px;
}

.moleskine-category-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 196px;
    padding: 44px 20px 54px;
    text-align: center;
}

.moleskine-load-more {
    min-width: 124px;
    min-height: 46px;
    padding: 11px 25px;
    border: 1px solid var(--moleskine-catalog-text);
    border-radius: 0;
    background: var(--moleskine-catalog-text);
    color: #fff;
    font: 700 14px/1 var(--ast-body-font-family, sans-serif);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.moleskine-load-more:hover,
.moleskine-load-more:focus-visible {
    background: #fff;
    color: var(--moleskine-catalog-text);
}

.moleskine-load-more:focus-visible {
    outline: 3px solid var(--moleskine-catalog-focus);
    outline-offset: 3px;
}

.moleskine-load-more[aria-busy="true"] {
    cursor: wait;
    opacity: 0.65;
}

.moleskine-product-count,
.moleskine-load-error {
    margin: 0;
    color: #575252;
    font-size: 14px;
    line-height: 1.4;
}

.moleskine-load-error {
    max-width: 42rem;
    color: #a32020;
}

@media (max-width: 1023px) {
    body.moleskine-category-active.woocommerce ul.products,
    body.moleskine-category-active.woocommerce-page ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Keep long mobile names inside the card without overriding the Home scale. */
@media (max-width: 767px) {
    body.moleskine-category-active.woocommerce ul.products li.product .moleskine-product-title,
    body.moleskine-category-active.woocommerce-page ul.products li.product .moleskine-product-title {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 600px) {
    body.moleskine-category-active.woocommerce ul.products,
    body.moleskine-category-active.woocommerce-page ul.products {
        grid-template-columns: minmax(0, 1fr);
    }

    .moleskine-category-pagination {
        min-height: 172px;
        padding-top: 38px;
        padding-bottom: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.moleskine-category-active .moleskine-product-image,
    .moleskine-load-more {
        transition-duration: 0.01ms !important;
    }
}
