/* Основная сетка */
.grid {
    position: relative;
    margin: 0 auto;
    padding: 1em 0; /* Убираем нижний padding */
    max-width: 1000px;
    list-style: none;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px; /* Равные отступы между карточками */
}

/* Общий стиль для figure */
.grid figure {
    font-family: Tahoma, sans-serif;
    position: relative;
    overflow: hidden;
    margin: 0;
    background: #3085a3;
    text-align: center;
    cursor: pointer;
    width: calc(33.33% - 4px); /* 3 колонки с учетом gap */
    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;
}

/* Заголовок (надпись) */
.grid figure h2,
.grid figure h3 {
    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: #931313;
    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;
}

/* 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;
    }
}