/* ===================================
   GALLERY PAGE STYLES
   ==================================== */

.gallery-header {
    background-color: var(--bg-secondary);
    padding: var(--spacing-2xl) 0;
    text-align: center;
    transition: background-color var(--transition-medium);
}

.gallery-intro {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.gallery-filters {
    padding: var(--spacing-lg) 0;
    background-color: var(--bg-primary);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.filter-btn {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.gallery-section {
    padding: var(--spacing-2xl) 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    aspect-ratio: 1;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.gallery-item.hidden {
    display: none;
}

.gallery-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image .image-placeholder {
    font-size: 4rem;
    opacity: 0.9;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: var(--spacing-lg);
    transform: translateY(100%);
    transition: transform var(--transition-medium);
    color: white;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-overlay h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.gallery-overlay p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* ===================================
   LIGHTBOX STYLES
   ==================================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    margin-bottom: var(--spacing-lg);
}

.lightbox-caption {
    text-align: center;
    color: white;
    max-width: 600px;
}

.lightbox-caption h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.lightbox-caption p {
    font-size: 1rem;
    opacity: 0.9;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.floating-shape {
    position: absolute;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0.05;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation-delay: 7s;
}

.shape-3 {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

/* ===================================
   GALLERY LIGHTBOX STYLES (Definitive Fix)
   ==================================== */

/* --- The main lightbox overlay --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 32, 44, 0.92) !important; /* Force the correct dark overlay */
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    z-index: 2000;
    padding: 2rem; /* Add some breathing room on the edges of the screen */
    box-sizing: border-box;
    
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium), visibility var(--transition-medium);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* --- The animation wrapper (SHOULD BE INVISIBLE) --- */
.lightbox-content {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    
    /* This defines the maximum area the image can occupy */
    max-width: 95vw;
    max-height: 95vh;
    
    /* Pop-out animation */
    transform: scale(0.9);
    transition: transform var(--transition-medium);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

/* --- The image's direct parent (THE LIKELY CULPRIT - SHOULD ALSO BE INVISIBLE) --- */
.lightbox-image {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    line-height: 0; /* Fixes potential extra space below the image */
}

/* --- The Image Itself (THE ONLY VISIBLE ELEMENT) --- */
.lightbox-image img {
    display: block;
    
    /* Ensure the image is constrained by its parents */
    max-width: 100%;
    max-height: 100%;
    
    /* Let the browser auto-calculate dimensions to maintain aspect ratio */
    width: auto;
    height: auto;
    
    object-fit: contain;
    
    /* Apply styling directly to the image */
    border-radius: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5); /* Strong shadow for a better pop effect */
}

/* --- Caption & Controls Styling (Unchanged but included for completeness) --- */
.lightbox-caption {
    text-align: center;
    color: var(--text-secondary);
    padding-top: var(--spacing-sm);
}
.lightbox-caption h3 { color: var(--text-primary); }
.lightbox-caption p { margin: 0; }

/* --- Control Buttons (Close, Next, Prev) --- */
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: rgba(45, 55, 72, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2010;
    transition: background-color var(--transition-fast);
    font-family: var(--font-mono); /* Use a mono font for clean arrows */
    font-weight: bold;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
    background: var(--accent-primary);
}

.lightbox-close {
    top: -15px;
    right: -15px;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
}

.lightbox-prev, .lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    font-size: 2rem;
}

.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }


/* --- Make gallery items clickable --- */
.gallery-item {
    cursor: pointer;
}

/* ===================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--spacing-md);
    }
    
    .lightbox-image {
        width: 90vw;
        height: 90vw;
        font-size: 4rem;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        padding: 0 var(--spacing-sm);
    }
    
    .filter-btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}
