/**
 * @file: assets/css/speakers-carousel.css
 * @description: Карусель карточек спикеров: 4/2/1 + peek справа, стрелки nav, высота ≤ 80vh.
 *   Изолирована от влияния других шорткодов (расписание и т.д.).
 * @created: 2026-09-03
 * @updated: 2026-09-09
 */

/* Изоляция карусели от глобальных стилей WordPress и других шорткодов */
.conf-speakers-carousel {
    --conf-sc-gap: 16px;
    --conf-sc-peek: 56px;
    --conf-sc-per-view: 4;
    /* Потолок блока: хватает на длинные должности + зум ~150% без внешнего CSS */
    --conf-sc-max-h: 80vh;
    /* Запас под ФИО + длинную должность/компанию (фото режется снизу, голова top) */
    --conf-sc-info-reserve: 10rem;
    /* Воздух снизу, чтобы рамка не упиралась в overflow:hidden */
    --conf-sc-pad-bottom: 16px;
    width: 100%;
    max-height: var(--conf-sc-max-h);
    padding-bottom: var(--conf-sc-pad-bottom);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    background: transparent !important;
    --wp--preset--color--contrast: transparent !important;
    isolation: isolate;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.conf-speakers-carousel--empty {
    display: none;
}

.conf-speakers-carousel--static .conf-speakers-carousel__nav {
    display: none;
}

.conf-speakers-carousel__viewport {
    width: 100%;
    overflow: hidden;
    background: transparent !important;
    cursor: grab;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.conf-speakers-carousel--dragging,
.conf-speakers-carousel--dragging .conf-speakers-carousel__viewport {
    cursor: grabbing;
}

.conf-speakers-carousel--dragging {
    user-select: none;
}

.conf-speakers-carousel--dragging img {
    pointer-events: none;
}

.conf-speakers-carousel__track {
    display: flex;
    gap: var(--conf-sc-gap);
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    margin: 0;
    padding: 0;
    background: transparent !important;
    --wp--preset--color--contrast: transparent !important;
    backface-visibility: hidden;
}

.conf-speakers-carousel__item {
    /* N полных карточек + peek следующей справа */
    flex: 0 0 calc((100% - var(--conf-sc-peek) - (var(--conf-sc-per-view) - 1) * var(--conf-sc-gap)) / var(--conf-sc-per-view));
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: var(--conf-radius-card, 10px);
    transition: border-color .18s ease;
    background: transparent !important;
    --wp--preset--color--contrast: transparent !important;
}

.conf-speakers-carousel__item:hover,
.conf-speakers-carousel__item:active,
.conf-speakers-carousel__item.is-touch-active,
.conf-speakers-carousel__item:focus-within {
    border-color: var(--conf-accent, #7bd68a);
}

/* Дополнительная изоляция */
.conf-speakers-carousel * {
    --wp--preset--color--contrast: transparent !important;
}

.conf-speakers-carousel *:not(img):not(.conf-speakers-carousel__img):not(.conf-speakers-carousel__nav):not(.conf-speakers-carousel__nav *),
.conf-speakers-carousel *:not(img):not(.conf-speakers-carousel__img):not(.conf-speakers-carousel__nav):not(.conf-speakers-carousel__nav *)::before,
.conf-speakers-carousel *:not(img):not(.conf-speakers-carousel__img):not(.conf-speakers-carousel__nav):not(.conf-speakers-carousel__nav *)::after {
    background-color: transparent !important;
    background: transparent !important;
}

.conf-speakers-carousel__photo {
    width: 100%;
    overflow: hidden;
    border-radius: var(--conf-radius-card, 10px);
    flex: 0 1 auto;
    min-height: 0;
}

.conf-speakers-carousel__img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    max-height: calc(var(--conf-sc-max-h) - var(--conf-sc-info-reserve) - var(--conf-sc-pad-bottom));
    object-fit: cover;
    object-position: top;
    background: #e9eef5;
    border-radius: var(--conf-radius-card, 10px);
    display: block;
    transition: transform 1s ease;
    will-change: transform;
}

.conf-speakers-carousel__item:hover .conf-speakers-carousel__img,
.conf-speakers-carousel__item:active .conf-speakers-carousel__img,
.conf-speakers-carousel__item.is-touch-active .conf-speakers-carousel__img,
.conf-speakers-carousel__item:focus-within .conf-speakers-carousel__img {
    transform: scale(1.06);
}

.conf-speakers-carousel__info {
    margin-top: 8px;
    flex: 0 0 auto;
}

.conf-speakers-carousel__name {
    font-weight: 600;
    line-height: 1.25;
    margin: 0;
    color: var(--conf-heading, #ffffff);
}

.conf-speakers-carousel__role {
    opacity: .9;
    line-height: 1.3;
    margin-top: 4px;
    color: var(--conf-heading, #ffffff);
}

.conf-speakers-carousel__company {
    opacity: .9;
    line-height: 1.3;
    margin-top: 2px;
    color: var(--conf-heading, #ffffff);
}

/* Nav arrows — только белые стрелки, без подложки */
.conf-speakers-carousel__nav {
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    color: #ffffff;
    font-size: 42px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity .18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.conf-speakers-carousel__nav:hover,
.conf-speakers-carousel__nav:focus {
    background: transparent !important;
    opacity: 1;
    outline: none;
}

.conf-speakers-carousel__nav:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.conf-speakers-carousel__nav span {
    display: block;
    margin-top: -4px;
    background: transparent !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.conf-speakers-carousel__nav--prev {
    left: 2px;
}

.conf-speakers-carousel__nav--next {
    right: 2px;
}

/* Адаптивность: 4+peek / 2+peek / 1+peek */
@media (max-width: 768px) {
    .conf-speakers-carousel {
        --conf-sc-per-view: 2;
        --conf-sc-peek: 48px;
        --conf-sc-gap: 12px;
        --conf-sc-info-reserve: 9.5rem;
    }

    .conf-speakers-carousel__nav {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .conf-speakers-carousel {
        --conf-sc-per-view: 1;
        --conf-sc-peek: 40px;
        --conf-sc-gap: 12px;
        --conf-sc-info-reserve: 9rem;
    }
}
