/* ==========================================================
   FOREMMA - MINI GALERÍA DE SERVICIOS
   Diseño masonry inspirado en Pinterest.
========================================================== */

.services-gallery {
    padding: clamp(1.4rem, 4vw, 2.5rem);
    background:
        radial-gradient(
            circle at top right,
            rgba(117, 165, 31, 0.08),
            transparent 34%
        ),
        #ffffff;
    border: 1px solid var(--color-border, #dce6e1);
    border-radius: var(--radius-md, 1.25rem);
    box-shadow: 0 12px 34px rgba(8, 52, 35, 0.06);
}

.services-gallery__heading {
    max-width: 760px;
    margin-inline: auto;
    margin-bottom: clamp(1.5rem, 3vw, 2.2rem);
}

.services-gallery__heading h3 {
    margin-bottom: 0.65rem;
    color: var(--color-text, #183027);
    font-family: "Sora", system-ui, sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.services-gallery__heading p {
    margin: 0;
    color: var(--color-muted, #66756f);
}

.services-gallery__masonry {
    columns: 3 280px;
    column-gap: 1rem;
}

.services-gallery__item {
    display: inline-block;
    width: 100%;
    margin: 0 0 1rem;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(11, 79, 52, 0.1);
    border-radius: 1rem;
    box-shadow: 0 10px 26px rgba(8, 52, 35, 0.08);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    transition:
        transform 220ms ease,
        border-color 220ms ease,
        box-shadow 220ms ease;
}

.services-gallery__item:hover {
    border-color: rgba(117, 165, 31, 0.4);
    box-shadow: 0 18px 38px rgba(8, 52, 35, 0.14);
    transform: translateY(-4px);
}

.services-gallery__link {
    position: relative;
    display: block;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}

.services-gallery__link img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition:
        transform 420ms cubic-bezier(0.2, 0.75, 0.25, 1),
        filter 220ms ease;
}

.services-gallery__item:hover img,
.services-gallery__link:focus-visible img {
    filter: saturate(1.05) contrast(1.02);
    transform: scale(1.035);
}

.services-gallery__caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    padding: 1.3rem 1rem 0.9rem;
    color: #ffffff;
    background:
        linear-gradient(
            to top,
            rgba(3, 37, 25, 0.94),
            rgba(3, 37, 25, 0.58) 55%,
            transparent
        );
    gap: 0.7rem;
    transform: translateY(100%);
    transition: transform 260ms ease;
}

.services-gallery__item:hover .services-gallery__caption,
.services-gallery__link:focus-visible .services-gallery__caption {
    transform: translateY(0);
}

.services-gallery__caption-icon {
    display: grid;
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    color: #19341f;
    background: var(--color-accent, #75a51f);
    border-radius: 50%;
    place-items: center;
}

.services-gallery__caption strong,
.services-gallery__caption small {
    display: block;
}

.services-gallery__caption strong {
    font-size: 0.9rem;
    font-weight: 800;
}

.services-gallery__caption small {
    margin-top: 0.12rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.73rem;
}

.services-gallery__link:focus-visible {
    outline: 3px solid var(--color-accent, #75a51f);
    outline-offset: -4px;
}

@media (max-width: 991.98px) {
    .services-gallery__masonry {
        columns: 2 250px;
    }

    .services-gallery__caption {
        position: static;
        color: var(--color-text, #183027);
        background: #ffffff;
        transform: none;
    }

    .services-gallery__caption small {
        color: var(--color-muted, #66756f);
    }
}

@media (max-width: 575.98px) {
    .services-gallery {
        padding: 1.1rem;
    }

    .services-gallery__masonry {
        columns: 1;
    }

    .services-gallery__item {
        margin-bottom: 0.85rem;
    }

    .services-gallery__caption {
        padding: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .services-gallery__item,
    .services-gallery__link img,
    .services-gallery__caption {
        transition: none !important;
    }
}

/* ----------------------------------------------------------
   Aparición progresiva al llegar a la galería con el scroll
----------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .services-gallery.is-reveal-ready .services-gallery__item {
        opacity: 0;
        filter: blur(5px);
        transform: translate3d(0, 34px, 0) scale(0.975);
        transition:
            opacity 680ms cubic-bezier(0.2, 0.75, 0.25, 1),
            transform 680ms cubic-bezier(0.2, 0.75, 0.25, 1),
            filter 680ms ease,
            border-color 220ms ease,
            box-shadow 220ms ease;
        transition-delay: var(--gallery-reveal-delay, 0ms);
        will-change: opacity, transform, filter;
    }

    .services-gallery.is-reveal-ready .services-gallery__item.is-visible {
        opacity: 1;
        filter: blur(0);
        transform: translate3d(0, 0, 0) scale(1);
    }

    .services-gallery.is-reveal-ready
        .services-gallery__item.is-visible:hover {
        transform: translate3d(0, -4px, 0) scale(1);
    }
}

