/* ==========================================================================
   Все специалисты (archive-specialist.php, /specialits/).
   Замеры: Tilda page52206905 при ширине 1400 и 375. Только flex.
   ========================================================================== */

.specs-page {
    background: #f5f5f5;
    font-family: 'Montserrat', Arial, sans-serif;
    color: #3f3f3f;
}

.specs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

.specs-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Шапка (rec803015907): белая плашка со скруглением 20 ─────────────────── */

.specs-hero {
    padding: 60px 0 27px;
    border-radius: 20px 20px 0 0;
    background: #fff;
}

.specs-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    font-size: 14px;
    line-height: 22px;
    color: #171717;
}

.specs-crumbs a { color: inherit; text-decoration: none; }
.specs-crumbs a:hover { color: #0093d5; }
.specs-crumbs__sep,
.specs-crumbs > span:last-child { opacity: .5; }

.specs-hero__title {
    max-width: 1033px;
    margin: 24px 0 0;
    font: 500 32px/35px 'FuturaPT', Arial, sans-serif;
    color: #171717;
}

.specs-hero__title span { color: #0093d5; }

.specs-hero__text {
    max-width: 712px;
    margin: 12px 0 0;
    font-size: 16px;
    line-height: 25px;
    color: #3f3f3f;
}

/* ── Каталог (rec775354611, t951) ─────────────────────────────────────────── */

.specs-catalog {
    padding: 0 0 60px;
    background: #fff;
}

.specs-catalog__top {
    display: flex;
    justify-content: flex-end;
    padding: 0 10px 20px;
}

.specs-search {
    position: relative;
    display: block;
    width: 220px;
}

.specs-search input {
    display: block;
    width: 100%;
    height: 25px;
    padding: 0 30px 0 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f8f8f8;
    font: 13px/23px 'Montserrat', Arial, sans-serif;
    color: #000;
    outline: none;
    -webkit-appearance: none;
}

.specs-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.specs-search input:focus { border-color: #b8b8b8; }

.specs-search svg {
    position: absolute;
    top: 6px;
    right: 9px;
    width: 13px;
    height: 13px;
    color: #757575;
    pointer-events: none;
}

.specs-catalog__row {
    display: flex;
    align-items: stretch;
    gap: 30px;
    padding: 0 10px;
}

/* Фильтр — серая колонка во всю высоту каталога */
.specs-filter {
    flex: 0 0 272px;
    padding: 30px;
    border-radius: 12px;
    background: #fafafa;
}

.specs-filter__bar,
.specs-search--mob { display: none; }

/* Флажки прилипают при прокрутке, как на Тильде; отступ сверху = высота шапки (--specs-sticky, из main.js) + 30 */
.specs-filter__body {
    position: sticky;
    top: calc(var(--specs-sticky, 138px) + 30px);
}

.specs-filter__title {
    display: block;
    width: 100%;
    margin: 0 0 11px;
    padding: 0;
    border: 0;
    background: none;
    font: 600 13px/20px 'Montserrat', Arial, sans-serif;
    color: #171717;
    text-align: left;
    pointer-events: none; /* на компьютере не сворачивается */
}

.specs-check {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 20px;
    font-size: 13px;
    line-height: 20px;
    color: #5f5a5a;
    cursor: pointer;
}

.specs-check + .specs-check { margin-top: 8px; }

.specs-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.specs-check__box {
    position: relative;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #5f5a5a;
    opacity: .6;
    transition: opacity .2s;
}

.specs-check__box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #5f5a5a;
    border-width: 0 2px 2px 0;
    opacity: 0;
    transform: rotate(45deg);
}

.specs-check:hover .specs-check__box,
.specs-check input:checked + .specs-check__box { opacity: 1; }
.specs-check input:checked + .specs-check__box::after { opacity: 1; }
.specs-check input:focus-visible + .specs-check__box { outline: 2px solid #0093d5; outline-offset: 2px; }

/* Карточки: 4 в ряд, 233 × фото 233×310 */
.specs-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 50px 20px;
    flex: 1 1 auto;
    min-width: 0;
}

.specs-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 0 calc((100% - 60px) / 4);
    min-width: 0;
}

.specs-card[hidden] { display: none; }

.specs-card__photo {
    display: block;
    width: 100%;
    aspect-ratio: 233 / 310;
    overflow: hidden;
    border-radius: 12px;
    background: #f2f2f2;
}

.specs-card__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.specs-card__photo:hover img { transform: scale(1.03); }

.specs-card__name {
    margin: 20px 0 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    color: #000;
}

.specs-card__name a { color: inherit; text-decoration: none; }
.specs-card__name a:hover { color: #0093d5; }

.specs-card__role {
    margin: 7px 0 0;
    font-size: 15px;
    line-height: 23px;
    color: #828282;
}

.specs-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 45px;
    margin-top: 31px;
    padding: 12px 30px;
    border: 1px solid #0093d5;
    border-radius: 40px;
    color: #0093d5;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}

.specs-card__btn span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.specs-card__btn:hover { background: #0093d5; color: #fff; }

.specs-grid__empty {
    margin: 0;
    font-size: 16px;
    color: #828282;
}

/* Переход к футеру (rec803015463): градиент 100px белый → #f5f5f5 */
.specs-fade {
    height: 100px;
    background: linear-gradient(0deg, #f5f5f5 0%, #fff 100%);
}

/* ── Адаптив ──────────────────────────────────────────────────────────────── */

@media (max-width: 1199px) {
    .specs-container { padding: 0 20px; }
    .specs-card { flex-basis: calc((100% - 40px) / 3); }
}

/* Планшет и телефон: фильтр — плашка «Фильтры» + лупа над карточками */
@media (max-width: 959px) {
    .specs-catalog__top { display: none; }
    .specs-catalog__row { flex-direction: column; gap: 20px; padding: 0; }
    .specs-filter { flex: 0 0 auto; margin: 0 15px; padding: 30px 35px; }

    .specs-filter__bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .specs-filter__toggle,
    .specs-filter__search-btn {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0;
        border: 0;
        background: none;
        color: #171717;
        font: 600 12px/24px 'Montserrat', Arial, sans-serif;
        cursor: pointer;
    }

    .specs-filter__toggle svg { width: 16px; height: 22px; }
    .specs-filter__search-btn svg { width: 16px; height: 20px; color: #000; }

    /* «Фильтры» открывает блок «Специализация» между линиями (свёрнут, раскрывается по заголовку),
       лупа — поиск под ним (Tilda t951, мобильный вид) */
    .specs-filter__body {
        position: static;
        display: none;
        margin-top: 20px;
        padding: 10px 0;
        border-top: 1px solid rgba(23, 23, 23, .3);
        border-bottom: 1px solid rgba(23, 23, 23, .3);
    }

    .specs-filter.is-filters .specs-filter__body { display: block; }
    .specs-filter.is-filters .specs-filter__toggle,
    .specs-filter.is-search .specs-filter__search-btn { opacity: .5; }

    .specs-filter__title {
        position: relative;
        margin: 0;
        padding-right: 14px;
        pointer-events: auto;
        cursor: pointer;
    }

    .specs-filter__title::after {
        content: '';
        position: absolute;
        top: 5px;
        right: 2px;
        width: 6px;
        height: 6px;
        border: solid #171717;
        border-width: 0 1px 1px 0;
        transform: rotate(45deg);
        transition: transform .2s;
    }

    .specs-filter__title[aria-expanded="true"]::after { top: 8px; transform: rotate(-135deg); }

    .specs-filter__options { display: none; padding: 20px 0 13px; }
    .specs-filter__title[aria-expanded="true"] + .specs-filter__options { display: block; }

    .specs-search--mob { width: 100%; margin-top: 20px; }
    .specs-filter.is-search .specs-search--mob { display: block; }

    .specs-search--mob input {
        height: 35px;
        padding: 2px 50px 2px 10px;
        font-size: 16px;
        line-height: 29px;
    }

    .specs-search__btn {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 35px;
        border-left: 1px solid #ddd;
    }

    .specs-search--mob .specs-search__btn svg { position: static; width: 13px; height: 13px; }
}

@media (max-width: 639px) {
    .specs-hero { padding: 50px 0 29px; }
    .specs-hero .specs-container { padding: 0 max(20px, calc(50% - 160px)); } /* текст шапки по сетке 320, карточки — шире */
    .specs-crumbs { font-size: 12px; line-height: 19px; }
    .specs-hero__title { margin-top: 21px; font-size: 28px; line-height: 31px; letter-spacing: -.7px; }
    .specs-hero__text { margin-top: 14px; }

    .specs-grid { gap: 60px 10px; }
    .specs-card { flex-basis: calc((100% - 10px) / 2); }
    .specs-card__photo { aspect-ratio: 163 / 216; }
    .specs-card__name { font-size: 15px; line-height: 20px; }
    .specs-card__role { margin-top: 8px; font-size: 12px; line-height: 19px; }
    .specs-card__btn { padding: 14px 20px; }
    .specs-card__btn span { white-space: normal; }
}
