/**
 * CTA card FX: particles canvas + irregular grid lines + shimmer.
 * Variants: .cta-card--fx-team, .cta-card--fx-ai (landing/about/ai); .cta-card--fx (marketing).
 * Grid geometry: JS sets --cta-grid-* per card (marketing-cta-card-fx.js); data-cta-grid="fixed" keeps CSS fallbacks only.
 * Copy: headline uses normal wrapping; optional <br>; .cta-heading-nowrap for phrases that must stay on one line.
 */

/* WP landing template: match marketing-style section + card when FX card is present */
.il-landing .cta-section:has(.cta-card--fx-team) {
  background: var(--white);
}
.il-landing .cta-card.cta-card--fx-team {
  border: none;
  background: linear-gradient(180deg, #324764 0%, #0a0a0a 100%);
  overflow: hidden;
}

/* ---------- Shared layers ---------- */
.cta-card.cta-card--fx-team,
.cta-card.cta-card--fx-ai,
.cta-card.cta-card--fx {
  position: relative;
  isolation: isolate;
}

/* Grain (subtle film noise) — shared CTA card layer */
.cta-card.cta-card--fx-team::after,
.cta-card.cta-card--fx-ai::after,
.cta-card.cta-card--fx::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3; /* above lines/particles, below text */
  /* Fallback only. AI-hero style grain is injected as a canvas by marketing-cta-card-fx.js. */
  opacity: 0.08;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  background-repeat: repeat;
  filter: none;
  transform: translateZ(0);
  animation: none;
}

.cta-card.cta-card--fx-team:hover::after,
.cta-card.cta-card--fx-ai:hover::after,
.cta-card.cta-card--fx:hover::after {
  opacity: 0.12;
}

/* AI hero style grain canvas */
.cta-card .cta-card__grain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2; /* above lines (1), below text (4) */
  /* Match AI hero feel: plain white noise on dark background */
  mix-blend-mode: normal;
  opacity: 0.34;
  filter: contrast(135%) brightness(108%);
}
@media (prefers-reduced-motion: reduce) {
  .cta-card .cta-card__grain-canvas { display: none; }
}

.cta-card.cta-card--fx-team > .cta-heading,
.cta-card.cta-card--fx-team > .cta-sub,
.cta-card.cta-card--fx-team > .btn,
.cta-card.cta-card--fx-ai > .cta-heading,
.cta-card.cta-card--fx-ai > .cta-sub,
.cta-card.cta-card--fx-ai > .btn,
.cta-card.cta-card--fx > .cta-heading,
.cta-card.cta-card--fx > .cta-sub,
.cta-card.cta-card--fx > .btn {
  position: relative;
  z-index: 4;
}

.cta-card.cta-card--fx-team .cta-card__particles,
.cta-card.cta-card--fx-ai .cta-card__particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.48;
}

.cta-card.cta-card--fx-team .cta-card__particles--reduced,
.cta-card.cta-card--fx-ai .cta-card__particles--reduced {
  opacity: 0;
  visibility: hidden;
}

.cta-card.cta-card--fx-team .cta-card__accent-lines,
.cta-card.cta-card--fx-ai .cta-card__accent-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
}

.cta-card.cta-card--fx-team .cta-card__hline,
.cta-card.cta-card--fx-team .cta-card__vline,
.cta-card.cta-card--fx-ai .cta-card__hline,
.cta-card.cta-card--fx-ai .cta-card__vline {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  will-change: transform, opacity;
}

.cta-card.cta-card--fx-team .cta-card__hline,
.cta-card.cta-card--fx-ai .cta-card__hline {
  height: 1px;
  left: 0;
  right: 0;
  transform: scaleX(0);
  transform-origin: 50% 50%;
  opacity: 0;
  animation: none;
}

.cta-card.cta-card--fx-team .cta-card__vline,
.cta-card.cta-card--fx-ai .cta-card__vline {
  width: 1px;
  top: 0;
  bottom: 0;
  transform: scaleY(0);
  transform-origin: 50% 0%;
  opacity: 0;
  animation: none;
}

