/* ========================================
   Gallery — photo grid, cards, lightbox
   ======================================== */

.pictures-page {
    width: 100%;
}

/* Gallery grid */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* Photo card */
.photo-card {
    width: 100%;
    aspect-ratio: 1;
    background: var(--color-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-card);
    transition: border-color 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.photo-card:hover {
    transform: translateY(-4px);
}

/* Image wrapper */
.image-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    background: #222;
}

/* Main image */
.photo-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.photo-main.loaded {
    opacity: 1;
}

.photo-card:hover .photo-main {
    transform: scale(1.04);
}


/* Error state */
.photo-card.error {
    border-color: rgba(255, 80, 80, 0.3);
}

.photo-card.error .image-wrapper {
    background: rgba(255, 80, 80, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 120, 120, 0.8);
    font-size: 13px;
}

.photo-card.error .image-wrapper::before {
    content: '⚠ Failed to load';
}

/* Caption area (hidden) */
.photo-caption {
    display: none;
}

/* ========================================
   Lightbox modal
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s ease;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--color-surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
    animation: modalSlideIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-media {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    display: block;
    width: auto;
    max-width: 90vw;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
}

.modal-info {
    display: none;
}

/* Close button */
.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 18px;
    color: var(--color-text);
    font-weight: 300;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Navigation arrows */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 22px;
    color: var(--color-text);
    z-index: 1001;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-prev { left: 20px; }
.modal-next { right: 20px; }

.modal-nav.disabled {
    opacity: 0.2;
    pointer-events: none;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ----------------------------------------
   Gallery responsive
   ---------------------------------------- */

@media screen and (max-width: 991px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }
}

@media screen and (max-width: 767px) {
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modal-prev { left: 10px; }
    .modal-next { right: 10px; }
}

@media screen and (max-width: 479px) {
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .photo-card { transition: none; }
    .photo-main { opacity: 1; transition: none; }
}
