﻿/* ========================================
   GALLERY PAGE STYLES/

/* ========================================
   Gallery Filters
   ======================================== */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: var(--spacing-lg);
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .filter-btn:hover {
        border-color: var(--primary-color);
        background: var(--bg-secondary);
        transform: translateY(-2px);
    }

    .filter-btn.active {
        background: var(--primary-color);
        border-color: var(--primary-color);
        color: white;
    }

/* ========================================
   Gallery Grid (Masonry Layout)
   ======================================== */
.gallery-grid {
    column-count: 4;
    column-gap: 1.5rem;
}

.gallery-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    break-inside: avoid;
    transition: all 0.3s ease;
}

    .gallery-item img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 12px;
        transition: transform 0.3s ease;
    }

    .gallery-item:hover img {
        transform: scale(1.05);
    }

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 77, 46, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    color: white;
    font-size: 2.5rem;
    transform: scale(0.5);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay i {
    transform: scale(1);
}

/* Hide filtered items */
.gallery-item.hidden {
    display: none;
}

/* ========================================
   Lightbox Modal
   ======================================== */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox.active {
    display: block;
}

/* Lightbox Content */
.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
    }

    to {
        transform: scale(1);
    }
}

/* Lightbox Caption */
.lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 1rem 0;
    font-size: 1rem;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

    .lightbox-close:hover,
    .lightbox-close:focus {
        color: var(--accent-color);
        transform: rotate(90deg);
    }

/* Navigation Arrows */
.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 1rem 1.5rem;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 2.5rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    user-select: none;
    background: rgba(26, 77, 46, 0.5);
}

    .lightbox-prev:hover,
    .lightbox-next:hover {
        background: rgba(26, 77, 46, 0.9);
        color: var(--accent-color);
    }

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* ========================================
   Responsive Design - Tablet
   ======================================== */
@media (max-width: 1024px) {
    .gallery-grid {
        column-count: 3;
        column-gap: 1.25rem;
    }

    .gallery-item {
        margin-bottom: 1.25rem;
    }

    .filter-btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   Responsive Design - Mobile
   ======================================== */
@media (max-width: 768px) {
    .gallery-grid {
        column-count: 2;
        column-gap: 1rem;
    }

    .gallery-item {
        margin-bottom: 1rem;
    }

    .gallery-filters {
        gap: 0.75rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .lightbox {
        padding: 20px;
    }

    .lightbox-content {
        max-width: 100%;
        max-height: 80vh;
    }

    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 2.5rem;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 2rem;
        padding: 0.75rem 1rem;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        column-count: 1;
    }

    .filter-btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 120px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 0.5rem 0.75rem;
        font-size: 1.5rem;
    }
}

/* ========================================
   Dark Mode Support
   ======================================== */
[data-theme="dark"] .filter-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

    [data-theme="dark"] .filter-btn:hover {
        background: var(--bg-tertiary);
    }

    [data-theme="dark"] .filter-btn.active {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

/* ========================================
   Loading Animation
   ======================================== */
.gallery-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation */
.gallery-item:nth-child(1) {
    animation-delay: 0.05s;
}

.gallery-item:nth-child(2) {
    animation-delay: 0.1s;
}

.gallery-item:nth-child(3) {
    animation-delay: 0.15s;
}

.gallery-item:nth-child(4) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(5) {
    animation-delay: 0.25s;
}

.gallery-item:nth-child(6) {
    animation-delay: 0.3s;
}

.gallery-item:nth-child(7) {
    animation-delay: 0.35s;
}

.gallery-item:nth-child(8) {
    animation-delay: 0.4s;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .gallery-filters,
    .lightbox {
        display: none;
    }

    .gallery-grid {
        column-count: 3;
        column-gap: 0.5rem;
    }

    .gallery-item {
        margin-bottom: 0.5rem;
        page-break-inside: avoid;
    }

    .gallery-overlay {
        display: none;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.filter-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.gallery-item:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
