/* ==================================================================
   AI-First Engineering — scroll-driven section styles.

   Extracted from the source project's globals.css. These class-based
   reveal animations are required by Components/ai-first/ServicePage.jsx
   (.whychoose / .howwework / .ind-marquee / .eng-* / .hire-*). The class
   names are feature-specific and do not collide with the existing site.
   Loaded per-page (public/styles) by AiFirstStaticSSR and ServicePage, not
   globally from _app, so other pages do not ship it.
   ================================================================== */

/* ogl particle field container (Components/Particles.jsx) */
.particles-container {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------------------------
   Mobile responsiveness for the ported static pages (everything inside
   `.aifx`). Their shared hero type (e.g. `.particle-hero h1` =
   clamp(40px, 5.4vw, 66px)) has a 40px floor that overflows narrow
   phones, and the original head media queries only adjusted grid
   layouts — never the hero font sizes. These overrides are scoped to
   `.aifx`, so they never touch the rest of the Cloudastra site or the
   React hub / Fractional-CTO pages (which are not rendered inside
   `.aifx`).
   ------------------------------------------------------------------ */
/* clip (not hidden) so the scroll-pinned sticky sections keep working — see
   the note in aifx.css. */
.aifx {
  overflow-x: clip;
}
.aifx * {
  min-width: 0; /* let flex/grid children shrink instead of forcing overflow */
}

@media (max-width: 640px) {
  /* Tighter gutters so headings have more room */
  .aifx .wrap,
  .aifx .wrap-narrow {
    padding-left: 18px;
    padding-right: 18px;
  }
  /* Cap + wrap every heading so long words never push past the viewport */
  .aifx h1 {
    font-size: clamp(26px, 7.4vw, 40px) !important;
    line-height: 1.16;
    overflow-wrap: break-word;
    white-space: normal !important;
  }
  .aifx h2 {
    font-size: clamp(22px, 6.4vw, 34px) !important;
    line-height: 1.2;
    overflow-wrap: break-word;
  }
  .aifx h3 {
    overflow-wrap: break-word;
  }
  /* Hero CTAs: stack full-width and centered instead of clipping */
  .aifx .hero-ctas {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .aifx .hero-ctas .btn {
    width: 100%;
    justify-content: center;
  }
  /* Trim oversized hero top/bottom padding on small screens */
  .aifx .particle-hero,
  .aifx .audit-hero {
    padding-top: 132px;
    padding-bottom: 72px;
  }
}

/* "How we work" (service pages) — scroll-driven step reveal (N = 5).
   Driven by `--howwework-progress` written once per frame on the
   .howwework section. */
.howwework-card {
  --start: calc(var(--i, 0) * (0.6 / 5) + 0.06);
  --slot: clamp(
    0,
    calc((var(--howwework-progress, 0) - var(--start)) * (5 / 0.6)),
    1
  );
  opacity: var(--slot);
  transform: translate3d(0, calc((1 - var(--slot)) * 48px), 0);
  filter: blur(calc((1 - var(--slot)) * 6px));
  will-change: transform, opacity, filter;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.howwework-card:hover {
  box-shadow: 0 18px 40px -16px rgba(5, 139, 240, 0.28);
  border-color: rgba(5, 139, 240, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .howwework { min-height: auto !important; }
  .howwework-pin { position: relative !important; height: auto !important; overflow: visible !important; }
  .howwework-card { opacity: 1 !important; transform: none !important; filter: none !important; }
  .howwework-track { display: none !important; }
}
@media (max-width: 880px) {
  .howwework { min-height: auto !important; }
  .howwework-pin { position: relative !important; height: auto !important; overflow: visible !important; }
  .howwework-card { opacity: 1 !important; transform: none !important; filter: none !important; }
  .howwework-track { display: none !important; }
}

/* "Why Cloudastra" (service pages) — sequenced reveal on scroll-in (`.in`
   toggled on the .whychoose section). */
.whychoose .why-head {
  opacity: 0;
  transform: translate3d(0, 52px, 0);
  filter: blur(8px);
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity, filter;
}
.whychoose.in .why-head {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}

.whychoose .why-card {
  opacity: 0;
  transform: translate3d(0, 48px, 0);
  filter: blur(12px);
  transition-property: opacity, transform, filter, background-color, border-color;
  transition-duration: 0.7s, 0.7s, 0.7s, 0.3s, 0.3s;
  transition-timing-function:
    cubic-bezier(0.16, 1, 0.3, 1),
    cubic-bezier(0.16, 1, 0.3, 1),
    cubic-bezier(0.16, 1, 0.3, 1),
    ease,
    ease;
  will-change: transform, opacity, filter;
}
.whychoose.in .why-card {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}
.whychoose.in .why-card:nth-child(1) { transition-delay: 0.25s, 0.25s, 0.25s, 0s, 0s; }
.whychoose.in .why-card:nth-child(2) { transition-delay: 0.34s, 0.34s, 0.34s, 0s, 0s; }
.whychoose.in .why-card:nth-child(3) { transition-delay: 0.43s, 0.43s, 0.43s, 0s, 0s; }
.whychoose.in .why-card:nth-child(4) { transition-delay: 0.52s, 0.52s, 0.52s, 0s, 0s; }
.whychoose.in .why-card:nth-child(5) { transition-delay: 0.61s, 0.61s, 0.61s, 0s, 0s; }
.whychoose.in .why-card:nth-child(6) { transition-delay: 0.70s, 0.70s, 0.70s, 0s, 0s; }

.why-card:hover {
  border-color: rgba(5, 139, 240, 0.4);
}
.why-icon {
  transition: background-color 0.3s ease, color 0.3s ease;
}
.why-card:hover .why-icon {
  background-color: #058BF0;
  color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .whychoose .why-head,
  .whychoose .why-card {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* INDUSTRIES (service pages) — marquee of hover-glow cards. */
@property --edge-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 135deg;
}
.ind-marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.ind-track {
  display: flex;
  gap: 16px;
  width: max-content;
  padding: 14px 0 32px;
  animation: indMarquee 42s linear infinite;
}
.ind-marquee:hover .ind-track {
  animation-play-state: paused;
}
@keyframes indMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ind-item {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(10, 27, 58, 0.1);
  box-shadow: 0 1px 2px rgba(10, 27, 58, 0.06);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}
.ind-item .ii {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 139, 240, 0.1);
  color: #058BF0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.ind-item:hover .ii {
  transform: scale(1.1) rotate(-5deg);
}
.ind-item span {
  font-family: var(--font-poppins), system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #0a1b3a;
  white-space: nowrap;
}
.ind-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--edge-angle),
    transparent 0deg,
    #058BF0 70deg,
    #5BB8FF 130deg,
    rgba(5, 139, 240, 0.12) 205deg,
    transparent 300deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.ind-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 46px -22px rgba(5, 139, 240, 0.5);
}
.ind-item:hover::before {
  opacity: 1;
  animation: edgeSpin 2.2s linear infinite;
}
@keyframes edgeSpin {
  from { --edge-angle: 0deg; }
  to { --edge-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .ind-track { animation: none; }
  .ind-marquee { overflow-x: auto; }
}

/* EngineersBand (service pages) — pinned, scroll-scrubbed staged reveal. */
.eng-runway {
  min-height: 340vh;
}
.eng-stage {
  opacity: var(--rev, 0);
  filter: blur(calc((1 - var(--rev, 0)) * 16px));
  transform: translateY(calc((1 - var(--rev, 0)) * 30px));
  will-change: opacity, filter, transform;
}
.eng-runway.no-scrub {
  min-height: 0 !important;
}
.eng-runway.no-scrub .eng-pin {
  /* relative (not static) keeps it the containing block so its blur glow stays clipped */
  position: relative !important;
  min-height: 0 !important;
  padding-top: 5rem;
  padding-bottom: 5rem;
}
.eng-runway.no-scrub .eng-stage {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
}
@media (prefers-reduced-motion: reduce), (max-width: 900px) {
  .eng-runway { min-height: 0 !important; }
  .eng-pin {
    /* `relative` (not `static`) so the pin stays the containing block for its
       absolutely-positioned blur glow — otherwise the w-[840px] glow escapes the
       overflow-hidden clip on mobile and overflows the document horizontally. */
    position: relative !important;
    min-height: 0 !important;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
  .eng-stage {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}

/* HireDeveloper (service pages) — pinned, scroll-scrubbed scale-up. */
.hire-runway {
  min-height: 240vh;
}
@media (prefers-reduced-motion: reduce), (max-width: 900px) {
  .hire-runway { min-height: 0 !important; }
  .hire-pin {
    /* `relative` (not `static`) so the pin stays the containing block for its
       absolutely-positioned blur glow — otherwise the w-[840px] glow escapes the
       overflow-hidden clip on mobile and overflows the document horizontally. */
    position: relative !important;
    min-height: 0 !important;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
  .hire-card { transform: none !important; }
  .hire-rest { max-height: none !important; opacity: 1 !important; }
}
