
/* ==========================================
   TerraStroy — каталог выполненных работ
   ========================================== */

.tsCatalog {
    --tsCatalogAccent: #a3643f;

    background: #fff;
    padding: 72px 0;
    color: #242323;
}

.tsCatalog .terrastroyContainer,
.tsCatalogEstimate .terrastroyContainer {
    width: min(1400px, calc(100% - 48px));
    margin-inline: auto;
}

/* Заголовок */

.tsCatalogHeader {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
    gap: 35px;
    align-items: start;
    margin-bottom: 36px;
}

.tsCatalogHeader h1 {
    margin: 0;
    color: #242323;
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.12;
    font-weight: 750;
    letter-spacing: -.03em;
}

.tsCatalogHeader p {
    margin: 0;
    padding-left: 28px;
    border-left: 1px solid #d7cfc8;
    font-size: 18px;
    line-height: 1.5;
    color: #746e69;
    max-width: 550px;
}

/* Фильтры */

.tsCatalogFilters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 26px;
}

.tsCatalogFilter {
    min-height: 43px;
    padding: 10px 19px;
    border: 1px solid #e8dfd8;
    border-radius: 999px;
    background: #fff;
    color: #252525;
    font: inherit;
    font-size: 14px;
    cursor: pointer;

    transition:
        background .22s ease,
        color .22s ease,
        transform .22s ease,
        border-color .22s ease;
}

.tsCatalogFilter:hover {
    border-color: var(--tsCatalogAccent);
    transform: translateY(-2px);
}

.tsCatalogFilter.is-active {
    background: var(--tsCatalogAccent);
    color: #fff;
    border-color: var(--tsCatalogAccent);
}

/* Сетка */

.tsCatalogStage {
    position: relative;
    min-height: 180px;
}

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

.tsCatalogCard {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #eae4df;
    border-radius: 16px;
    background: #fff;
    color: #252525;
    box-shadow: 0 6px 25px rgba(20, 20, 20, .045);

    transition:
        transform .28s ease,
        box-shadow .28s ease;
}

.tsCatalogCard:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 35px rgba(20, 20, 20, .11);
}

.tsCatalogCardLink {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Изображение карточки */

.tsCatalogPhoto {
    width: 100%;
    aspect-ratio: 1.5;
    overflow: hidden;
    background: #eae8e4;
}

.tsCatalogPhoto img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;

    transition:
        transform .65s cubic-bezier(.2, .7, .2, 1);
}

.tsCatalogCard:hover .tsCatalogPhoto img {
    transform: scale(1.05);
}

.tsCatalogPhotoEmpty {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        #e3ded6,
        #f7f4f0
    );
}

/* Текст карточки */

.tsCatalogCardBody {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 20px;
    gap: 10px;
}

.tsCatalogTags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tsCatalogTags span {
    padding: 4px 9px;
    border-radius: 50px;
    background: #f7f0e9;
    color: var(--tsCatalogAccent);
    font-size: 12px;
    line-height: 1.25;
}

.tsCatalogCard h3 {
    margin: 0;
    color: #242323;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 750;
}

.tsCatalogCard p {
    margin: 0;
    color: #766e68;
    font-size: 14px;
    line-height: 1.55;
}

.tsCatalogMore {
    margin-top: auto;
    padding-top: 10px;
    color: var(--tsCatalogAccent);
    font-size: 14px;
    font-weight: 700;
}

.tsCatalogMore span {
    display: inline-block;
    margin-left: 8px;
    font-size: 19px;
    transition: transform .2s ease;
}

.tsCatalogCard:hover .tsCatalogMore span {
    transform: translate(3px, -3px);
}

/* Показать ещё */

.tsCatalogFooter {
    text-align: center;
    padding-top: 26px;
}

.tsCatalogLoadMore {
    padding: 12px 22px;
    border: none;
    background: none;
    color: var(--tsCatalogAccent);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}

.tsCatalogLoadMore span {
    display: inline-block;
    transition: transform .3s ease;
}

.tsCatalogLoadMore:hover span {
    transform: translateY(5px);
}

