/* ==========================================================================
   ДОБАВЬТЕ ЭТИ ПРАВИЛА В landing.css (не заменяет существующие .hero/.landing-* стили,
   только дополняет их — существующие отступы/цвета/шрифты трогать не пришлось).
   ========================================================================== */

/* --- Hero: видео вместо градиента ------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
}

.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* лёгкое затемнение поверх видео, чтобы текст оставался читаемым —
   подберите прозрачность под конкретное видео */
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(25, 61, 80, 0.75) 0%, rgba(25, 61, 80, 0.55) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* --- Новый блок "О проекте": шахматка факт/фото ------------------------ */
.landing-project-title {
    font-size: 32px;
    font-weight: 800;
    color: #193D50;
    margin: 8px 0 12px;
}

.landing-project-subtitle {
    font-size: 16px;
    color: #55697a;
    margin-bottom: 32px;
    max-width: 640px;
}

.landing-project-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-top: 1px solid #e3e8ec;
}

.landing-project-fact,
.landing-project-photo {
    min-height: 220px;
    box-sizing: border-box;
}

.landing-project-fact {
    padding: 28px 24px;
    background-color: #f7f5ef; /* тёплый светлый фон как на референсе */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.landing-project-fact-number {
    font-size: 28px;
    font-weight: 800;
    color: #193D50;
    margin-bottom: 10px;
}

.landing-project-fact-text {
    font-size: 14px;
    line-height: 1.5;
    color: #45555f;
    margin: 0;
}

.landing-project-photo {
    overflow: hidden;
}

.landing-project-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 900px) {
    .landing-project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .landing-project-grid {
        grid-template-columns: 1fr;
    }
    .landing-project-fact,
    .landing-project-photo {
        min-height: 180px;
    }
}

/* --- Блок "О платформе": новый стильный вид галереи ------------------ */
/* --- Блок "О платформе": многострочная адаптивная галерея-гармошка --- */
.landing-about-gallery {
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;       /* Разрешаем перенос карточек на новую строку */
    gap: 20px;             /* Слегка увеличили зазор для аккуратности */
    width: 100%;
}

.landing-gallery-card {
    /* Базовая ширина карточки в строке.
       calc(25% - 15px) означает, что по умолчанию в одной строке будет примерно 4 карточки */
    flex: 1 1 calc(25% - 15px);
    position: relative;
    height: 280px;         /* Оптимальная высота для многострочного режима */
    border-radius: 16px;
    overflow: hidden;
    cursor: zoom-in;
    background-color: #f0f4f7;
    transition: flex-grow 0.5s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.3s ease,
                box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(25, 61, 80, 0.05);
}

.landing-gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* Эффект расширения при наведении (теперь работает внутри каждой строки независимо) */
.landing-gallery-card:hover {
    flex-grow: 2;          /* Плавное увеличение в ширину */
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(25, 61, 80, 0.15);
}

.landing-gallery-card:hover img {
    transform: scale(1.05);
}

/* Красивое затемнение и текст/иконка */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(25, 61, 80, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.landing-gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-zoom {
    color: white;
    font-size: 15px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(4px);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.landing-gallery-card:hover .gallery-zoom {
    transform: scale(1);
}

/* Адаптивность для мобильных экранов и планшетов */
@media (max-width: 1024px) {
    .landing-gallery-card {
        /* На планшетах делаем по 3 карточки в ряд */
        flex: 1 1 calc(33.333% - 14px);
        height: 220px;
    }
}

@media (max-width: 768px) {
    .landing-gallery-card {
        /* На мобильных по 2 карточки в ряд и отключаем гармошку во избежание дерганья экрана */
        flex: none !important;
        width: calc(50% - 10px);
        height: 160px;
    }
    .landing-about-gallery {
        gap: 20px;
    }
    .landing-gallery-card:hover {
        transform: none;
    }
    .landing-gallery-card:hover img {
        transform: none;
    }
}

@media (max-width: 480px) {
    .landing-gallery-card {
        /* На совсем маленьких экранах — в 1 колонку */
        width: 100%;
        height: 200px;
    }
}

/* --- Галерея на мобильных: показываем только первые 4 карточки,
   остальные — по кнопке "Показать ещё" (иначе на мобилке разворачивается
   вся галерея разом, что избыточно и требует долгого скролла) --- */
.gallery-show-more-wrap {
    display: none;
}

@media (max-width: 768px) {
    .landing-gallery-card:nth-child(n + 5) {
        display: none;
    }

    .landing-about-gallery.gallery-expanded .landing-gallery-card {
        display: block;
    }

    .gallery-show-more-wrap {
        display: flex;
        justify-content: center;
        margin-top: 24px;
    }

    .gallery-show-more-btn {
        padding: 12px 32px;
        background: white;
        color: #193D50;
        border: 2px solid #193D50;
        border-radius: 14px;
        font-size: 15px;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        transition: background 0.2s, color 0.2s;
    }

    .gallery-show-more-btn:hover {
        background: #193D50;
        color: white;
    }
}

/* --- Стили модального окна (переиспользуются из newsObject) ----------- */
.news-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

.news-modal.show {
    opacity: 1;
    visibility: visible;
}

.news-modal-content {
    display: block;
    max-width: 90%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    cursor: default;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.94);
    transition: transform 0.25s ease;
}

.news-modal.show .news-modal-content {
    transform: scale(1);
}

.news-modal-close {
    position: fixed;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 38px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.2s;
}

.news-modal-close:hover {
    color: #ccc;
}

.news-modal-counter {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background-color: rgba(255, 255, 255, 0.14);
    padding: 6px 16px;
    border-radius: 50px;
    z-index: 1001;
}

.news-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background-color: rgba(25, 61, 80, 0.55);
    color: white;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.85;
    transition: background-color 0.2s, opacity 0.2s;
    z-index: 2;
}

.news-nav-arrow:hover {
    background-color: rgba(25, 61, 80, 0.85);
    opacity: 1;
}

.news-modal-nav {
    width: 52px;
    height: 52px;
    font-size: 26px;
    background-color: rgba(255, 255, 255, 0.12);
}

.news-modal-nav:hover {
    background-color: rgba(255, 255, 255, 0.28);
}

.news-modal-prev {
    left: 24px;
}

.news-modal-next {
    right: 24px;
}
