/* Product-specific demo animations */

.ai-visual {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fff8f1 0%, #ffffff 48%, #ffe8cc 100%);
  overflow: hidden;
}

.demo {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 52rem);
  margin: 1.5rem auto 3rem;
}

.demo-caption {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(9, 9, 73, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  white-space: nowrap;
}

/* ========== HOME: Agentic workflow ========== */
.demo-agent {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 0.85rem;
  align-items: stretch;
  min-height: 16rem;
}

.panel {
  background: #fff;
  border: 1px solid rgba(9, 9, 73, 0.1);
  border-radius: 1rem;
  box-shadow: 0 12px 28px rgba(9, 9, 73, 0.08);
  padding: 0.9rem;
  overflow: hidden;
}

.panel-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin: 0 0 0.65rem;
}

.doc-stack {
  position: relative;
  height: 9.5rem;
}

.doc-card {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 4.8rem;
  border-radius: 0.55rem;
  background: #f8fafc;
  border: 1px solid rgba(9, 9, 73, 0.12);
  padding: 0.55rem 0.65rem;
  animation: docCycle 6s ease-in-out infinite;
}

.doc-card::before,
.doc-card::after {
  content: "";
  display: block;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(9, 9, 73, 0.12);
  margin-bottom: 0.35rem;
}

.doc-card::after {
  width: 62%;
}

.doc-card .chip {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(232, 93, 4, 0.12);
  color: var(--orange-deep);
  font-size: 0.65rem;
  font-weight: 700;
}

.doc-card.d1 { top: 0.2rem; animation-delay: 0s; }
.doc-card.d2 { top: 1.5rem; opacity: 0.7; transform: scale(0.96); animation-delay: -2s; }
.doc-card.d3 { top: 2.8rem; opacity: 0.45; transform: scale(0.92); animation-delay: -4s; }

@keyframes docCycle {
  0%, 15% { transform: translateY(0) scale(1); opacity: 1; }
  40% { transform: translateY(-0.4rem) scale(1.02); opacity: 1; }
  55% { transform: translate(120%, -1rem) scale(0.9); opacity: 0; }
  56% { transform: translate(-40%, 1rem) scale(0.9); opacity: 0; }
  75%, 100% { transform: translateY(0) scale(1); opacity: 1; }
}

.agent-card {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.55rem;
  padding-top: 0.85rem;
}

.agent-orb {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbbf24, #e85d04 55%, #9a3412);
  box-shadow: 0 0 0 0 rgba(232, 93, 4, 0.35);
  animation: agentPulse 2.4s ease-out infinite;
  position: relative;
}

.agent-orb::after {
  content: "AI";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

@keyframes agentPulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 93, 4, 0.4); transform: scale(1); }
  70% { box-shadow: 0 0 0 16px rgba(232, 93, 4, 0); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 rgba(232, 93, 4, 0); transform: scale(1); }
}

.agent-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
}

.agent-status span {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #16a34a;
  margin-right: 0.35rem;
  animation: nodePulse 1.2s ease-in-out infinite;
  vertical-align: 0.05rem;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.task-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.55rem;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.45;
  animation: taskDone 8s ease-in-out infinite;
}

.task-list li i {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid rgba(9, 9, 73, 0.2);
  flex-shrink: 0;
}

.task-list li:nth-child(1) { animation-delay: 0s; }
.task-list li:nth-child(2) { animation-delay: 1.2s; }
.task-list li:nth-child(3) { animation-delay: 2.4s; }
.task-list li:nth-child(4) { animation-delay: 3.6s; }
.task-list li:nth-child(5) { animation-delay: 4.8s; }

