/* AI-SHOWCASE-1 (30.10.2026): ШІ як головний акцент сайту — блок «Штучний інтелект у CRM» на головній, приклади й анімації на /ai-v-crm/,
   акцент пункту меню, відступи на /ai-rishennya/. Підключає partials/v2/ai-showcase.php (після bf2_page_transform). Лише токени --bf-*,
   власний простір імен ai-x-* / ai-sub-* / bf2-ai-badge; спільні класи сайту (шапка, футер, кнопки, відступи секцій) не перевизначаються. */

/* ── акцент пункту меню «Штучний інтелект в CRM» ───────────────────────────── */
/* селектор ≥ 0,2,0: інакше перемагає .bf2-dd__item span (сірий колір підпису пункту) — текст «Нове» зливався з фоном */
.bf2-dd__item .bf2-ai-badge, .bf2-ai-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 1px 8px; border-radius: var(--bf-radius-full); background: var(--bf-accent-strong); color: var(--bf-on-accent); font-size: 11px; font-weight: 700; line-height: 18px; letter-spacing: .02em; vertical-align: 1px; }
.bf2-dd__item.bf2-ai-item { background: var(--bf-accent-soft); border-radius: var(--bf-radius-md); }

/* ── /ai-rishennya/: підзаголовки груп і примітка не впираються в картки ───────────── */
.ai-sub-h { margin: 36px 0 14px !important; }
.ai-sub-note { margin: 0 0 18px !important; max-width: 760px; }
.ai-price-line { margin: 10px 0 0; color: var(--bf-text); font-weight: 600; }

/* ── загальне ─────────────────────────────────────────────────────────────── */
.ai-x { position: relative; }
.ai-x__lead { max-width: 760px; margin: 0 auto; color: var(--bf-text-2); font-size: var(--bf-site-lead, 18px); line-height: 1.55; text-align: center; }
.ai-x__note { margin: 16px auto 0; max-width: 760px; color: var(--bf-text-muted); font-size: 14px; line-height: 1.5; text-align: center; }
.ai-x__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.ai-x-card { min-width: 0; background: var(--bf-card); border: 1px solid var(--bf-hairline); border-radius: var(--bf-radius-card); box-shadow: var(--bf-shadow-sm); }

/* ── тизер на головній: 3 кроки «тема → чернетка → зображення» ───────────────────── */
.ai-x-teaser { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.ai-x-step { display: grid; align-content: start; gap: 10px; padding: 18px; min-height: 220px; }
.ai-x-step__n { display: inline-flex; align-items: center; gap: 8px; color: var(--bf-accent-ink); font-size: 13px; font-weight: 700; }
.ai-x-step__n b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--bf-radius-full); background: var(--bf-accent-soft); }
.ai-x-step__t { margin: 0; color: var(--bf-text); font-size: 16px; font-weight: 600; }
.ai-x-bubble { margin: 0; padding: 12px 14px; border-radius: var(--bf-radius-md); background: var(--bf-surface-2); color: var(--bf-text); font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ai-x-step img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--bf-radius-md); background: var(--bf-surface-2); }
/* картинка тизера — цілком (напис пропозиції й логотип у куті не обрізаються): квадрат до 280 px по центру */
.ai-x-step--img img { width: min(100%, 280px); justify-self: center; }
/* поява кроків — лише коли тизер ще нижче екрана (JS ставить is-wait і знімає при появі; без JS — усе видно одразу) */
.ai-x-teaser .ai-x-step { transition: opacity .5s var(--bf-ease), transform .5s var(--bf-ease); }
.ai-x-teaser.is-wait .ai-x-step { opacity: 0; transform: translateY(10px); }
.ai-x-teaser .ai-x-step:nth-child(2) { transition-delay: .35s; }
.ai-x-teaser .ai-x-step:nth-child(3) { transition-delay: .7s; }
.ai-x-run [hidden] { display: none !important; }
.ai-x-nw { white-space: nowrap; }
.ai-x-rest { visibility: hidden; }

