/* Xaflo — MEGA upgrade v1.3 — cinematic demo + clearly animated backgrounds */

/* ============================================================
   STRONGER ANIMATED SECTION BACKGROUNDS
   Two animated blobs per section that drift visibly
   ============================================================ */
.xaflo-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.xaflo-section::before,
.xaflo-section::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: -1;
  opacity: 1;
  will-change: transform;
}
.xaflo-section::before {
  width: 60vw; height: 60vw;
  max-width: 800px; max-height: 800px;
  top: -10%;
  left: -10%;
}
.xaflo-section::after {
  width: 55vw; height: 55vw;
  max-width: 750px; max-height: 750px;
  bottom: -15%;
  right: -10%;
  background: none;
  animation: none;
}

/* Per-section blob colors (overrides previous tints) */
.xaflo-section#what-we-do::before { background: radial-gradient(circle, rgba(58,141,255,0.22), transparent 65%); animation: xaflo-blob-a 22s ease-in-out infinite; }
.xaflo-section#what-we-do::after  { background: radial-gradient(circle, rgba(0,217,255,0.18), transparent 65%); animation: xaflo-blob-b 26s ease-in-out infinite; }

.xaflo-section#principles::before { background: radial-gradient(circle, rgba(124,58,237,0.24), transparent 65%); animation: xaflo-blob-a 24s ease-in-out infinite reverse; }
.xaflo-section#principles::after  { background: radial-gradient(circle, rgba(217,70,239,0.18), transparent 65%); animation: xaflo-blob-b 28s ease-in-out infinite; }

.xaflo-section#capabilities::before { background: radial-gradient(circle, rgba(0,217,255,0.22), transparent 65%); animation: xaflo-blob-a 23s ease-in-out infinite; }
.xaflo-section#capabilities::after  { background: radial-gradient(circle, rgba(58,141,255,0.18), transparent 65%); animation: xaflo-blob-b 27s ease-in-out infinite reverse; }

.xaflo-section#cases::before { background: radial-gradient(circle, rgba(217,70,239,0.22), transparent 65%); animation: xaflo-blob-a 25s ease-in-out infinite; }
.xaflo-section#cases::after  { background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 65%); animation: xaflo-blob-b 22s ease-in-out infinite reverse; }

.xaflo-section#demo::before { background: radial-gradient(circle, rgba(0,217,255,0.26), transparent 65%); animation: xaflo-blob-a 20s ease-in-out infinite; }
.xaflo-section#demo::after  { background: radial-gradient(circle, rgba(124,58,237,0.22), transparent 65%); animation: xaflo-blob-b 24s ease-in-out infinite reverse; }

.xaflo-section#code::before { background: radial-gradient(circle, rgba(58,141,255,0.22), transparent 65%); animation: xaflo-blob-a 24s ease-in-out infinite reverse; }
.xaflo-section#code::after  { background: radial-gradient(circle, rgba(0,217,255,0.18), transparent 65%); animation: xaflo-blob-b 26s ease-in-out infinite; }

.xaflo-section#process::before { background: radial-gradient(circle, rgba(124,58,237,0.22), transparent 65%); animation: xaflo-blob-a 25s ease-in-out infinite; }
.xaflo-section#process::after  { background: radial-gradient(circle, rgba(58,141,255,0.18), transparent 65%); animation: xaflo-blob-b 28s ease-in-out infinite reverse; }

.xaflo-section#presence::before { background: radial-gradient(circle, rgba(0,217,255,0.22), transparent 65%); animation: xaflo-blob-a 23s ease-in-out infinite reverse; }
.xaflo-section#presence::after  { background: radial-gradient(circle, rgba(217,70,239,0.18), transparent 65%); animation: xaflo-blob-b 26s ease-in-out infinite; }

.xaflo-section#group::before { background: radial-gradient(circle, rgba(217,70,239,0.22), transparent 65%); animation: xaflo-blob-a 25s ease-in-out infinite; }
.xaflo-section#group::after  { background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 65%); animation: xaflo-blob-b 27s ease-in-out infinite reverse; }

.xaflo-section#products::before { background: radial-gradient(circle, rgba(58,141,255,0.22), transparent 65%); animation: xaflo-blob-a 22s ease-in-out infinite; }
.xaflo-section#products::after  { background: radial-gradient(circle, rgba(0,217,255,0.18), transparent 65%); animation: xaflo-blob-b 25s ease-in-out infinite reverse; }

.xaflo-section.xaflo-stats-section::before { background: radial-gradient(circle, rgba(0,217,255,0.20), transparent 65%); animation: xaflo-blob-a 26s ease-in-out infinite; }
.xaflo-section.xaflo-stats-section::after  { background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 65%); animation: xaflo-blob-b 24s ease-in-out infinite reverse; }

