/* Основная сетка */
.grid {
    position: relative;
    margin: 0 auto;
    /* ИЗМЕНЕНИЕ ЗДЕСЬ */
    /* Было: padding: 1em 0; */
    padding-top: 1em; /* Отступ сверху оставляем */
    padding-bottom: 0; /* Отступ снизу убираем полностью */

    max-width: 1000px;
    list-style: none;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

/* Общий стиль для figure */
    .grid figure {
        font-family: 'Oswald', sans-serif;
        position: relative;
        overflow: hidden;
        margin: 0;
        background: #3085a3;
        text-align: center;
        cursor: pointer;
        width: calc(25% - 4.5px); /* 4 колонки с учетом gap: 6px */
        box-sizing: border-box;
        transition: all 0.3s ease;
    }

/* Изображение внутри figure */
.grid figure img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100%;
    opacity: 0.8;
    object-fit: cover;
    transition: opacity 0.35s, transform 0.35s;
}
        /* Добавь это в CSS, чтобы picture не ломал верстку */
        .grid figure picture {
            display: block;
            width: 100%;
            height: 100%;
        }

/* Заголовок (надпись) */
        .grid figure h2,
        .grid figure h3 {
            font-weight: 300;
            /* Для надежности можно продублировать название шрифта здесь */
            font-family: 'Oswald', sans-serif;
            display: block;
            width: 100%;
            min-height: 35px;
            height: auto;
            max-height: 60px;
            color: #ffffff;
            font-size: 18px;
            line-height: 1.2;
            text-align: center;
            text-transform: uppercase;
            background-color: #2d2d2d;
            position: absolute;
            bottom: 0;
            left: 0;
            margin: 0;
            padding: 6px 0;
            z-index: 2;
            opacity: 0.8;
            box-sizing: border-box;
            word-break: break-word;
            overflow: hidden;
            transition: transform 0.35s;
            /* Клик на ссылку сквозь блок: */
            pointer-events: none;
        }

/* Caption и ссылка */
.grid figure figcaption::before,
.grid figure figcaption::after {
    pointer-events: none;
}

.grid figure figcaption,
.grid figure figcaption > a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.grid figure figcaption > a {
    text-indent: 200%;
    white-space: nowrap;
    font-size: 0;
    opacity: 0;
}

/***** Apollo *****/
figure.effect-apollo {
    background: #ffffff; /* Белый фон */
}

figure.effect-apollo img {
    opacity: 0.95;
    transform: scale3d(1.05, 1.05, 1);
    transition: opacity 0.35s, transform 0.35s;
}

figure.effect-apollo figcaption::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5); /* Прозрачный белый */
    content: '';
    transition: transform 0.6s;
    transform: scale3d(1.9, 1.4, 1) rotate(45deg) translate(0, -100%);
}

figure.effect-apollo h3,
figure.effect-apollo h2 {
    bottom: 0;
    left: 0;
    padding-left: 0;
}

/* Эффект при наведении */
figure.effect-apollo:hover img {
    opacity: 0.6;
    transform: scale3d(1, 1, 1);
}

figure.effect-apollo:hover figcaption::before {
    background: rgba(255, 255, 255, 1); /* Белый фон при наведении */
	opacity: 0.6;
    transform: scale3d(1.9, 1.4, 1) rotate(45deg) translate(0, 100%);
}

/***** Адаптация под мобильные устройства *****/
@media screen and (max-width: 800px) {
    .grid figure {
        width: calc(50% - 4px); /* 2 колонки */
    }

    .grid figure h2,
    .grid figure h3 {
        font-size: 16px;
        min-height: 35px;
        height: auto;
        padding: 6px 0;
        line-height: 1.2;
        word-break: break-word;
    }

    figure.effect-goliath p {
        display: none;
    }

    figure.effect-goliath:hover img,
    figure.effect-goliath:hover h2,
    figure.effect-goliath:hover h3 {
        transform: none;
    }
}

@media screen and (max-width: 500px) {
    .grid figure {
        width: calc(50% - 4px); /* 2 колонки */
    }

    .grid figure h2,
    .grid figure h3 {
        font-size: 14px;
        min-height: 35px;
        height: auto;
        padding: 6px 0;
        line-height: 1.2;
        word-break: break-word;
    }
}