/* ── /ai-v-crm/: інтерактивні приклади ───────────────────────────────────── */
.ai-x-demo { display: grid; gap: 18px; margin-top: 26px; }
.ai-x-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-x-chip { appearance: none; min-height: 40px; padding: 0 16px; border: 1px solid var(--bf-hairline); border-radius: var(--bf-radius-full); background: var(--bf-card); color: var(--bf-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.ai-x-chip:hover { border-color: var(--bf-text-muted); }
.ai-x-chip:focus-visible { outline: none; box-shadow: var(--bf-focus-ring); }
.ai-x-chip[aria-pressed="true"] { background: var(--bf-accent-soft); border-color: var(--bf-accent); color: var(--bf-accent-ink); }
.ai-x-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; color: var(--bf-text-2); font-size: 14px; }
.ai-x-meta b { color: var(--bf-text); font-weight: 600; }
.ai-x-run { display: flex; justify-content: center; }
.ai-x-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr); gap: 16px; align-items: start; }
.ai-x-out { display: grid; gap: 10px; padding: 16px; min-width: 0; }
.ai-x-out__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; color: var(--bf-text); font-size: 15px; font-weight: 700; }
.ai-x-out__tag { padding: 2px 10px; border-radius: var(--bf-radius-full); background: var(--bf-surface-2); color: var(--bf-text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ai-x-out__text { margin: 0; min-height: 12em; color: var(--bf-text); font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.ai-x-out__tags { margin: 0; color: var(--bf-accent-ink); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-x-out__img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--bf-radius-md); background: var(--bf-surface-2); }
.ai-x-out__cap { margin: 0; color: var(--bf-text-muted); font-size: 12px; line-height: 1.45; }
.ai-x-caret { display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -2px; background: var(--bf-accent); animation: aiXBlink 1s steps(2, start) infinite; }
@keyframes aiXBlink { to { visibility: hidden; } }
.ai-x-out.is-wait { opacity: .45; }
.ai-x-out__img.is-hidden { opacity: 0; }
.ai-x-out__img { transition: opacity .6s var(--bf-ease); }
.ai-x-illu { margin: 4px auto 0; max-width: 760px; color: var(--bf-text-muted); font-size: 13px; text-align: center; }

/* ── /ai-v-crm/: «що після чого» — 6 кроків ──────────────────────────────── */
.ai-x-flow { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 26px 0 0; padding: 0; counter-reset: aix; }
.ai-x-flow li { position: relative; display: grid; align-content: start; gap: 6px; padding: 18px 18px 18px 58px; min-width: 0; counter-increment: aix; }
.ai-x-flow li::before { content: counter(aix); position: absolute; left: 16px; top: 16px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--bf-radius-full); background: var(--bf-accent-soft); color: var(--bf-accent-ink); font-size: 14px; font-weight: 700; }
.ai-x-flow h3 { margin: 0; color: var(--bf-text); font-size: 16px; }
.ai-x-flow p { margin: 0; color: var(--bf-text-2); font-size: 14px; line-height: 1.5; }
/* ── підсвічування поточного кроку (site-ai.js: по черзі, а під мишкою — крок під курсором). Текст не приглушується (контраст WCAG у будь-який момент);
      лише рамка-кільце (box-shadow, без зміни розмірів — без зсуву макета) і колір номера. Класи ai-x-cur ставить JS; без JS — статично. ── */
.ai-x-flow li, .bf-sx-steps .bf-sx-step, .bf2-flow li, .ai-x-teaser .ai-x-step, .ai-x-out { transition: box-shadow .35s var(--bf-ease), border-color .35s var(--bf-ease), background-color .35s var(--bf-ease); }
.ai-x-flow li::before, .bf-sx-steps .bf-sx-step::before, .bf2-flow li::before { transition: background-color .35s var(--bf-ease), color .35s var(--bf-ease); }
.ai-x-flow li.ai-x-cur { border-color: var(--bf-accent); box-shadow: var(--bf-shadow-md); }
.ai-x-flow li.ai-x-cur::before { background: var(--bf-accent-strong); color: var(--bf-on-accent); }
.bf-sx-steps .bf-sx-step.ai-x-cur { box-shadow: 0 0 0 1.5px var(--bf-accent), var(--bf-shadow-md); }
.bf-sx-steps .bf-sx-step.ai-x-cur::before, .bf2-flow li.ai-x-cur::before { background: var(--bf-accent-strong); color: var(--bf-on-accent); }
.bf2-flow li.ai-x-cur { box-shadow: 0 0 0 1.5px var(--bf-accent); color: var(--bf-text); }
/* картки без послідовності — лише ховер */
@media (hover: hover) {
  .ai-x-teaser .ai-x-step:hover, .ai-x-out:hover { border-color: var(--bf-accent); box-shadow: var(--bf-shadow-md); }
  html.bf-wow .wow-steps li:hover .wow-steps__n { background: var(--bf-accent-strong); color: var(--bf-on-accent); }
}

/* ── /ai-v-crm/: ще ШІ в CRM + «на вашому проєкті» ───────────────────────── */
.ai-x-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.ai-x-two .ai-x-card { display: grid; align-content: start; gap: 8px; padding: 20px; }
.ai-x-two h3 { margin: 0; color: var(--bf-text); font-size: 17px; }
.ai-x-two p { margin: 0; color: var(--bf-text-2); font-size: 15px; line-height: 1.55; }
.ai-x-cond { color: var(--bf-text-muted) !important; font-size: 13px !important; }
/* «Те саме на вашому проєкті»: текст зліва вирівняний угору, ціна — окрема панель (редизайн 30.10.2026) */
main > section.bf2-section.ai-x--tight { padding-top: 0; }   /* сторінка має своє правило секцій вищої специфічності */
.ai-x-project { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 28px; align-items: stretch; padding: 28px; }
.ai-x-project__main { display: grid; align-content: start; gap: 10px; }
.ai-x-project__main .bf2-eyebrow { justify-self: start; margin: 0; }
.ai-x-project h3 { margin: 0; color: var(--bf-text); font-size: 22px; }
.ai-x-project p { margin: 0; color: var(--bf-text-2); font-size: 15px; line-height: 1.55; }
.ai-x-checks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.ai-x-checks li { display: flex; align-items: center; gap: 10px; color: var(--bf-text); font-size: 15px; font-weight: 500; }
.ai-x-checks svg { flex: 0 0 auto; padding: 4px; border-radius: var(--bf-radius-full); background: var(--bf-accent-soft); color: var(--bf-accent-ink); box-sizing: content-box; }
.ai-x-price { display: grid; align-content: center; gap: 6px; padding: 22px; border-radius: var(--bf-radius-md); background: var(--bf-accent-soft); }
.ai-x-price__l { color: var(--bf-accent-ink); font-size: 13px; font-weight: 600; }
.ai-x-price__v { color: var(--bf-text); font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.ai-x-price__v small { color: var(--bf-text-2); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.ai-x-price__s { color: var(--bf-text-2); font-size: 14px; }
.ai-x-price .bf2-btn { margin-top: 10px; justify-self: stretch; text-align: center; }

/* ── AI-AUTONOMY (30.10.2026): «ШІ працює, поки ви займаєтесь бізнесом» — лише за data/site_wow.php['ai_autonomy'].
   Без JS / з reduced-motion — усе видно статично (кінцевий стан). JS ставить .is-ready (кінцевий стан ховається) і .is-play (сцена програється раз). */
.ai-a-modes { list-style: none; margin: 0 auto 28px; padding: 6px; display: flex; gap: 6px; width: max-content; max-width: 100%; border-radius: var(--bf-radius-full); background: var(--bf-card); box-shadow: var(--bf-shadow-sm); }
.ai-a-mode { display: grid; gap: 2px; padding: 10px 20px; border-radius: var(--bf-radius-full); text-align: center; color: var(--bf-text-muted); }
.ai-a-mode b { color: var(--bf-text); font-size: 15px; }
.ai-a-mode span { font-size: 12px; }
.ai-a-mode.is-on { background: var(--bf-accent-strong); color: var(--bf-on-accent); }
.ai-a-mode.is-on b { color: var(--bf-on-accent); }
.ai-a-live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.ai-a-card { display: grid; align-content: start; gap: 6px; padding: 24px; }
.ai-a-card h3 { margin: 0; color: var(--bf-text); font-size: 19px; }
.ai-a-sub { margin: 0 0 10px; color: var(--bf-text-2); font-size: 14px; line-height: 1.5; }
.ai-a-chat { display: grid; gap: 10px; padding: 16px; border-radius: var(--bf-radius-md); background: var(--bf-surface-2); }
.ai-a-chat > :nth-child(1) { grid-row: 1; } .ai-a-chat > :nth-child(2), .ai-a-chat > :nth-child(3) { grid-row: 2; }
.ai-a-chat > :nth-child(4) { grid-row: 3; } .ai-a-chat > :nth-child(5) { grid-row: 4; } .ai-a-chat > :nth-child(6) { grid-row: 5; }
.ai-a-msg { grid-column: 1; max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.ai-a-msg p { margin: 0; }
.ai-a-msg time { display: block; margin-top: 4px; font-size: 11px; opacity: .75; text-align: right; }
.ai-a-msg--in { justify-self: start; border-bottom-left-radius: 4px; background: var(--bf-card); color: var(--bf-text); box-shadow: var(--bf-shadow-xs); }
.ai-a-msg--ai { justify-self: end; border-bottom-right-radius: 4px; background: var(--bf-accent-strong); color: var(--bf-on-accent); }
.ai-a-typing { grid-column: 1; justify-self: end; align-self: center; display: flex; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--bf-accent-soft); opacity: 0; }
.ai-a-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--bf-accent-ink); }
.ai-a-done { grid-column: 1; justify-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--bf-radius-full);
  background: var(--bf-st-success-bg); color: var(--bf-st-success-fg); font-size: 13px; font-weight: 600; }
