/* ===========================================
   PHOTO GALLERY PAGE - Страница галереи фото
   =========================================== */

/* Запрет выделения текста */
.gallery-main,
.gallery-lightbox {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.gallery-main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0 4rem;
    background-color: var(--color-bg-dark);
}

.gallery-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding-x);
}

/* Gallery Header */
.gallery-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gallery-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 14px;
}

.gallery-breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.gallery-breadcrumb a:hover {
    color: var(--color-text-primary);
}

.gallery-breadcrumb span {
    color: var(--color-text-secondary);
}

.gallery-breadcrumb .current {
    color: var(--color-text-primary);
}

.gallery-page-title {
    font-size: var(--font-size-xlarge);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.gallery-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    margin-bottom: 0.25rem;
}

.gallery-subtitle a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.gallery-subtitle a:hover {
    color: var(--color-text-primary);
}

.gallery-count {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    opacity: 0.7;
}

/* Gallery Grid - Masonry via JS columns */
.gallery-grid {
    display: flex;
    gap: 8px;
    margin-top: 2rem;
}

.gallery-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--color-bg-lighter);
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.3s ease, opacity 0.4s ease-out;
    opacity: 0;
}

.gallery-item img.loaded {
    opacity: 1;
}

.gallery-item:hover img {
    transform: scale(1.03);
}

/* Skeleton loading */
.gallery-item .skeleton {
    width: 100%;
    padding-bottom: 66.67%;
    background: linear-gradient(90deg, var(--color-bg-lighter) 25%, rgba(255,255,255,0.05) 50%, var(--color-bg-lighter) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Gallery Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.97);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
}

.lightbox-close:hover {
    color: #fff;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 3.5rem;
    width: 60px;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    color: #fff;
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.lightbox-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    will-change: transform;
}

.lightbox-slide img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Download button */
.lightbox-download {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 14px;
    font-family: inherit;
    transition: color 0.2s ease;
    z-index: 10;
    padding: 0.5rem;
}

.lightbox-download:hover {
    color: #fff;
}

.lightbox-download svg {
    width: 22px;
    height: 22px;
}

.lightbox-info {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.7);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    font-size: 14px;
    white-space: nowrap;
}

/* Swipe hint for mobile */
.lightbox-swipe-hint {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 13px;
    pointer-events: none;
    animation: swipe-fade 3s ease-out forwards;
}

@keyframes swipe-fade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Loading state for gallery */
.gallery-loading {
    text-align: center;
    padding: 4rem 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-medium);
}

/* Photographer arrow */
.gallery-subtitle .photographer-arrow {
    display: inline;
    margin-left: 0.25rem;
}

/* Download label text next to icon */
.lightbox-download-label {
    font-size: 13px;
    white-space: nowrap;
}

/* Bottom action buttons */
.gallery-bottom-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.gallery-bottom-btn {
    display: inline-block;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
    font-family: 'Montserrat', sans-serif;
    text-align: center;
    background: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.gallery-bottom-btn:hover {
    border-color: var(--color-text-primary);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1024px) {
}

@media (max-width: 768px) {
    .gallery-main {
        padding: 1.5rem 0 3rem;
    }

    .gallery-container {
        padding: 0 10px;
        max-width: 100%;
    }

    .gallery-grid {
        gap: 6px;
    }

    .gallery-column {
        gap: 6px;
    }

    .gallery-item {
        border-radius: 6px;
    }

    .gallery-page-title {
        font-size: 28px;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 2.5rem;
    }

    .lightbox-prev {
        left: 0.25rem;
    }

    .lightbox-next {
        right: 0.25rem;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .lightbox-download {
        top: 0.5rem;
        left: 0.5rem;
        font-size: 13px;
    }

    .lightbox-download svg {
        width: 20px;
        height: 20px;
    }

    .lightbox-info {
        bottom: 1rem;
        padding: 0.5rem 1rem;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        gap: 4px;
    }

    .gallery-column {
        gap: 4px;
    }

    .gallery-item {
        border-radius: 4px;
    }
}
