/**
 * 3D motion — header + home hero
 */

/* ── Header entrance ── */
.motion-3d-header .site-header {
  opacity: 0;
  transform: translate3d(0, -100%, 0) rotateX(-12deg);
  transform-origin: top center;
}

.motion-3d-header.motion-3d-header-ready .site-header {
  animation: motion3dHeaderIn 1.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes motion3dHeaderIn {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg);
  }
}

.motion-3d-header-ready .site-header__bar {
  animation: motion3dHeaderBar 1.05s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

@keyframes motion3dHeaderBar {
  from {
    opacity: 0;
    transform: perspective(900px) rotateX(-8deg) translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.motion-3d-header-ready .site-header .site-logo-link {
  animation: motion3dFadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.28s both;
}

.motion-3d-header-ready .site-header__bar > ul > li,
.motion-3d-header-ready .site-header__bar > .lang-dropdown,
.motion-3d-header-ready .site-header__bar > .mobile-menu-btn {
  animation: motion3dFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.motion-3d-header-ready .site-header__bar > ul > li:nth-child(1) { animation-delay: 0.42s; }
.motion-3d-header-ready .site-header__bar > ul > li:nth-child(2) { animation-delay: 0.5s; }
.motion-3d-header-ready .site-header__bar > ul > li:nth-child(3) { animation-delay: 0.58s; }
.motion-3d-header-ready .site-header__bar > ul > li:nth-child(4) { animation-delay: 0.66s; }
.motion-3d-header-ready .site-header__bar > ul > li:nth-child(5) { animation-delay: 0.74s; }
.motion-3d-header-ready .site-header__bar > ul > li:nth-child(6) { animation-delay: 0.82s; }
.motion-3d-header-ready .site-header__bar > .lang-dropdown { animation-delay: 0.88s; }
.motion-3d-header-ready .site-header__bar > .mobile-menu-btn { animation-delay: 0.94s; }

@keyframes motion3dFadeUp {
  from {
    opacity: 0;
    transform: perspective(600px) rotateX(-12deg) translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Hero copy: staggered entrance (fill-mode both = hidden during delay) ── */
.page-home-enterprise.motion-3d.hero-motion-play .hero-meta {
  animation: motion3dHeroIn 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line {
  display: block;
  transform-origin: left center;
  animation: motion3dHeroIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(1) { animation-delay: 0.2s; }
.page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(2) { animation-delay: 0.34s; }
.page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(3) { animation-delay: 0.48s; }

.page-home-enterprise.motion-3d.hero-motion-play .hero-lead {
  animation: motion3dHeroIn 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-actions {
  animation: motion3dHeroIn 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-clients {
  animation: motion3dHeroIn 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.78s both;
}

@keyframes motion3dHeroIn {
  from {
    opacity: 0;
    transform: perspective(1000px) rotateX(10deg) translate3d(0, 1rem, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

[dir="rtl"] .page-home-enterprise.motion-3d .hero-headline__line {
  transform-origin: right center;
}

/* SOC dashboard — entrance then mouse tilt (legacy pages) */
.hero-3d-scene {
  perspective: 1200px;
  perspective-origin: 50% 45%;
}

.hero-3d-tilt {
  --hero-tilt-x: 0deg;
  --hero-tilt-y: 0deg;
  position: relative;
  width: min(100%, 21rem);
  margin-inline: auto;
  aspect-ratio: 1;
  overflow: visible;
  transform-style: preserve-3d;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-3d-tilt:not(.hero-3d-tilt--ready) {
  animation: motion3dSocIn 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both;
}

@keyframes motion3dSocIn {
  from {
    opacity: 0;
    transform: perspective(1100px) rotateY(-10deg) rotateX(8deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: perspective(1100px) rotateX(0deg) rotateY(0deg) scale(1);
  }
}

.page-home-enterprise.motion-3d .hero-3d-tilt.hero-3d-tilt--ready {
  animation: none;
  opacity: 1;
  transform: perspective(1100px) rotateX(var(--hero-tilt-x)) rotateY(var(--hero-tilt-y)) scale(1);
  transition: transform 0.14s ease-out;
  will-change: transform;
}

.page-home-enterprise.motion-3d .hero-visual__stage.hero-3d-tilt {
  opacity: 1;
}

.page-home-enterprise.motion-3d .hero-3d-tilt .hero-visual__frame {
  transform: translateY(-50%);
}

.page-home-enterprise.motion-3d .hero-visual__stage.hero-3d-tilt {
  transition: none;
}

/* Ambient (legacy orbs — hidden when hero-section--cyber-bg) */
.page-home-enterprise.motion-3d .hero-section__orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.page-home-enterprise.motion-3d .hero-section__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.3;
  animation: motion3dOrbFloat 22s ease-in-out infinite;
}

.page-home-enterprise.motion-3d .hero-section__orb--1 {
  width: min(40vw, 22rem);
  height: min(40vw, 22rem);
  top: 10%;
  left: 5%;
  background: rgba(219, 9, 77, 0.32);
}

.page-home-enterprise.motion-3d .hero-section__orb--2 {
  width: min(35vw, 18rem);
  height: min(35vw, 18rem);
  bottom: 15%;
  right: 8%;
  background: rgba(219, 9, 77, 0.18);
  animation-delay: -6s;
}

@keyframes motion3dOrbFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(2%, -2%, 0); }
}

.page-home-enterprise.motion-3d .hero-section:not(.hero-section--hero-image) .hero-section__canvas {
  animation: motion3dGridDrift 28s ease-in-out infinite alternate;
}

@keyframes motion3dGridDrift {
  to { opacity: 0.9; }
}

.page-home-enterprise.motion-3d .hero-container {
  position: relative;
  z-index: 1;
}

.page-home-enterprise.motion-3d .hero-visual--soc {
  position: relative;
  z-index: 1;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-scroll-hint {
  animation: motion3dHeroFade 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.78s both;
}

.page-home-enterprise.motion-3d.hero-motion-play .hero-scroll-hint__icon {
  animation: motion3dScrollBob 3.5s ease-in-out 1.8s infinite;
}

@keyframes motion3dHeroFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes motion3dScrollBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@media (max-width: 767px) {
  .page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(1) { animation-delay: 0.1s; }
  .page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(2) { animation-delay: 0.16s; }
  .page-home-enterprise.motion-3d.hero-motion-play .hero-headline__line:nth-child(3) { animation-delay: 0.22s; }

  .page-home-enterprise.motion-3d.hero-motion-play .hero-lead {
    animation-delay: 0.28s;
  }

  .page-home-enterprise.motion-3d.hero-motion-play .hero-actions {
    animation-delay: 0.34s;
  }

  .page-home-enterprise.motion-3d.hero-motion-play .hero-3d-tilt:not(.hero-3d-tilt--ready) {
    animation-delay: 0.1s;
  }

  .page-home-enterprise.motion-3d .hero-aside .hero-3d-scene .hero-visual__stage,
  .page-home-enterprise.motion-3d .hero-aside .hero-3d-scene .hero-3d-tilt {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .page-home-enterprise.motion-3d .hero-aside .hero-3d-scene .hero-visual__frame,
  .page-home-enterprise.motion-3d .hero-3d-tilt .hero-visual__frame {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    inset-inline: auto;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-3d-header .site-header,
  .motion-3d-header.motion-3d-header-ready .site-header,
  .page-home-enterprise.motion-3d .hero-meta,
  .page-home-enterprise.motion-3d .hero-headline__line,
  .page-home-enterprise.motion-3d .hero-lead,
  .page-home-enterprise.motion-3d .hero-actions,
  .page-home-enterprise.motion-3d .hero-3d-tilt,
  .page-home-enterprise.motion-3d .hero-section__canvas,
  .page-home-enterprise.motion-3d .hero-section__orb,
  .page-home-enterprise.motion-3d .hero-scroll-hint,
  .page-home-enterprise.motion-3d .hero-clients {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero-3d-tilt {
    --hero-tilt-x: 0deg;
    --hero-tilt-y: 0deg;
  }
}
