/* ==========================================================================
   FAQ Аккордеон — Elementor widget ci-faq
   ========================================================================== */

.ci-faq {
    --ci-purple: #3d2d7a !important;
    --ci-accent: #6C5FB8 !important;
    --ci-faq-bg: #FFF8F1 !important;
    --ci-faq-radius: 18px;
    --ci-faq-gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.ci-faq__title {
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 800;
    color: var(--ci-purple);
    line-height: 1.2;
    margin: 0 0 32px 0;
}

.ci-faq__list {
    display: flex;
    flex-direction: column;
    gap: var(--ci-faq-gap);
}

.ci-faq__item {
    background: #fff !important;
    border-radius: var(--ci-faq-radius);
    box-shadow: 0 2px 8px rgba(60, 45, 122, 0.05);
    overflow: hidden;
    min-width: 0;
    transition: box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.3s ease;
}

.ci-faq__item.is-open {
    box-shadow: 0 8px 28px rgba(60, 45, 122, 0.12);
}

/* Кнопка-вопрос — весь header кликабелен */
.ci-faq__question {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 24px !important;
    padding: 24px 32px !important;
    border: 0 !important;
    background: #fff !important;
    color: var(--ci-purple) !important;
    font-family: inherit !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    text-align: left !important;
    cursor: pointer !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow: hidden !important;
}

.ci-faq__question:focus-visible {
    outline: 2px solid var(--ci-accent);
    outline-offset: -4px;
}

.ci-faq__question:hover {
    background: #fff !important;
    color: #6C5FB8 !important;
}

.ci-faq__question-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Иконка +/× через два псевдоэлемента */
.ci-faq__icon {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.ci-faq__icon::before,
.ci-faq__icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 2.5px;
    background: var(--ci-purple);
    border-radius: 2px;
    transform: translate(-50%, -50%);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ci-faq__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* Open: палочки расходятся в крест → морф + → × */
.ci-faq__item.is-open .ci-faq__icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ci-faq__item.is-open .ci-faq__icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Панель ответа: collapsed по умолчанию.
   Высоту в открытом состоянии задаёт JS (точное значение scrollHeight),
   поэтому переход max-height получается линейным от 0 до реальной высоты,
   без «пустой» части анимации. */
.ci-faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: max-height;
}

.ci-faq__answer-inner {
    padding: 0 32px 24px;
    color: #333;
    font-size: 16px;
    line-height: 1.65;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease 0.05s,
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.05s;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.ci-faq__item.is-open .ci-faq__answer-inner {
    opacity: 1;
    transform: translateY(0);
}

.ci-faq__answer-inner p {
    margin: 0 0 12px;
}

.ci-faq__answer-inner p:last-child {
    margin-bottom: 0;
}

.ci-faq__answer-inner a {
    color: var(--ci-accent);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Адаптив
-------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .ci-faq {
        --ci-faq-radius: 14px;
        --ci-faq-gap: 10px;
    }

    .ci-faq__question {
        padding: 18px 20px;
        font-size: 16px;
        gap: 16px;
    }

    .ci-faq__answer-inner {
        padding: 0 20px 18px;
        font-size: 15px;
    }

    .ci-faq__icon {
        width: 20px;
        height: 20px;
    }

    .ci-faq__icon::before,
    .ci-faq__icon::after {
        width: 14px;
    }
}