/* Состояния AJAX */

.tsCatalogEmpty,
.tsCatalogError {
    padding: 26px;
    color: #746e69;
    text-align: center;
    font-size: 16px;
}

.tsCatalogError {
    color: #b23131;
}

.tsCatalog [hidden] {
    display: none !important;
}

/* Прелоудер сборки конструкции */

.tsCatalogLoader {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

.tsCatalogLoader p {
    color: var(--tsCatalogAccent);
    font-size: 13px;
    letter-spacing: .06em;
    white-space: nowrap;
}

.tsCatalogLoaderArt {
    position: relative;
    width: 82px;
    height: 82px;
    margin: auto;
    transform: rotate(45deg);
}

.tsCatalogLoaderArt span {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: var(--tsCatalogAccent);
    box-shadow: 0 5px 18px rgba(163, 100, 63, .18);

    animation: tsCatalogBuild 1.25s
        ease-in-out infinite alternate;
}

.tsCatalogLoaderArt span:nth-child(1) {
    top: 5px;
    left: 5px;
    animation-delay: 0s;
}

.tsCatalogLoaderArt span:nth-child(2) {
    top: 5px;
    right: 5px;
    animation-delay: .18s;
}

.tsCatalogLoaderArt span:nth-child(3) {
    bottom: 5px;
    right: 5px;
    animation-delay: .36s;
}

.tsCatalogLoaderArt span:nth-child(4) {
    bottom: 5px;
    left: 5px;
    animation-delay: .54s;
}

.tsCatalogStage.is-loading .tsCatalogGrid {
    opacity: .25;
    filter: blur(3px);

    transition:
        opacity .22s ease,
        filter .22s ease;
}

/* Анимация появления карточек */

.tsCatalogCard.tsCardRevealed {
    animation: tsCatalogCardIn .55s both;
    animation-delay: calc(var(--cardIndex, 0) * 55ms);
}

@keyframes tsCatalogBuild {
    0% {
        opacity: .22;
        transform: scale(.5) rotate(-18deg);
        border-radius: 50%;
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
        border-radius: 6px;
    }
}

@keyframes tsCatalogCardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Доступность */

.tsCatalogFilter:focus-visible,
.tsCatalogLoadMore:focus-visible,
.tsCatalogCardLink:focus-visible {
    outline: 3px solid var(--tsCatalogAccent);
    outline-offset: 3px;
}

/* ==========================================
   Форма после каталога — белый фон
   ========================================== */

.tsCatalogEstimate {
    padding: 24px 0 70px;
    background: #fff;
    color: #242323;
}

.tsCatalogEstimateHeading {
    margin: 0 0 22px;
    color: #242323;
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1.2;
    font-weight: 750;
}

/* Убираем внешние лишние отступы глобальной формы */

.tsCatalogEstimate .tsEstimate {
    padding-top: 0;
    padding-bottom: 0;
    background: transparent;
}

/* Сама форма сохраняет штатное оформление */

.tsCatalogEstimate .tsEstimateInner {
    background: #f5f3f0;
}

/* ==========================================
   Адаптивность
   ========================================== */

@media (max-width: 1200px) {
    .tsCatalogGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tsCatalog {
        padding: 50px 0;
    }
}

@media (max-width: 700px) {
    .tsCatalog .terrastroyContainer,
    .tsCatalogEstimate .terrastroyContainer {
        width: calc(100% - 32px);
    }

    .tsCatalog {
        padding: 35px 0;
    }

    .tsCatalogHeader {
        display: block;
    }

    .tsCatalogHeader p {
        margin-top: 16px;
        padding: 0;
        border-left: 0;
        font-size: 15px;
    }

    .tsCatalogFilters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .tsCatalogFilter {
        flex: none;
    }

    .tsCatalogGrid {
        grid-template-columns: 1fr;
    }

    .tsCatalogCard h3 {
        font-size: 19px;
    }

    .tsCatalogEstimate {
        padding: 16px 0 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tsCatalog *,
    .tsCatalog *::before,
    .tsCatalog *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
