/* ============================================================
   MOTION - Animations, transitions, micro-interactions
   ============================================================ */

/* --- Scroll reveal base --- */

[data-reveal],
.reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity .75s cubic-bezier(.2,.8,.2,1),
    transform .75s cubic-bezier(.2,.8,.2,1);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal="fade-left"] {
  transform: translate3d(32px, 0, 0);
}

[data-reveal="fade-right"] {
  transform: translate3d(-32px, 0, 0);
}

[data-reveal="scale"] {
  transform: scale(.96);
}

[data-reveal].is-visible,
.reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* --- Hero page-load orchestration --- */

.hero-brand-text {
  animation: fadeDown .52s var(--ease-out) both;
}

.hero-title-mist::before {
  content: none;
}

.hero-visual::after {
  animation: blueprintIn 1.1s var(--ease-out) .72s both;
}

/* Hero text slide directions — override the default reveal transform */
.hero .hero-title-word[data-reveal] {
  transform: translate3d(0, -48px, 0);
}

.hero .hero-subtitle[data-reveal] {
  transform: translate3d(0, 48px, 0);
}

.hero .hero-title-word[data-reveal].is-visible,
.hero .hero-subtitle[data-reveal].is-visible {
  transform: translate3d(0, 0, 0);
}

/* --- Sidebar entrance and progress rail --- */

.sidebar {
  animation: sidebarIn .5s var(--ease-out) both;
}

.sidebar-active-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 42px;
  border-radius: 0 999px 999px 0;
  background: var(--grad);
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition: transform .34s var(--ease-out), opacity .24s var(--ease-out), height .24s var(--ease-out);
  pointer-events: none;
}

.sidebar:has(.sidebar-link.is-active) .sidebar-active-indicator {
  opacity: 1;
}

.sidebar-nav li:nth-child(1) .sidebar-link { animation: navItemIn .38s var(--ease-out) .12s both; }
.sidebar-nav li:nth-child(2) .sidebar-link { animation: navItemIn .38s var(--ease-out) .18s both; }
.sidebar-nav li:nth-child(3) .sidebar-link { animation: navItemIn .38s var(--ease-out) .24s both; }
.sidebar-nav li:nth-child(4) .sidebar-link { animation: navItemIn .38s var(--ease-out) .30s both; }
.sidebar-nav li:nth-child(5) .sidebar-link { animation: navItemIn .38s var(--ease-out) .36s both; }
.sidebar-nav li:nth-child(6) .sidebar-link { animation: navItemIn .38s var(--ease-out) .42s both; }
.sidebar-nav li:nth-child(7) .sidebar-link { animation: navItemIn .38s var(--ease-out) .48s both; }
.sidebar-nav li:nth-child(8) .sidebar-link { animation: navItemIn .38s var(--ease-out) .54s both; }
.sidebar-nav li:nth-child(9) .sidebar-link { animation: navItemIn .38s var(--ease-out) .60s both; }

.sidebar-link:hover .nav-icon::before,
.sidebar-link.is-active .nav-icon::before {
  filter: none drop-shadow(0 0 10px rgba(0,252,146,.35));
  transform: scale(1.06);
}

/* --- Specialty card transition --- */

.specialty-card {
  transition: opacity .24s var(--ease-out), transform .24s var(--ease-out);
}

.specialty-card.is-switching {
  opacity: .35;
  transform: translateY(6px);
}

/* --- Approach / timeline --- */

.timeline-step {
  opacity: .45;
  transform: translateY(8px);
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}

.approach.is-active .timeline-step,
.timeline-step.is-active {
  opacity: 1;
  transform: translateY(0);
}

.approach.is-active .timeline-step:nth-child(2) { transition-delay: .08s; }
.approach.is-active .timeline-step:nth-child(3) { transition-delay: .16s; }
.approach.is-active .timeline-step:nth-child(4) { transition-delay: .24s; }
.approach.is-active .timeline-step:nth-child(5) { transition-delay: .32s; }

.timeline-number {
  transition: background .28s var(--ease-out), color .28s var(--ease-out), box-shadow .28s var(--ease-out), transform .28s var(--ease-out);
}

.timeline-step.is-active .timeline-number,
.approach.is-active .timeline-step:hover .timeline-number {
  background: var(--grad-soft);
  box-shadow: 0 0 0 7px rgba(0,252,146,.12);
  transform: translateY(-2px);
}

.approach-illustration {
  opacity: 0;
  transform: translateX(18px);
  transition: opacity .65s var(--ease-out) .1s, transform .65s var(--ease-out) .1s;
}

.approach.is-active .approach-illustration {
  opacity: .76;
  transform: translateX(0);
}

.approach.is-active .approach-illustration img {
  animation: floatY 6s ease-in-out .5s infinite;
}

/* --- Cards and images --- */

