/* Категории */
.completed_works {
    max-width: 1350px;
    margin: 0 auto;
    padding: 25px 20px;
}

.completed_works__title {
    font-size: 2em;
    line-height: 1.3;
}

.completed_works__cat {
    margin-top: 20px;
}

.completed_works__cat ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.completed_works__cat ul li {
    display: block;
}

.completed_works__cat ul li a {
    display: block;
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background-color: #dbdfe8;
    border-radius: 24px;
    color: #27292b;
    font-size: 0.95em;
    line-height: 1.3;
    text-decoration: none;
}

.completed_works__cat ul li a.active {
    background-color: #007bff;
    border: 1px solid rgba(0, 0, 0, 0.3);
    color: #fff;
}

/* Карточки — сетка 3 колонки, паттерн из 6 карточек */
.works-container {
    margin-top: 30px;
}

.works-list__items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.works-item {
    margin: 0;
    padding: 0;
    min-width: 0;
}

/* 1-я — 2 колонки, 6-я — на всю ширину */
.works-item:nth-child(6n + 1) {
    grid-column: span 2;
}

.works-item:nth-child(6n) {
    grid-column: 1 / -1;
}

.works-item__container {
    position: relative;
    height: 320px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #1a1a1a;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.works-item:hover .works-item__container {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.works-item__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    display: block;
}

.works-item__content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    padding: 1.5em;
    box-sizing: border-box;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.35) 55%,
        rgba(0, 0, 0, 0.82) 100%
    );
    transition: background 0.3s ease;
}

.works-item__content::before {
    content: none;
}

.works-item:hover .works-item__content {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.55) 45%,
        rgba(0, 0, 0, 0.9) 100%
    );
}

.works-item__title {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.works-item__desc {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.works-item__more {
    align-self: flex-start;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.works-item:hover .works-item__desc,
.works-item:hover .works-item__more {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.button__secondary {
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #007bff;
}

/* Планшет */
@media (max-width: 991px) {
    .works-list__items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .works-item:nth-child(6n + 1) {
        grid-column: span 2;
    }

    .works-item:nth-child(6n) {
        grid-column: 1 / -1;
    }

    .works-item__container {
        height: 280px;
    }
}

/* Мобильный */
@media (max-width: 660px) {
    .works-list__items {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .works-item:nth-child(6n + 1),
    .works-item:nth-child(6n) {
        grid-column: span 1;
    }

    .works-item__container {
        height: 260px;
    }

    .works-item__title {
        font-size: 1.1em;
        -webkit-line-clamp: 4;
    }
}