.xaflo-section#contact::before { background: radial-gradient(circle, rgba(217,70,239,0.24), transparent 65%); animation: xaflo-blob-a 22s ease-in-out infinite; }
.xaflo-section#contact::after  { background: radial-gradient(circle, rgba(0,217,255,0.20), transparent 65%); animation: xaflo-blob-b 26s ease-in-out infinite reverse; }

.xaflo-section.xaflo-providers::before { background: none; animation: none; }
.xaflo-section.xaflo-providers::after  { background: none; animation: none; }

@keyframes xaflo-blob-a {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(15vw, 10vh); }
  50%      { transform: translate(8vw, 25vh); }
  75%      { transform: translate(20vw, 5vh); }
}
@keyframes xaflo-blob-b {
  0%, 100% { transform: translate(0, 0); }
  30%      { transform: translate(-10vw, -8vh); }
  60%      { transform: translate(-18vw, 12vh); }
  80%      { transform: translate(-5vw, -15vh); }
}

@media (prefers-reduced-motion: reduce) {
  .xaflo-section::before,
  .xaflo-section::after { animation: none !important; }
}

/* ============================================================
   DEMO — CINEMATIC v2 LAYOUT
   ============================================================ */
.xaflo-demo {
  padding: 7rem 1.25rem;
}
.xaflo-demo-stage {
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  min-height: 480px;
}
@media (max-width: 820px) {
  .xaflo-demo-stage { grid-template-columns: 1fr; gap: 1.25rem; min-height: auto; }
}

.xaflo-demo-side {
  padding: 2rem;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(0,217,255,0.08), transparent 55%),
    linear-gradient(180deg, rgba(15,20,36,0.78), rgba(10,14,26,0.78));
  border: 1px solid var(--x-border-2);
  border-radius: 20px;
  min-height: 480px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Hide the center demo-flow connector — replaced by particle flow */
.xaflo-demo-flow { display: none !important; }

/* LEFT SIDE — INPUT */
.xaflo-demo-side:first-child::before {
  /* Sector chip is at top-left as small label */
  content: "// INPUT";
  position: absolute; top: 1.2rem; left: 2rem;
  font-family: var(--x-mono); font-size: 0.7rem;
  letter-spacing: 0.3em; color: var(--x-cyan);
  opacity: 0.6;
}
.xaflo-demo-side h4 { display: none !important; }
.xaflo-demo-sector {
  position: absolute; top: 1rem; right: 2rem;
  margin: 0 !important;
}

/* Big industry icon (injected by JS) */
.xaflo-demo-industry {
  width: 90px; height: 90px;
  border-radius: 22px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(0,217,255,0.3), transparent 60%),
    linear-gradient(135deg, rgba(0,217,255,0.1), rgba(124,58,237,0.15));
  border: 1px solid rgba(0,217,255,0.35);
  color: var(--x-cyan);
  margin: 1.8rem 0 1.4rem;
  transition: transform .6s cubic-bezier(.2,.7,.2,1),
              background .6s ease, border-color .6s ease,
              color .6s ease, box-shadow .6s ease;
  position: relative;
  box-shadow: 0 0 30px rgba(0,217,255,0.15);
}
.xaflo-demo-industry svg { width: 44px; height: 44px; }
.xaflo-demo-industry::before {
  content: ""; position: absolute; inset: -4px;
  border-radius: 26px;
  border: 1px solid rgba(0,217,255,0.4);
  opacity: 0;
  animation: xaflo-demo-pulse 2.4s ease-out infinite;
}
@keyframes xaflo-demo-pulse {
  0%   { opacity: 0.6; transform: scale(0.9); }
  70%  { opacity: 0;   transform: scale(1.25); }
  100% { opacity: 0;   transform: scale(1.25); }
}

/* User row */
.xaflo-demo-user {
  display: flex; align-items: center; gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.xaflo-demo-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--x-violet), var(--x-magenta));
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--x-display); font-size: 0.95rem; font-weight: 700;
  color: var(--x-base);
  transition: background .6s ease;
}
.xaflo-demo-user > span:not(.xaflo-demo-avatar) {
  font-family: var(--x-display);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--x-contrast);
  letter-spacing: -0.005em;
  text-transform: none;
}

/* Prompt bubble */
.xaflo-demo-chat { flex: 1; display: flex; flex-direction: column; }
.xaflo-demo-bubble {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--x-border-2);
  border-radius: 18px 18px 18px 4px;
  padding: 1.2rem 1.35rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--x-contrast);
  min-height: 4em;
  margin-bottom: 1rem;
}
.xaflo-demo-bubble::before { display: none; }

