/* =================================================================
   ИИ для бизнеса: страница /ai, демо-чат и блок на главной
   ================================================================= */

.ai-grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* — Первый экран — */
.ai-hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.ai-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.ai-hero__chips li { font-size: 12px; color: var(--ink-soft); padding: 6px 12px; border: 1px solid var(--border-2); border-radius: 100px; background: rgba(255,255,255,.02); }

/* =================================================================
   ДЕМО
   ================================================================= */
.ai-demo-section { padding-top: 60px; }
.aidemo__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.aidemo__tabs button {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 100px;
    font-size: 14px; font-weight: 600; color: var(--ink-soft);
    background: var(--surface); border: 1px solid var(--border); transition: border-color .2s, color .2s, background .2s;
}
.aidemo__tabs button:hover { color: var(--ink); border-color: var(--border-2); }
.aidemo__tabs button.is-active { color: #fff; background: rgba(77,124,254,.16); border-color: var(--azure); }
.aidemo__grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.aidemo--auto .aidemo__grid { grid-template-columns: 1fr; }

/* — Окно чата — */
.aichat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.aichat__head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.aichat__avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: var(--grad-soft); border: 1px solid var(--border-2); flex-shrink: 0; }
.aichat__who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.aichat__who b { font-family: var(--f-display); font-size: 15px; }
.aichat__who > span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-mut); }
.aichat__online { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 8px #22C55E; }
.aichat__ai { margin-left: auto; font-size: 11px; color: var(--cyan); padding: 4px 9px; border-radius: 100px; border: 1px solid rgba(56,232,255,.35); background: rgba(56,232,255,.08); }

.aichat__body { height: 440px; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.aidemo--auto .aichat__body { height: 380px; }

.aichat__msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.aichat__msg.is-in { opacity: 1; transform: none; }
.aichat__msg--bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-2); border-bottom-left-radius: 4px; }
.aichat__msg--user { align-self: flex-end; background: var(--azure); color: #fff; border-bottom-right-radius: 4px; }
.aichat__msg--wide { align-self: stretch; max-width: 100%; padding: 0; }
.aichat__msg--system { align-self: center; font-family: var(--f-mono); font-size: 11.5px; color: #22C55E; padding: 6px 12px; border-radius: 100px; background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.25); }
.aichat__msg--docs { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; max-width: 100%; }
.aichat__msg--typing { padding: 12px 16px; }

.aichat__typing { display: inline-flex; gap: 4px; }
.aichat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-mut); animation: aiTyping 1.2s infinite ease-in-out; }
.aichat__typing i:nth-child(2) { animation-delay: .15s; }
.aichat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiTyping { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.aichat__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.aichat__card { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border-2); font-size: 13px; }
.aichat__card-ic { font-size: 26px; margin-bottom: 4px; }
.aichat__card b { font-family: var(--f-display); font-size: 14px; }
.aichat__card span { color: var(--ink-mut); }
.aichat__card em { font-style: normal; color: var(--cyan); margin-top: 6px; font-size: 13px; }

.aichat__fields { padding: 14px 16px; border-radius: 14px; background: rgba(56,232,255,.05); border: 1px solid rgba(56,232,255,.25); }
.aichat__fields-title { display: block; font-size: 11.5px; color: var(--cyan); margin-bottom: 10px; letter-spacing: .04em; }
.aichat__fields dl, .airesult__rows { display: flex; flex-direction: column; gap: 7px; }
.aichat__fields dl > div, .airesult__rows > div { display: grid; grid-template-columns: 128px 1fr; gap: 12px; font-size: 13.5px; }
.aichat__fields dt, .airesult__rows dt { color: var(--ink-mut); }
.aichat__fields dd, .airesult__rows dd { color: var(--ink); }

.aichat__doc { font-size: 12px; color: var(--amber); padding: 5px 10px; border-radius: 100px; background: rgba(255,138,76,.08); border: 1px solid rgba(255,138,76,.28); }

.aichat__incoming { padding: 14px 16px; border-radius: 14px; background: var(--bg-2); border: 1px dashed var(--border-2); }
.aichat__incoming-meta { display: block; font-size: 11.5px; color: var(--ink-mut); margin-bottom: 6px; }
.aichat__incoming p { font-size: 14px; color: var(--ink-soft); }