@keyframes taskDone {
  0%, 8% { opacity: 0.4; background: #f8fafc; color: var(--muted); }
  18%, 70% {
    opacity: 1;
    background: rgba(232, 93, 4, 0.1);
    color: var(--navy);
  }
  18% { transform: translateX(0); }
  85%, 100% { opacity: 0.4; background: #f8fafc; color: var(--muted); }
}

.task-list li:nth-child(1) i,
.task-list li:nth-child(2) i,
.task-list li:nth-child(3) i,
.task-list li:nth-child(4) i,
.task-list li:nth-child(5) i {
  animation: taskCheck 8s ease-in-out infinite;
}

.task-list li:nth-child(1) i { animation-delay: 0s; }
.task-list li:nth-child(2) i { animation-delay: 1.2s; }
.task-list li:nth-child(3) i { animation-delay: 2.4s; }
.task-list li:nth-child(4) i { animation-delay: 3.6s; }
.task-list li:nth-child(5) i { animation-delay: 4.8s; }

@keyframes taskCheck {
  0%, 12% { background: transparent; border-color: rgba(9, 9, 73, 0.2); }
  20%, 70% { background: var(--orange); border-color: var(--orange); }
  85%, 100% { background: transparent; border-color: rgba(9, 9, 73, 0.2); }
}

/* ========== REDACTAI ========== */
.demo-redact {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  min-height: 15rem;
}

.doc-page {
  position: relative;
  background: #fff;
  border-radius: 0.85rem;
  border: 1px solid rgba(9, 9, 73, 0.12);
  padding: 1rem 1.1rem;
  overflow: hidden;
  min-height: 14rem;
}

.doc-page .line {
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(9, 9, 73, 0.12);
  margin-bottom: 0.55rem;
}

.doc-page .line.short { width: 55%; }
.doc-page .line.mid { width: 78%; }

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e85d04, transparent);
  box-shadow: 0 0 12px rgba(232, 93, 4, 0.6);
  animation: scanDown 4.5s ease-in-out infinite;
}

@keyframes scanDown {
  0% { top: 8%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 90%; opacity: 0; }
}

.redact-bar {
  position: absolute;
  left: 1.1rem;
  height: 0.7rem;
  border-radius: 0.2rem;
  background: #111827;
  transform-origin: left center;
  transform: scaleX(0);
  animation: redactReveal 4.5s ease-in-out infinite;
}

.redact-bar.r1 { top: 3.1rem; width: 42%; animation-delay: 0.6s; }
.redact-bar.r2 { top: 5.4rem; width: 58%; animation-delay: 1.3s; }
.redact-bar.r3 { top: 7.7rem; width: 36%; animation-delay: 2s; }
.redact-bar.r4 { top: 10rem; width: 48%; animation-delay: 2.7s; }

@keyframes redactReveal {
  0%, 12% { transform: scaleX(0); opacity: 0; }
  22%, 78% { transform: scaleX(1); opacity: 1; }
  90%, 100% { transform: scaleX(0); opacity: 0; }
}

.redact-side {
  display: grid;
  gap: 0.65rem;
  align-content: center;
}

.pill-stat {
  background: #fff;
  border-radius: 0.85rem;
  border: 1px solid rgba(9, 9, 73, 0.1);
  padding: 0.85rem;
  animation: fadePop 4.5s ease-in-out infinite;
}

.pill-stat strong {
  display: block;
  color: var(--navy);
  font-size: 1.1rem;
}

.pill-stat span {
  font-size: 0.75rem;
  color: var(--muted);
}

.pill-stat:nth-child(2) { animation-delay: 0.8s; }
.pill-stat:nth-child(3) { animation-delay: 1.6s; }

@keyframes fadePop {
  0%, 15% { opacity: 0.35; transform: translateY(4px); }
  30%, 75% { opacity: 1; transform: none; }
  90%, 100% { opacity: 0.35; transform: translateY(4px); }
}

/* ========== SIGNATURE ========== */
.demo-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 14rem;
}

.sign-box {
  background: #fff;
  border-radius: 0.85rem;
  border: 1px solid rgba(9, 9, 73, 0.1);
  padding: 0.9rem;
  position: relative;
  min-height: 12rem;
}

