/* ===========================================================
   Home page — world-class dynamic enhancements
   Custom cursor, animated hero, orbs, 3D tilt, stats, marquee
   Works for both RTL (ar) and LTR (en)
   =========================================================== */

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 4px; width: 0;
  background: linear-gradient(90deg, var(--c-accent), #ffce55);
  z-index: 3000; transition: width .1s linear;
}

/* ---------- Custom cursor (desktop only) ---------- */
@media (hover: hover) and (pointer: fine) {
  * { cursor: none !important; }
  .cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 4000; pointer-events: none; border-radius: 50%; }
  .cursor-dot {
    width: 8px; height: 8px; background: var(--c-accent);
    transform: translate(-50%, -50%); transition: width .2s, height .2s, background .2s;
  }
  .cursor-ring {
    width: 40px; height: 40px; border: 2px solid rgba(242,169,0,.6);
    transform: translate(-50%, -50%); transition: transform .18s ease-out, width .25s, height .25s, border-color .25s, background .25s;
  }
  .cursor-ring.hover { width: 62px; height: 62px; border-color: var(--c-accent); background: rgba(242,169,0,.10); }
  .cursor-ring.down { width: 30px; height: 30px; }
  .cursor-dot.hover { width: 0; height: 0; }
}

/* ---------- HERO dynamic ---------- */
.hero.dyn { background: none; }
.hero.dyn .hero-bg {
  background-image: linear-gradient(120deg, rgba(13,30,50,.92), rgba(20,38,60,.80));
}
/* animated mesh gradient layer */
.hero.dyn .mesh {
  position: absolute; inset: 0; z-index: 1; overflow: hidden;
}
.hero.dyn .orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55;
  animation: float 14s ease-in-out infinite;
}
.hero.dyn .orb.o1 { width: 460px; height: 460px; background: #2f5f8f; top: -120px; right: -80px; }
.hero.dyn .orb.o2 { width: 380px; height: 380px; background: #F2A900; bottom: -120px; left: -60px; animation-delay: -4s; opacity: .35; }
.hero.dyn .orb.o3 { width: 300px; height: 300px; background: #4e5091; top: 40%; left: 30%; animation-delay: -8s; }
@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.1); }
  66% { transform: translate(-30px,25px) scale(.95); }
}
/* subtle moving grid */
.hero.dyn .grid-lines {
  position: absolute; inset: 0; z-index: 1; opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.25) 1px, transparent 1px);
  background-size: 60px 60px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  animation: gridmove 20s linear infinite;
}
@keyframes gridmove { to { background-position: 60px 60px; } }

.hero.dyn .container { z-index: 3; }
/* gradient animated headline */
.hero.dyn h1 .grad {
  background: linear-gradient(90deg, #F2A900, #ffd873, #F2A900);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; animation: shine 4s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

/* word-by-word reveal */
.reveal-words span { display: inline-block; opacity: 0; transform: translateY(24px); }
.reveal-words.in span { animation: wordUp .6s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes wordUp { to { opacity: 1; transform: none; } }

/* rotating tagline */
.rotator { display: inline-block; position: relative; color: var(--c-accent); font-weight: 800; }
.rotator .word { position: absolute; right: 0; left: 0; white-space: nowrap; opacity: 0; transform: translateY(12px); }
html[dir="ltr"] .rotator .word { text-align: left; }
.rotator .word.active { opacity: 1; transform: none; transition: .5s; }

/* hero badges row */
.hero-badges { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 34px; }
.hero-badge { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.9); font-weight: 600; font-size: 15px; }
.hero-badge .b-ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(242,169,0,.15); color: var(--c-accent); display: grid; place-items: center; font-size: 18px; }

/* ---------- Magnetic buttons ---------- */
.magnetic { transition: transform .2s cubic-bezier(.2,.7,.3,1); }

/* ---------- Stats counters ---------- */
.stats-dyn { background: linear-gradient(115deg, var(--c-primary), #16314c); color: #fff; position: relative; overflow: hidden; }
.stats-dyn::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, rgba(242,169,0,.12), transparent 40%); }
.stats-dyn .grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; position: relative; }
.stat-card { text-align: center; padding: 20px; border-radius: 16px; transition: .3s; }
.stat-card:hover { background: rgba(255,255,255,.05); transform: translateY(-6px); }
.stat-card .num { font-size: clamp(34px,4.4vw,54px); font-weight: 900; color: var(--c-accent); line-height: 1; }
.stat-card .lbl { margin-top: 10px; opacity: .9; font-size: 16px; font-weight: 600; }

/* ---------- 3D tilt cards ---------- */
.tilt { transform-style: preserve-3d; transition: transform .2s ease-out, box-shadow .3s; will-change: transform; }
.tilt .tilt-inner { transform: translateZ(30px); }

/* ---------- marquee tech strip ---------- */
.tech-marquee { background: var(--c-soft); padding: 26px 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.tech-track { display: flex; gap: 50px; width: max-content; animation: techscroll 26s linear infinite; }
.tech-track span { color: var(--c-primary); font-weight: 800; font-size: 22px; opacity: .55; white-space: nowrap; transition: .2s; }
.tech-track span:hover { opacity: 1; color: var(--c-accent); }
@keyframes techscroll { to { transform: translateX(-50%); } }
html[dir="ltr"] .tech-track { animation-name: techscroll-ltr; }
@keyframes techscroll-ltr { to { transform: translateX(50%); } }

/* ---------- reveal variants ---------- */
.r-up, .r-left, .r-right, .r-zoom { opacity: 0; transition: .8s cubic-bezier(.2,.7,.3,1); }
.r-up { transform: translateY(40px); }
.r-left { transform: translateX(-40px); }
.r-right { transform: translateX(40px); }
.r-zoom { transform: scale(.9); }
.r-up.in, .r-left.in, .r-right.in, .r-zoom.in { opacity: 1; transform: none; }
.d-1 { transition-delay: .1s; } .d-2 { transition-delay: .2s; } .d-3 { transition-delay: .3s; } .d-4 { transition-delay: .4s; } .d-5 { transition-delay: .5s; }

/* ---------- back to top ---------- */
.to-top {
  position: fixed; bottom: 26px; z-index: 900; width: 50px; height: 50px; border-radius: 50%;
  background: var(--c-primary); color: #fff; border: none; display: grid; place-items: center; font-size: 22px;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(20px); transition: .3s;
}
html[dir="rtl"] .to-top { left: 26px; }
html[dir="ltr"] .to-top { right: 26px; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--c-accent); color: #16314c; transform: translateY(-4px); }

/* ---------- feature cards glow ---------- */
.glow-card { position: relative; overflow: hidden; }
.glow-card::after {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(242,169,0,.18), transparent 70%);
  top: var(--my,50%); left: var(--mx,50%); transform: translate(-50%,-50%); opacity: 0; transition: opacity .3s; pointer-events: none;
}
.glow-card:hover::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .hero.dyn .orb, .hero.dyn .grid-lines, .tech-track, .hero.dyn h1 .grad { animation: none !important; }
  .r-up, .r-left, .r-right, .r-zoom, .reveal-words span { opacity: 1 !important; transform: none !important; }
}
