.sap-portfolio {
    background: #fff;
    color: #1b1f24;
    padding: 3.5rem 0;
}

.sap-portfolio-head {
    text-align: center;
    margin-bottom: 1.25rem;
}

.sap-portfolio-head h2 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.sap-portfolio-head p {
    margin: .5rem 0 0;
    color: #6b6f75;
}

.sap-filters {
    display: flex;
    gap: .55rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.3rem;
}

.sap-filter {
    border: 1px solid #d7d9dd;
    border-radius: 999px;
    background: #f5f6f8;
    padding: .5rem .9rem;
    font-weight: 600;
    cursor: pointer;
}

.sap-filter.is-active {
    background: #29313a;
    border-color: #29313a;
    color: #fff;
}

.sap-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.sap-layout-masonry .sap-grid {
    display: block;
    column-count: 3;
    column-gap: 1rem;
}

.sap-layout-masonry .sap-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 1rem;
    break-inside: avoid;
}

.sap-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    transition: transform .25s ease, box-shadow .25s ease;
}

.sap-card.is-hidden {
    display: none;
}

.sap-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0,0,0,.14);
}

.sap-card-image {
    display: block;
    height: 260px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.sap-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.35), rgba(0,0,0,0));
}

.sap-card-content {
    padding: .9rem 1rem 1rem;
}

.sap-card-content h3 {
    margin: 0;
    font-size: 1.03rem;
}

.sap-card-meta {
    margin-top: .35rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #b79d7f;
}

.sap-card-content p {
    margin: .4rem 0 0;
    font-size: .92rem;
    color: #666d75;
}

.sap-empty {
    text-align: center;
    color: #666d75;
    grid-column: 1 / -1;
}

.sap-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 99999;
    padding: 2rem 1rem;
}

.sap-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sap-lightbox img {
    max-width: min(94vw, 1600px);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 36px rgba(0, 0, 0, .45);
}

.sap-lightbox-close,
.sap-lightbox-nav {
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
}

.sap-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
}

.sap-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
    line-height: 1;
}

.sap-lightbox-prev { left: 1rem; }
.sap-lightbox-next { right: 1rem; }

.sap-lightbox-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: .9rem;
    text-align: center;
    color: #f1f3f6;
    font-size: .95rem;
    font-weight: 500;
}

@media (max-width: 980px) {
    .sap-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sap-layout-masonry .sap-grid {
        column-count: 2;
    }
}

@media (max-width: 640px) {
    .sap-grid {
        grid-template-columns: 1fr;
    }

    .sap-layout-masonry .sap-grid {
        column-count: 1;
    }

    .sap-lightbox-nav {
        display: none;
    }
}
