/* ==========================================================================
   LOFA CODE — Interactions & Motion

   New, purely additive interaction/motion layer: scroll progress, hero
   entrance choreography, text reveal, card-group stagger, touch feedback,
   pointer glow (desktop only), sticky mobile CTA, premium mobile-nav
   motion. Kept separate from style.css/responsive.css (design system +
   layout/breakpoints) because it is a distinct concern — pure animation
   and micro-interaction, none of it changes layout or color.

   Every effect here degrades safely: without JS the page is fully usable,
   and @media (prefers-reduced-motion: reduce) at the bottom neutralizes
   all motion added in this file.
   ========================================================================== */

/* ==========================================================================
   Scroll progress bar
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 1100;
  background: transparent;
  pointer-events: none;
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-deep), var(--blue-bright));
  transform-origin: left;
  transition: width 80ms linear;
}

/* ==========================================================================
   Hero entrance choreography (above-the-fold, so it runs on load rather
   than waiting on IntersectionObserver — the hero is already in view)
   ========================================================================== */

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

@keyframes heroVisualIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.hero-eyebrow,
.hero-title,
.hero-subtitle,
.hero-ctas {
  animation: heroRise 600ms var(--ease) both;
}

.hero-eyebrow  { animation-delay: 0ms; }
.hero-title    { animation-delay: 80ms; }
.hero-subtitle { animation-delay: 160ms; }
.hero-ctas     { animation-delay: 240ms; }

.hero-visual {
  animation: heroVisualIn 700ms var(--ease) 200ms both;
}

/* Text reveal: overflow-hidden mask with an inner span that slides up.
   Applied selectively (hero-title only) via a small markup wrapper —
   not used on every heading. */

.text-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.text-reveal__inner {
  display: inline-block;
  transform: translateY(105%);
  animation: textReveal 650ms var(--ease) 120ms both;
}

@keyframes textReveal {
  to { transform: translateY(0); }
}

/* ==========================================================================
   Scroll-reveal stagger for card groups
   Builds on the existing [data-reveal] IntersectionObserver system in
   main.js — this only adds a per-item transition-delay so groups of
   cards settle in with a subtle cascade instead of arriving as one block.
   ========================================================================== */

.services-bar .service-col:nth-child(1)   { transition-delay: 0ms; }
.services-bar .service-col:nth-child(2)   { transition-delay: 70ms; }
.services-bar .service-col:nth-child(3)   { transition-delay: 140ms; }
.services-bar .service-col:nth-child(4)   { transition-delay: 210ms; }

.solutions-grid .solution-card:nth-child(1) { transition-delay: 0ms; }
.solutions-grid .solution-card:nth-child(2) { transition-delay: 70ms; }
.solutions-grid .solution-card:nth-child(3) { transition-delay: 140ms; }
.solutions-grid .solution-card:nth-child(4) { transition-delay: 210ms; }

.capability-grid .capability-card:nth-child(n)   { transition-delay: 0ms; }
.capability-grid .capability-card:nth-child(4n+2) { transition-delay: 60ms; }
.capability-grid .capability-card:nth-child(4n+3) { transition-delay: 120ms; }
.capability-grid .capability-card:nth-child(4n+4) { transition-delay: 180ms; }

.industries-strip .industry-item:nth-child(n)      { transition-delay: 0ms; }
.industries-strip .industry-item:nth-child(7n+2)   { transition-delay: 40ms; }
.industries-strip .industry-item:nth-child(7n+3)   { transition-delay: 80ms; }
.industries-strip .industry-item:nth-child(7n+4)   { transition-delay: 120ms; }
.industries-strip .industry-item:nth-child(7n+5)   { transition-delay: 160ms; }
.industries-strip .industry-item:nth-child(7n+6)   { transition-delay: 200ms; }
.industries-strip .industry-item:nth-child(7n+7)   { transition-delay: 240ms; }

.industry-detail-grid .industry-detail-card:nth-child(odd)  { transition-delay: 0ms; }
.industry-detail-grid .industry-detail-card:nth-child(even) { transition-delay: 80ms; }

/* ==========================================================================
   Touch feedback (touch devices only — desktop keeps its existing
   :hover elevation/glow effects, defined in style.css, untouched)
   ========================================================================== */

