/* ===================================
   СПЕЦИАЛИСТЫ - КАРУСЕЛЬ
   =================================== */

.specialists {
    padding: var(--space-24) 0;
    background-color: var(--color-bg-blue);
    position: relative;
    overflow: hidden;
}

.specialists__header {
    margin-bottom: var(--space-12);
}

/* Обёртка карусели */
.specialists__carousel-wrapper {
    position: relative;
    display: block; /* Изменено с flex */
}

/* Контейнер карусели */
.specialists__carousel {
    overflow: hidden;
    width: 100%;
    position: relative;
}

/* Grid внутри карусели */
.specialists__grid {
    display: flex;
    gap: var(--space-6);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    align-items: stretch;
}

/* Карточка специалиста */
.specialist-card {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    width: calc((100% - (var(--space-6) * 3)) / 4);
}

.specialist-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-6px);
    border-color: rgba(48, 166, 218, .15);
}

.specialist-card__photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-primary-light);
    flex-shrink: 0;
}

.specialist-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform var(--transition-slow);
}

.specialist-card:hover .specialist-card__photo img {
    transform: scale(1.05);
}

.specialist-card__info {
    padding: var(--space-5) var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex-grow: 1;
}

.specialist-card__name {
    font-family: var(--font-heading), serif;
    font-size: var(--fz-base);
    font-weight: var(--fw-bold);
    color: var(--color-text);
    line-height: var(--lh-tight);
    height: 2.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: var(--space-3);
}

.specialist-card__role {
    font-size: var(--fz-sm);
    color: var(--color-primary);
    font-weight: var(--fw-medium);
    position: relative;
    padding-bottom: var(--space-3);
    height: 4em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: var(--space-2);
}

.specialist-card__role::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background-color: var(--color-primary-light);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.specialist-card:hover .specialist-card__role::after {
    width: 56px;
    background-color: var(--color-primary);
}

.specialist-card__exp {
    font-size: var(--fz-xs);
    color: var(--color-text-secondary);
    height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: var(--space-4);
}

.specialist-card .btn--outline {
    width: 100%;
    margin-top: auto;
}

/* Контейнер навигации с точками */
.specialists__navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-8);
}

/* Кнопки навигации */
.specialists__nav {
    position: static; /* Изменено с absolute */
    transform: none; /* Убрано позиционирование */
    z-index: 10;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.specialists__nav:hover:not(:disabled) {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
    transform: scale(1.05);
}

.specialists__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.specialists__nav svg {
    width: 24px;
    height: 24px;
}

/* Индикаторы (dots) */
.specialists__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.specialists__dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    padding: 0;
}

.specialists__dot:hover {
    background: var(--color-primary-light);
    transform: scale(1.2);
}

.specialists__dot.active {
    background: var(--color-primary);
    width: 24px;
}

.specialists__footer {
    display: flex;
    justify-content: center;
    margin-top: var(--space-12);
}

/* Loader */
.specialists__loader {
    text-align: center;
    padding: 3rem 0;
    width: 100%;
}

.specialists {
    padding: var(--space-24) 0;
    background-color: var(--color-bg-blue);
    position: relative;
    overflow: hidden;
}

/* Голубое пятно по центру */
.specialists__bg-blob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 58%; /* уменьшено */
    height: 72%; /* уменьшено */
    background: radial-gradient(ellipse at center,
    rgba(48, 166, 218, .13) 0%,
    rgba(5, 171, 242, .07) 30%,
    rgba(5, 171, 242, .03) 50%,
    transparent 60%
    );
    z-index: 0;
    pointer-events: none;
    filter: blur(70px);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    animation: morphBlobSpecialists 20s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes morphBlobSpecialists {
    0% {
        transform: translate(-50%, -50%) scale(0.96) rotate(0deg);
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }
    33% {
        transform: translate(-48%, -52%) scale(1.03) rotate(120deg);
        border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
    }
    66% {
        transform: translate(-52%, -48%) scale(0.92) rotate(240deg);
        border-radius: 50% 50% 60% 40% / 60% 40% 50% 50%;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.98) rotate(360deg);
        border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    }
}

/* Контент секции поверх фона */
.specialists > .container,
.specialists__header,
.specialists__carousel-wrapper,
.specialists__navigation,
.specialists__footer {
    position: relative;
    z-index: 2;
}
/* ===================================
   RESPONSIVE STYLES
=================================== */

/* ── 1200px: Широкие ноутбуки ── */
@media (max-width: 1200px) {
    .specialist-card {
        width: calc((100% - (var(--space-5) * 3)) / 4);
    }

    .specialists__grid {
        gap: var(--space-5);
    }
}

