.sf-gallery {
    position: relative;
    padding: 6rem 0 4rem;
    background: #060606;
    isolation: isolate;
    min-height: 100%;

    /* background glow like the hero/footer */
    &::before,
    &::after {
        content: "";
        position: absolute;
        width: 800px;
        height: 800px;
        border-radius: 50%;
        filter: blur(100px);
        opacity: 0.15;
        pointer-events: none;
        z-index: 0;
    }

    &::before {
        top: -150px;
        left: -250px;
        background: radial-gradient(circle at center,
                rgba(127, 82, 255, 1),
                transparent 70%);
    }

    &::after {
        bottom: -250px;
        right: -200px;
        background: radial-gradient(circle at center,
                rgba(0, 194, 255, 1),
                transparent 70%);
    }

    .gallery-hero {
        text-align: center;
        max-width: 720px;
        margin: 0 auto 3rem;
        position: relative;
        z-index: 1;

        h1 {
            font-size: 2.5rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        p {
            color: rgba(255, 255, 255, 0.7);
            font-weight: 300;
            line-height: 1.6;
            font-size: 1rem;
        }
    }

    .gallery-grid {
        columns: 1;
        position: relative;
        z-index: 1;
        padding: 0 1.5rem;
        gap: 1.5rem;
    }

    .gallery-item {
        margin: 1.5rem 0;
        position: relative;
        overflow: hidden;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.03);
        cursor: pointer;
        transition: transform 0.25s ease, box-shadow 0.25s ease;

        &:hover {
            transform: translateY(-4px);
            box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(127, 82, 255, 0.15);
        }

        img,
        video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border-radius: inherit;
            transition: transform 0.4s ease, opacity 0.3s ease;
        }

        &:hover img,
        &:hover video {
            transform: scale(1.05);
            opacity: 0.9;
        }

        video {
            filter: brightness(0.92) contrast(1.03);
        }

        .overlay {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            justify-content: end;
            padding: 1rem 1.25rem;
            background: linear-gradient(0deg,
                    rgba(0, 0, 0, 0.7) 10%,
                    transparent 70%);
            border-radius: inherit;
            opacity: 0;
            transition: opacity 0.3s ease;

            h3 {
                margin: 0 0 0.25rem 0;
                font-size: 1.05rem;
                font-weight: 500;
            }

            span {
                font-size: 0.9rem;
                color: rgba(255, 255, 255, 0.7);
            }
        }

        &:hover .overlay {
            opacity: 1;
        }
    }

    /* .gallery-item .skeleton { */
    /*     position: absolute; */
    /*     inset: 0; */
    /*     background-color: red; */
    /*     transition: opacity 0.4s; */
    /* } */

    .gallery-item {
        .skeleton {
            position: absolute;
            inset: 0;
            background: linear-gradient(110deg, #4a4a4a 8%, #5a5a5a 18%, #4a4a4a 33%);
            border-radius: 5px;
            background-size: 200% 100%;
            animation: 1.5s shine linear infinite;
            transition: opacity 0.4s;
        }
    }

    .gallery-item.loaded .skeleton {
        opacity: 0;
        pointer-events: none;
    }

    .gallery-item.video {
        position: relative;
        overflow: hidden;
        border-radius: 16px;
        transition: transform 0.25s ease, box-shadow 0.4s ease;
        background: rgba(255, 255, 255, 0.03);
        box-shadow:
            0 0 14px 3px rgba(59, 103, 206, 0.35),
            0 0 28px 10px rgba(127, 82, 255, 0.3);
    }

    /* hover & playback glow */
    .gallery-item.video:hover,
    .gallery-item.video.playing {
        box-shadow:
            0 0 12px 2px rgba(59, 103, 206, 0.3),
            0 0 24px 6px rgba(127, 82, 255, 0.35);
        transform: translateY(-3px);
    }

    .gallery-item.video.playing {
        animation: boxGlowBreathe 2s ease-in-out infinite;
    }

    @media (max-width: 640px) {
        .gallery-hero {
            h1 {
                font-size: 2rem;
            }

            p {
                font-size: 0.95rem;
            }
        }
    }
}

@keyframes boxGlowBreathe {
    0% {
        box-shadow:
            0 0 14px 3px rgba(59, 103, 206, 0.35),
            0 0 28px 10px rgba(127, 82, 255, 0.3);
    }

    50% {
        box-shadow:
            0 0 18px 4px rgba(59, 103, 206, 0.6),
            0 0 34px 12px rgba(127, 82, 255, 0.55);
    }

    100% {
        box-shadow:
            0 0 14px 3px rgba(59, 103, 206, 0.35),
            0 0 28px 10px rgba(127, 82, 255, 0.3);
    }
}

@keyframes shine {
  to {
    background-position-x: -200%;
  }
}

@media screen and (min-width: 640px) {
    .sf-gallery {
        .gallery-grid {
            columns: 2;
        }
    }
}

@media screen and (min-width: 1024px) {
    .sf-gallery {
        .gallery-grid {
            columns: 3;
        }
    }
}
