/* Gallery Section Styles */
.gallery-section {
    padding: 60px 0;
    background: #f8f9fa;
    position: relative;
}

.gallery-header {
    text-align: center;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Filter Tabs - Hidden for masonry layout */
.gallery-filters {
    display: none;
}

/* Gallery Grid - Masonry Layout */
.gallery-grid {
    column-count: 3;
    column-gap: 16px;
    width: 100%;
    padding: 0;
}

/* Card Design - Masonry Compatible */
.gallery-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 16px;
    cursor: pointer;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.gallery-card:hover .card-image img {
    transform: scale(1.05);
    filter: brightness(1.05);
}

.card-image {
    position: relative;
    height: auto;
    min-height: 180px;
    overflow: hidden;
    border-radius: 16px;
}

/* Random varied heights for maze effect */
.gallery-card:nth-child(11n+1) .card-image {
    min-height: 280px;
}

.gallery-card:nth-child(11n+2) .card-image {
    min-height: 200px;
}

.gallery-card:nth-child(11n+3) .card-image {
    min-height: 320px;
}

.gallery-card:nth-child(11n+4) .card-image {
    min-height: 240px;
}

.gallery-card:nth-child(11n+5) .card-image {
    min-height: 300px;
}

.gallery-card:nth-child(11n+6) .card-image {
    min-height: 220px;
}

.gallery-card:nth-child(11n+7) .card-image {
    min-height: 260px;
}

.gallery-card:nth-child(11n+8) .card-image {
    min-height: 290px;
}

.gallery-card:nth-child(11n+9) .card-image {
    min-height: 250px;
}

.gallery-card:nth-child(11n+10) .card-image {
    min-height: 270px;
}

.gallery-card:nth-child(11n) .card-image {
    min-height: 230px;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s ease;
    display: block;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.category-pill {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #19b3b6;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-btn i {
    color: #ccc;
    font-size: 16px;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    transform: scale(1.1);
}

.favorite-btn:hover i {
    color: #ff4757;
}

.favorite-btn.active i {
    color: #ff4757;
}

.favorite-count {
    position: absolute;
    top: 50%;
    right: 42px;
    transform: translateY(-50%);
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.favorite-btn:hover .favorite-count {
    opacity: 1;
    transform: translateY(-50%) translateX(-5px);
}

.card-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-meta {
    font-size: 12px;
    color: #19b3b6;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 15px;
    color: #6B7280;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Modal/Lightbox */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.gallery-modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-modal.active .modal-content {
    transform: translateY(0);
}

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

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.modal-close i {
    color: #333;
    font-size: 20px;
}

.modal-body {
    display: flex;
    flex-direction: column;
}

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

.modal-text {
    padding: 40px;
}

.modal-category {
    display: inline-block;
    background: #e0f7fa;
    color: #006064;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 32px;
    font-weight: 800;
    color: #111;
    margin-bottom: 16px;
}

.modal-description {
    font-size: 16px;
    line-height: 1.7;
    color: #444;
}

/* Responsive Styles */
@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Ensure 3 cols on large screens */
    }
}

@media (max-width: 991px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .gallery-tabs::-webkit-scrollbar {
        height: 4px;
    }

    .gallery-tabs::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }

    /* Masonry layout - 2 columns on tablets */
    .gallery-grid {
        column-count: 2;
        column-gap: 16px;
        padding: 0 5px;
    }

    .gallery-card {
        margin-bottom: 16px;
    }
}

@media (max-width: 767px) {
    /* Masonry layout - 1 column on mobile */
    .gallery-grid {
        column-count: 1;
        column-gap: 0;
        padding: 0;
    }

    .gallery-card {
        margin-bottom: 16px;
    }

    .gallery-section {
        padding: 40px 0;
    }

    .card-image {
        min-height: 180px !important;
    }

    .modal-image {
        height: 250px;
    }

    .modal-text {
        padding: 24px;
    }

    .modal-title {
        font-size: 24px;
    }
}