.sign-box svg {
  width: 100%;
  height: 6.5rem;
  margin-top: 0.5rem;
}

.sign-path {
  fill: none;
  stroke: var(--navy);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: drawSign 5s ease-in-out infinite;
}

.sign-box.ref .sign-path {
  stroke: rgba(9, 9, 73, 0.35);
  animation: none;
  stroke-dashoffset: 0;
}

@keyframes drawSign {
  0%, 10% { stroke-dashoffset: 320; }
  45%, 70% { stroke-dashoffset: 0; }
  90%, 100% { stroke-dashoffset: 320; }
}

.match-badge {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  background: #16a34a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  opacity: 0;
  animation: matchFlash 5s ease-in-out infinite;
}

@keyframes matchFlash {
  0%, 40% { opacity: 0; transform: scale(0.9); }
  50%, 75% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; transform: scale(0.9); }
}

.compare-beam {
  position: absolute;
  left: calc(50% - 0.5rem);
  top: 35%;
  width: 1rem;
  height: 2px;
  background: var(--orange);
  opacity: 0;
  animation: beamBlink 5s ease-in-out infinite;
}

@keyframes beamBlink {
  0%, 35% { opacity: 0; }
  45%, 70% { opacity: 1; }
  85%, 100% { opacity: 0; }
}

/* ========== RECONCILE ========== */
.demo-reconcile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  position: relative;
  min-height: 14rem;
}

.ledger {
  background: #fff;
  border-radius: 0.85rem;
  border: 1px solid rgba(9, 9, 73, 0.1);
  padding: 0.85rem;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.35rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
  background: #f8fafc;
}

.ledger-row.match {
  animation: rowMatch 5.5s ease-in-out infinite;
}

.ledger-row.exception {
  animation: rowException 5.5s ease-in-out infinite;
}

.ledger-row:nth-child(2).match { animation-delay: 0.4s; }
.ledger-row:nth-child(3).match { animation-delay: 0.8s; }
.ledger-row:nth-child(4).exception { animation-delay: 1.2s; }

