/* ================================================================
   Khoozo — css/animation.css
   All keyframes and motion-only rules. Layout/color lives in style.css.
   ================================================================ */

/* ================================================================
   1. PRELOADER
   ================================================================ */
.preloader {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
.preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-mark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem;
  background: linear-gradient(120deg, var(--red), var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pulseScale 1.4s ease-in-out infinite;
}
.preloader-bar { width: 140px; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.preloader-bar span {
  display: block; height: 100%; width: 40%; border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--orange));
  animation: preloaderSlide 1.1s ease-in-out infinite;
}
@keyframes preloaderSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@keyframes pulseScale {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.06); opacity: 0.85; }
}

/* ================================================================
   2. SCROLL PROGRESS BAR
   ================================================================ */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90;
  background: transparent;
}
.scroll-progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red), var(--orange));
  transition: width 0.1s linear;
}

/* ================================================================
   3. CUSTOM CURSOR (fine-pointer devices only)
   ================================================================ */
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  a, button, input, textarea, select, .fab, .back-to-top { cursor: none; }

  .cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0; z-index: 250; pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
  }
  .cursor-dot {
    width: 7px; height: 7px; background: var(--orange);
    transition: transform 0.08s linear, opacity 0.2s ease;
  }
  .cursor-ring {
    width: 34px; height: 34px; border: 1.5px solid var(--red);
    transition: transform 0.15s var(--ease), width 0.2s var(--ease), height 0.2s var(--ease), opacity 0.2s ease;
    opacity: 0.6;
  }
  .cursor-ring.is-active { width: 50px; height: 50px; border-color: var(--orange); opacity: 0.9; }
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ================================================================
   4. SCROLL REVEAL
   ================================================================ */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* stagger children of grids slightly for a premium cascade */
.cards-grid .reveal:nth-child(2), .feature-grid .reveal:nth-child(2), .quote-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.cards-grid .reveal:nth-child(3), .feature-grid .reveal:nth-child(3), .quote-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.cards-grid .reveal:nth-child(4), .feature-grid .reveal:nth-child(4) { transition-delay: 0.24s; }

/* hero entrance (plays once on load, independent of scroll observer) */
.hero .reveal { animation: rise 0.8s var(--ease) forwards; opacity: 0; }
.hero .eyebrow.reveal { animation-delay: 0.05s; }
.hero h1.reveal { animation-delay: 0.12s; }
.hero .lede.reveal { animation-delay: 0.2s; }
.hero .hero-actions.reveal { animation-delay: 0.28s; }
.hero .hero-stats.reveal { animation-delay: 0.36s; }
.hero-visual.reveal { animation-delay: 0.2s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ================================================================
   5. HERO AMBIENT MOTION
   ================================================================ */
.floating-shape { animation: floatY 9s ease-in-out infinite; }
.shape-2 { animation-duration: 11s; animation-delay: -3s; }
.shape-3 { animation-duration: 7s; animation-delay: -1.5s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-24px); }
}

.plane-icon { animation: flyPath 14s linear infinite; }
@keyframes flyPath {
  0%   { offset-distance: 0%; opacity: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

.scroll-cue i { display: inline-block; animation: bounceDown 1.8s ease-in-out infinite; }
@keyframes bounceDown {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(6px); opacity: 1; }
}

/* ================================================================
   6. ORBIT SYSTEM MOTION
   ================================================================ */
.orbit-ring { animation: spinRing 46s linear infinite; }
@keyframes spinRing { to { transform: translate(-50%, -50%) rotate(360deg); } }

.hub-core { animation: hubFloat 5s ease-in-out infinite; }
@keyframes hubFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50%      { transform: translate(-50%, -50%) translateY(-8px); }
}

.orbit-node { animation: nodePulse 4.5s ease-in-out infinite; }
.orbit-node.node-travel { animation-delay: -1.1s; }
.orbit-node.node-visa { animation-delay: -2.2s; }
.orbit-node.node-realestate { animation-delay: -3.3s; }
@keyframes nodePulse {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50%      { box-shadow: var(--shadow-md); }
}

/* ================================================================
   7. TYPING EFFECT CURSOR BLINK
   ================================================================ */
.typing-cursor { animation: blinkCursor 1s step-end infinite; }
@keyframes blinkCursor { 50% { opacity: 0; } }

/* ================================================================
   8. FAB STACK ENTRANCE
   ================================================================ */
.fab { animation: fabIn 0.5s var(--ease) backwards; }
.fab-messenger { animation-delay: 0.06s; }
.fab-call { animation-delay: 0.12s; }
.fab-email { animation-delay: 0.18s; }
@keyframes fabIn {
  from { opacity: 0; transform: translateX(20px) scale(0.8); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ================================================================
   9. REDUCED MOTION — disable everything non-essential
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; animation: none; opacity: 1; transform: none; }
  .hero .reveal { animation: none; opacity: 1; }
  .floating-shape, .plane-icon, .scroll-cue i,
  .orbit-ring, .hub-core, .orbit-node, .typing-cursor,
  .preloader-mark, .preloader-bar span, .fab {
    animation: none !important;
  }
  .btn, .service-card, .feature-card, .pillar-card, .quote-card, .theme-toggle, .fab, .back-to-top {
    transition: none !important;
  }
}
