/* --- /css/sections/product-categories.css --- */

.product-categories-section {
    padding: 10px 0;
    background-color: #ffffff; 
}

.product-categories-section .container {
    text-align: left;
}

.product-categories-section .section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-color);
}

.category-grid {
    display: grid;
    /* A 4-column grid provides flexibility for the collage */
    grid-template-columns: repeat(4, 1fr);
    /* Define grid rows to have a minimum height */
    grid-auto-rows: minmax(200px, auto);
    gap: 20px;
}

.category-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px; 
    text-decoration: none;
    color: #ffffff;
    display: flex; /* Use flexbox for better content control */
}

/* --- COLLAGE LAYOUT DEFINITIONS --- */
/* Make the 1st and 6th items larger */
.category-card:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
}
.category-card:nth-child(6) {
    grid-column: span 2;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.category-card:hover img {
    transform: scale(1.1);
}

.category-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.1));
    display: flex;
    align-items: flex-end;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.category-card:hover .category-card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.2));
}

.category-card-name {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: left;
}


/* --- Responsive Styles --- */

/* For Tablets: Simplify to a 2-column grid */
@media (max-width: 991px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Reset all special spanning for the tablet view */
    .category-card:nth-child(1),
    .category-card:nth-child(6) {
        grid-column: span 1;
        grid-row: span 1;
    }
    /* Force a consistent aspect ratio for a clean 2xN grid */
    .category-card {
        aspect-ratio: 4 / 3;
    }
}

/* For Mobile Phones: Simplify to a single column */
@media (max-width: 767px) {
    .category-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .product-categories-section .section-title {
        font-size: 2rem;
    }
    .category-card {
        aspect-ratio: 16 / 9; /* Use a wider aspect ratio for single column */
    }
}