/*
 * Блок «Рассылки и автоматизации» (якорь #communications), fstrk.ftc-io
 * Все правила ограничены корнем .ft-comm, чтобы не задевать стили темы.
 * Шрифт Roboto уже подключён на сайте.
 */

.ft-comm {
  --ftc-bg: #f7f7f9;
  --ftc-surface: #ffffff;
  --ftc-surface-2: #f0f0f4;
  --ftc-fg: #141428;
  --ftc-muted: #5d5d72;
  --ftc-eyebrow: #abacb4;
  --ftc-line: #e4e4ec;
  --ftc-accent: #b70c13;
  --ftc-accent-hover: #9a0a10;
  --ftc-accent-soft: rgba(183, 12, 19, 0.08);
  --ftc-ok: #1f9d55;
  --ftc-ok-soft: rgba(31, 157, 85, 0.12);
  --ftc-shadow: 0 1px 2px rgba(20, 20, 40, 0.04), 0 8px 24px rgba(20, 20, 40, 0.06);
  --ftc-font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ftc-mono: ui-monospace, "Roboto Mono", Consolas, monospace;

  background: var(--ftc-bg);
  color: var(--ftc-fg);
  font-family: var(--ftc-font);
  font-size: 16px;
  line-height: 1.5;
  padding: 72px 16px 40px;
}
.ft-comm *,
.ft-comm *::before,
.ft-comm *::after { box-sizing: border-box; }
.ft-comm [hidden] { display: none !important; }
.ft-comm p,
.ft-comm li { text-wrap: pretty; }
.ft-comm :focus-visible { outline: 2px solid var(--ftc-accent); outline-offset: 2px; }
.ft-comm .ft-i { width: 18px; height: 18px; flex: none; }

/* ---------- шапка ---------- */
.ft-comm .ftc-wrap { max-width: 1240px; margin: 0 auto; }
.ft-comm .ftc-head { text-align: center; max-width: 760px; margin: 0 auto 48px; display: grid; gap: 12px; }
.ft-comm .ftc-eyebrow { font-size: 16px; font-weight: 600; color: var(--ftc-eyebrow); }
.ft-comm .ftc-head h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 600; line-height: 1.15; text-wrap: balance; color: var(--ftc-fg); }
.ft-comm .ftc-head p { margin: 0; font-size: 18px; color: var(--ftc-muted); text-wrap: balance; }

/* ---------- вкладки ---------- */
.ft-comm .ftc-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.ft-comm .ftc-tab {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 12px; padding: 14px 16px;
  font: 500 15px/1.3 var(--ftc-font); color: var(--ftc-muted); overflow: hidden;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.ft-comm .ftc-tab:hover { color: var(--ftc-fg); transform: translateY(-2px); box-shadow: var(--ftc-shadow); }
.ft-comm .ftc-tab[aria-selected="true"] { color: var(--ftc-fg); border-color: var(--ftc-accent); }
.ft-comm .ftc-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--ftc-surface-2); color: var(--ftc-muted); transition: background-color 0.18s ease, color 0.18s ease;
}
.ft-comm .ftc-ico svg { width: 17px; height: 17px; }
.ft-comm .ftc-tab[aria-selected="true"] .ftc-ico { background: var(--ftc-accent); color: #fff; }
/* полоска прогресса автопереключения, ширину задаёт block.ftc-js */
.ft-comm .ftc-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--ftc-accent); }

