/* Page mécaniques — grilles de vignettes et cartes cliquables */

.mechanics-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin: 0 auto;
    max-width: 900px;
}

/* Flex + justify-content: center : dernière ligne incomplète centrée automatiquement */
.mechanics-grid-item {
    position: relative;
    overflow: hidden;
    flex: 0 0 calc((min(100%, 900px) - 50px) / 3);
    max-width: calc((900px - 50px) / 3);
    width: calc((min(100%, 900px) - 50px) / 3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 16px;
    aspect-ratio: 1 / 1;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mechanics-grid-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: var(--card-bg-image, none);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.mechanics-grid-item > * {
    position: relative;
    z-index: 1;
}

.mechanics-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.mechanics-grid-item h2 {
    color: white;
    font-size: 1.2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
    line-height: 1.25;
}

.mechanics-grid-item p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    line-height: 1.35;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    margin: 0;
}

@media (max-width: 768px) {
    .mechanics-grid-item {
        flex: 0 0 calc((100% - 25px) / 2);
        max-width: calc((100% - 25px) / 2);
        width: calc((100% - 25px) / 2);
    }

    .mechanics-grid-item h2 {
        font-size: 1.05rem;
    }

    .mechanics-grid-item p {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .mechanics-grid-item {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}