/* ── 1024px: Планшет landscape ── */
@media (max-width: 1024px) {
    .specialist-card {
        width: calc((100% - (var(--space-5) * 2)) / 3);
    }

    .specialists__nav {
        width: 44px;
        height: 44px;
    }

    .specialists__nav svg {
        width: 20px;
        height: 20px;
    }
}

/* ── 768px: Планшет portrait / Мобильные ── */
@media (max-width: 768px) {
    .specialists {
        padding: var(--space-16) 0;
    }

    .specialist-card {
        width: calc((100% - var(--space-4)) / 2);
    }

    .specialists__grid {
        gap: var(--space-4);
    }

    .specialists__navigation {
        gap: var(--space-4);
        margin-top: var(--space-6);
    }

    .specialists__nav {
        width: 40px;
        height: 40px;
    }

    .specialists__nav svg {
        width: 18px;
        height: 18px;
    }

    .specialist-card__name {
        font-size: var(--fz-sm);
        height: 2.6em;
    }

    .specialist-card__role {
        height: 3.8em;
    }

    .specialist-card__exp {
        height: 1.4em;
    }
}

/* ── 480px: Мобильные portrait ── */
@media (max-width: 480px) {
    .specialists {
        padding: var(--space-12) 0;
    }

    .specialist-card {
        width: calc((100% - var(--space-3)) / 2);
    }

    .specialists__grid {
        gap: var(--space-3);
    }

    .specialist-card__info {
        padding: var(--space-4) var(--space-3) var(--space-5);
    }

    .specialists__navigation {
        gap: var(--space-3);
    }

    .specialists__nav {
        width: 36px;
        height: 36px;
    }

    .specialists__nav svg {
        width: 16px;
        height: 16px;
    }

    .specialist-card__name {
        font-size: 0.8rem;
        height: 2.4em;
        margin-bottom: var(--space-2);
    }

    .specialist-card__role {
        font-size: var(--fz-xs);
        height: 3.6em;
        margin-bottom: var(--space-1);
    }

    .specialist-card__exp {
        font-size: 0.7rem;
        height: 1.4em;
        margin-bottom: var(--space-3);
    }

    .specialists__footer {
        margin-top: var(--space-8);
    }
}

/* ── 360px: Очень маленькие экраны ── */
@media (max-width: 360px) {
    .specialist-card {
        width: calc((100% - var(--space-2)) / 1.5);
    }

    .specialists__grid {
        gap: var(--space-2);
    }

    .specialists__navigation {
        gap: var(--space-2);
    }

    .specialists__nav {
        width: 32px;
        height: 32px;
    }

    .specialists__nav svg {
        width: 14px;
        height: 14px;
    }

    .specialist-card__name {
        font-size: 0.72rem;
        height: 2.2em;
    }

    .specialist-card__role {
        height: 3.4em;
    }

    .specialist-card__exp {
        height: 1.3em;
    }
}

