/* ============================================================
   DEMO — главный продающий блок «Before / After».
   Объединяет два режима:
   1) ТАБЫ со сценариями (Telegram / Email / Задача / Пост / Конспект / Промпт)
      — каждая вкладка показывает «как сказано» vs «как написано».
   2) ЖИВУЮ ЗАПИСЬ — кнопка-микрофон, waveform, реальная транскрипция
      пользователя в ту же двухколоночную раскладку.
   ============================================================ */

.demo {
  padding: clamp(40px, 6vw, 96px) 0 clamp(64px, 9vw, 128px);
  position: relative;
}

.demo .section-head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 56px); }

.demo-card {
  max-width: 1100px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.demo-card::before {
  content: "";
  position: absolute;
  top: -120px; right: -120px;
  width: 420px; height: 420px;
  background: radial-gradient(closest-side, rgba(251,26,38,0.16), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── tabs ─────────────────────────────────────── */
.demo-tabs {
  display: flex;
  gap: 0;
  padding: 0 clamp(14px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
}
.demo-tabs::-webkit-scrollbar { display: none; }

.demo-tab {
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .2s, border-color .25s;
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
}
.demo-tab:hover { color: var(--ink-0); }
.demo-tab.is-active { color: var(--ink-0); border-bottom-color: var(--red-0); }
.demo-tab .badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--red-soft);
  color: var(--red-0);
  border: 1px solid var(--red-line);
}

/* ─── status pill ──────────────────────────────── */
.demo-head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(18px, 2.4vw, 28px);
  position: relative; z-index: 1;
  border-bottom: 1px solid var(--line);
}
.demo-head-bar .eyebrow-mini {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.demo-status {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-3);
  display: inline-flex; align-items: center; gap: 8px;
}
.demo-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
  transition: background .25s;
}
.demo-card.is-recording .demo-status { color: var(--red-0); border-color: var(--red-line); background: var(--red-soft); }
.demo-card.is-recording .demo-status .dot {
  background: var(--red-0);
  box-shadow: 0 0 0 0 rgba(251,26,38,0.6);
  animation: rec-pulse 1.6s infinite var(--ease-out);
}
.demo-card.is-processing .demo-status { color: #FFD27A; border-color: rgba(255,210,122,0.28); }
.demo-card.is-processing .demo-status .dot { background: #FFD27A; }
.demo-card.is-result .demo-status { color: #6CD49B; border-color: rgba(108,212,155,0.28); }
.demo-card.is-result .demo-status .dot { background: #6CD49B; }
.demo-card.is-error .demo-status { color: #FF8B82; border-color: rgba(255,139,130,0.28); }
.demo-card.is-error .demo-status .dot { background: #FF8B82; }

/* ─── panels ───────────────────────────────────── */
.demo-panels {
  padding: clamp(20px, 3vw, 32px) clamp(20px, 3vw, 32px) 0;
  position: relative; z-index: 1;
}
.demo-panel { display: none; }
.demo-panel.is-active { display: block; }

.demo-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) { .demo-cols { grid-template-columns: 1fr; } }

.demo-col {
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--bg-1);
  border: 1px solid var(--line);
  min-height: 220px;
  position: relative;
}
.demo-col.clean {
  border-color: var(--red-line);
  background: rgba(251,26,38,0.04);
}
.demo-col .lbl {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}
.demo-col.clean .lbl { color: var(--red-0); }
.demo-col .txt {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-1);
  text-wrap: pretty;
  white-space: pre-line;
}
.demo-col.raw .txt { color: var(--ink-2); font-style: italic; }

/* ─── divider «или продиктуйте своё» ───────────── */
.demo-divider {
  position: relative;
  text-align: center;
  margin: clamp(28px, 4vw, 40px) 0 clamp(18px, 3vw, 28px);
}
.demo-divider::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--line);
}
.demo-divider span {
  position: relative;
  padding: 0 16px;
  background: var(--bg-2);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ─── trial внутри demo ──────────────────────── */
.demo-trial {
  padding: 0 clamp(20px, 3vw, 32px) clamp(28px, 4vw, 40px);
  position: relative; z-index: 1;
  text-align: center;
}

.demo-mic {
  position: relative;
  width: 84px; height: 84px;
  margin: 0 auto 18px;
}
.mic-btn {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--red-0), var(--red-1));
  box-shadow: 0 14px 40px -8px rgba(251,26,38,0.6), 0 0 0 6px rgba(251,26,38,0.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: transform .2s, box-shadow .25s;
}
.mic-btn:hover { transform: translateY(-2px); }
.mic-btn:active { transform: translateY(0); }
.mic-btn:focus-visible {
  outline: none;
  box-shadow: 0 14px 40px -8px rgba(251,26,38,0.6),
              0 0 0 4px var(--bg-2),
              0 0 0 7px var(--red-0);
}
.mic-btn svg { width: 32px; height: 32px; }
.mic-btn .mic-icon-stop { display: none; }
.demo-card.is-recording .mic-btn .mic-icon-record { display: none; }
.demo-card.is-recording .mic-btn .mic-icon-stop { display: block; }
.demo-card.is-recording .mic-btn { animation: mic-pulse 1.6s infinite var(--ease-out); }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 14px 40px -8px rgba(251,26,38,0.6), 0 0 0 6px rgba(251,26,38,0.18); }
  50%      { box-shadow: 0 14px 40px -8px rgba(251,26,38,0.75), 0 0 0 16px rgba(251,26,38,0.08); }
}
.demo-card.is-processing .mic-btn { background: var(--bg-3); box-shadow: 0 0 0 1px var(--line-strong); cursor: default; }
.demo-card.is-processing .mic-btn svg { display: none; }
.demo-card.is-processing .mic-btn::before {
  content: "";
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--red-0);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.demo-cta-text {
  color: var(--ink-1);
  font-size: 15px;
  font-weight: 500;
}
.demo-cta-text em {
  font-family: var(--ff-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--red-0);
}
.demo-cta-hint {
  margin-top: 4px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.demo-wave {
  display: none;
  height: 56px;
  width: 100%;
  max-width: 600px;
  margin: 4px auto 10px;
}
.demo-card.is-recording .demo-wave { display: block; }
.demo-card.is-recording .demo-cta-text,
.demo-card.is-recording .demo-cta-hint { display: none; }

.demo-timer {
  display: none;
  font-family: var(--ff-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--red-0);
  letter-spacing: 0.06em;
}
.demo-card.is-recording .demo-timer { display: block; }

/* при результате — скрываем кнопку и показываем actions */
.demo-card.is-result .demo-mic,
.demo-card.is-result .demo-cta-text,
.demo-card.is-result .demo-cta-hint { display: none; }

.demo-actions {
  display: none;
  margin-top: 12px;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.demo-card.is-result .demo-actions { display: flex; }
.demo-actions .btn { padding: 10px 16px; font-size: 13px; }

.demo-error {
  display: none;
  max-width: 560px;
  margin: 16px auto 0;
  color: #FF8B82;
  font-size: 14px;
  padding: 12px 16px;
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.28);
  border-radius: var(--r-md);
  text-align: left;
}
.demo-card.is-error .demo-error { display: block; }
