/* Gallery Section */
.gallery-section {
    padding: var(--section-padding) 0;
    background: #f5f5f5;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--color-white);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 58, 48, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    font-size: 48px;
    color: var(--color-primary);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-overlay i {
    opacity: 1;
    transform: scale(1);
}

/* Modal Styles */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
}

.gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    z-index: 2001;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--color-white);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideUp 0.3s ease;
    padding: 0;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-text);
    z-index: 2002;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-white);
    transform: scale(1.1);
}

.modal-close i {
    font-size: 20px;
}

.modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 90vh;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    .gallery-section {
        padding: var(--section-padding-md) 0;
    }

    .modal-close {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
        font-size: 20px;
    }

    .modal-close i {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .gallery-section {
        padding: var(--section-padding-sm) 0;
    }

    .gallery-overlay i {
        font-size: 36px;
    }

    .modal-content {
        width: 95%;
        max-width: 100%;
        border-radius: 8px;
    }

    .modal-close {
        width: 38px;
        height: 38px;
        top: 8px;
        right: 8px;
        font-size: 18px;
    }

    .modal-close i {
        font-size: 16px;
    }

    .modal-image {
        max-height: 80vh;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .gallery-section {
        padding: 40px 0;
    }

    .gallery-overlay i {
        font-size: 28px;
    }

    .modal-content {
        width: 98%;
        max-height: 85vh;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        top: 6px;
        right: 6px;
        font-size: 16px;
    }

    .modal-close i {
        font-size: 14px;
    }

    .modal-image-container {
        max-height: 85vh;
    }

    .modal-image {
        max-height: 85vh;
    }
}

/* Accessibility */
.modal-close:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.gallery-item:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .gallery-item {
        box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    }

    .gallery-item:hover {
        box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
    }

    .modal-content {
        background: var(--color-bg-dark);
    }

    .modal-close {
        background: rgba(199, 231, 56, 0.2);
        color: var(--color-primary);
    }

    .modal-close:hover {
        background: var(--color-primary);
        color: var(--color-text);
    }
}
