/* ═══════════════════════════════════════════════════════════════════════════
   MIAR International — Animation System
   animations.css — Scroll reveal, micro-interactions, keyframes
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Scroll Reveal Base ────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transition: opacity var(--transition-reveal),
              transform var(--transition-reveal);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none !important;
}

/* Fade Up */
.fade-up {
  transform: translateY(32px);
}

/* Fade In */
.fade-in {
  transform: none;
}

/* Scale In */
.scale-in {
  transform: scale(0.94);
}

/* Slide Left (comes from right) */
.slide-left {
  transform: translateX(40px);
}

/* Slide Right (comes from left) */
.slide-right {
  transform: translateX(-40px);
}

/* Clip Wipe (for images) */
.clip-wipe {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.9s cubic-bezier(0.77, 0, 0.175, 1);
  opacity: 1;
}

.clip-wipe.is-visible {
  clip-path: inset(0 0% 0 0);
}

/* ── Stagger Children ──────────────────────────────────────────────────── */
.stagger-children > .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-children > .reveal:nth-child(2) { transition-delay: 80ms; }
.stagger-children > .reveal:nth-child(3) { transition-delay: 160ms; }
.stagger-children > .reveal:nth-child(4) { transition-delay: 240ms; }
.stagger-children > .reveal:nth-child(5) { transition-delay: 320ms; }
.stagger-children > .reveal:nth-child(6) { transition-delay: 400ms; }

/* Fast stagger (for many items) */
.stagger-fast > .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-fast > .reveal:nth-child(2) { transition-delay: 60ms; }
.stagger-fast > .reveal:nth-child(3) { transition-delay: 120ms; }
.stagger-fast > .reveal:nth-child(4) { transition-delay: 180ms; }
.stagger-fast > .reveal:nth-child(5) { transition-delay: 240ms; }
.stagger-fast > .reveal:nth-child(6) { transition-delay: 300ms; }
.stagger-fast > .reveal:nth-child(7) { transition-delay: 360ms; }
.stagger-fast > .reveal:nth-child(8) { transition-delay: 420ms; }

/* ── Hero Word Reveal ──────────────────────────────────────────────────── */
.word-reveal .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.word-reveal.is-visible .word:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(2) { transition-delay: 150ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(3) { transition-delay: 300ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(4) { transition-delay: 450ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(5) { transition-delay: 600ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(6) { transition-delay: 750ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(7) { transition-delay: 900ms; opacity: 1; transform: none; }
.word-reveal.is-visible .word:nth-child(8) { transition-delay: 1050ms; opacity: 1; transform: none; }

/* ── Character Reveal (About hero) ─────────────────────────────────────── */
.char-reveal .char {
  display: inline-block;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.char-reveal.is-visible .char {
  opacity: 1;
}

/* Delays set via JS: style="transition-delay: Xms" */

/* ── Connecting Line Animation (How We Work) ───────────────────────────── */
.process-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.2s ease-out;
}

.process-line.is-visible {
  stroke-dashoffset: 0;
}

/* ── Step Pop-In ───────────────────────────────────────────────────────── */
.step-pop {
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-pop.is-visible {
  transform: scale(1);
}

/* ── SVG Line Draw (Org Chart) ─────────────────────────────────────────── */
.line-draw {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 0.8s ease-out;
}

.line-draw.is-visible {
  stroke-dashoffset: 0;
}

.org-child-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.org-chart.is-visible .org-child-reveal {
  opacity: 1;
  transform: none;
}

/* Each child fades in after its parent section triggers, staggered by index */
.org-children > div:nth-child(1) .org-child-reveal { transition-delay: 0.5s; }
.org-children > div:nth-child(2) .org-child-reveal { transition-delay: 0.8s; }
.org-children > div:nth-child(3) .org-child-reveal { transition-delay: 1.1s; }

/* ── Micro-Interactions ────────────────────────────────────────────────── */

/* Button hover lift */
.btn {
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast);
}

/* Card hover — already in main.css, but enforce transition */
.card,
.card-dark,
.card-image {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

/* Nav link underline slide — already in main.css */

/* Form input focus gold border — already in main.css */

/* Footer social icon scale — already in main.css */

/* ── Parallax (controlled via JS) ──────────────────────────────────────── */
.parallax-bg {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* For JS-driven parallax */
[data-parallax] {
  will-change: transform;
}

/* ── Animated Dot Grid Background ──────────────────────────────────────── */
.dot-grid-bg {
  position: relative;
}

.dot-grid-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(201, 168, 76, 0.12) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: dot-drift 15s linear infinite;
  pointer-events: none;
}

@keyframes dot-drift {
  0% { background-position: 0 0; }
  100% { background-position: 30px 30px; }
}

/* ── Map Fade-In ───────────────────────────────────────────────────────── */
.map-reveal {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.map-reveal.is-visible {
  opacity: 1;
}

/* ── Loading Skeleton ──────────────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--off-white) 0%, var(--light-gray) 40%, var(--off-white) 80%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Page Transition (optional) ────────────────────────────────────────── */
body {
  animation: page-in 0.4s ease-out;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Accessibility: Respect Reduced Motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none !important;
  }

  .clip-wipe {
    clip-path: none;
  }

  .word-reveal .word,
  .char-reveal .char {
    opacity: 1;
    transform: none;
  }

  .floating-card {
    animation: none;
  }

  .marquee-track {
    animation: none;
  }

  .marquee-item {
    animation: none;
  }

  .org-parent {
    animation: none;
  }
}

/* ── Mobile: disable horizontal slide animations to prevent overflow ─────── */
@media (max-width: 992px) {
  /* Replace side-slide reveals with simple fade-up — no horizontal bleed */
  .slide-left,
  .slide-right {
    transform: translateY(24px) !important;
  }

  /* Marquee: stop animation on small screens, just show items inline */
  .marquee-track {
    animation: none;
    flex-wrap: wrap;
    width: 100%;
    gap: 12px;
    justify-content: flex-start;
  }

  .marquee-item {
    animation: none;
  }
}
