.gallery_section {
    background: #f5f7f3;

    & .section_inner {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    & .text_area {
        width: 100%;
        text-align: center;
        margin-bottom: 4rem;

        & h2, & h3 {
            font-weight: 700;
            margin-top: 0;

            &::after {
                content: '';
                display: block;
                width: 5rem;
                height: 3px;
                background: var(--primary);
                margin: 2.5rem auto 0;
            }
        }
    }

    & .gallery_filters {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
        margin-bottom: 4rem;

        & .gallery_filter {
            padding: 1.4rem 2rem;
            border-radius: 1rem;
            border: 2px solid var(--primary);
            background: transparent;
            color: var(--black);
            font-size: 1.5rem;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.2s ease, color 0.2s ease;

            &:hover,
            &.active {
                background: var(--primary);
                color: var(--white);
            }
        }
    }

    & .gallery_grid {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        justify-content: center;

        @media (max-width: 767px) {
            gap: 1rem;
        }

        & .gallery_item {
            /* 4 cols: (100% - 3 × 1.5rem) / 4 */
            flex: 0 0 calc(25% - 1.125rem);
            border-radius: 1rem;
            overflow: hidden;

            @media (max-width: 1199px) {
                /* 3 cols: (100% - 2 × 1.5rem) / 3 */
                flex: 0 0 calc(33.333% - 1rem);
            }

            @media (max-width: 767px) {
                /* 2 cols: (100% - 1 × 1rem) / 2 */
                flex: 0 0 calc(50% - 0.5rem);
            }

            @media (max-width: 479px) {
                flex: 0 0 100%;
            }

            &.gallery_item--hidden {
                display: none;
            }

            & .gallery_item_link {
                display: block;
                width: 100%;
                aspect-ratio: 4 / 3;
                overflow: hidden;
                border-radius: 1rem;
                position: relative;

                & img.gallery_thumb {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    display: block;
                    transition: transform 0.4s ease;
                }

                &::after {
                    content: '';
                    position: absolute;
                    inset: 0;
                    background: rgba(0, 0, 0, 0);
                    transition: background 0.3s ease;
                    border-radius: 1rem;
                }

                &:hover {
                    & img.gallery_thumb {
                        transform: scale(1.05);
                    }

                    &::after {
                        background: rgba(0, 0, 0, 0.15);
                    }
                }
            }
        }
    }
}