.aichat__replies { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; min-height: 66px; padding: 12px 18px 16px; border-top: 1px solid var(--border); background: var(--bg-2); }
.aichat__reply {
    padding: 10px 16px; border-radius: 100px; font-size: 14px; font-weight: 600; color: #fff;
    background: rgba(77,124,254,.18); border: 1px solid var(--azure);
    transition: background .2s, transform .2s; animation: aiPulse 2s ease-in-out infinite;
}
.aichat__reply:hover, .aichat__reply.is-pressed { background: var(--azure); transform: translateY(-1px); animation: none; }
.aichat__reply--ghost { color: var(--ink-soft); background: transparent; border-color: var(--border-2); animation: none; }
.aichat__reply--ghost:hover { background: rgba(255,255,255,.05); color: var(--ink); }
@keyframes aiPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(77,124,254,.0); } 50% { box-shadow: 0 0 0 5px rgba(77,124,254,.18); } }

/* — Итог для менеджера — */
.airesult-wrap { display: flex; flex-direction: column; gap: 10px; }
.airesult-wrap__label { font-size: 12px; color: var(--ink-mut); }
.airesult-wrap__label b { color: var(--violet); font-weight: 500; }
.airesult { flex: 1; padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.airesult.is-done { border-color: rgba(34,197,94,.45); background: linear-gradient(180deg, rgba(34,197,94,.06), var(--surface) 45%); animation: aiResultIn .5s cubic-bezier(.16,1,.3,1); }
@keyframes aiResultIn { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.airesult__empty { height: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; color: var(--ink-mut); font-size: 14px; }
.airesult__empty-ic { font-size: 30px; opacity: .7; }
.airesult__head { margin-bottom: 18px; }
.airesult__head h3 { font-family: var(--f-display); font-size: 1.2rem; margin-top: 10px; }
.airesult__badge { font-size: 11px; color: #22C55E; padding: 4px 10px; border-radius: 100px; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); }
.airesult__note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--ink-soft); }

.ai-demo__note { margin-top: 18px; font-size: 13.5px; color: var(--ink-mut); max-width: 860px; }
.ai-demo__note a { color: var(--azure); white-space: nowrap; }
.ai-demo__note a:hover { text-decoration: underline; }

/* =================================================================
   РЕШЕНИЯ
   ================================================================= */
.ai-solutions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ai-sol {
    position: relative; display: flex; flex-direction: column; padding: 28px; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border);
    transition: transform .4s cubic-bezier(.2,.7,.3,1), border-color .3s, background .3s;
}
.ai-sol:hover { transform: translateY(-6px); border-color: var(--accent-c); background: var(--surface-2); }
.ai-sol__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.ai-sol__ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--accent-bg); border: 1px solid var(--accent-br); }
.ai-sol__price { font-size: 12.5px; color: var(--ink); padding: 6px 12px; border: 1px solid var(--accent-br); background: var(--accent-bg); border-radius: 100px; white-space: nowrap; }
.ai-sol__title { font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; line-height: 1.2; margin-bottom: 8px; }
.ai-sol__lead { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 18px; }
.ai-sol__list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 22px; }
.ai-sol__list li { display: flex; gap: 10px; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.ai-sol__list svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--accent-c); margin-top: 2px; }
.ai-sol__foot { display: flex; gap: 18px; align-items: center; margin-top: auto; }

.ai-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 26px; }
.ai-more__label { font-size: 12.5px; color: var(--ink-mut); margin-right: 4px; }
.ai-more span:not(.ai-more__label) { font-size: 13.5px; color: var(--ink-soft); padding: 7px 14px; border-radius: 100px; background: var(--surface); border: 1px solid var(--border); }
.ai-support { margin-top: 18px; padding: 22px 26px; border-radius: var(--r-lg); background: var(--grad-soft); border: 1px solid var(--border-2); }
.ai-support div { display: flex; flex-direction: column; gap: 4px; }
.ai-support b { font-family: var(--f-display); font-size: 1.08rem; }
.ai-support span { font-size: 14px; color: var(--ink-soft); }

/* =================================================================
   СВЯЗКА / КЕЙСЫ / ШАГИ / ДОВЕРИЕ
   ================================================================= */
