/* Animation keyframes are co-located with their owning components in services.css, hero.css, and components.css. */

/* ============================================================
   CTA video — atmospheric "focus pulling" effect.
   Default state: scene is softly blurred and slightly desaturated,
   like an out-of-focus film still. The cursor pulls a sharp,
   warm spotlight through the scene; figures near the cursor
   come into focus and warmth, the rest stays dreamy.
   The whole panel breathes with a slow idle float.
   ============================================================ */

.cta-video-section {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-bottom: clamp(220px, 26vw, 380px) !important;
}

.cta-video-section > .cta-inner {
  position: relative;
  z-index: 5;
}

.cta-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

/* Two stacked copies of the video:
   - Base: heavily blurred + desaturated (the "out of focus" world)
   - Sharp: clean, masked to a soft circle that follows the cursor
*/
.cta-video__base,
.cta-video__sharp {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  display: block;
  will-change: transform, filter;
  transform-origin: center bottom;
}

.cta-video__base {
  z-index: 0;
  transform: translate3d(0, 0, 0) scale(1.06);
  filter: blur(7px) saturate(0.78) brightness(0.96) contrast(0.98);
}

.cta-video__sharp {
  z-index: 1;
  transform: translate3d(0, 0, 0) scale(1.06);
  filter: saturate(1.05) contrast(1.04);
  /* Mask is driven via CSS variables from JS — circle follows cursor.
     Default position is centred; opacity ramps up via .is-active. */
  --m-x: 50%;
  --m-y: 60%;
  --m-r: 280px;
  -webkit-mask-image: radial-gradient(
    circle var(--m-r) at var(--m-x) var(--m-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.85) 55%,
    rgba(0, 0, 0, 0) 100%
  );
          mask-image: radial-gradient(
    circle var(--m-r) at var(--m-x) var(--m-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.85) 55%,
    rgba(0, 0, 0, 0) 100%
  );
  opacity: 0;
  transition: opacity 500ms ease;
}

.cta-video.is-active .cta-video__sharp {
  opacity: 1;
}

/* Top fade — keeps copy legible against the page surface */
.cta-video__fade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--cta-fade, #efefef) 0%,
    color-mix(in srgb, var(--cta-fade, #efefef) 92%, transparent) 28%,
    color-mix(in srgb, var(--cta-fade, #efefef) 55%, transparent) 50%,
    color-mix(in srgb, var(--cta-fade, #efefef) 0%, transparent) 72%
  );
}

/* Warm bloom — radial warmth that follows the cursor.
   Sits in front of the sharp video, soft-light blended.
   Position driven via --bx / --by from JS. */
.cta-video__bloom {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    420px 360px at var(--bx, 50%) var(--by, 65%),
    rgba(255, 220, 170, 0.55) 0%,
    rgba(255, 200, 150, 0.22) 30%,
    rgba(255, 200, 150, 0) 65%
  );
  mix-blend-mode: soft-light;
  filter: blur(6px);
  opacity: 0;
  transition: opacity 700ms ease;
  will-change: background;
}

.cta-video.is-active .cta-video__bloom { opacity: 1; }

/* Cool counter-tone — the area FAR from the cursor stays cool/blue,
   reinforcing the "warm island in a cool room" feeling. */
.cta-video__cool {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    900px 700px at var(--cx, 50%) var(--cy, 50%),
    rgba(80, 100, 140, 0) 0%,
    rgba(80, 100, 140, 0.16) 70%,
    rgba(60, 80, 120, 0.28) 100%
  );
  mix-blend-mode: soft-light;
  opacity: 0.75;
  transition: opacity 600ms ease;
  will-change: background;
}

/* Vignette that breathes with proximity (closer = softer, lighter) */
.cta-video__vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(
    100% 80% at 50% 100%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, calc(0.18 * (1 - var(--p, 0)))) 75%,
    rgba(0, 0, 0, calc(0.32 * (1 - var(--p, 0)))) 100%
  );
  will-change: background;
}

@media (max-width: 720px) {
  .cta-video-section {
    padding-bottom: clamp(160px, 50vw, 260px) !important;
  }
  .cta-video__base { filter: blur(5px) saturate(0.82) brightness(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  .cta-video__base,
  .cta-video__sharp,
  .cta-video__bloom,
  .cta-video__cool,
  .cta-video__vignette {
    transition: none !important;
  }
  .cta-video__sharp { opacity: 1 !important; }
  .cta-video__base { filter: saturate(1) !important; }
}