@media (hover: none) {
  .solution-card:active,
  .capability-card:active,
  .industry-detail-card:active,
  .industry-item:active,
  .card:active,
  .service-col:active {
    transform: scale(0.985);
    border-color: var(--border-blue);
    transition: transform 120ms var(--ease), border-color 120ms var(--ease);
  }

  .btn:active {
    transform: scale(0.98);
  }

  .btn-primary:active {
    box-shadow: 0 4px 14px -6px rgba(38, 132, 255, 0.6);
  }

  .btn-secondary:active {
    border-color: var(--border-blue);
    background: rgba(38, 132, 255, 0.08);
  }

  .link-arrow:active svg {
    transform: translateX(2px);
  }
}

/* ==========================================================================
   Pointer glow — fine-pointer desktop devices only. --mouse-x/--mouse-y
   are set by initPointerGlow() in interactions.js; on touch devices (or
   if JS never runs) the gradient simply never appears, no layout impact.
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  .solution-card,
  .capability-card {
    position: relative;
    isolation: isolate;
  }

  .solution-card::after,
  .capability-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
      280px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(38, 132, 255, 0.10),
      transparent 55%
    );
    opacity: 0;
    transition: opacity 300ms var(--ease);
    pointer-events: none;
    z-index: 0;
  }

  .solution-card:hover::after,
  .capability-card:hover::after {
    opacity: 1;
  }

  .solution-card > *,
  .capability-card > * {
    position: relative;
    z-index: 1;
  }

  /* Magnetic primary CTAs: initMagneticButtons() applies a tiny
     translate via inline transform; this just gives it a smooth
     settle so it doesn't feel like an abrupt DOM update. */
  .hero-ctas .btn-primary,
  .cta-panel .btn-primary {
    transition: transform 200ms var(--ease), box-shadow var(--t-fast), background var(--t-fast);
  }
}

/* ==========================================================================
   Premium mobile navigation motion
   ========================================================================== */

.mobile-nav::before {
  content: "";
  position: absolute;
  top: -10%;
  right: -20%;
  width: 70%;
  height: 40%;
  background: var(--grad-radial-glow);
  pointer-events: none;
  opacity: 0.7;
}

.mobile-nav ul li {
  opacity: 0;
  transform: translateY(10px);
}

.mobile-nav.is-open ul li {
  animation: navItemIn 420ms var(--ease) both;
}

.mobile-nav.is-open ul li:nth-child(1) { animation-delay: 60ms; }
.mobile-nav.is-open ul li:nth-child(2) { animation-delay: 100ms; }
.mobile-nav.is-open ul li:nth-child(3) { animation-delay: 140ms; }
.mobile-nav.is-open ul li:nth-child(4) { animation-delay: 180ms; }
.mobile-nav.is-open ul li:nth-child(5) { animation-delay: 220ms; }
.mobile-nav.is-open ul li:nth-child(6) { animation-delay: 260ms; }
.mobile-nav.is-open ul li:nth-child(7) { animation-delay: 300ms; }

@keyframes navItemIn {
  to { opacity: 1; transform: translateY(0); }
}

.nav-toggle svg { transition: transform var(--t-fast); }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

/* ==========================================================================
   Sticky mobile CTA — mobile only, appears after the hero, hides near
   the footer. Visibility fully controlled by initStickyMobileCTA().
   ========================================================================== */

.sticky-mobile-cta {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 20px;
  min-height: 48px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-blue);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(38, 132, 255, 0.08) inset;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
  pointer-events: none;
}

.sticky-mobile-cta svg {
  width: 16px;
  height: 16px;
  color: var(--blue-bright);
  transition: transform var(--t-fast);
}

.sticky-mobile-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sticky-mobile-cta:active {
  transform: scale(0.98);
}

.sticky-mobile-cta:active svg {
  transform: translateX(2px);
}

@media (min-width: 481px) {
  .sticky-mobile-cta { display: none !important; }
}

@media (max-width: 480px) {
  .sticky-mobile-cta { display: flex; }
}

/* ==========================================================================
   Reduced motion — disables everything added in this file
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow,
  .hero-title,
  .hero-subtitle,
  .hero-ctas,
  .hero-visual,
  .text-reveal__inner,
  .mobile-nav.is-open ul li {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-progress__bar { transition: none; }

  .solution-card::after,
  .capability-card::after {
    display: none;
  }

  .hero-ctas .btn-primary,
  .cta-panel .btn-primary {
    transition: box-shadow var(--t-fast), background var(--t-fast);
  }

  .sticky-mobile-cta {
    transition: opacity 1ms linear;
  }

  [data-reveal] {
    transition-delay: 0ms !important;
  }
}
