/* SPACEL_STOREFRONT_BOOKFIRST_UI_V3_20260822
   Unified public storefront product cards.
   Goal: the book cover is the dominant visual element, with two cards per row on mobile
   and a maximum of five cards per row on wide desktop screens. */

:root {
    --slv3-text: #1d1d1f;
    --slv3-muted: #6e6e73;
    --slv3-border: #e6e6e9;
    --slv3-soft: #f7f7f8;
    --slv3-action: #111827;
    --slv3-success: #166534;
    --slv3-danger: #b42318;
    --slv3-warning: #8a5a00;
}

body.sp-ios-storefront .products,
body.sp-ios-storefront .products-grid,
body.sp-ios-storefront .product-slider {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    align-items: stretch !important;
    min-width: 0 !important;
}

body.sp-ios-storefront .sl-product-card {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    border: 1px solid var(--slv3-border) !important;
    border-radius: 13px !important;
    background: #fff !important;
    color: var(--slv3-text) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035) !important;
    isolation: isolate !important;
    transform: none !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
}

body.sp-ios-storefront .sl-product-card::before,
body.sp-ios-storefront .sl-product-card::after {
    display: none !important;
    content: none !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__media,
body.sp-ios-storefront .sl-product-card .card-media {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid #efeff1 !important;
    background: #fff !important;
    box-shadow: none !important;
    isolation: isolate !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__media::before,
body.sp-ios-storefront .sl-product-card .sl-product-card__media::after,
body.sp-ios-storefront .sl-product-card .card-media::before,
body.sp-ios-storefront .sl-product-card .card-media::after {
    display: none !important;
    content: none !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.sp-ios-storefront .sl-product-card--book .sl-product-card__media {
    aspect-ratio: 2 / 3 !important;
    background: #fff !important;
}

body.sp-ios-storefront .sl-product-card--general .sl-product-card__media {
    aspect-ratio: 1 / 1 !important;
    background: var(--slv3-soft) !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__media-link {
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    color: inherit !important;
    text-decoration: none !important;
    background: transparent !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__image,
body.sp-ios-storefront .sl-product-card .card-media > a > img,
body.sp-ios-storefront .sl-product-card .card-media > img {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: transform .18s ease !important;
}

/* Many supplier images are square canvases containing a smaller 3D book render.
   The JS marks only square-ish book images and gives them a conservative visual zoom. */
body.sp-ios-storefront .sl-product-card--book .sl-product-card__media[data-sl-book-image="padded"] .sl-product-card__image {
    transform: scale(1.16) !important;
}

body.sp-ios-storefront .sl-product-card__discount {
    position: absolute !important;
    top: 7px !important;
    inset-inline-start: 7px !important;
    z-index: 5 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 25px !important;
    padding: 3px 7px !important;
    border-radius: 999px !important;
    background: #ef3340 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    direction: ltr !important;
    box-shadow: 0 3px 10px rgba(239, 51, 64, .18) !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__content,
body.sp-ios-storefront .sl-product-card .card-body {
    position: relative !important;
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 9px 9px 10px !important;
    overflow: visible !important;
    background: #fff !important;
}

body.sp-ios-storefront .sl-product-card__title-link {
    display: block !important;
    min-width: 0 !important;
    color: inherit !important;
    text-decoration: none !important;
}

body.sp-ios-storefront .sl-product-card .sl-product-card__title,
body.sp-ios-storefront .sl-product-card .title {
    display: -webkit-box !important;
    width: 100% !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    color: var(--slv3-text) !important;
    font-size: 12.5px !important;
    font-weight: 800 !important;
    line-height: 1.5 !important;
    letter-spacing: 0 !important;
    text-align: start !important;
    text-overflow: ellipsis !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    unicode-bidi: plaintext !important;
}

body.sp-ios-storefront .sl-product-card__author {
    display: block !important;
    min-width: 0 !important;
    min-height: 17px !important;
    margin-top: 3px !important;
    overflow: hidden !important;
    color: var(--slv3-muted) !important;
    font-size: 10.8px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    unicode-bidi: plaintext !important;
}

body.sp-ios-storefront .sl-product-card__price-row,
body.sp-ios-storefront .sl-product-card .price-row {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    width: 100% !important;
    margin-top: auto !important;
    padding-top: 7px !important;
}

body.sp-ios-storefront .sl-product-card__price,
body.sp-ios-storefront .sl-product-card .price {
    color: var(--slv3-text) !important;
    font-size: 13.5px !important;
    font-weight: 900 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
}

body.sp-ios-storefront .sl-product-card__old-price {
    color: #8e8e93 !important;
    font-size: 10px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    text-decoration: line-through !important;
    text-decoration-thickness: 1px !important;
}

body.sp-ios-storefront .sl-product-card__availability {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-height: 16px !important;
    margin-top: 4px !important;
    overflow: hidden !important;
    color: var(--slv3-muted) !important;
    font-size: 10px !important;
    font-weight: 750 !important;
    line-height: 1.3 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.sp-ios-storefront .sl-product-card__availability--ondemand strong {
    color: var(--slv3-warning) !important;
}

body.sp-ios-storefront .sl-product-card__availability--out {
    color: var(--slv3-danger) !important;
}

body.sp-ios-storefront .sl-product-card__action {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 40px !important;
    margin: 8px 0 0 !important;
    padding: 7px 9px !important;
    border: 1px solid var(--slv3-action) !important;
    border-radius: 9px !important;
    background: var(--slv3-action) !important;
    color: #fff !important;
    font: inherit !important;
    font-size: 11.5px !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    transition: transform .16s ease, opacity .16s ease, background .16s ease !important;
}

body.sp-ios-storefront .sl-product-card__action:disabled {
    cursor: not-allowed !important;
    opacity: .48 !important;
}

body.sp-ios-storefront .sl-product-card__action--options {
    background: #fff !important;
    color: var(--slv3-text) !important;
    border-color: #c7c7cc !important;
}

body.sp-ios-storefront .sl-product-card__action.is-loading {
    opacity: .64 !important;
    pointer-events: none !important;
}

body.sp-ios-storefront .sl-product-card__action.is-added {
    background: var(--slv3-success) !important;
    border-color: var(--slv3-success) !important;
}

body.sp-ios-storefront .sl-product-card__action-short {
    display: inline !important;
}

body.sp-ios-storefront .sl-product-card__action-full {
    display: none !important;
}

/* Featured shelf now uses the exact same product-card component. */
body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail {
    display: flex !important;
    gap: 9px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 1px 10px 8px !important;
    margin-inline: -10px !important;
    scroll-snap-type: x proximity !important;
    overscroll-behavior-inline: contain !important;
    scrollbar-width: none !important;
}

body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail::-webkit-scrollbar {
    display: none !important;
}

body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail > .sl-product-card {
    flex: 0 0 calc((100vw - 29px) / 2) !important;
    width: calc((100vw - 29px) / 2) !important;
    min-width: calc((100vw - 29px) / 2) !important;
    max-width: 230px !important;
    scroll-snap-align: start !important;
}

body.sp-ios-storefront .sl-card-skeleton {
    overflow: hidden !important;
    border: 1px solid var(--slv3-border) !important;
    border-radius: 13px !important;
    background: #fff !important;
}

body.sp-ios-storefront .sl-card-skeleton__media {
    aspect-ratio: 2 / 3 !important;
    background: linear-gradient(100deg, #f2f2f4 20%, #fafafa 38%, #f2f2f4 56%) !important;
    background-size: 220% 100% !important;
    animation: slv3-shimmer 1.15s linear infinite !important;
}

body.sp-ios-storefront .sl-card-skeleton__body {
    padding: 9px !important;
}

body.sp-ios-storefront .sl-card-skeleton__line {
    height: 10px !important;
    margin: 7px 0 !important;
    border-radius: 999px !important;
    background: #f0f0f2 !important;
}

body.sp-ios-storefront .sl-card-skeleton__line.short {
    width: 58% !important;
}

body.sp-ios-storefront .sl-card-skeleton__button {
    height: 40px !important;
    margin-top: 9px !important;
    border-radius: 9px !important;
    background: #f0f0f2 !important;
}

@keyframes slv3-shimmer {
    to { background-position-x: -220%; }
}

body.sp-ios-storefront .sl-product-card a:focus-visible,
body.sp-ios-storefront .sl-product-card button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28) !important;
    outline-offset: 2px !important;
}

@media (max-width: 359px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    body.sp-ios-storefront .sl-product-card .sl-product-card__content,
    body.sp-ios-storefront .sl-product-card .card-body {
        padding: 8px !important;
    }

    body.sp-ios-storefront .sl-product-card .sl-product-card__title,
    body.sp-ios-storefront .sl-product-card .title {
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 12px !important;
    }

    body.sp-ios-storefront .sl-product-card__price,
    body.sp-ios-storefront .sl-product-card .price {
        font-size: 13px !important;
    }

    body.sp-ios-storefront .sl-product-card__action {
        min-height: 38px !important;
        padding-inline: 6px !important;
    }

    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail > .sl-product-card {
        flex-basis: calc((100vw - 24px) / 2) !important;
        width: calc((100vw - 24px) / 2) !important;
        min-width: calc((100vw - 24px) / 2) !important;
    }
}

@media (min-width: 360px) and (max-width: 767px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 9px !important;
    }
}

@media (min-width: 768px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    body.sp-ios-storefront .sl-product-card .sl-product-card__content,
    body.sp-ios-storefront .sl-product-card .card-body {
        padding: 10px 11px 11px !important;
    }

    body.sp-ios-storefront .sl-product-card .sl-product-card__title,
    body.sp-ios-storefront .sl-product-card .title {
        min-height: 41px !important;
        max-height: 41px !important;
        font-size: 13.5px !important;
    }

    body.sp-ios-storefront .sl-product-card__author {
        font-size: 11.5px !important;
    }

    body.sp-ios-storefront .sl-product-card__price,
    body.sp-ios-storefront .sl-product-card .price {
        font-size: 14px !important;
    }

    body.sp-ios-storefront .sl-product-card__action-short {
        display: none !important;
    }

    body.sp-ios-storefront .sl-product-card__action-full {
        display: inline !important;
    }

    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px !important;
        margin-inline: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        scroll-snap-type: none !important;
    }

    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail > .sl-product-card {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: initial !important;
    }
}

@media (min-width: 1024px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }
}

@media (min-width: 1280px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 15px !important;
    }

    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 15px !important;
    }
}

@media (min-width: 1600px) {
    body.sp-ios-storefront .products,
    body.sp-ios-storefront .products-grid,
    body.sp-ios-storefront .product-slider,
    body.sp-ios-home .sp-ios-block--featured .sl-featured-product-rail {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 16px !important;
    }
}

@media (hover: hover) and (pointer: fine) {
    body.sp-ios-storefront .sl-product-card:hover {
        transform: translateY(-2px) !important;
        border-color: #d2d2d7 !important;
        box-shadow: 0 9px 26px rgba(15, 23, 42, .07) !important;
    }

    body.sp-ios-storefront .sl-product-card__action:hover {
        transform: translateY(-1px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.sp-ios-storefront .sl-product-card,
    body.sp-ios-storefront .sl-product-card__action,
    body.sp-ios-storefront .sl-product-card__image {
        transition: none !important;
    }

    body.sp-ios-storefront .sl-card-skeleton__media {
        animation: none !important;
    }
}