/*
 * Soltan product catalogue refinement
 * Shared by public merchant storefronts (/s/{slug}) and the Soltan homepage.
 * Presentation only: no form, cart, checkout, pricing or merchant theme data is changed.
 */

/* Merchant storefront: compact, aligned product cards. */
.public-storefront .public-store-collection {
    width: 100%;
    max-width: 1180px;
    box-sizing: border-box;
    margin-inline: auto;
}

.public-storefront .public-store-product-grid {
    justify-content: center;
    align-items: stretch;
    gap: 18px;
    margin-inline: auto;
}

.public-storefront .public-store-product-grid.columns-four {
    grid-template-columns: repeat(4, minmax(0, 250px));
}

.public-storefront .public-store-product-grid.columns-three {
    grid-template-columns: repeat(3, minmax(0, 250px));
}

.public-storefront .public-store-product-grid.columns-two {
    grid-template-columns: repeat(2, minmax(0, 250px));
}

.public-storefront .public-store-product {
    width: 100%;
    max-width: 250px;
    justify-self: center;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}

.public-storefront .public-store-product-link {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.public-storefront .public-store-product-image,
.public-storefront .public-store-product-placeholder {
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    max-height: 188px;
    padding: 14px;
    object-fit: contain;
    object-position: center;
    background: #f3f4f6;
    border: 0;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.public-storefront .public-store-product-image {
    display: block;
    transition: transform .25s ease;
}

.public-storefront .public-store-product:hover .public-store-product-image {
    transform: scale(1.025);
}

.public-storefront .public-store-product-copy {
    gap: 7px;
    padding: 13px 14px 10px;
}

.public-storefront .public-store-product-copy h3 {
    min-height: 2.5em;
    font-size: 14px;
    line-height: 1.3;
}

.public-storefront .public-store-product-copy p {
    min-height: 3em;
    font-size: 11px;
    line-height: 1.45;
}

.public-storefront .public-store-product-copy strong {
    padding-top: 3px;
    font-size: 16px;
}

.public-storefront .public-store-add-form {
    gap: 7px;
    padding: 8px 12px 13px;
}

.public-storefront .public-store-add-form input {
    width: 43px;
    min-height: 38px;
}

.public-storefront .public-store-add-form .public-store-button {
    min-height: 38px;
    font-size: 11px;
}

/* Merchant product images: use the same fixed 4:3 image stage as the homepage.
   The wrapper, rather than the image's intrinsic dimensions, controls the layout. */
.public-storefront .public-store-product-media {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 13px;
    overflow: hidden;
    background: #f1f3f6;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.public-storefront .public-store-product-media .public-store-product-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: auto;
    padding: 0;
    border: 0;
    background: transparent;
    object-fit: contain;
    object-position: center;
    transition: transform .25s ease;
}

.public-storefront .public-store-product:hover .public-store-product-media .public-store-product-image {
    transform: scale(1.025);
}

.public-storefront .public-store-product-media .public-store-product-placeholder {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

/* Homepage marketplace: same image treatment and a smaller catalogue scale. */
.marketplace-section .market-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 245px));
    justify-content: center;
    align-items: stretch;
    gap: 18px;
    max-width: 1120px;
    margin-inline: auto;
}

.marketplace-section .market-product-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .09);
    transition: transform .2s ease, box-shadow .2s ease;
}

.marketplace-section .market-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .14);
}

.marketplace-section .market-product-image {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    padding: 13px;
    overflow: hidden;
    background: #f1f3f6;
}

.marketplace-section .market-product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform .25s ease;
}

.marketplace-section .market-product-card:hover .market-product-image img {
    transform: scale(1.025);
}

.marketplace-section .market-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.marketplace-section .market-product-info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 13px 14px 15px;
}

.marketplace-section .market-product-info h3 {
    min-height: 2.5em;
    margin: 3px 0;
    font-size: 14px;
    line-height: 1.3;
}

