/* 
  Gallery Styles
  Provides modern masonry/grid layout and popup modal logic
*/

:root {
    --gallery-bg: #0f172a; /* Assuming dark theme from 'badge btn-glow' in index */
    --gallery-text: #f8fafc;
    --gallery-bg-2: #0B2F1D;
    --gallery-bg-3: rgb(6, 9, 7);
    --highlight-color: #10b981; /* Default green-ish, change if home.css is different */
    --transition-smooth: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body {
    background-color: var(--gallery-bg-3); /* Use base dark background */
    color: var(--gallery-text);
    margin: 0;
    padding: 0;
    
}

/* Base adjustment for the page layout when navbar is fixed */
.gallery-container {
    padding-top: 120px; /* Space for the navbar */
    padding-bottom: 60px;
    max-width: 1400px;
    margin: 0 auto;
    padding-inline: 5%;
}

.gallery-header {
    text-align: center;
    margin-top: -80px;
    margin-bottom: 3rem;
}

.gallery-title {
    font-size: 3rem;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 1rem;
}

.gallery-subtitle {
    font-size: 1.1rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
}

/* CSS Grid Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    grid-auto-flow: dense; /* Helps fill spaces */
}

/* For varied sizes (Masonry-like) */
.gallery-grid .gallery-item:nth-child(1),
.gallery-grid .gallery-item:nth-child(8) {
    grid-column: span 2;
    grid-row: span 2;
}

@media (max-width: 768px) {
    .gallery-grid .gallery-item:nth-child(1),
    .gallery-grid .gallery-item:nth-child(8) {
        grid-column: span 1;
        grid-row: span 1;
    }
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    aspect-ratio: 4 / 3;
}

.gallery-grid .gallery-item:nth-child(1),
.gallery-grid .gallery-item:nth-child(8) {
    aspect-ratio: auto;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
    display: block;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
    opacity: 0;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 2rem;
    backdrop-filter: blur(2px);
}

.gallery-overlay i {
    font-size: 3rem;
    color: #fff;
    margin-bottom: 1rem;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.gallery-overlay span {
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    transform: translateY(20px);
    transition: var(--transition-smooth);
    transition-delay: 0.1s;
}

/* Hover Effects */
.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

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

/* Dialog / Modal Styles */
.image-modal {
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 20px;
    background: transparent;
    max-width: 90vw;
    max-height: 90vh;
    overflow: visible;
}

.image-modal::backdrop {
    
    backdrop-filter: blur(30px ) saturate(180%);
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgb(15, 23, 18);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 12px;
    object-fit: contain;
}

.modal-caption {
    margin-top: 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    color: #fff;
    padding: 0.5rem 1rem;
}

.close-modal {
    position: fixed;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

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

/* Animations */
@media (prefers-reduced-motion: reduce) {
    .gallery-item img,
    .gallery-overlay,
    .gallery-overlay i,
    .gallery-overlay span,
    .modal-content,
    .close-modal {
        transition: none;
        animation: none;
    }
}