/* Typing indicator (3 dots) */
.xaflo-demo-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--x-border-2);
  border-radius: 18px 18px 18px 4px;
  width: max-content;
  margin-bottom: 1rem;
  opacity: 0;
  transition: opacity .3s ease;
}
.xaflo-demo-typing.is-active { opacity: 1; }
.xaflo-demo-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--x-cyan);
  animation: xaflo-typing-dot 1.2s infinite;
}
.xaflo-demo-typing span:nth-child(2) { animation-delay: 0.2s; }
.xaflo-demo-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes xaflo-typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30%           { opacity: 1;   transform: scale(1.2); }
}

/* RIGHT SIDE — OUTPUT */
.xaflo-demo-side:last-child::before {
  content: "// OUTPUT";
  position: absolute; top: 1.2rem; left: 2rem;
  font-family: var(--x-mono); font-size: 0.7rem;
  letter-spacing: 0.3em; color: var(--x-cyan);
  opacity: 0.6;
}

/* Status pill (above output, shows current state) */
.xaflo-demo-status {
  position: absolute; top: 1rem; right: 2rem;
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--x-mono); font-size: 0.66rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--x-border-2);
  background: rgba(255,255,255,0.02);
  border-radius: 999px;
  color: var(--x-muted-2);
  transition: all .4s ease;
}
.xaflo-demo-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--x-muted);
  transition: background .4s ease, box-shadow .4s ease;
}
.xaflo-demo-status.is-thinking { color: var(--x-violet); border-color: rgba(124,58,237,0.4); }
.xaflo-demo-status.is-thinking .dot { background: var(--x-violet); box-shadow: 0 0 8px var(--x-violet); animation: xaflo-blink-dot 0.9s infinite; }
.xaflo-demo-status.is-working  { color: var(--x-magenta); border-color: rgba(217,70,239,0.4); }
.xaflo-demo-status.is-working  .dot { background: var(--x-magenta); box-shadow: 0 0 8px var(--x-magenta); animation: xaflo-blink-dot 0.6s infinite; }
.xaflo-demo-status.is-live     { color: var(--x-cyan); border-color: rgba(0,217,255,0.5); background: rgba(0,217,255,0.06); }
.xaflo-demo-status.is-live     .dot { background: var(--x-cyan); box-shadow: 0 0 10px var(--x-cyan); animation: xaflo-blink-dot 1.2s infinite; }
@keyframes xaflo-blink-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Output metrics — bigger, cleaner, with count-up */
.xaflo-demo-output {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 5.5rem;
}
.xaflo-demo-metric {
  flex: none;
  display: flex; flex-direction: column;
  gap: 0.4rem;
  padding: 1.15rem 1.15rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--x-border-2);
  border-radius: 14px;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1);
  position: relative;
  overflow: hidden;
}
.xaflo-demo-output.is-in .xaflo-demo-metric { opacity: 1; transform: translateY(0) scale(1); }
.xaflo-demo-output.is-in .xaflo-demo-metric:nth-child(1) { transition-delay: 0s; }
.xaflo-demo-output.is-in .xaflo-demo-metric:nth-child(2) { transition-delay: 0.18s; }
.xaflo-demo-output.is-in .xaflo-demo-metric:nth-child(3) { transition-delay: 0.36s; }
.xaflo-demo-output.is-in .xaflo-demo-metric:nth-child(4) { transition-delay: 0.54s; }
.xaflo-demo-metric::before {
  content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--x-cyan), var(--x-violet), var(--x-magenta));
  transition: width 1.4s cubic-bezier(.2,.7,.2,1) 0.4s;
}
.xaflo-demo-output.is-in .xaflo-demo-metric::before { width: 100%; }
.xaflo-demo-metric b {
  font-family: var(--x-display);
  font-size: 2rem; font-weight: 700; line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #00d9ff, #7c3aed);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  display: block;
  min-width: auto;
}
.xaflo-demo-metric span {
  color: var(--x-muted-2);
  font-size: 0.82rem;
  line-height: 1.35;
}

/* Particle flow visualization between left/right (decorative, optional) */
.xaflo-demo-particles {
  display: none; /* Use background only — keeps it simple. Bringing it back later */
}

/* Mobile tweaks */
@media (max-width: 820px) {
  .xaflo-demo-side { min-height: auto; padding: 1.5rem; }
  .xaflo-demo-side:first-child::before,
  .xaflo-demo-side:last-child::before { top: 1rem; left: 1.5rem; }
  .xaflo-demo-sector { top: 0.85rem; right: 1.5rem; }
  .xaflo-demo-status { top: 0.85rem; right: 1.5rem; }
  .xaflo-demo-industry { width: 70px; height: 70px; margin-top: 2rem; }
  .xaflo-demo-industry svg { width: 36px; height: 36px; }
  .xaflo-demo-output { margin-top: 4.5rem; grid-template-columns: 1fr; }
  .xaflo-demo-metric b { font-size: 1.7rem; }
}