.marketplace-section .market-product-info > b {
    margin-top: auto;
    font-size: 16px;
}

.marketplace-section .market-view {
    margin-top: 7px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .public-storefront .public-store-product-grid.columns-four,
    .public-storefront .public-store-product-grid.columns-three {
        grid-template-columns: repeat(2, minmax(0, 250px));
    }

    .marketplace-section .market-product-grid {
        grid-template-columns: repeat(2, minmax(0, 245px));
    }
}

@media (max-width: 560px) {
    .public-storefront .public-store-collection {
        width: min(100% - 28px, 100%);
    }

    .public-storefront .public-store-product-grid,
    .public-storefront .public-store-product-grid.columns-four,
    .public-storefront .public-store-product-grid.columns-three,
    .public-storefront .public-store-product-grid.columns-two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }

    .public-storefront .public-store-product {
        max-width: none;
    }

    .public-storefront .public-store-product-media {
        padding: 9px;
    }

    .public-storefront .public-store-product-media .public-store-product-image,
    .public-storefront .public-store-product-media .public-store-product-placeholder {
        padding: 0;
    }

    .public-storefront .public-store-product-copy {
        padding: 11px 10px 8px;
    }

    .public-storefront .public-store-product-copy h3 {
        font-size: 12px;
    }

    .public-storefront .public-store-product-copy p {
        font-size: 10px;
    }

    .public-storefront .public-store-product-copy strong {
        font-size: 14px;
    }

    .public-storefront .public-store-add-form {
        gap: 5px;
        padding: 7px 9px 10px;
    }

    .public-storefront .public-store-add-form input {
        width: 37px;
        min-height: 35px;
        padding: 5px;
    }

    .public-storefront .public-store-add-form .public-store-button {
        min-height: 35px;
        padding-inline: 5px;
        font-size: 10px;
    }

    .marketplace-section .market-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }

    .marketplace-section .market-product-image {
        padding: 9px;
    }

    .marketplace-section .market-product-info {
        gap: 4px;
        padding: 10px;
    }

    .marketplace-section .market-product-info h3 {
        font-size: 12px;
    }

    .marketplace-section .market-product-info > b {
        font-size: 14px;
    }

    .marketplace-section .market-view {
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .public-storefront .public-store-product-grid,
    .public-storefront .public-store-product-grid.columns-four,
    .public-storefront .public-store-product-grid.columns-three,
    .public-storefront .public-store-product-grid.columns-two,
    .marketplace-section .market-product-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-storefront .public-store-product-image,
    .marketplace-section .market-product-card,
    .marketplace-section .market-product-image img {
        transition: none;
    }

    .public-storefront .public-store-product:hover .public-store-product-image,
    .marketplace-section .market-product-card:hover,
    .marketplace-section .market-product-card:hover .market-product-image img {
        transform: none;
    }
}


/* Guaranteed visible product-detail link on every merchant product card.
   Keep this after all catalogue rules so older card-height rules cannot hide it. */
body.storefront-body .public-storefront .public-store-product {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0;
}

body.storefront-body .public-storefront .public-store-product > .public-store-product-link {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
}

body.storefront-body .public-storefront .public-store-product > .public-store-view-product {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    align-items: center;
    align-self: flex-start;
    gap: 7px;
    min-height: 34px;
    margin: 0 14px 9px;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    background: transparent !important;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,.72);
    text-underline-offset: 4px;
    cursor: pointer;
}

body.storefront-body .public-storefront .public-store-product > .public-store-view-product:hover {
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    background: transparent !important;
    text-decoration-color: #fff;
    transform: translateX(2px);
}

body.storefront-body .public-storefront .public-store-product > .public-store-view-product:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

@media (max-width: 560px) {
    body.storefront-body .public-storefront .public-store-product > .public-store-view-product {
        min-height: 32px;
        margin: 0 10px 8px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.storefront-body .public-storefront .public-store-product > .public-store-view-product {
        transition: none;
    }
}
