/* Category Grid - Reusable Component */

.category-grid {
    --category-grid-gap: 10px;

    display: flex;
    flex-wrap: nowrap;
    gap: var(--category-grid-gap);
    margin-top: 24px;
    overflow: auto hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.products-section .category-grid {
    gap: var(--category-grid-gap);
}

.category-grid .product-card {
    flex: 0 0 calc((100% - (var(--category-grid-gap) * 2)) / 3);
    position: relative;
    display: flex;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 0;
    background:
        linear-gradient(140deg, rgba(0, 108, 172, 0.92), rgba(9, 46, 78, 0.88)),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
    box-shadow: none;
    isolation: isolate;
    will-change: opacity, transform;
    min-height: 410px;
    scroll-snap-align: start;
}

.category-grid .product-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--product-card-image);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transform: scale(1.01);
    transition: transform 0.45s ease;
    z-index: -3;
}

.category-grid .product-card:nth-child(2) {
    background:
        linear-gradient(
            160deg,
            rgba(181, 111, 15, 0.9),
            rgba(120, 73, 10, 0.86)
        ),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
}

.category-grid .product-card:nth-child(3) {
    background:
        linear-gradient(150deg, rgba(12, 73, 101, 0.9), rgba(11, 37, 56, 0.88)),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
}

.category-grid .product-card:nth-child(4) {
    background:
        linear-gradient(145deg, rgba(80, 20, 10, 0.9), rgba(50, 15, 8, 0.88)),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
}

.category-grid .product-card:nth-child(5) {
    background:
        linear-gradient(155deg, rgba(20, 60, 80, 0.9), rgba(15, 40, 55, 0.88)),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
}

.category-grid .product-card:nth-child(6) {
    background:
        linear-gradient(150deg, rgba(60, 40, 20, 0.9), rgba(40, 25, 12, 0.88)),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0)
        );
}

.category-grid .product-card-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            rgba(6, 17, 25, 0.34),
            rgba(6, 17, 25, 0.42) 42%,
            rgba(6, 17, 25, 0.64)
        ),
        linear-gradient(90deg, rgba(6, 17, 25, 0.2), rgba(6, 17, 25, 0.1));
    z-index: -2;
}

.category-grid .product-card-inner {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 48px 46px 30px;
    color: #fff;
    z-index: 1;
}

.category-grid .product-card-eyebrow {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.category-grid .product-card h3 {
    width: 100%;
    min-height: 2.3em;
    margin: 0;
    display: block;
    color: #fff;
    text-align: center;
    font-size: clamp(2rem, 2.45vw, 3.25rem);
    line-height: 1.12;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

.category-grid .product-card-copy {
    width: 100%;
    max-width: 27rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.96);
    text-align: left;
    font-size: clamp(1rem, 1.08vw, 1.15rem);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-grid .product-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    min-height: 52px;
    margin-top: auto;
    padding: 0 24px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: lowercase;
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity 0.28s ease,
        transform 0.28s ease,
        background-color 0.28s ease,
        border-color 0.28s ease;
}

.category-grid .product-card-link {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.category-grid .product-card:hover::before,
.category-grid .product-card:focus-within::before {
    transform: scale(1.06);
}

.category-grid .product-card:hover .product-card-button,
.category-grid .product-card:focus-within .product-card-button {
    opacity: 1;
    transform: translateY(0);
}

.category-grid .product-card:hover .product-card-button {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.92);
}

@media (prefers-reduced-motion: reduce) {
    .category-grid .product-card {
        opacity: 1;
        transform: none;
        transition: none;
        will-change: auto;
    }
}

@media (max-width: 1100px) {
    .category-grid .product-card {
        flex-basis: calc((100% - var(--category-grid-gap)) / 2);
        border-radius: 0;
    }
}

@media (max-width: 860px) {
    .category-grid {
        --category-grid-gap: 12px;
    }

    .category-grid .product-card {
        flex-basis: 100%;
    }

    .category-grid .product-card-inner {
        padding: 34px 24px 24px;
    }

    .category-grid .product-card h3 {
        font-size: clamp(1.8rem, 7.2vw, 2.6rem);
        line-height: 1.15;
    }

    .category-grid .product-card-copy {
        max-width: none;
        text-wrap: pretty;
    }

    .category-grid .product-card-button {
        opacity: 1;
        transform: translateY(0);
    }
}
