/* ==========================================================================
   1. GALLERY PAGE LAYOUT & HEADER
   ========================================================================== */
.gallery-page {
    padding: 15vh 5vw 10vh 5vw;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

.gallery-header {
    margin-bottom: 40px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--accent-color);
}

.page-title {
    font-size: clamp(2.5rem, 4vw, 4rem);
    margin: 0;
    line-height: 1.1;
    color: var(--text-main);
}

/* ==========================================================================
   2. FILTER NAVIGATION
   ========================================================================== */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    border-bottom: 1px solid #222;
    padding-bottom: 20px;
}

.filter-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-code);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    border-color: var(--accent-color);
    color: var(--text-main);
    background: rgba(0, 255, 102, 0.05);
}

/* ==========================================================================
   3. MASONRY GRID (CSS Columns)
   ========================================================================== */
.masonry-grid {
    column-count: 3;
    column-gap: 20px;
}

.masonry-item {
    break-inside: avoid; /* Crucial: Prevents images from being split across columns */
    margin-bottom: 20px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    display: block;
}

.masonry-item img {
    width: 100%;
    display: block;
    border-radius: 8px;
    transition: transform 0.4s ease;
}

/* -------- Hover Overlay (Expand Icon) -------- */
.photo-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-overlay i {
    color: white; 
    font-size: 3rem; 
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.masonry-item:hover .photo-overlay { opacity: 1; }
.masonry-item:hover .photo-overlay i {
    opacity: 1;
    transform: scale(1);
}
.masonry-item:hover img { transform: scale(1.02); }

/* ==========================================================================
   4. LIGHTBOX: BASE & PURE IMAGE (Video Games)
   ========================================================================== */
.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none; 
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 2001;
}

.lightbox-close:hover {
    color: var(--accent-color);
}

.pure-image-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 40px; 
    box-sizing: border-box;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

/* ==========================================================================
   5. LIGHTBOX: EXIF METADATA (Real Life)
   ========================================================================== */
.meta-image-content {
    display: flex;
    max-width: 90vw;
    max-height: 85vh;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.lightbox-img-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #050505; 
    padding: 20px;
}

.meta-image-content .lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    box-shadow: none; 
}

/* -------- Metadata Sidebar -------- */
.lightbox-sidebar {
    width: 320px;
    min-width: 320px;
    padding: 40px 30px;
    background: #151515;
    border-left: 1px solid #222;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.meta-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.meta-header i {
    color: var(--text-main);
    font-size: 1.5rem;
}

.meta-header h3 {
    color: var(--text-main);
    font-size: 1.2rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta-list p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-family: var(--font-code);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.meta-list i {
    color: var(--accent-color);
    width: 20px;
    text-align: center;
}

/* ==========================================================================
   6. RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Tablets & Small Desktops */
@media (max-width: 900px) {
    .masonry-grid { column-count: 2; }
    .pure-image-content { padding: 20px; }
    .lightbox-close { top: 15px; right: 20px; }
    
    /* Meta Lightbox Stacked Layout */
    .meta-image-content { 
        flex-direction: column; 
        max-height: 95vh; 
    }
    .lightbox-img-wrapper { padding: 10px; }
    .meta-image-content .lightbox-img { max-height: 50vh; }
    
    .lightbox-sidebar { 
        width: 100%; 
        min-width: 100%;
        padding: 20px;
        border-left: none; 
        border-top: 1px solid #222; 
    }
    .meta-list {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Shifts list to a neat 2-column grid */
    }
}

/* Mobile Devices */
@media (max-width: 600px) {
    .masonry-grid { column-count: 1; }
    .gallery-filters { justify-content: center; }
}