/* ── Landscape на мобильных ── */
@media (orientation: landscape) and (max-height: 500px) {
    .specialists {
        padding: var(--space-10) 0;
    }

    .specialist-card {
        width: calc((100% - (var(--space-3) * 3)) / 4);
        display: flex;
        flex-direction: column;
    }

    .specialists__grid {
        gap: var(--space-3);
        align-items: stretch;
    }

    /* Фото - фиксированная высота */
    .specialist-card__photo {
        aspect-ratio: 4 / 3;
        min-height: 120px;
        max-height: 120px; /* ДОБАВЛЕНО: фиксируем максимальную высоту */
        flex-shrink: 0;
    }

    .specialist-card__photo img {
        object-position: center 30%;
    }

    .specialist-card__info {
        padding: var(--space-3) var(--space-3) var(--space-4);
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0; /* ВАЖНО: позволяет flex-детям сжиматься */
    }

    /* Имя - фиксированная высота с overflow */
    .specialist-card__name {
        font-size: 0.8rem;
        line-height: 1.3;
        height: 2.6em; /* ИЗМЕНЕНО: фиксированная высота (2 строки) */
        min-height: 2.6em;
        margin-bottom: var(--space-2);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-wrap: break-word;
        hyphens: auto;
        flex-shrink: 0; /* Не сжимаем */
    }

    /* Роль - фиксированная высота с overflow */
    .specialist-card__role {
        font-size: 0.72rem;
        line-height: 1.35;
        height: 4em; /* ИЗМЕНЕНО: фиксированная высота (~3 строки) */
        min-height: 4em;
        padding-bottom: var(--space-3);
        margin-bottom: var(--space-2);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        word-wrap: break-word;
        hyphens: auto;
        flex-shrink: 0; /* Не сжимаем */
    }

    .specialist-card__role::after {
        width: 24px;
    }

    /* Опыт - фиксированная высота */
    .specialist-card__exp {
        font-size: 0.7rem;
        line-height: 1.2;
        height: 1.2em; /* ИЗМЕНЕНО: фиксированная высота (1 строка) */
        margin-bottom: var(--space-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 0;
    }

    /* Кнопка - прижимаем к низу */
    .specialist-card .btn--outline {
        font-size: 0.75rem;
        padding: var(--space-2) var(--space-3);
        margin-top: auto;
        flex-shrink: 0;
    }

    .specialists__navigation {
        gap: var(--space-3);
        margin-top: var(--space-4);
    }

    .specialists__nav {
        width: 36px;
        height: 36px;
    }
}

/* ── Очень низкие экраны (например, iPhone SE в landscape) ── */
@media (orientation: landscape) and (max-height: 400px) {
    .specialists {
        padding: var(--space-8) 0;
    }

    .specialist-card {
        width: calc((100% - (var(--space-2) * 4)) / 5);
        display: flex;
        flex-direction: column;
    }

    .specialists__grid {
        gap: var(--space-2);
        align-items: stretch;
    }

    .specialist-card__photo {
        aspect-ratio: 1 / 1;
        min-height: 100px;
        max-height: 100px; /* ДОБАВЛЕНО */
        flex-shrink: 0;
    }

    .specialist-card__photo img {
        object-position: center 35%;
    }

    .specialist-card__info {
        padding: var(--space-2) var(--space-2) var(--space-3);
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
    }

    .specialist-card__name {
        font-size: 0.72rem;
        line-height: 1.25;
        height: 2.5em; /* ИЗМЕНЕНО: фиксированная высота */
        min-height: 2.5em;
        margin-bottom: var(--space-1);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-wrap: break-word;
        hyphens: auto;
        flex-shrink: 0;
    }

    .specialist-card__role {
        font-size: 0.68rem;
        line-height: 1.3;
        height: 3.9em; /* ИЗМЕНЕНО: фиксированная высота */
        min-height: 3.9em;
        padding-bottom: var(--space-2);
        margin-bottom: var(--space-1);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        word-wrap: break-word;
        hyphens: auto;
        flex-shrink: 0;
    }

    .specialist-card__role::after {
        width: 20px;
        height: 1.5px;
    }

    .specialist-card__exp {
        font-size: 0.65rem;
        line-height: 1.2;
        height: 1.2em; /* ИЗМЕНЕНО: фиксированная высота */
        margin-bottom: var(--space-2);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 0;
    }

    .specialist-card .btn--outline {
        font-size: 0.7rem;
        padding: var(--space-1) var(--space-2);
        margin-top: auto;
        flex-shrink: 0;
    }

    .specialists__navigation {
        margin-top: var(--space-3);
    }

    .specialists__nav {
        width: 32px;
        height: 32px;
    }

    .specialists__nav svg {
        width: 14px;
        height: 14px;
    }
}


/* ── Дополнительная корректировка для средних landscape экранов ── */
@media (orientation: landscape) and (min-height: 401px) and (max-height: 600px) {
    .specialist-card__photo {
        aspect-ratio: 4 / 3;
        min-height: 140px;
        max-height: 140px; /* ДОБАВЛЕНО */
    }

    .specialist-card__name {
        font-size: 0.85rem;
        height: 2.6em; /* ДОБАВЛЕНО */
        min-height: 2.6em;
    }

    .specialist-card__role {
        font-size: 0.75rem;
        height: 4em; /* ДОБАВЛЕНО */
        min-height: 4em;
    }

    .specialist-card__exp {
        font-size: 0.72rem;
        height: 1.2em; /* ДОБАВЛЕНО */
    }
}

/* ── Touch-устройства: убираем hover-эффекты ── */
@media (hover: none) and (pointer: coarse) {
    .specialist-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .specialist-card:hover .specialist-card__photo img {
        transform: none;
    }

    .specialists__nav:hover:not(:disabled) {
        transform: none;
        background: var(--color-white);
        color: var(--color-text);
    }
}

/* ── Печать ── */
@media print {
    .specialists__navigation,
    .specialists__footer {
        display: none;
    }

    .specialist-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
