@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;600;700&display=swap');

/* ── Hero visual: rotating automation scenes ─────────────────────
   Three scenes (live feed → AI chat → chaos-to-order) that alternate.
   The stage is designed at 480×500 and scaled to fit by hero-visual.js.
   Works LTR (English site) and RTL (Arabic site). */

.hero-diagram { display: flex; align-items: flex-start; justify-content: center; }
.hv {
  --hv-dx: 120px; --hv-in: 40px;
  position: relative; width: 100%; max-width: 480px; height: 500px;
  font-family: 'Inter', 'IBM Plex Sans Arabic', -apple-system, sans-serif;
  color: #F1F5F9; perspective: 1400px;
}
[dir="rtl"] .hv { --hv-dx: -120px; --hv-in: -40px; }
.hv svg, .hero-diagram .hv svg { filter: none; }
.hv [lang="ar"] { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }
.hv [lang="en"] { font-family: 'Inter', -apple-system, sans-serif; }

.hv-stage { position: absolute; top: 0; left: 0; width: 480px; height: 500px; transform-origin: top left; }
[dir="rtl"] .hv-stage { left: auto; right: 0; transform-origin: top right; }
.hv-tilt { transition: transform .25s ease-out; transform-style: preserve-3d; }

.hv-panel {
  box-sizing: border-box; height: 448px; padding: 18px;
  background: rgba(15, 23, 42, .78); border: 1px solid rgba(255, 255, 255, .09); border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, .08), 0 24px 48px rgba(0, 0, 0, .3), 0 0 60px rgba(59, 130, 246, .10);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; overflow: hidden;
}
.hv-head { display: flex; align-items: center; gap: 8px; height: 30px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.hv-dots { display: flex; gap: 5px; }
.hv-dots span { width: 8px; height: 8px; border-radius: 50%; }
.hv-dots span:nth-child(1) { background: #ff5f57; } .hv-dots span:nth-child(2) { background: #febc2e; } .hv-dots span:nth-child(3) { background: #28c840; }
.hv-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #AAB6C8; margin-inline-start: 4px; }
.hv-live { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #86EFAC; }
.hv-live i { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; animation: hvPulse 1.6s ease-in-out infinite; }

.hv-scene { flex: 1; min-height: 0; display: flex; animation: hvEnter .7s cubic-bezier(.2, .8, .2, 1) both; }
.hv-scene[hidden] { display: none; }

/* Scene A — live feed */
.hv-feed { flex-direction: column; gap: 8px; }
.hv-row {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: #111C33; border: 1px solid #1E293B; border-radius: 12px;
  animation: hvRowIn .5s cubic-bezier(.2, .8, .2, 1) var(--d) both, hvFlash 1.2s ease calc(var(--d) + 1.1s) both;
}
.hv-ico { width: 30px; height: 30px; flex: none; border-radius: 8px; background: #172554; display: flex; align-items: center; justify-content: center; }
.hv-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hv-t { font-size: 13px; font-weight: 600; color: #F1F5F9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-m { font-size: 11.5px; color: #B4C0D3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-status { position: relative; flex: none; width: 112px; height: 24px; }
.hv-chip { position: absolute; inset-inline-end: 0; top: 0; display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.hv-wait { background: #172554; color: #93C5FD; animation: hvHide .25s ease calc(var(--d) + 1.1s) forwards; }
.hv-wait svg { animation: hvSpin .8s linear infinite; }
.hv-done { background: #052E1A; color: #4ADE80; opacity: 0; animation: hvShow .35s cubic-bezier(.2, 1.4, .4, 1) calc(var(--d) + 1.15s) forwards; }
.hv-done.is-amber { background: #3A2604; color: #FBBF24; }

/* Scene B — AI chat */
.hv-chatscene { gap: 12px; }
.hv-chat { width: 244px; flex: none; box-sizing: border-box; background: #0B1324; border: 1px solid #1E2A4A; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.hv-chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #1E293B; }
.hv-avatar { width: 30px; height: 30px; border-radius: 50%; background: #3B82F6; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }
.hv-chat-name { font-size: 13px; font-weight: 700; }
.hv-chat-status { font-size: 11px; color: #86EFAC; }
.hv-msgs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 10px; font-size: 13px; line-height: 1.45; overflow: hidden; }
.hv-msg { max-width: 88%; padding: 7px 11px; border-radius: 13px; animation: hvPop .4s ease var(--d) both; }
.hv-msg.is-them { align-self: flex-start; background: #1E293B; color: #E2E8F0; }
.hv-msg.is-bot { align-self: flex-end; background: #2563EB; color: #fff; }
.hv-typing { align-self: flex-end; display: flex; gap: 4px; padding: 11px 13px; border-radius: 13px; background: #2563EB; overflow: hidden; animation: hvTyping 1.1s ease var(--d) both; }
.hv-typing i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: hvDot 1s infinite; }
.hv-typing i:nth-child(2) { animation-delay: .15s; } .hv-typing i:nth-child(3) { animation-delay: .3s; }
.hv-acts { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 8px; overflow: hidden; padding-top: 4px; }
.hv-acts-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #AAB6C8; margin-bottom: 2px; }
.hv-act { display: flex; gap: 8px; align-items: flex-start; padding: 9px 10px; background: #0F172A; border: 1px solid #1E293B; border-radius: 12px; animation: hvRowIn .5s cubic-bezier(.2, .8, .2, 1) var(--d) both, hvFlash 1.2s ease calc(var(--d) + .2s) both; }
.hv-act svg { flex: none; margin-top: 1px; }
.hv-act .hv-t { font-size: 12.5px; white-space: normal; } .hv-act .hv-m { font-size: 11px; white-space: normal; }

/* Scene C — chaos to order */
.hv-order { gap: 10px; align-items: stretch; }
.hv-before, .hv-after { width: 196px; flex: none; box-sizing: border-box; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.hv-before { background: rgba(17, 24, 39, .9); border: 1px dashed #475569; position: relative; z-index: 2; }
.hv-after { background: #0F172A; border: 1px solid #1E293B; animation: hvGlowIn .6s ease 3.1s forwards; }
.hv-tag { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.hv-before .hv-tag { color: #FCA5A5; } .hv-after .hv-tag { color: #86EFAC; }
.hv-pile { position: relative; flex: 1; }
.hv-note {
  position: absolute; inset-inline-start: var(--x); top: var(--y); width: 152px; padding: 9px 11px; border-radius: 9px;
  font-size: 12px; line-height: 1.4; transform: rotate(var(--r));
  animation: hvDrop .55s cubic-bezier(.2, .9, .3, 1.25) var(--d) both, hvWiggle .18s ease 1.7s 3, hvSuck .55s cubic-bezier(.6, 0, .9, .4) calc(2.4s + var(--i)) forwards;
}
.hv-note.n-mail { background: #1F2937; border: 1px solid #374151; color: #E5E7EB; }
.hv-note.n-xls { background: #14532D; border: 1px solid #166534; color: #DCFCE7; }
.hv-note.n-sticky { background: #FDE68A; color: #422006; font-weight: 600; border-radius: 3px; }
.hv-note.n-alert { background: #450A0A; border: 1px solid #7F1D1D; color: #FECACA; }
.hv-arrow { flex: none; display: flex; align-items: center; position: relative; z-index: 3; }
.hv-arrow span { width: 28px; height: 28px; border-radius: 50%; background: #3B82F6; display: flex; align-items: center; justify-content: center; animation: hvRing 1s ease-out 2.4s 2; }
[dir="rtl"] .hv-arrow svg { transform: scaleX(-1); }
.hv-win { display: flex; gap: 8px; align-items: flex-start; padding: 8px 9px; background: #111C33; border: 1px solid #1E293B; border-radius: 10px; animation: hvRowIn .45s ease var(--d) both; }
.hv-win svg { flex: none; margin-top: 1px; }
.hv-win .hv-t { font-size: 12.5px; white-space: normal; }
.hv-win .hv-m { font-size: 11px; white-space: normal; }

/* Tabs / progress */
.hv-tabs { display: flex; gap: 10px; margin-top: 12px; }
.hv-tab { flex: 1; height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 6px; text-align: start; font: inherit; }
.hv-bar { display: block; height: 3px; border-radius: 3px; background: #1E293B; overflow: hidden; }
.hv-bar i { display: block; height: 3px; width: 0; background: #3B82F6; }
.hv-tab.is-active .hv-bar i { animation: hvGrow 9s linear both; }
.hv.is-paused .hv-tab.is-active .hv-bar i { animation-play-state: paused; }
.hv-tab-label { font-size: 11.5px; font-weight: 600; color: #AAB6C8; }
.hv-tab.is-active .hv-tab-label { color: #E2E8F0; }
.hv-tab:focus-visible { outline: 2px solid #3B82F6; outline-offset: 2px; border-radius: 4px; }

@keyframes hvEnter { from { opacity: 0; filter: blur(14px); transform: scale(.95); } to { opacity: 1; filter: none; transform: none; } }
@keyframes hvRowIn { from { opacity: 0; transform: translateX(var(--hv-in)); } to { opacity: 1; transform: none; } }
@keyframes hvFlash { 0% { border-color: #1E293B; box-shadow: none; } 30% { border-color: #4ADE80; box-shadow: 0 0 22px rgba(74, 222, 128, .35); } 100% { border-color: #1E293B; box-shadow: none; } }
@keyframes hvHide { to { opacity: 0; transform: scale(.8); } }
@keyframes hvShow { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes hvSpin { to { transform: rotate(360deg); } }
@keyframes hvPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes hvPop { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes hvTyping { 0% { opacity: 0; max-height: 0; } 12% { opacity: 1; max-height: 40px; } 85% { opacity: 1; max-height: 40px; } 100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -8px; } }
@keyframes hvDot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes hvDrop { from { opacity: 0; transform: translateY(-50px) rotate(var(--r)); } to { opacity: 1; transform: rotate(var(--r)); } }
@keyframes hvWiggle { 0%, 100% { transform: rotate(var(--r)); } 25% { transform: rotate(calc(var(--r) - 4deg)); } 75% { transform: rotate(calc(var(--r) + 4deg)); } }
@keyframes hvSuck { to { opacity: 0; transform: translate(var(--hv-dx), var(--dy)) rotate(0deg) scale(.15); } }
@keyframes hvRing { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .7); } 100% { box-shadow: 0 0 0 22px rgba(59, 130, 246, 0); } }
@keyframes hvGlowIn { to { border-color: #3B82F6; box-shadow: 0 0 36px rgba(59, 130, 246, .25); } }
@keyframes hvGrow { from { width: 0; } to { width: 100%; } }

/* Larger stage when the hero stacks (tablet); hidden on phones as before */
@media (max-width: 960px) { .hero-diagram { max-width: 480px; width: 100%; } }
@media (max-width: 600px) { .hero-diagram { display: none; } }

/* Respect reduced-motion: show finished states, no autoplay */
@media (prefers-reduced-motion: reduce) {
  .hv *, .hv-scene { animation: none !important; transition: none !important; }
  .hv-wait, .hv-typing { display: none; }
  .hv-done { opacity: 1; }
  .hv-note { opacity: .45; }
  .hv-tab.is-active .hv-bar i { width: 100%; }
}
