/* Phase 3 — Interactive product showcases and scroll storytelling */

/* Section story markers */
.scroll-story {
  position: relative;
}

/* Quick-call typing */
.quick-call-stage.is-animated .chat-bubble {
  opacity: 1;
}

.chat-bubble[data-typewriter] p {
  min-height: 1.4em;
}

.chat-bubble .tw-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: twBlink 0.9s step-end infinite;
}

@keyframes twBlink {
  50% { opacity: 0; }
}

/* Feature interactive demos */
.fx-demo {
  position: relative;
  overflow: hidden;
}

.fx-demo-bar {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(30, 27, 58, 0.08);
}

.fx-demo-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(30, 27, 58, 0.12);
}

.fx-demo-bar span:nth-child(1) { background: #ff5f57; }
.fx-demo-bar span:nth-child(2) { background: #febc2e; }
.fx-demo-bar span:nth-child(3) { background: #28c840; }

.fx-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #047857;
  background: rgba(52, 211, 153, 0.12);
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.fx-demo.is-playing .fx-live-tag {
  opacity: 1;
  transform: translateY(0);
}

.fx-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: fxPulse 2s ease infinite;
}

@keyframes fxPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.fx-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fx-demo.is-playing .fx-wave {
  opacity: 1;
}

.fx-wave span {
  flex: 1;
  max-width: 3px;
  border-radius: 2px;
  background: #4f46e5;
  animation: fxWave 0.85s ease-in-out infinite;
}

.fx-wave span:nth-child(2) { animation-delay: 0.06s; }
.fx-wave span:nth-child(3) { animation-delay: 0.12s; }
.fx-wave span:nth-child(4) { animation-delay: 0.08s; }
.fx-wave span:nth-child(5) { animation-delay: 0.14s; }
.fx-wave span:nth-child(6) { animation-delay: 0.18s; }

@keyframes fxWave {
  0%, 100% { height: 5px; opacity: 0.45; }
  50% { height: 18px; opacity: 1; }
}

.fx-step {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.fx-demo.is-playing .fx-step {
  opacity: 1;
  transform: translateX(0);
}

.fx-demo.is-playing .fx-step:nth-child(1) { transition-delay: 0.2s; }
.fx-demo.is-playing .fx-step:nth-child(2) { transition-delay: 0.45s; }
.fx-demo.is-playing .fx-step:nth-child(3) { transition-delay: 0.7s; }
.fx-demo.is-playing .fx-step:nth-child(4) { transition-delay: 0.95s; }

/* Schedule demo calendar */
.fx-cal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.fx-cal-slot {
  padding: 6px 4px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--body);
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.1);
  transition: background 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
}

.fx-cal-slot.is-booked {
  background: rgba(79, 70, 229, 0.14);
  border-color: rgba(79, 70, 229, 0.28);
  color: var(--ink);
  transform: scale(1.02);
}

/* Analytics mini chart */
.fx-mini-chart {
  height: 56px;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.fx-demo.is-playing .fx-mini-chart {
  opacity: 1;
}

.fx-mini-chart svg {
  width: 100%;
  height: 100%;
}

.fx-chart-line {
  fill: none;
  stroke: #4f46e5;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.fx-demo.is-playing .fx-chart-line {
  stroke-dashoffset: 0;
}

/* Gradient cards hover showcase (disabled auto-cycle for voice-overview GSAP) */
.gradient-card.is-active {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px rgba(30, 27, 58, 0.14);
}

#voice-overview .gradient-card.is-active {
  transform: none;
  box-shadow: 0 18px 40px -22px rgba(15, 23, 42, 0.28);
}

.gradient-card .gradient-card-icon {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

#voice-overview .gradient-card .gradient-card-icon {
  transition: none;
}

.gradient-card.is-active .gradient-card-icon {
  transform: scale(1.08) rotate(-3deg);
}

#voice-overview .gradient-card.is-active .gradient-card-icon {
  transform: none;
}

/* Live demo product rail */
.live-demo-widget {
  max-width: 920px;
}

.live-demo-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.live-demo-rail.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.live-demo-rail-panel {
  padding: 12px;
  border-radius: 12px;
  background: var(--ld-lavender, #f6f6fb);
  border: 1px solid var(--ld-border, #e6e7ef);
  font-size: 0.6875rem;
  color: var(--ld-muted, #6b7280);
  min-height: 88px;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.live-demo-rail-panel.is-updated {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.08);
}

.live-demo-rail-panel strong {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ld-ink, #1e1b3a);
  margin-bottom: 6px;
}

.live-demo-rail-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ld-ink, #1e1b3a);
  line-height: 1.4;
}

.live-demo-rail-panel[data-panel="sms"] .live-demo-rail-value {
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--ld-border);
}

.live-demo-rail-panel.is-updated[data-panel="sms"] .live-demo-rail-value {
  animation: smsSlide 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes smsSlide {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.live-demo-cal-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.live-demo-cal-slot {
  padding: 4px;
  border-radius: 6px;
  text-align: center;
  font-size: 0.5625rem;
  background: #fff;
  border: 1px solid var(--ld-border);
  transition: background 0.35s ease, border-color 0.35s ease;
}

.live-demo-cal-slot.is-booked {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.3);
  color: var(--ld-primary, #4f46e5);
  font-weight: 600;
}

/* Simulated idle preview on try-live */
.live-demo-idle-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(16px);
}

.live-demo-idle-preview.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.live-demo-idle-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--ld-lavender, #f6f6fb);
  border: 1px solid var(--ld-border, #e6e7ef);
  font-size: 0.6875rem;
}

.live-demo-idle-card strong {
  display: block;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ld-ink);
  margin-bottom: 6px;
}

.live-demo-idle-line {
  display: block;
  opacity: 0;
  transform: translateY(4px);
  animation: idleLineIn 0.5s ease forwards;
}

.live-demo-idle-line:nth-child(2) { animation-delay: 0.3s; }
.live-demo-idle-line:nth-child(3) { animation-delay: 0.6s; }

@keyframes idleLineIn {
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .live-demo-rail {
    grid-template-columns: 1fr;
  }
  .live-demo-idle-preview {
    grid-template-columns: 1fr;
  }
  .fx-cal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-wave span, .fx-pulse, .live-demo-idle-line { animation: none !important; }
  .fx-step, .fx-live-tag, .fx-wave, .fx-mini-chart, .live-demo-rail, .live-demo-idle-preview {
    opacity: 1 !important;
    transform: none !important;
  }
  .fx-demo.is-playing .fx-chart-line { stroke-dashoffset: 0; }
}
