/* Section Nos Produits */
.products {
    padding: 2rem 0;
    background-image: url('../assets/images/motifs1.svg');
    background-size: 1600px;
    background-repeat: repeat;
    position: relative;
}

.products::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    z-index: 1;
}

.products .container {
    position: relative;
    z-index: 2;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 3rem;
}

.products .section-title {
    position: relative;
    z-index: 2;
    color: var(--color-black);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15),
                 0 0 20px rgba(255, 255, 255, 0.9);
    font-family: var(--font-decorative);
    font-size: 4rem;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.products-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin-top: 1.5rem;
    max-width: 100%;
    position: relative;
}

.products-category {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 2rem;
}

.category-title {
    text-align: center;
    margin-bottom: 1rem;
    color: black;
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: normal;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.products-category.savory .products-grid {
    grid-template-columns: repeat(2, 1fr);
    /* Pour s'assurer que la grille elle-même est centrée si elle ne prend pas toute la largeur */
    /* Ou que les items sont bien répartis. Avec repeat(2, 1fr) et width: 100% pour .products-grid, */
    /* les deux cartes devraient occuper l'espace. Si on veut plus d'espace autour, */
    /* on pourrait ajouter un max-width plus petit à cette grille spécifique et margin: auto, */
    /* ou jouer avec le padding/gap. Pour l'instant, changer le nombre de colonnes devrait suffire */
    /* à les réaligner. Si elles doivent être centrées dans un espace plus large, il faudra ajuster. */
}

.product-card {
    width: 100%;
    height: 250px;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.product-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1rem;
    overflow: hidden;
}

.card-front {
    background-color: var(--color-beige);
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    font-family: var(--font-decorative);
    font-size: 1.8rem;
    text-align: center;
    margin: 0;
}

.card-back {
    background-color: var(--color-beige);
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.card-back .background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.15;
    z-index: 0;
}

.product-description {
    position: relative;
    z-index: 1;
    color: white;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
    max-width: 90%;
}

@media (max-width: 992px) {
    .products {
        padding: 2rem 0;
    }

    .products .container {
        padding: 0 1.5rem;
    }

    .products-grid {
        gap: 1rem;
    }

    .products .section-title {
        font-size: 3rem;
    }

    .category-title {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .product-card {
        height: 220px;
    }

    .product-name {
        font-size: 1.5rem;
        padding: 1.25rem;
    }

    .card-back {
        padding: 1.5rem;
    }

    .product-description {
        font-size: 0.9rem;
        line-height: 1.35;
    }
}

@media (max-width: 768px) {
    .products {
        padding: 1.5rem 0;
    }

    .products .container {
        padding: 0 1rem;
    }

    .products-categories {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .products-categories::after {
        display: none;
    }

    .products-category {
        padding: 0;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .products-category.savory .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-card {
        height: 180px;
    }

    .products .section-title {
        font-size: 2.5rem;
    }

    .category-title {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .product-name {
        font-size: 1.3rem;
        padding: 1rem;
    }

    .card-back {
        padding: 1.25rem;
    }

    .product-description {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .products {
        padding: 1rem 0;
    }

    .products .container {
        padding: 0 0.75rem;
    }

    .products-categories {
        gap: 2rem;
    }
    
    .products-grid,
    .products-category.savory .products-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .product-card {
        height: 180px;
    }

    .products .section-title {
        font-size: 2rem;
    }

    .category-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .product-name {
        font-size: 1.2rem;
        padding: 0.75rem;
    }

    .card-back {
        padding: 1rem;
    }

    .product-description {
        font-size: 0.8rem;
        line-height: 1.25;
        max-width: 95%;
    }

    .card-inner {
        transition: transform 0.6s;
    }
}
