/* Shared storefront cards, including related products on detail pages. */

:is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card {
    isolation: isolate;
    border-color: #d2e0f5;
    border-radius: 20px;
    box-shadow: 0 10px 26px rgba(30, 64, 175, .065);
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

:is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card::after {
    content: '';
    position: absolute;
    z-index: 3;
    top: 0;
    left: 22px;
    right: 22px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, transparent, #0051bb, transparent);
    opacity: 0;
    transform: scaleX(.45);
    transition: opacity .28s ease, transform .28s ease;
    pointer-events: none;
}

:is(.shop-catalog, .design-catalog) .product-img-wrap::after {
    display: none;
}

:is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card :is(.product-image-wrap, .product-img-wrap) img {
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    filter: drop-shadow(0 12px 16px rgba(15, 23, 42, .10));
    transition: transform .38s ease, filter .38s ease;
}

:is(.shop-catalog, .design-catalog) .products-grid .btn-select {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #0051bb;
    box-shadow: none;
}

:is(.shop-catalog, .design-catalog) .products-grid .btn-info {
    border: 1px solid #dfe3ea;
    background: #fff;
    color: #172033;
    box-shadow: none;
}

:is(.shop-catalog, .design-catalog) .products-grid .product-card.selected {
    border-color: #0051bb;
    box-shadow: 0 0 0 3px rgba(0, 81, 187, .15), 0 10px 26px rgba(30, 64, 175, .1);
}


/* Keep the selection indicator for selected items, not decorative hover. */

:is(.shop-catalog, .design-catalog) .product-card:not(.selected) .product-select-check {
    opacity: 0;
}

@media (min-width: 721px) {
     :is(.shop-catalog, .design-catalog) .products-grid:not(.list-view) .product-img-wrap {
        display: grid;
        grid-template: minmax(0, 1fr) / minmax(0, 1fr);
        place-items: center;
        height: 212px;
        min-height: 0;
        flex: 0 0 212px;
        aspect-ratio: auto;
        padding: 22px;
    }
     :is(.shop-catalog, .design-catalog) .products-grid:not(.list-view) .product-img-wrap img {
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
        max-width: 168px;
        max-height: 168px;
    }
     :is(.shop-catalog, .design-catalog) .products-grid:not(.list-view) .product-info {
        padding: 17px 16px 10px;
    }
     :is(.shop-catalog, .design-catalog) .products-grid .product-cat-tag {
        min-height: 0;
        font-size: 13px;
        font-weight: 400;
        color: #374151;
    }
     :is(.shop-catalog, .design-catalog) .products-grid .product-name {
        min-height: 20px;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.4;
    }
     :is(.shop-catalog, .design-catalog) .products-grid .product-price {
        font-weight: 700;
    }
     :is(.shop-catalog, .design-catalog) .products-grid:not(.list-view) .product-footer {
        display: grid;
        grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
        gap: 8px;
        margin-top: auto;
        padding: 0 16px 16px;
    }
     :is(.shop-catalog, .design-catalog) .products-grid :is(.btn-select, .btn-info) {
        min-width: 0;
        min-height: 42px;
        padding: 8px;
        border-radius: 12px;
        font-size: 12px !important;
        font-weight: 600;
        line-height: 1.2;
        white-space: normal;
    }
     :is(.shop-catalog, .design-catalog) .products-grid .btn-select>i {
        display: none;
    }
}

@media (hover: hover) and (pointer: fine) {
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:hover {
        transform: translateY(-6px);
        border-color: #7aa5e8;
        box-shadow: 0 20px 42px rgba(30, 64, 175, .14);
    }
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:hover::after {
        opacity: 1;
        transform: scaleX(1);
    }
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:hover :is(.product-image-wrap, .product-img-wrap) img {
        transform: translateY(-3px) scale(1.055);
        filter: drop-shadow(0 16px 20px rgba(15, 23, 42, .14));
    }
}

:is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:focus-within {
    border-color: #7aa5e8;
    box-shadow: 0 20px 42px rgba(30, 64, 175, .14);
}

:is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:focus-within::after {
    opacity: 1;
    transform: scaleX(1);
}

:is(.shop-catalog, .design-catalog) .products-grid .btn-select:hover {
    border-color: #0051bb;
    background: #0051bb;
    color: #fff;
}

:is(.shop-catalog, .design-catalog) .products-grid .btn-info:hover {
    border-color: #cdd3dd;
    background: #f3f5f8;
    box-shadow: 0 7px 16px rgba(15, 23, 42, .07);
    transform: none;
}

@media (hover: none),
(prefers-reduced-motion: reduce) {
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:hover,
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card:hover :is(.product-image-wrap, .product-img-wrap) img {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card,
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card::after,
     :is(.home-modern-theme, .shop-catalog, .design-catalog) .product-card :is(.product-image-wrap, .product-img-wrap) img {
        transition: none;
    }
}


/* Related products use the same card classes without affecting the detail viewer. */

.related-section .related-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.related-section .related-card {
    position: relative;
    min-width: 0;
    min-height: 0;
}

.related-section .related-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 17px 16px 16px;
}

.related-section .related-cat {
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 400;
    color: #374151;
    overflow-wrap: anywhere;
}

.related-section .related-name {
    font-size: 14px;
    font-weight: 600;
}

.related-section .related-price {
    font-weight: 500 !important;
    overflow-wrap: anywhere;
}

.related-section .related-footer {
    padding-top: 0;
}

.related-section .related-actions {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    margin-top: 10px;
}

.related-section .related-action {
    min-width: 0;
    text-align: center;
    line-height: 1.2;
}

.related-section .related-action:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

@media (max-width: 991px) {
    .related-section .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .related-section .related-grid {
        gap: 12px;
    }
    .related-section .related-head {
        flex-wrap: wrap;
        gap: 12px;
    }
    .related-section .related-img {
        display: grid;
        grid-template: minmax(0, 1fr) / minmax(0, 1fr);
        place-items: center;
        height: clamp(140px, 40vw, 240px);
        flex: 0 0 clamp(140px, 40vw, 240px);
        padding: 12px;
    }
    .related-section .related-img img {
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
        max-width: 100%;
        max-height: 100%;
    }
    .related-section .related-body {
        padding: 10px;
    }
    .related-section .related-cat {
        font-size: 10px;
    }
    .related-section .related-name {
        font-size: 12px;
    }
    .related-section .related-actions {
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 6px;
    }
    .related-section .related-action {
        min-height: 44px;
        padding: 6px 4px;
        font-size: 11px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .related-section .related-action-secondary {
        width: 44px;
        padding: 0;
    }
    .related-section .related-action-secondary span {
        display: none;
    }
    .related-section .related-action-secondary i {
        font-size: 20px;
    }
}

@media (max-width: 360px) {
    .related-section .related-grid {
        gap: 8px;
    }
    .related-section .related-body {
        padding: 8px;
    }
    .related-section .related-actions {
        gap: 4px;
    }
}