/*
=========================================================
KARUBARI SAHULAT
PREMIUM RESPONSIVE PORTFOLIO
=========================================================
*/

.portfolio-section {
    overflow: hidden;
}

.portfolio-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.filter-btn {
    border: 1px solid rgba(16, 42, 67, 0.18);
    border-radius: 999px;
    padding: 11px 20px;
    color: #102a43;
    background: #ffffff;
    font-weight: 700;
    line-height: 1.2;
    transition:
        color 0.25s ease,
        background-color 0.25s ease,
        border-color 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.filter-btn:hover,
.filter-btn:focus-visible {
    border-color: #f4b400;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 42, 67, 0.12);
}

.filter-btn.active {
    color: #102a43;
    border-color: #f4b400;
    background: #f4b400;
    box-shadow: 0 10px 24px rgba(244, 180, 0, 0.28);
}

/*
Responsive auto-adjusting card widths.
No fixed Bootstrap col-lg-4 width is required.
*/
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    gap: clamp(20px, 2.5vw, 32px);
    align-items: stretch;
}

.portfolio-item {
    min-width: 0;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.24s ease,
        transform 0.24s ease;
}

.portfolio-item.portfolio-item-hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
}

.portfolio-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(16, 42, 67, 0.08);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 14px 42px rgba(16, 42, 67, 0.09);
    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.portfolio-card:hover {
    border-color: rgba(244, 180, 0, 0.42);
    transform: translateY(-9px);
    box-shadow: 0 24px 55px rgba(16, 42, 67, 0.17);
}

.portfolio-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(16, 42, 67, 0.08), rgba(244, 180, 0, 0.12));
}

.portfolio-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition:
        transform 0.55s ease,
        filter 0.55s ease;
}

.portfolio-card:hover .portfolio-image img {
    transform: scale(1.075);
    filter: saturate(1.06) contrast(1.03);
}

.portfolio-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: end start;
    padding: 24px;
    color: #ffffff;
    background:
        linear-gradient(
            180deg,
            rgba(8, 24, 38, 0.06) 18%,
            rgba(8, 24, 38, 0.88) 100%
        );
    opacity: 0;
    transition: opacity 0.35s ease;
}

.portfolio-card:hover .portfolio-overlay,
.portfolio-card:focus-within .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay-content {
    width: 100%;
    transform: translateY(14px);
    transition: transform 0.35s ease;
}

.portfolio-card:hover .portfolio-overlay-content,
.portfolio-card:focus-within .portfolio-overlay-content {
    transform: translateY(0);
}

.portfolio-overlay-content span {
    display: inline-block;
    margin-bottom: 7px;
    color: #f4b400;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portfolio-overlay-content h4 {
    margin: 0;
    padding-right: 56px;
    color: #ffffff;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.portfolio-view {
    position: absolute;
    right: 22px;
    bottom: 22px;
    display: inline-grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    color: #102a43;
    background: #f4b400;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition:
        transform 0.25s ease,
        background-color 0.25s ease;
}

.portfolio-view:hover,
.portfolio-view:focus-visible {
    color: #102a43;
    background: #ffffff;
    transform: rotate(90deg) scale(1.06);
}

.portfolio-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: clamp(20px, 2vw, 28px);
}

.portfolio-category {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 12px;
    border-radius: 999px;
    padding: 7px 12px;
    color: #8a6500;
    background: rgba(244, 180, 0, 0.14);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.025em;
}

.portfolio-content h3 {
    margin-bottom: 12px;
    color: #102a43;
    font-size: clamp(1.15rem, 1.6vw, 1.4rem);
    line-height: 1.35;
}

.portfolio-content p {
    flex-grow: 1;
    margin-bottom: 0;
    color: #52667a;
    line-height: 1.75;
}

#portfolioModal .modal-dialog {
    width: min(94vw, 1200px);
}

#portfolioModalImage {
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 767.98px) {
    .portfolio-filter {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        margin-inline: -12px;
        padding: 4px 12px 14px;
        scrollbar-width: thin;
    }

    .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-card {
        border-radius: 18px;
    }

    .portfolio-overlay {
        opacity: 1;
        background:
            linear-gradient(
                180deg,
                transparent 35%,
                rgba(8, 24, 38, 0.82) 100%
            );
    }

    .portfolio-overlay-content {
        transform: none;
    }

    .portfolio-overlay-content span,
    .portfolio-overlay-content h4 {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .portfolio-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .portfolio-item,
    .portfolio-card,
    .portfolio-image img,
    .portfolio-overlay,
    .portfolio-overlay-content,
    .portfolio-view,
    .filter-btn {
        transition: none;
    }
}