.area-item {
  transition: opacity .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1), background .22s var(--ease-out), border-color .22s var(--ease-out);
  cursor: default;
}

.area-item:hover {
  background: rgba(0, 252, 146, .07);
  transform: translateY(-3px);
}

.area-item img,
.service-card img {
  transition: opacity .22s var(--ease-out), transform .22s var(--ease-out), filter .22s var(--ease-out);
}

.area-item:hover img,
.service-card:hover img {
  opacity: 1;
  transform: translateY(-2px) scale(1.03);
  filter: drop-shadow(0 8px 12px rgba(0,162,254,.12));
}

.service-card {
  transition: opacity .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1), background .22s var(--ease-out), box-shadow .22s var(--ease-out), border-color .22s var(--ease-out);
}

.service-card:hover {
  background: rgba(0, 252, 146, .05);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(3,23,56,.07);
}

.project-card {
  transition: opacity .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1), box-shadow .24s var(--ease-out), border-color .24s var(--ease-out);
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0,162,254,.26);
  box-shadow: 0 20px 50px rgba(3,23,56,.09);
}

.project-card:hover .project-media img {
  transform: scale(1.03);
}

.project-media img {
  transition: transform .55s var(--ease-out);
}

.project-body h3 {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size .28s var(--ease-out);
}

.project-card:hover .project-body h3 {
  background-size: 100% 1px;
}

.job-card {
  transition: opacity .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1), border-color .22s var(--ease-out), box-shadow .22s var(--ease-out);
}

/* --- Form and button micro-interactions --- */

.form-tab-labels label {
  transition: color .22s var(--ease-out), background .22s var(--ease-out), border-color .22s var(--ease-out);
}

.btn .arrow,
.link-arrow .arrow {
  display: inline-block;
  transition: transform .24s var(--ease-out);
}

.btn:hover .arrow,
.link-arrow:hover .arrow,
.project-card:hover .arrow,
.service-card:hover .arrow,
.job-card:hover .arrow {
  transform: translateX(5px);
}

/* --- Ambient illustration motion --- */

.sidebar-blueprint {
  animation: floatY 7s ease-in-out infinite;
}

.site-footer::after {
  animation: breathe 10s ease-in-out infinite;
}

.contact-info::after {
  animation: floatY 8s ease-in-out 1s infinite;
}

/* --- Optional scroll snap --- */

@media (min-width: 1024px) {
  html:has(body.enable-scroll-snap) {
    scroll-snap-type: y proximity;
  }

  body.enable-scroll-snap .main {
    scroll-snap-type: y proximity;
  }

  body.enable-scroll-snap section[data-snap] {
    scroll-snap-align: start;
    scroll-margin-top: 0;
  }
}

/* --- Final CTA shimmer --- */

.final-cta .section-inner::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.24) 46%, transparent 58%);
  content: "";
  opacity: .28;
  transform: translateX(-100%);
  animation: energySweep 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes imageFade {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes heroImageMagnify {
  0%   { opacity: 0; transform: scale(1); }
  18%  { opacity: 1; }
  52%  { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes letterMistIn {
  0% {
    opacity: 0;
    filter: blur(14px);
    transform: translate3d(0, .72em, 0) scale(1.06);
  }
  64% {
    opacity: 1;
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes mistSweep {
  0% {
    opacity: 0;
    transform: translateX(-34%) scaleX(.72);
  }
  18% {
    opacity: .7;
  }
  64% {
    opacity: .48;
  }
  100% {
    opacity: 0;
    transform: translateX(34%) scaleX(1.08);
  }
}

@keyframes blueprintIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: .42; transform: translateY(0) scale(1); }
}

@keyframes dotPulse {
  0%   { opacity: 0; transform: translateY(.08em) scale(.45); }
  70%  { opacity: 1; transform: translateY(.08em) scale(1.18); }
  100% { opacity: 1; transform: translateY(.08em) scale(1); }
}

@keyframes sidebarIn {
  from { opacity: 0; transform: translateX(-100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes navItemIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes metricPop {
  0%   { opacity: 0; transform: scale(.84) translateY(6px); }
  65%  { transform: scale(1.06) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-9px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .13; }
  50%       { transform: scale(1.04); opacity: .19; }
}

@keyframes buttonRipple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(24);
  }
}

@keyframes feedbackIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes energySweep {
  0%, 72% { transform: translateX(-100%); }
  100%   { transform: translateX(100%); }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }

  [data-reveal],
  .reveal,
  .mist-letter,
  .hero-title-dot,
  .hero .hero-title-word[data-reveal],
  .hero .hero-subtitle[data-reveal],
  .timeline-step,
  .approach-illustration {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }

  .main,
  html:has(body.enable-scroll-snap) {
    scroll-snap-type: none !important;
  }
}
