/* ============================================================
   NewBlock — изолированные стили галереи (без Tailwind)
   Все классы prefixed с nb- чтобы не конфликтовать с Bootstrap
   ============================================================ */

/* --- Layout: слайд (текст слева + сетка справа) --- */
.nb-slide {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

/* Swiper slide не должен обрезать галерею */
.section-newblock .swiper {
    overflow: hidden !important;
}
.section-newblock .swiper-slide {
    height: auto !important;
    overflow: visible !important;
}
@media (max-width: 991px) {
    .section-newblock .swiper {
        overflow: visible !important;
    }
    .section-newblock .swiper-slide {
        height: auto !important;
    }
}
.section-newblock {
    overflow: visible !important;
}
.section-newblock .container {
    overflow: visible;
}

.nb-text {
    flex: 0 0 33.333%;
    max-width: 33.333%;
}

.nb-gallery-wrap {
    flex: 1;
    min-width: 0;
}

/* --- Воздух в текстовом блоке --- */
.nb-text .service-slide-info {
    padding: 0;
}

.nb-text .service-slide-title {
    margin-bottom: 24px;
}

.nb-text .service-slide-desc {
    margin-bottom: 32px;
    line-height: 1.8;
}

.nb-text .service-slide-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nb-text .service-slide-list li {
    padding: 10px 0 10px 16px;
    position: relative;
}

.nb-text .service-slide-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--primary, #07C42C);
}

/* --- Навигация (справа, над слайдами) --- */
.nb-nav-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.nb-nav-bar button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nb-nav-bar button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.nb-nav-bar button:active {
    transform: translateY(0);
}

.nb-nav-bar button i {
    font-size: 16px;
}

/* --- Пагинация (слева, под текстом) — квадратные точки --- */
.nb-pagination {
    width: calc(33.333% - 32px);
    display: flex !important;
    gap: 10px;
    margin-top: 24px;
    position: static !important;
}

.nb-pagination .swiper-pagination-bullet {
    width: 10px !important;
    height: 10px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    opacity: 1 !important;
    margin: 0 !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
}

.nb-pagination .swiper-pagination-bullet-active {
    background: var(--primary, #07C42C) !important;
    width: 10px !important;
    height: 10px !important;
    border-radius: 2px !important;
    opacity: 1 !important;
}

/* --- Контейнер галереи --- */
.nb-gallery {
    width: 100%;
    height: auto;
    container-type: inline-size;
    position: relative;
    margin-top: 8px;
    overflow: visible;
}

.nb-grid {
    position: relative;
    height: 100%;
    width: 100%;
    display: grid;
    gap: 12px;
    grid-template-columns: 32cqmin 32cqmin 32cqmin;
    padding: 0 0 0 8px;
    transition: all 0.5s ease-in-out;
    overflow: visible;
}

/* Column expand on hover */
.nb-grid:has(.nb-col:nth-child(1):hover) {
    grid-template-columns: 60cqmin 15cqmin 15cqmin;
}
.nb-grid:has(.nb-col:nth-child(2):hover) {
    grid-template-columns: 15cqmin 60cqmin 15cqmin;
}
.nb-grid:has(.nb-col:nth-child(3):hover) {
    grid-template-columns: 15cqmin 15cqmin 60cqmin;
}

/* --- Glow фон (отключён) --- */

/* --- Колонка --- */
.nb-col {
    display: grid;
    gap: 12px;
    grid-template-rows: 28cqmin 28cqmin 28cqmin;
    transition: all 0.5s ease-in-out;
    position: relative;
    z-index: 1;
}

.nb-col:has(.nb-card:nth-child(1):hover) {
    grid-template-rows: 56cqmin 14cqmin 14cqmin;
}
.nb-col:has(.nb-card:nth-child(2):hover) {
    grid-template-rows: 14cqmin 56cqmin 14cqmin;
}
.nb-col:has(.nb-card:nth-child(3):hover) {
    grid-template-rows: 14cqmin 14cqmin 56cqmin;
}

/* --- Карточка --- */
.nb-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    height: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.nb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease-in-out;
    transform: scale(1);
}

.nb-grid:hover .nb-card img {
    transform: scale(1);
}

.nb-grid:hover .nb-card:hover img {
    transform: scale(1.2);
    transition-delay: 0.3s;
}

/* --- Video card --- */
.nb-card-video {
    display: grid;
    container-type: inline-size;
}

.nb-card-video .nb-video-logo {
    position: absolute;
    width: 80%;
    place-self: center;
    z-index: 10;
}

.nb-card-video video {
    object-fit: cover;
    width: 100%;
    height: 100%;
    filter: brightness(0.5) contrast(1.5) saturate(0);
}

