/* Gallery Page Specific Styles */

/* Active nav link styling */
.nav-link.active {
    color: #3b82f6;
    font-weight: 600;
}

/* Gallery Intro Section */
.gallery-intro {
    margin-bottom: 40px;
    text-align: center;
}

.gallery-intro h1 {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 15px;
}

.gallery-intro h1 span {
    color: #3b82f6;
}

.gallery-intro p {
    font-size: 18px;
    color: #888;
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery Filters */
.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.filter-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

.light-mode .filter-btn {
    border-color: rgba(0, 0, 0, 0.1);
    color: #555;
}

.light-mode .filter-btn:hover,
.light-mode .filter-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Pinterest-Style Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 10px;
    grid-gap: 20px;
    margin-bottom: 60px;
}

.gallery-item {
    grid-row-end: span 30; /* Default height, will be adjusted by JS */
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Transition classes for smooth filtering */
.item-transition {
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: transform, opacity;
}

.item-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.item-hidden {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(5px);
    pointer-events: none;
}

/* Staggered animation for items appearing */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Animation for filter buttons */
.filter-btn {
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
}

.filter-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #3b82f6;
    transition: width 0.3s ease;
}

.filter-btn.active::after,
.filter-btn:hover::after {
    width: 100%;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Mobile Layout - Similar to the reference image */
@media (max-width: 768px) {
    .gallery-intro {
        text-align: left;
        padding: 0 15px;
    }
    
    .gallery-intro h1 {
        font-size: 32px;
    }
    
    .gallery-filters {
        padding: 0 15px;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 15px;
    }
    
    .filter-btn {
        flex-shrink: 0;
    }
    
    .gallery-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
        padding: 0 10px;
    }
    
    .gallery-item {
        width: calc(50% - 4px);
        margin-bottom: 8px;
        height: auto;
        border-radius: 8px;
    }
    
    .gallery-item-inner {
        border-radius: 8px;
    }
    
    /* Create staggered layout with varying heights */
    .gallery-item:nth-child(odd) {
        width: 47%;
    }
    
    .gallery-item:nth-child(even) {
        width: 47%;
    }
    
    /* Vary heights to create visual interest */
    .gallery-item:nth-child(3n+1) {
        aspect-ratio: 3/4;
    }
    
    .gallery-item:nth-child(3n+2) {
        aspect-ratio: 1/1;
    }
    
    .gallery-item:nth-child(3n+3) {
        aspect-ratio: 4/5;
    }
    
    /* Adjust some items to be taller for variety */
    .gallery-item:nth-child(5n) {
        aspect-ratio: 3/5;
    }
    
    /* Make text overlay more prominent on mobile */
    .item-overlay {
        opacity: 1;
        transform: translateY(0);
        padding: 12px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 80%);
    }
    
    .item-overlay h3 {
        font-size: 16px;
        font-weight: 500;
    }
    
    /* Adjust modal for mobile */
    .modal-container {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-content {
        flex-direction: column;
    }
    
    .modal-image-container {
        height: 50vh;
    }
    
    .modal-info {
        width: 100%;
        padding: 20px;
    }
}

.gallery-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.item-overlay h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.item-category {
    display: inline-block;
    font-size: 12px;
    background-color: rgba(59, 130, 246, 0.8);
    padding: 3px 8px;
    border-radius: 30px;
    margin-top: 5px;
}

/* Glassomorphic Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    pointer-events: none; /* Allow clicks to pass through when inactive */
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Enable interaction when active */
}

.modal-container {
    width: 90%;
    max-width: 1000px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 30, 0.4);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0 auto;
    position: relative; /* Allow absolute positioning relative to the overlay */
    z-index: 1001;
}

.light-mode .modal-container {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(59, 130, 246, 0.8);
}

.light-mode .modal-close {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.light-mode .modal-close:hover {
    background: rgba(59, 130, 246, 0.8);
    color: white;
}

.modal-content {
    display: flex;
    flex-direction: row;
    height: 100%;
    overflow: hidden;
}

.modal-image-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    width: 350px;
    padding: 40px 30px;
    overflow-y: auto;
    color: white;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-height: 90vh;
}

.light-mode .modal-info {
    background: rgba(255, 255, 255, 0.7);
    color: #333;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.modal-category {
    display: inline-block;
    font-size: 14px;
    background-color: rgba(59, 130, 246, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.modal-description {
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-metadata {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.metadata-item i {
    color: #3b82f6;
    width: 16px;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .modal-content {
        flex-direction: column;
    }
    
    .modal-info {
        width: 100%;
        max-height: 50vh;
    }
    
    .modal-image-container {
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .gallery-intro h1 {
        font-size: 36px;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-gap: 15px;
    }
    
    .gallery-intro h1 {
        font-size: 32px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .item-overlay {
        padding: 15px;
    }
    
    .item-overlay h3 {
        font-size: 16px;
    }
}