@keyframes rowMatch {
  0%, 20% { background: #f8fafc; box-shadow: none; }
  35%, 75% { background: rgba(22, 163, 74, 0.12); box-shadow: inset 3px 0 0 #16a34a; }
  90%, 100% { background: #f8fafc; box-shadow: none; }
}

@keyframes rowException {
  0%, 25% { background: #f8fafc; box-shadow: none; }
  40%, 80% { background: rgba(232, 93, 4, 0.14); box-shadow: inset 3px 0 0 #e85d04; }
  92%, 100% { background: #f8fafc; box-shadow: none; }
}

.link-lines {
  position: absolute;
  inset: 15% 42%;
  pointer-events: none;
}

.link-lines span {
  display: block;
  height: 2px;
  background: linear-gradient(90deg, #16a34a, #e85d04);
  margin: 1.35rem 0;
  transform: scaleX(0);
  transform-origin: left;
  animation: linkDraw 5.5s ease-in-out infinite;
}

.link-lines span:nth-child(1) { animation-delay: 0.4s; }
.link-lines span:nth-child(2) { animation-delay: 0.8s; }
.link-lines span:nth-child(3) { animation-delay: 1.2s; background: #e85d04; }

@keyframes linkDraw {
  0%, 20% { transform: scaleX(0); opacity: 0; }
  35%, 75% { transform: scaleX(1); opacity: 1; }
  90%, 100% { transform: scaleX(0); opacity: 0; }
}

/* ========== FORMFLOW ========== */
.demo-formflow {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  min-height: 14rem;
}

.form-mock label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.form-mock .field {
  height: 1.7rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(9, 9, 73, 0.12);
  background: #fff;
  position: relative;
  overflow: hidden;
}

.form-mock .field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(232, 93, 4, 0.2), transparent);
  transform: translateX(-100%);
  animation: fieldScan 4s ease-in-out infinite;
}

.form-mock .field:nth-child(2)::after { animation-delay: 0.4s; }
.form-mock .field:nth-child(3)::after { animation-delay: 0.8s; }

@keyframes fieldScan {
  0%, 15% { transform: translateX(-100%); }
  40%, 60% { transform: translateX(0%); }
  85%, 100% { transform: translateX(100%); }
}

.data-out {
  display: grid;
  gap: 0.5rem;
  align-content: center;
}

.data-chip {
  background: #fff;
  border: 1px solid rgba(9, 9, 73, 0.1);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  opacity: 0;
  transform: translateX(12px);
  animation: chipIn 4s ease-in-out infinite;
}

.data-chip:nth-child(1) { animation-delay: 0.5s; }
.data-chip:nth-child(2) { animation-delay: 1s; }
.data-chip:nth-child(3) { animation-delay: 1.5s; }
.data-chip:nth-child(4) { animation-delay: 2s; }

@keyframes chipIn {
  0%, 15% { opacity: 0; transform: translateX(12px); }
  30%, 70% { opacity: 1; transform: none; }
  85%, 100% { opacity: 0; transform: translateX(12px); }
}

/* ========== INTELLIGENT AUTOMATION / SERVICES ========== */
.demo-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 12rem;
  padding: 0.5rem 0;
}

.flow-node {
  flex: 1;
  background: #fff;
  border: 1px solid rgba(9, 9, 73, 0.1);
  border-radius: 0.85rem;
  padding: 0.85rem 0.55rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  position: relative;
  animation: nodeActive 7s ease-in-out infinite;
}

.flow-node .icon {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.45rem;
  border-radius: 0.55rem;
  background: rgba(232, 93, 4, 0.12);
  display: grid;
  place-items: center;
  color: var(--orange-deep);
  font-size: 0.85rem;
}

.flow-node:nth-child(1) { animation-delay: 0s; }
.flow-node:nth-child(3) { animation-delay: 1.2s; }
.flow-node:nth-child(5) { animation-delay: 2.4s; }
.flow-node:nth-child(7) { animation-delay: 3.6s; }
.flow-node:nth-child(9) { animation-delay: 4.8s; }

@keyframes nodeActive {
  0%, 12% { border-color: rgba(9, 9, 73, 0.1); transform: translateY(0); }
  18%, 30% {
    border-color: var(--orange);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(232, 93, 4, 0.15);
  }
  45%, 100% { border-color: rgba(9, 9, 73, 0.1); transform: translateY(0); box-shadow: none; }
}

.flow-arrow {
  width: 1.1rem;
  height: 2px;
  background: rgba(9, 9, 73, 0.2);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--orange);
  transform: translateX(-100%);
  animation: arrowRun 7s ease-in-out infinite;
}

.flow-arrow.a1::after { animation-delay: 0.3s; }
.flow-arrow.a2::after { animation-delay: 1.5s; }
.flow-arrow.a3::after { animation-delay: 2.7s; }
.flow-arrow.a4::after { animation-delay: 3.9s; }

@keyframes arrowRun {
  0%, 10% { transform: translateX(-100%); }
  20%, 28% { transform: translateX(0); }
  40%, 100% { transform: translateX(100%); }
}

@media (max-width: 800px) {
  .demo-agent,
  .demo-redact,
  .demo-sign,
  .demo-reconcile,
  .demo-formflow {
    grid-template-columns: 1fr;
  }

  .link-lines,
  .compare-beam {
    display: none;
  }

  .demo-flow {
    flex-wrap: wrap;
    justify-content: center;
  }

  .flow-arrow {
    display: none;
  }

  .flow-node {
    flex: 0 0 calc(50% - 0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-visual *,
  .demo-caption::before {
    animation: none !important;
  }
}