.ai-a-week { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ai-a-slot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--bf-radius-md); background: var(--bf-surface-2); }
.ai-a-slot__d { display: grid; justify-items: center; min-width: 52px; padding: 6px 8px; border-radius: var(--bf-radius-sm); background: var(--bf-card); color: var(--bf-text-muted); font-size: 12px; }
.ai-a-slot__d b { color: var(--bf-text); font-size: 15px; }
.ai-a-slot__t { color: var(--bf-text); font-size: 14px; font-weight: 500; }
.ai-a-slot__s { display: grid; }
.ai-a-st { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 10px; border-radius: var(--bf-radius-full); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ai-a-st--prep { background: var(--bf-accent-soft); color: var(--bf-accent-ink); opacity: 0; }
.ai-a-st--ok { background: var(--bf-st-success-bg); color: var(--bf-st-success-fg); }
.ai-a-wins { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ai-a-wins li { display: grid; gap: 4px; padding: 18px; border-radius: var(--bf-radius-md); background: var(--bf-card); box-shadow: var(--bf-shadow-xs); }
.ai-a-wins b { color: var(--bf-accent-ink); font-size: 17px; }
.ai-a-wins span { color: var(--bf-text-2); font-size: 14px; line-height: 1.45; }
.ai-a-h { margin: 34px 0 14px; color: var(--bf-text); font-size: 20px; text-align: center; }
.ai-a-setup { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ai-a-setup li { display: grid; align-content: start; gap: 6px; padding: 20px; }
.ai-a-setup h3 { margin: 0; color: var(--bf-text); font-size: 17px; }
.ai-a-setup p { margin: 0; color: var(--bf-text-2); font-size: 14px; line-height: 1.5; }
.ai-a-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bf-accent-strong); color: var(--bf-on-accent); font-weight: 700; font-size: 14px; }
.ai-a-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.ai-a-foot [data-ai-auto-replay][hidden] { display: none; }
/* сцена: кінцевий стан ховається лише коли JS готовий програти */
.ai-a.is-ready .ai-a-chat > :not(.ai-a-typing), .ai-a.is-ready .ai-a-st--ok, .ai-a.is-ready .ai-a-wins li, .ai-a.is-ready .ai-a-setup li { opacity: 0; }
@keyframes ai-a-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ai-a-flash { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ai-a-dot { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-3px); opacity: 1; } }
@keyframes ai-a-ring { 0% { box-shadow: 0 0 0 0 var(--bf-accent-soft-2); } 100% { box-shadow: 0 0 0 10px transparent; } }
.ai-a.is-play .ai-a-chat > .ai-a-msg, .ai-a.is-play .ai-a-done, .ai-a.is-play .ai-a-st--ok, .ai-a.is-play .ai-a-wins li, .ai-a.is-play .ai-a-setup li { animation: ai-a-in .45s var(--bf-ease) both; }
.ai-a.is-play .ai-a-chat > :nth-child(1) { animation-delay: .2s; }
.ai-a.is-play .ai-a-typing { animation: ai-a-flash 1.3s linear .9s both; }
.ai-a.is-play .ai-a-typing i { animation: ai-a-dot .9s ease-in-out infinite; }
.ai-a.is-play .ai-a-typing i:nth-child(2) { animation-delay: .15s; } .ai-a.is-play .ai-a-typing i:nth-child(3) { animation-delay: .3s; }
.ai-a.is-play .ai-a-chat > :nth-child(3) { animation-delay: 2.2s; }
.ai-a.is-play .ai-a-chat > :nth-child(4) { animation-delay: 3.3s; }
.ai-a.is-play .ai-a-chat > :nth-child(5) { animation-delay: 4.3s; }
.ai-a.is-play .ai-a-chat > :nth-child(6) { animation-delay: 5.1s; }
.ai-a.is-play .ai-a-slot .ai-a-st--prep { animation: ai-a-flash 1.4s linear both; }
.ai-a.is-play .ai-a-slot:nth-child(1) .ai-a-st--prep { animation-delay: .6s; } .ai-a.is-play .ai-a-slot:nth-child(1) .ai-a-st--ok { animation-delay: 2s; }
.ai-a.is-play .ai-a-slot:nth-child(2) .ai-a-st--prep { animation-delay: 2.2s; } .ai-a.is-play .ai-a-slot:nth-child(2) .ai-a-st--ok { animation-delay: 3.6s; }
.ai-a.is-play .ai-a-slot:nth-child(3) .ai-a-st--prep { animation-delay: 3.8s; } .ai-a.is-play .ai-a-slot:nth-child(3) .ai-a-st--ok { animation-delay: 5.2s; }
.ai-a.is-play .ai-a-mode.is-on { animation: ai-a-ring 1.2s ease-out .3s 2; }
.ai-a.is-play .ai-a-wins li:nth-child(2) { animation-delay: .1s; } .ai-a.is-play .ai-a-wins li:nth-child(3) { animation-delay: .2s; } .ai-a.is-play .ai-a-wins li:nth-child(4) { animation-delay: .3s; }
.ai-a.is-play .ai-a-setup li:nth-child(2) { animation-delay: .12s; } .ai-a.is-play .ai-a-setup li:nth-child(3) { animation-delay: .24s; }
@media (max-width: 1023px) { .ai-a-wins { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .ai-a-live, .ai-a-setup { grid-template-columns: minmax(0, 1fr); }
  .ai-a-modes { width: auto; flex-direction: column; border-radius: var(--bf-radius-md); }
  .ai-a-mode { border-radius: var(--bf-radius-sm); }
  .ai-a-card { padding: 18px; }
}
@media (max-width: 479px) { .ai-a-wins { grid-template-columns: minmax(0, 1fr); } .ai-a-slot { grid-template-columns: auto minmax(0, 1fr); } .ai-a-slot__s { grid-column: 1 / -1; justify-self: start; } }
@media (prefers-reduced-motion: reduce) { .ai-a.is-play * { animation: none !important; } }

@media (max-width: 1023px) {
  .ai-x-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ai-x-grid .ai-x-out--img { grid-column: 1 / -1; max-width: 420px; justify-self: center; width: 100%; }
  .ai-x-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .ai-x-teaser, .ai-x-grid, .ai-x-two, .ai-x-flow, .ai-x-project { grid-template-columns: minmax(0, 1fr); }
  .ai-x-step { min-height: 0; }
  .ai-x-out__text { min-height: 0; }
  .ai-x-project { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-x-teaser .ai-x-step, .ai-x-flow li, .bf-sx-steps .bf-sx-step, .bf2-flow li, .ai-x-out, .ai-x-flow li::before, .bf-sx-steps .bf-sx-step::before, .bf2-flow li::before { opacity: 1 !important; transform: none !important; transition: none !important; }
  .ai-x-caret { animation: none; display: none; }
  .ai-x-out__img { transition: none; }
}
