.portfolio-section {
    --section-padding-block: clamp(3.5rem, 7vw, 6.5rem);
    background: rgba(21, 25, 55, 0.82);
    border-block: 1px solid var(--border-section-soft);
}

.portfolio-section__inner {
    display: flex;
    flex-direction: column;
    gap: clamp(var(--space-md), 4vw, var(--space-xl));
}

.portfolio-grid {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(var(--space-xs), 2vw, var(--space-sm));
}

.portfolio-grid__item {
    position: relative;
    display: block;
    flex: 1 1 calc(33.333% - var(--space-sm));
    min-width: 200px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 3px solid var(--border-card-strong);
    background: var(--media-frame-surface);
    clip-path: polygon(var(--shape-card-bevel-lg) 0, 100% 0, 100% calc(100% - var(--shape-card-bevel-lg)), calc(100% - var(--shape-card-bevel-lg)) 100%, 0 100%, 0 var(--shape-card-bevel-lg));
    box-shadow: var(--media-frame-shadow);
    transition: transform var(--transition-default), box-shadow var(--transition-default);
    color: #fff;
    text-decoration: none;
}

.portfolio-grid__item:hover,
.portfolio-grid__item:focus-visible {
    transform: translateY(-6px);
    box-shadow: 0 32px 70px rgba(0, 0, 0, 0.48);
}

.portfolio-grid__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform var(--transition-default), opacity var(--transition-default);
}

.portfolio-grid__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.72));
    opacity: 0;
    transition: opacity var(--transition-default);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.9rem;
}

.portfolio-grid__item:hover .portfolio-grid__image,
.portfolio-grid__item:focus-visible .portfolio-grid__image {
    transform: scale(1.05);
    opacity: 0.95;
}

.portfolio-grid__item:hover .portfolio-grid__overlay,
.portfolio-grid__item:focus-visible .portfolio-grid__overlay {
    opacity: 1;
}

.portfolio-section__cta {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
}

.portfolio-section__title {
    margin: 0;
}

@media (max-width: 960px) {
    .portfolio-grid__item {
        flex-basis: calc(50% - var(--space-xs));
    }
}

@media (max-width: 640px) {
    .portfolio-section__cta {
        align-items: stretch;
    }

    .portfolio-grid__item {
        flex-basis: 100%;
    }
}
