/* ========================================
   ГАЛЕРЕЯ ПОРТФОЛИО (ФРОНТЕНД)
   ======================================== */

/* Сетка: 2 → 3 → 4 колонки */
.boat-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 768px) {
    .boat-gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
    .boat-gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Элемент: квадрат */
.boat-gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: box-shadow .3s;
}
.boat-gallery-item:hover {
    box-shadow: 0 12px 32px rgba(15, 76, 117, .15);
}

.boat-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.boat-gallery-item:hover img {
    transform: scale(1.1);
}

/* Иконка увеличения */
.boat-gallery-zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 46, 74, 0);
    color: #fff;
    font-size: 28px;
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
}
.boat-gallery-item:hover .boat-gallery-zoom {
    opacity: 1;
    background: rgba(10, 46, 74, .3);
}

/* Счётчик */
.boat-gallery-counter {
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
}

/* Пагинация */
.boat-gallery-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}
.boat-gallery-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #0A2E4A;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all .2s;
}
.boat-gallery-btn:hover {
    border-color: #B87333;
    color: #B87333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 115, 51, .15);
}
.boat-gallery-btn.current {
    background: linear-gradient(135deg, #B87333, #9A6129);
    border-color: #B87333;
    color: #fff;
}

/* ========================================
   ЛАЙТБОКС-КАРУСЕЛЬ (v3.1)
   ======================================== */
#boat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .94);
    padding: 0;                 /* 🆕 было 20px — соседи выглядывали в полях */
    touch-action: none;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
#boat-lightbox.open { display: flex; }

#boat-lb-track {
    position: relative;
    z-index: 1;                 /* 🆕 трек НИЖЕ кнопок */
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    transform: translateX(-100%);
    will-change: transform, opacity;
}

.boat-lb-slide {
    flex: 0 0 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 72px 84px;    /* внутренние отступы вместо padding оверлея */
}

.boat-lb-slide img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.boat-lb-btn {
    position: absolute;
    z-index: 30;                /* 🆕 ВЫШЕ трека — иначе слайды глотают клики */
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.boat-lb-btn:hover { background: rgba(255, 255, 255, .28); }
#boat-lb-close { top: 24px; right: 24px; }
#boat-lb-prev  { left: 24px;  top: 50%; transform: translateY(-50%); }
#boat-lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }

#boat-lb-counter {
    position: absolute;
    z-index: 30;                /* 🆕 тоже выше трека */
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    background: rgba(0, 0, 0, .55);
    padding: 8px 18px;
    border-radius: 24px;
}

/* 📱 Мобильные: стрелки внизу, фото чище для свайпа */
@media (max-width: 640px) {
    .boat-lb-slide { padding: 16px 10px 84px; }
    .boat-lb-slide img { max-height: 70vh; }
    #boat-lb-prev { left: 12px; top: auto; bottom: 24px; transform: none; }
    #boat-lb-next { right: 12px; top: auto; bottom: 24px; transform: none; }
}

/* ========================================
   СОСТОЯНИЕ ЗАГРУЗКИ (AJAX-пагинация)
   ======================================== */
.boat-gallery-grid {
    transition: opacity 0.3s ease;
}

.boat-gallery-pager {
    transition: opacity 0.2s ease;
}

/* Анимация появления элементов */
.boat-gallery-item {
    animation: boatGalleryFadeIn 0.4s ease forwards;
}

@keyframes boatGalleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Задержка для каскадного появления */
.boat-gallery-item:nth-child(1) { animation-delay: 0.05s; }
.boat-gallery-item:nth-child(2) { animation-delay: 0.10s; }
.boat-gallery-item:nth-child(3) { animation-delay: 0.15s; }
.boat-gallery-item:nth-child(4) { animation-delay: 0.20s; }
.boat-gallery-item:nth-child(5) { animation-delay: 0.25s; }
.boat-gallery-item:nth-child(6) { animation-delay: 0.30s; }
.boat-gallery-item:nth-child(7) { animation-delay: 0.35s; }
.boat-gallery-item:nth-child(8) { animation-delay: 0.40s; }
.boat-gallery-item:nth-child(9) { animation-delay: 0.45s; }
.boat-gallery-item:nth-child(10) { animation-delay: 0.50s; }
.boat-gallery-item:nth-child(11) { animation-delay: 0.55s; }
.boat-gallery-item:nth-child(12) { animation-delay: 0.60s; }