.ai-flow-section { background: linear-gradient(180deg, transparent, rgba(12,17,32,.5), transparent); }
.ai-flow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; counter-reset: flow; }
.ai-flow__step { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.ai-flow__step:not(:last-child)::after { content: '→'; position: absolute; right: -11px; top: 30px; color: var(--azure); font-weight: 700; z-index: 1; }
.ai-flow__ic { font-size: 24px; margin-bottom: 4px; }
.ai-flow__step b { font-family: var(--f-display); font-size: 15px; line-height: 1.25; }
.ai-flow__step span { font-size: 13px; color: var(--ink-mut); line-height: 1.4; }

.ai-cases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ai-case { display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); transition: transform .3s, border-color .3s; }
.ai-case:hover { transform: translateY(-4px); border-color: var(--accent-c); }
.ai-case h3 { font-family: var(--f-display); font-size: 1.12rem; }
.ai-case p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.ai-case__link { margin-top: auto; font-size: 14px; font-weight: 600; color: var(--accent-c); }

.ai-process { background: linear-gradient(180deg, transparent, rgba(18,24,41,.4)); }
.ai-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ai-step { padding: 26px 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.ai-step__num { display: inline-block; font-size: 13px; color: var(--azure); padding: 5px 10px; border-radius: 8px; background: rgba(77,124,254,.1); margin-bottom: 16px; }
.ai-step h3 { font-family: var(--f-display); font-size: 1.12rem; margin-bottom: 8px; }
.ai-step p { font-size: 14px; color: var(--ink-soft); line-height: 1.55; }

.ai-trust-section { padding-top: 40px; padding-bottom: 40px; }
.ai-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ai-trust__item { padding: 26px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.ai-trust__ic { font-size: 26px; display: block; margin-bottom: 12px; }
.ai-trust__item h3 { font-family: var(--f-display); font-size: 1.12rem; margin-bottom: 8px; }
.ai-trust__item p { font-size: 14px; color: var(--ink-soft); line-height: 1.55; }

/* =================================================================
   БЛОК НА ГЛАВНОЙ
   ================================================================= */
.ai-teaser { background: radial-gradient(60% 70% at 85% 40%, rgba(155,109,255,.12), transparent 70%); }
.ai-teaser__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.ai-teaser__list { display: flex; flex-direction: column; gap: 8px; margin: 28px 0 32px; }
.ai-teaser__list a { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); transition: border-color .2s, transform .2s; }
.ai-teaser__list a:hover { border-color: var(--azure); transform: translateX(4px); }
.ai-teaser__list b { font-weight: 600; font-size: 15px; }
.ai-teaser__list em { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.ai-teaser__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.ai-teaser__caption { display: block; margin-top: 12px; font-size: 11.5px; color: var(--ink-mut); text-align: center; }

/* — Пункт меню — */
.nav__links a.nav__ai { color: var(--ink); }
.nav__links a.nav__ai .nav__ai-badge { font-family: var(--f-mono); font-size: 9.5px; color: var(--cyan); border: 1px solid rgba(56,232,255,.4); border-radius: 100px; padding: 1px 6px; margin-left: 5px; vertical-align: 2px; }

/* =================================================================
   АДАПТИВ
   ================================================================= */
@media (max-width: 1080px) {
    .ai-solutions { grid-template-columns: repeat(2, 1fr); }
    .ai-flow { grid-template-columns: repeat(3, 1fr); }
    .ai-flow__step:nth-child(3)::after { display: none; }
    .ai-cases, .ai-steps { grid-template-columns: repeat(2, 1fr); }
    .ai-teaser__grid { gap: 36px; }
}
@media (max-width: 860px) {
    .aidemo__grid { grid-template-columns: 1fr; }
    .ai-teaser__grid { grid-template-columns: 1fr; }
    .ai-trust { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .ai-solutions, .ai-cases, .ai-steps { grid-template-columns: 1fr; }
    .ai-flow { grid-template-columns: 1fr 1fr; }
    .ai-flow__step::after { display: none; }
    .aichat__body { height: 400px; padding: 16px 12px; }
    .aichat__msg { max-width: 90%; }
    .aichat__replies { padding: 10px 12px 14px; }
    .aichat__fields dl > div, .airesult__rows > div { grid-template-columns: 1fr; gap: 2px; }
    .aidemo__tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gut) * -1) 16px; padding: 0 var(--gut) 4px; scrollbar-width: none; }
    .aidemo__tabs button { flex-shrink: 0; }
    .ai-teaser__list em { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .aichat__msg { transition: none; opacity: 1; transform: none; }
    .aichat__reply { animation: none; }
}
.aichat__msg--hint { color: var(--ink-mut); background: rgba(255,255,255,.03); border-color: var(--border-2); }

/* =================================================================
   ЗАГОЛОВКИ: переливающийся градиент, широкие шапки
   ================================================================= */
.ai-grad { background-size: 220% auto; animation: aiShine 7s ease-in-out infinite; }
@keyframes aiShine { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.section__head--wide { max-width: 1020px; }
.ai-nowrap { white-space: nowrap; }
.ai-page .section__head .eyebrow::before { content: ''; display: inline-block; width: 22px; height: 1px; margin-right: 10px; vertical-align: middle; background: var(--grad); }

/* =================================================================
   ЖИВЫЕ КАРТОЧКИ: наклон и свет за курсором, как на остальном сайте
   ================================================================= */
:is(.ai-sol, .ai-case, .ai-step, .ai-flow__step, .ai-trust__item) { position: relative; isolation: isolate; transition: opacity .7s cubic-bezier(.16,1,.3,1) var(--d, 0s), transform .45s cubic-bezier(.2,.7,.3,1), border-color .3s, background .3s, box-shadow .3s; }
:is(.ai-sol, .ai-case, .ai-step, .ai-flow__step, .ai-trust__item) > * { position: relative; z-index: 1; }
:is(.ai-sol, .ai-case, .ai-step, .ai-flow__step, .ai-trust__item).pointer-reactive::before {
    content: ''; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(260px circle at var(--pointer-x) var(--pointer-y), rgba(77,124,254,.17), rgba(56,232,255,.055) 32%, transparent 68%);
    opacity: 0; transition: opacity .28s;
}
:is(.ai-sol, .ai-case, .ai-step, .ai-flow__step, .ai-trust__item).pointer-reactive:hover::before { opacity: 1; }
:is(.ai-sol, .ai-case, .ai-step, .ai-flow__step, .ai-trust__item).pointer-reactive:hover {
    transform: perspective(950px) translateY(-6px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}
:is(.ai-step, .ai-flow__step, .ai-trust__item):hover { border-color: var(--border-2); background: var(--surface-2); box-shadow: 0 24px 50px -30px rgba(77,124,254,.5); }

/* Иконки оживают при наведении */
.ai-sol__ic, .ai-flow__ic, .ai-trust__ic, .ai-step__num { transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .3s; }
.ai-sol:hover .ai-sol__ic { transform: translateY(-3px) rotate(-6deg) scale(1.08); box-shadow: 0 10px 24px -10px var(--accent-c); }
.ai-flow__step:hover .ai-flow__ic, .ai-trust__item:hover .ai-trust__ic { transform: translateY(-3px) scale(1.15); }
.ai-step:hover .ai-step__num { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(77,124,254,.12); }
.ai-case:hover .ai-case__link { letter-spacing: .02em; }

/* Стрелки между шагами связки «бегут» */
.ai-flow__step:not(:last-child)::after { animation: aiArrow 1.8s ease-in-out infinite; animation-delay: calc(var(--d, 0s) * 4); }
@keyframes aiArrow { 0%, 100% { transform: translateX(0); opacity: .55; } 50% { transform: translateX(4px); opacity: 1; } }

/* =================================================================
   ВЫРАВНИВАНИЕ: заголовки и описания на одной высоте во всех карточках ряда
   ================================================================= */
.ai-step__num { justify-self: start; }
@supports (grid-template-rows: subgrid) {
    .ai-sol        { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; }
    .ai-sol__foot  { align-self: end; }
    .ai-step       { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
    .ai-flow__step { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; align-content: start; }
    .ai-trust__item{ display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
    .ai-case       { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 10px; }
    .ai-case__link { align-self: end; }
}

@media (max-width: 700px) {
    .ai-nowrap { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
    .ai-grad, .ai-flow__step::after { animation: none; }
}