/* ---------- панель вкладки ---------- */
.ft-comm .ftc-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
.ft-comm .ftc-copy { display: grid; gap: 20px; min-width: 0; }
.ft-comm .ftc-ttl { margin: 0; font-size: clamp(22px, 2.4vw, 28px); font-weight: 600; line-height: 1.2; text-wrap: balance; color: var(--ftc-fg); }
.ft-comm .ftc-lead { margin: 0; color: var(--ftc-muted); font-size: 17px; max-width: 52ch; }
.ft-comm .ftc-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.ft-comm .ftc-points li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 0; }
.ft-comm .ftc-points li .ft-i { margin-top: 3px; color: var(--ftc-accent); }
.ft-comm .ftc-points b { font-weight: 600; }
.ft-comm .ftc-fact {
  display: inline-flex; align-items: center; gap: 8px; align-self: start; justify-self: start;
  background: var(--ftc-accent-soft); color: var(--ftc-accent); font-weight: 500; font-size: 14px;
  padding: 6px 12px; border-radius: 999px;
}
.ft-comm .ftc-note { margin: 0; font-size: 14px; color: var(--ftc-muted); border-left: 2px solid var(--ftc-line); padding-left: 12px; max-width: 52ch; }
.ft-comm .ftc-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ft-comm .ftc-btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font: 600 16px/1 var(--ftc-font); color: #fff; background: var(--ftc-accent); border: 0; border-radius: 8px;
  padding: 15px 22px; transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.ft-comm .ftc-btn:hover { color: #fff; background: var(--ftc-accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px var(--ftc-accent-soft); }
.ft-comm .ftc-btn .ft-i { transition: transform 0.18s ease; }
.ft-comm .ftc-btn:hover .ft-i { transform: translateX(3px); }
.ft-comm .ftc-guide { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ftc-accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; transition: color 0.18s ease; }
.ft-comm .ftc-guide:hover { color: var(--ftc-accent-hover); }

.ft-comm .ftc-stage {
  background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 16px;
  padding: 28px; min-height: 440px; display: grid; place-items: center; overflow: hidden;
}

/* появление содержимого: перезапускается при каждом показе панели (display: none → grid) */
.ft-comm .ftc-enter { animation: ftc-enter 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ft-comm .ftc-enter-d1 { animation-delay: 0.06s; }
.ft-comm .ftc-enter-d2 { animation-delay: 0.12s; }
.ft-comm .ftc-enter-d3 { animation-delay: 0.18s; }
.ft-comm .ftc-enter-d4 { animation-delay: 0.24s; }
@keyframes ftc-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- иконки каналов ---------- */
.ft-comm .ftc-ch { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.ft-comm .ftc-ch svg { width: 20px; height: 20px; }
.ft-comm .ftc-ch-wa { background: #25d366; }
.ft-comm .ftc-ch-waw { background: #6b7a8f; }
.ft-comm .ftc-ch-sms { background: #e2202a; }
.ft-comm .ftc-ch-tg { background: #2aa3e0; }
.ft-comm .ftc-ch-max { background: linear-gradient(135deg, #3b6cff, #9b3bff); }
.ft-comm .ftc-ch-vk { background: #0077ff; }
.ft-comm .ftc-ch-bot { background: #f2b705; }

/* ---------- вкладка 1: каналы ---------- */
.ft-comm .ftc-channels { width: 100%; max-width: 460px; display: grid; gap: 10px; }
.ft-comm .ftc-chan {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 12px; padding: 12px 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ft-comm .ftc-chan:hover { transform: translateX(4px); box-shadow: var(--ftc-shadow); border-color: transparent; }
.ft-comm .ftc-chan-name { font-weight: 600; font-size: 15px; }
.ft-comm .ftc-chan-sub { font-size: 13px; color: var(--ftc-muted); }
.ft-comm .ftc-tag { font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 999px; background: var(--ftc-surface-2); color: var(--ftc-muted); white-space: nowrap; }
.ft-comm .ftc-tag-ok { background: var(--ftc-ok-soft); color: var(--ftc-ok); }

/* ---------- вкладка 2: каскад (состояния шагов переключает block.ftc-js) ---------- */
.ft-comm .ftc-cascade { width: 100%; max-width: 460px; display: grid; }
.ft-comm .ftc-step { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.ft-comm .ftc-pill {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--ftc-surface); border: 1px solid var(--ftc-line); font-weight: 500; font-size: 15px;
  transition: opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.ft-comm .ftc-pill .ftc-ch { width: 30px; height: 30px; border-radius: 8px; }
.ft-comm .ftc-pill .ftc-ch svg { width: 17px; height: 17px; }
.ft-comm .ftc-status { font-size: 13px; color: var(--ftc-muted); min-width: 118px; text-align: right; transition: color 0.3s ease; }
.ft-comm .ftc-gap { display: flex; align-items: center; gap: 10px; height: 30px; padding-left: 28px; font-size: 12px; color: var(--ftc-muted); }
.ft-comm .ftc-gap i { width: 2px; height: 100%; background: repeating-linear-gradient(to bottom, var(--ftc-line) 0 4px, transparent 4px 8px); }
.ft-comm .ftc-step.ftc-is-wait .ftc-pill { opacity: 0.45; }
.ft-comm .ftc-step.ftc-is-try .ftc-pill { border-color: var(--ftc-accent); box-shadow: 0 0 0 4px var(--ftc-accent-soft); transform: scale(1.02); }
.ft-comm .ftc-step.ftc-is-fail .ftc-pill { opacity: 0.7; }
.ft-comm .ftc-step.ftc-is-ok .ftc-pill { border-color: var(--ftc-ok); box-shadow: 0 0 0 4px var(--ftc-ok-soft); }
.ft-comm .ftc-step.ftc-is-ok .ftc-status { color: var(--ftc-ok); font-weight: 600; }
.ft-comm .ftc-step.ftc-is-skip .ftc-pill { opacity: 0.3; }
.ft-comm .ftc-cascade-sum { margin-top: 16px; font-size: 13px; color: var(--ftc-muted); text-align: center; min-height: 20px; }

/* ---------- вкладка 3: виджет и инвайт ---------- */
.ft-comm .ftc-widget-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; width: 100%; max-width: 560px; }
.ft-comm .ftc-w-col { display: grid; gap: 10px; min-width: 0; align-content: start; }
.ft-comm .ftc-cap { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; color: var(--ftc-fg); }
.ft-comm .ftc-cap i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: var(--ftc-accent); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; flex: none; }
.ft-comm .ftc-scene {
  position: relative; height: 100%; min-height: 330px; border: 1px solid var(--ftc-line); border-radius: 14px;
  background: var(--ftc-surface-2); padding: 14px; display: grid; gap: 10px; align-content: start; overflow: hidden;
}
.ft-comm .ftc-sk { display: block; background: var(--ftc-line); border-radius: 6px; }
.ft-comm .ftc-sk-nav { height: 10px; width: 55%; }
.ft-comm .ftc-sk-hero { height: 70px; border-radius: 10px; }
.ft-comm .ftc-sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ft-comm .ftc-sk-row .ftc-sk { height: 56px; border-radius: 10px; }
.ft-comm .ftc-launcher {
  position: absolute; right: 14px; bottom: 14px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ftc-accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px -6px var(--ftc-accent);
}
.ft-comm .ftc-launcher svg { width: 22px; height: 22px; }
.ft-comm .ftc-launcher::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ftc-accent); animation: ftc-ring 2.4s ease-out infinite; }
@keyframes ftc-ring { from { transform: scale(1); opacity: 0.6; } to { transform: scale(1.5); opacity: 0; } }
.ft-comm .ftc-invite {
  position: absolute; right: 14px; bottom: 72px; left: 14px; margin-left: auto; max-width: 220px;
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.4;
  background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 14px 14px 4px 14px;
  padding: 10px 12px; box-shadow: var(--ftc-shadow);
  transform-origin: bottom right; animation: ftc-invite 5s ease-in-out 0.6s infinite both;
}
@keyframes ftc-invite {
  0% { opacity: 0; transform: translateY(8px) scale(0.94); }
  10%, 100% { opacity: 1; transform: none; }
}
.ft-comm .ftc-invite small { display: block; font-size: 11px; color: var(--ftc-muted); font-weight: 500; margin-bottom: 2px; }
.ft-comm .ftc-w-ava { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.ft-comm .ftc-invite .ftc-w-ava { background: var(--ftc-accent); color: #fff; width: 26px; height: 26px; font-size: 12px; }
.ft-comm .ftc-widget { background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 16px; overflow: hidden; box-shadow: var(--ftc-shadow); }
.ft-comm .ftc-w-head { background: var(--ftc-accent); color: #fff; padding: 14px 16px; display: flex; gap: 10px; align-items: center; }
.ft-comm .ftc-w-head b { display: block; font-size: 14px; }
.ft-comm .ftc-w-head span { font-size: 12px; opacity: 0.85; }
.ft-comm .ftc-w-body { padding: 14px 16px; display: grid; gap: 10px; font-size: 13px; }
.ft-comm .ftc-w-msg { background: var(--ftc-surface-2); border-radius: 12px 12px 12px 4px; padding: 10px 12px; }
.ft-comm .ftc-w-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ft-comm .ftc-w-btn { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--ftc-line); border-radius: 10px; font-weight: 500; transition: background-color 0.18s ease; }
.ft-comm .ftc-w-btn:hover { background: var(--ftc-surface-2); }
/* нечётная последняя кнопка канала — на всю ширину */
.ft-comm .ftc-w-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ft-comm .ftc-w-btn .ftc-ch { width: 22px; height: 22px; border-radius: 6px; }
.ft-comm .ftc-w-btn .ftc-ch svg { width: 13px; height: 13px; }
.ft-comm .ftc-w-foot { text-align: center; font-size: 11px; color: var(--ftc-muted); padding: 8px; border-top: 1px solid var(--ftc-line); }
.ft-comm .ftc-rules { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ft-comm .ftc-rules-t { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ftc-muted); font-weight: 600; }
.ft-comm .ftc-rule { display: flex; gap: 8px; align-items: center; font-size: 13px; background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 10px; padding: 8px 10px; }
.ft-comm .ftc-tog { width: 26px; height: 16px; border-radius: 999px; background: var(--ftc-ok); position: relative; flex: none; }
.ft-comm .ftc-tog::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff; top: 2px; right: 2px; }

/* ---------- вкладка 4: сценарий ---------- */
.ft-comm .ftc-flow { width: 100%; max-width: 440px; display: grid; justify-items: center; }
.ft-comm .ftc-wire { width: 2px; height: 22px; background: var(--ftc-line); position: relative; overflow: hidden; }
.ft-comm .ftc-wire::after { content: ""; position: absolute; left: 0; width: 2px; height: 10px; background: var(--ftc-accent); animation: ftc-run 1.6s linear infinite; }
@keyframes ftc-run { from { top: -10px; } to { top: 22px; } }
.ft-comm .ftc-fn {
  --tone: var(--ftc-accent);
  width: 100%; max-width: 330px; background: var(--ftc-surface); border: 1px solid var(--ftc-line); border-radius: 14px;
  padding: 12px 14px; display: flex; gap: 12px; align-items: center; font-size: 14px; line-height: 1.35;
  animation: ftc-step 6s ease-in-out infinite; animation-delay: calc(var(--i) * 1s);
  transition: transform 0.18s ease;
}
.ft-comm .ftc-fn:hover { transform: translateY(-2px); }
.ft-comm .ftc-t-crm { --tone: #7c5cff; }
.ft-comm .ftc-t-wait { --tone: #f08c00; }
.ft-comm .ftc-t-msg { --tone: var(--ftc-accent); }
.ft-comm .ftc-t-if { --tone: #228be6; }
.ft-comm .ftc-t-yes { --tone: var(--ftc-ok); }
.ft-comm .ftc-t-no { --tone: var(--ftc-accent); }
.ft-comm .ftc-fn-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--tone); color: #fff; flex: none; display: grid; place-items: center; box-shadow: 0 6px 14px -6px var(--tone); }
.ft-comm .ftc-fn-ico svg { width: 18px; height: 18px; }
.ft-comm .ftc-fn small { display: block; font-size: 11px; font-weight: 600; color: var(--tone); text-transform: uppercase; letter-spacing: 0.05em; }
.ft-comm .ftc-fn b { font-weight: 600; }
.ft-comm .ftc-fn em { display: block; font-style: normal; font-size: 12px; color: var(--ftc-muted); }
/* шаги подсвечиваются по очереди: задержка = --i секунд */
@keyframes ftc-step {
  0%, 14% { border-color: var(--tone); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 18%, transparent); }
  22%, 100% { border-color: var(--ftc-line); box-shadow: none; }
}
.ft-comm .ftc-fn-msg { flex-direction: column; align-items: stretch; gap: 10px; }
.ft-comm .ftc-fn-head { display: flex; gap: 12px; align-items: center; }
.ft-comm .ftc-bubble { background: var(--ftc-surface-2); border-radius: 14px 14px 14px 4px; padding: 10px 12px; margin-left: 46px; display: grid; gap: 8px; font-size: 14px; }
.ft-comm .ftc-coupon {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1.5px dashed var(--ftc-accent); border-radius: 10px; padding: 7px 10px; background: var(--ftc-surface);
  font: 700 14px var(--ftc-mono); color: var(--ftc-accent); letter-spacing: 0.02em;
}
.ft-comm .ftc-coupon i { font: 500 11px var(--ftc-font); font-style: normal; color: var(--ftc-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ft-comm .ftc-fbranch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; width: 100%; position: relative; padding-top: 24px; }
.ft-comm .ftc-fbranch::before,
.ft-comm .ftc-fbranch::after { content: ""; position: absolute; top: 0; height: 24px; width: 25%; border-top: 2px solid; }
.ft-comm .ftc-fbranch::before { left: 25%; border-left: 2px solid; border-color: var(--ftc-ok); border-radius: 12px 0 0 0; }
.ft-comm .ftc-fbranch::after { right: 25%; border-right: 2px solid; border-color: var(--ftc-accent); border-radius: 0 12px 0 0; }
.ft-comm .ftc-fbranch .ftc-fn { max-width: none; }

.ft-comm .ftc-foot { max-width: 1240px; margin: 32px auto 0; font-size: 12px; color: var(--ftc-muted); }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .ft-comm .ftc-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ft-comm .ftc-panel { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 560px) {
  .ft-comm { padding: 48px 16px 24px; }
  .ft-comm .ftc-head p { font-size: 16px; }
  .ft-comm .ftc-tab { padding: 12px; font-size: 14px; gap: 8px; }
  .ft-comm .ftc-tab .ftc-ico { display: none; }
  .ft-comm .ftc-stage { padding: 18px; min-height: 0; }
  .ft-comm .ftc-widget-wrap,
  .ft-comm .ftc-rules { grid-template-columns: minmax(0, 1fr); }
  .ft-comm .ftc-status { min-width: 0; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ft-comm *,
  .ft-comm *::before,
  .ft-comm *::after { animation: none !important; transition: none !important; }
}
