.nmso-grid {
    display: grid;
    width: 100%;
    /* Kolumny i gap są ustawiane przez PHP */
}

.nmso-item {
    position: relative;
    overflow: hidden; /* Kluczowe: wszystko co wychodzi poza kafel, znika */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    display: block; /* Dla tagu <a> */
    text-decoration: none;
}

/* Nakładka */
.nmso-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    /* Domyślnie schowana gdzieś daleko, JS ustawi ją na start */
    transform: translate(-100%, -100%); 
    
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    
    /* Płynność ruchu */
    transition: transform 0.3s ease-out;
    pointer-events: none; /* Myszka ma widzieć rodzica, nie overlay */
}

.nmso-content {
    max-width: 100%;
}

.nmso-title {
    margin: 0 0 10px 0;
    font-size: 1.5em;
    font-weight: 700;
}

.nmso-desc {
    font-size: 1em;
    line-height: 1.4;
}

/* --- WERSJA MOBILNA I TABLETOWA (poniżej 1024px) --- */
@media (max-width: 1024px) {
    .nmso-overlay {
        /* 1. Nadpisujemy style inline dodawane przez JS (transform) */
        transform: translate(0, 0) !important;
        transition: none !important;

        /* 2. Pozycjonowanie na dole */
        top: auto;
        bottom: 0;
        
        /* 3. Wysokość - "na 30% banera", ale elastycznie */
        height: auto;
        min-height: 30%; 
        
        /* 4. Wygląd */
        align-items: center; /* Wyśrodkowanie treści w pionie */
        padding: 15px;
        
        /* Opcjonalnie: lekki cień, żeby oddzielić tekst od zdjęcia, jeśli tło jest półprzezroczyste */
        box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    }

    /* Opcjonalnie: Zmniejszamy trochę tytuł na mobile */
    .nmso-title {
        font-size: 1.2em; 
        margin-bottom: 5px;
    }
    
    .nmso-desc {
        font-size: 0.9em;
    }
}