.cta-card.cta-card--fx-team .cta-card__hline::after,
.cta-card.cta-card--fx-team .cta-card__vline::after,
.cta-card.cta-card--fx-ai .cta-card__hline::after,
.cta-card.cta-card--fx-ai .cta-card__vline::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: none;
}

.cta-card.cta-card--fx-team .cta-card__hline::after,
.cta-card.cta-card--fx-ai .cta-card__hline::after {
  background: linear-gradient(90deg, transparent, rgba(250, 250, 250, 0.18), transparent);
}

.cta-card.cta-card--fx-team .cta-card__vline::after,
.cta-card.cta-card--fx-ai .cta-card__vline::after {
  background: linear-gradient(180deg, transparent, rgba(250, 250, 250, 0.14), transparent);
}

.cta-card.cta-card--fx-team > .cta-heading,
.cta-card.cta-card--fx-team > .cta-sub,
.cta-card.cta-card--fx-team > .btn,
.cta-card.cta-card--fx-ai > .cta-heading,
.cta-card.cta-card--fx-ai > .cta-sub,
.cta-card.cta-card--fx-ai > .btn {
  position: relative;
  z-index: 2;
}

/*
 * Master CTA — grid: marketing-cta-card-fx.js sets --cta-grid-* per .cta-card (use data-cta-grid="fixed" to keep CSS fallbacks only).
 * Copy: wrap naturally; optional <br> for forced breaks; .cta-heading-nowrap keeps one phrase unbroken.
 */
.cta-card.cta-card--fx-team > .cta-heading,
.cta-card.cta-card--fx-ai > .cta-heading {
  white-space: normal;
}

/* Irregular grid — shared .cta-card--fx-team / .cta-card--fx-ai (fallbacks match legacy team layout) */
.cta-card.cta-card--fx-team .cta-card__hline:nth-child(1),
.cta-card.cta-card--fx-ai .cta-card__hline:nth-child(1) {
  top: var(--cta-grid-h1, 18%);
  transform-origin: var(--cta-grid-h1-ox, 96%) 50%;
}
.cta-card.cta-card--fx-team .cta-card__hline:nth-child(2),
.cta-card.cta-card--fx-ai .cta-card__hline:nth-child(2) {
  top: var(--cta-grid-h2, 42%);
  transform-origin: var(--cta-grid-h2-ox, 9%) 50%;
}
.cta-card.cta-card--fx-team .cta-card__hline:nth-child(3),
.cta-card.cta-card--fx-ai .cta-card__hline:nth-child(3) {
  top: var(--cta-grid-h3, 69%);
  transform-origin: var(--cta-grid-h3-ox, 64%) 50%;
}
.cta-card.cta-card--fx-team .cta-card__vline:nth-child(4),
.cta-card.cta-card--fx-ai .cta-card__vline:nth-child(4) {
  left: var(--cta-grid-v1, 11%);
  transform-origin: 50% var(--cta-grid-v1-anchor, 0%);
}
.cta-card.cta-card--fx-team .cta-card__vline:nth-child(5),
.cta-card.cta-card--fx-ai .cta-card__vline:nth-child(5) {
  left: var(--cta-grid-v2, 46%);
  transform-origin: 50% var(--cta-grid-v2-anchor, 100%);
}
.cta-card.cta-card--fx-team .cta-card__vline:nth-child(6),
.cta-card.cta-card--fx-ai .cta-card__vline:nth-child(6) {
  left: var(--cta-grid-v3, 86%);
  transform-origin: 50% var(--cta-grid-v3-anchor, 0%);
}
.cta-card.cta-card--fx-team .cta-card__hline--faint,
.cta-card.cta-card--fx-ai .cta-card__hline--faint {
  top: var(--cta-grid-faint-top, 54%);
  transform-origin: var(--cta-grid-faint-ox, 4%) 50%;
  background: rgba(255, 255, 255, 0.06);
  transform: scaleX(0);
  opacity: 0;
  animation: none;
}