/* --- Responsive --- */
@media (max-width: 991px) {
    /* ── Слайд: вертикальный стек без лишних отступов ── */
    .nb-slide {
        flex-direction: column;
        gap: 0;
        height: auto;
    }

    /* ── Галерея сверху ── */
    .nb-gallery-wrap {
        flex: 0 0 auto !important;
        max-width: 100%;
        order: -1;
        width: 100%;
        padding: 0 10px;
        margin-bottom: 0;
        box-sizing: border-box;
        height: 45vh !important;
        min-height: 0 !important;
        max-height: 45vh !important;
    }

    /* ── Текст снизу ── */
    .nb-text {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        order: 1;
        width: 100%;
        padding-top: 48px;
        height: auto !important;
        min-height: 0 !important;
    }

    .nb-text .service-slide-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .nb-text .service-slide-desc {
        margin-bottom: 16px;
        font-size: 14px;
        line-height: 1.6;
    }

    .nb-text .service-slide-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 16px;
    }

    .nb-text .service-slide-list li {
        padding: 4px 0 4px 12px;
        font-size: 13px;
    }

    /* ── Галерея: полная сетка 3x3 без скролла ── */
    .nb-gallery {
        height: auto;
        min-height: 0;
        container-type: normal;
        overflow: visible;
    }

    .nb-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 10px;
        overflow: visible;
        padding: 0;
        height: auto !important;
    }

    /* Отключаем hover-расширение колонок */
    .nb-grid:has(.nb-col:nth-child(1):hover),
    .nb-grid:has(.nb-col:nth-child(2):hover),
    .nb-grid:has(.nb-col:nth-child(3):hover) {
        grid-template-columns: repeat(3, 1fr);
    }

    .nb-col {
        flex: none;
        display: grid;
        grid-template-rows: repeat(3, 1fr);
        gap: 10px;
    }

    .nb-col .nb-card {
        margin-bottom: 0;
        height: 100%;
        aspect-ratio: 1 / 1;
        cursor: pointer;
        transition: transform 0.2s ease;
    }

    .nb-col .nb-card:active {
        transform: scale(0.97);
    }

    .nb-col .nb-card img,
    .nb-col .nb-card video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: pointer;
    }

    /* Отключаем hover-зум карточек на мобильных */
    .nb-grid:hover .nb-card img,
    .nb-grid:hover .nb-card:hover img {
        transform: scale(1) !important;
        transition: none !important;
    }

    .nb-card img {
        transition: none !important;
    }

    /* Отключаем hover-расширение колонок на мобильных */
    .nb-grid:hover {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .nb-col:hover {
        grid-template-rows: auto !important;
    }

    /* Видео на мобильных — чуть темнее и ниже */
    .nb-card-video video {
        filter: brightness(0.7) contrast(1.2) saturate(0.8);
    }

    /* ── Навигация: крупные кнопки по центру ── */
    .nb-nav-bar {
        justify-content: center;
        margin-bottom: 16px;
    }

    .nb-nav-bar button {
        padding: 14px 24px;
        font-size: 14px;
        min-height: 48px;
        border-radius: 10px;
    }

    /* ── Пагинация: крупные точки, по центру ── */
    .nb-pagination {
        width: 100%;
        justify-content: center;
        margin-top: 16px;
    }

    .nb-pagination .swiper-pagination-bullet {
        width: 12px !important;
        height: 12px !important;
    }

    /* ── Мобильный лайтбокс ── */
    .nb-lightbox {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        z-index: 10000;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-sizing: border-box;
    }

    .nb-lightbox.is-open {
        display: flex;
    }

    .nb-lightbox-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
    }

    .nb-lightbox-close {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 10001;
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 28px;
        color: #fff;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nb-lightbox-img {
        position: relative;
        z-index: 10001;
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
        animation: nbLightboxIn 0.3s ease;
    }

    @keyframes nbLightboxIn {
        from { opacity: 0; transform: scale(0.9); }
        to { opacity: 1; transform: scale(1); }
    }
}

/* Десктоп — отключаем курсор и active-эффект на картинках */
@media (min-width: 992px) {
    .nb-col .nb-card {
        cursor: default;
        transition: none;
    }
    
    .nb-col .nb-card:active {
        transform: none;
    }
    
    .nb-col .nb-card img,
    .nb-col .nb-card video {
        cursor: default;
    }
}

/* Полностью отключаем hover-эффекты на тач-устройствах */
@media (hover: none) {
    .nb-grid,
    .nb-col,
    .nb-card,
    .nb-card img {
        transition: none !important;
    }
    .nb-grid:hover,
    .nb-col:hover {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: auto !important;
    }
    .nb-card:hover img,
    .nb-grid:hover .nb-card:hover img {
        transform: scale(1) !important;
    }
}

@media (max-width: 360px) {
    .nb-slide {
        height: 520px;
    }
    .nb-gallery {
        height: 260px;
    }
    .nb-text {
        min-height: 220px;
        max-height: 220px;
    }
    .nb-text .service-slide-list {
        grid-template-columns: 1fr;
    }
}
