/* ==========================================
   Полноэкранный просмотрщик (Lightbox)
   Единый дизайн с Reels UI
   ========================================== */
.preview-card img,
.work-card img,
.work-card-media img {
    cursor: pointer !important;
}

.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    overflow: hidden;
    background: #000000;
}

.lightbox-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 18, 0.95);
    backdrop-filter: blur(8px);
}

.lightbox-topbar {
    position: absolute;
    top: 20px;
    left: 24px;
    right: 24px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1px;
}

.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background-color 0.2s ease, transform 0.15s ease;
    padding: 0;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.05);
}

.lightbox-btn svg {
    display: block;
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background-color 0.2s ease, transform 0.15s ease;
    user-select: none;
}

.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-50%) scale(1.06);
}

.lightbox-prev { left: 24px; padding-right: 3px; }
.lightbox-next { right: 24px; padding-left: 3px; }

.lightbox-scroll-area {
    position: relative;
    z-index: 5;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.lightbox-container {
    width: auto;
    max-width: 90vw;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto;
    position: relative;
}

.lightbox-image-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-height: 88vh;
    max-width: 90vw;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9);
    background: #000;
}

.lightbox-image-wrapper img {
    display: block;
    max-width: 90vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    cursor: zoom-in;
    border-radius: 16px;
}

/* Плашка описания поверх фотографии: точный градиент и типографика как в Reels */
.lightbox-info-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.75) 40%, rgba(0, 0, 0, 0.3) 75%, transparent 100%);
    padding: 24px 14px 16px;
    text-align: left;
    box-sizing: border-box;
    cursor: pointer;
    border: none !important;
    border-radius: 0 0 16px 16px;
}

.lightbox-header-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}

.lightbox-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.20rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.lightbox-price {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #89B8CC;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Описание: 2 строки в свернутом виде */
.lightbox-desc {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.80rem;
    font-weight: 400;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    padding: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.lightbox-desc::-webkit-scrollbar {
    display: none !important;
}

/* Раскрытый текст фотографии */
.lightbox-desc.is-expanded {
    display: block !important;
    -webkit-line-clamp: unset !important;
    max-height: 220px !important;
    overflow-y: auto !important;
}

/* Кнопка "ещё..." */
.lightbox-more-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.74rem;
    color: #89B8CC;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: inline-block;
    margin-top: 4px;
    padding: 2px 0;
}

.lightbox-more-btn:hover {
    color: #a5d2e5;
    text-decoration: underline;
}

/* Режим зума */
.lightbox-modal.is-zoomed .lightbox-scroll-area {
    align-items: flex-start;
    padding-top: 80px;
    overflow-y: auto;
}

.lightbox-modal.is-zoomed .lightbox-image-wrapper {
    max-height: none !important;
    max-width: 95vw !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.lightbox-modal.is-zoomed .lightbox-image-wrapper img {
    max-height: none !important;
    max-width: 95vw !important;
    cursor: zoom-out !important;
    border-radius: 8px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85) !important;
}

.lightbox-modal.is-zoomed .lightbox-info-box {
    display: none !important;
}

/* Адаптив под мобильные устройства (iOS Safari / Android) */
@media (max-width: 768px) {
    .lightbox-topbar {
        position: absolute !important;
        top: env(safe-area-inset-top, 10px) !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 20 !important;
        padding: 8px 14px !important;
    }

    .lightbox-nav-btn {
        display: none !important;
    }

    .lightbox-container {
        max-width: 100vw !important;
        width: 100vw !important;
        height: 100dvh !important;
    }

    .lightbox-image-wrapper {
        width: 100vw !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .lightbox-image-wrapper img {
        width: 100vw !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        object-fit: contain !important;
    }

    .lightbox-info-box {
        border-radius: 0 !important;
        padding-bottom: calc(env(safe-area-inset-bottom, 10px) + 14px) !important;
    }
}

/* Скрытие кнопки открытия в новой вкладке */
.lightbox-btn-tab,
#lightbox-open-original {
    display: none !important;
}

/* Скрытие кнопки зума на смартфонах и планшетах (стандарт iOS / Instagram) */
@media (max-width: 768px) {
    #lightbox-zoom-toggle {
        display: none !important;
    }
    
    .lightbox-image-wrapper img {
        cursor: default !important;
    }
}

/* Отключаем дефолтные конфликтующие жесты браузера над картинкой */
.lightbox-image-wrapper {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.lightbox-image-wrapper img {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    will-change: transform;
}

/* Стили зума для десктопа (ПК) */
@media (min-width: 769px) {
    .lightbox-modal.is-zoomed-pc .lightbox-image-wrapper {
        overflow: visible !important;
    }

    .lightbox-modal.is-zoomed-pc .lightbox-image-wrapper img {
        cursor: grab !important;
    }

    .lightbox-modal.is-zoomed-pc.is-dragging .lightbox-image-wrapper img {
        cursor: grabbing !important;
    }

    .lightbox-image-wrapper img {
        cursor: zoom-in;
    }
}