.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline {
  animation: marketingCtaDrawX 800ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(1),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(1) {
  animation: marketingCtaDrawX 830ms cubic-bezier(0.22, 0.61, 0.36, 1) 92ms forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(2),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(2) {
  animation: marketingCtaDrawX 750ms cubic-bezier(0.28, 0.55, 0.32, 1) 264ms forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(3),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(3) {
  animation: marketingCtaDrawX 870ms cubic-bezier(0.18, 0.72, 0.38, 1) 438ms forwards;
}

.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline {
  animation: marketingCtaDrawY 900ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(4),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(4) {
  animation: marketingCtaDrawY 910ms cubic-bezier(0.22, 0.61, 0.36, 1) 512ms forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(5),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(5) {
  animation: marketingCtaDrawY 805ms cubic-bezier(0.32, 0.52, 0.24, 1) 648ms forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(6),
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(6) {
  animation: marketingCtaDrawY 865ms cubic-bezier(0.2, 0.65, 0.4, 1) 792ms forwards;
}

.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline--faint,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline--faint {
  animation: marketingCtaDrawXFaint 715ms cubic-bezier(0.26, 0.58, 0.34, 1) 336ms forwards;
}

.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline::after {
  animation: marketingCtaShimmer 900ms ease-out forwards;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(1)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(1)::after {
  animation-delay: 92ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(2)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(2)::after {
  animation-delay: 264ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline:nth-child(3)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline:nth-child(3)::after {
  animation-delay: 438ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(4)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(4)::after {
  animation-delay: 512ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(5)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(5)::after {
  animation-delay: 648ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__vline:nth-child(6)::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__vline:nth-child(6)::after {
  animation-delay: 792ms;
}
.cta-section.cta-section--in-view .cta-card.cta-card--fx-team .cta-card__hline--faint::after,
.cta-section.cta-section--in-view .cta-card.cta-card--fx-ai .cta-card__hline--faint::after {
  background: linear-gradient(90deg, transparent, rgba(250, 250, 250, 0.07), transparent);
  animation-delay: 336ms;
}

/* Keyframes (same names as marketing.css so one definition can merge if both load) */
@keyframes marketingCtaDrawX {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  60% {
    opacity: 0.62;
  }
  100% {
    transform: scaleX(1);
    opacity: 0.55;
  }
}

@keyframes marketingCtaDrawXFaint {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  60% {
    opacity: 0.28;
  }
  100% {
    transform: scaleX(1);
    opacity: 0.18;
  }
}

@keyframes marketingCtaDrawY {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  60% {
    opacity: 0.62;
  }
  100% {
    transform: scaleY(1);
    opacity: 0.55;
  }
}

@keyframes marketingCtaShimmer {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 0.17;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta-card.cta-card--fx-team .cta-card__hline,
  .cta-card.cta-card--fx-team .cta-card__vline,
  .cta-card.cta-card--fx-ai .cta-card__hline,
  .cta-card.cta-card--fx-ai .cta-card__vline {
    animation: none !important;
    opacity: 0.28;
    transform: none !important;
  }

  .cta-card.cta-card--fx-team .cta-card__hline--faint,
  .cta-card.cta-card--fx-ai .cta-card__hline--faint {
    opacity: 0.14 !important;
  }

  .cta-card.cta-card--fx-team .cta-card__hline::after,
  .cta-card.cta-card--fx-team .cta-card__vline::after,
  .cta-card.cta-card--fx-ai .cta-card__hline::after,
  .cta-card.cta-card--fx-ai .cta-card__vline::after {
    animation: none !important;
    opacity: 0;
  }
}

/* Careers CTA: “IMPOSSIBLE Team” must wrap on narrow screens (nowrap overflows the card) */
@media (max-width: 768px) {
  .cta-card.cta-card--fx-team .cta-heading-nowrap {
    display: inline;
    white-space: normal !important;
  }
}
