.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.gallery-category-heading-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.gallery-category-heading {
    margin-bottom: 0;
    font-weight: bold;
    text-transform: uppercase;
}

.category-hr-left,
.category-hr-right {
    flex-grow: 1;
    height: 2px;
}

.category-hr-right {
    background: linear-gradient(to left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
}

.category-hr-left {
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
}

.gallery-image-wrapper {
    text-align: center;
}

.gallery-image-container {
    position: relative; 
    width: 100%;
    /* Ratio can be adjusted to change image size (e.g., 16/9, 1/1 for square) */
    aspect-ratio: 4 / 3; 
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-image:hover {
    /* Slight zoom on hover */
    transform: scale(1.1); 
}

.gallery-title {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1rem;
    text-align: center;
    padding: 0.5rem 0;
    /* Hidden initially */
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    /* Prevent blocking the hover effect */
    pointer-events: none;
}

.gallery-social-icons a {
    font-size: 35px;
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 20px;
    color: #000;
    background-color: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.gallery-social-icons a:hover {
    background-color: var(--primary);
    color: var(--background);
    border-radius: 50%;
}

.gallery-image-container:hover .gallery-title {
    /* Shows title on hover */
    opacity: 1;
    background: rgba(0, 0, 0, 0.8); 
}

/* ----- Sort Selector Styling ----- */
.sort-selector {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.sort-selector select {
    width: auto;
    padding: 0.5rem 1rem;
    /* Bootstrap border color */
    border: 1px solid #ced4da; 
    border-radius: 5px;
    background-color: white;
    font-size: 1rem;
    /* Bootstrap text color */
    color: #495057;
}

/* Back to Top Button */

.top-button {
    height: 42px;
    width: 42px;
    position: fixed;
    bottom: 10px;
    right: 10px;
    color: white;
    background: var(--primary);
    border: 2px solid var(--primary);
}

.top-link {
    cursor: pointer;
}

/* ----- Media Queries ----- */

@media (max-width: 576px) {
    .gallery-heading {
        font-size: 1.5rem;
    }

    .sort-selector {
        justify-content: center;
    }

    .gallery-social-icons a {
        font-size: 30px;
        width: 45px;
        height: 45px;
        margin: 0 10px;
    }
}
