/* Cinematic, environmental section transitions. Minimal and soft by design. */

.homepage-watermark {
  --watermark-y: 0px;
  animation: none;
  opacity: 0.06;
  transform: translate3d(-50%, calc(-50% + var(--watermark-y)), 0) scale(1);
}

.cinematic-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.cinematic-section > *:not(.section-transition-sweep):not(.section-ambient-layer) {
  position: relative;
  z-index: 2;
}

.section-ambient-layer,
.section-transition-sweep {
  position: absolute;
  pointer-events: none;
}

.section-ambient-layer {
  inset: 0;
  z-index: 1;
  opacity: 0.68;
  background:
    radial-gradient(circle at var(--ambient-x, 18%) 26%, rgba(13, 92, 63, 0.15), rgba(13, 92, 63, 0) 18rem),
    radial-gradient(circle at calc(100% - var(--ambient-x, 18%)) 76%, rgba(91, 154, 198, 0.1), rgba(91, 154, 198, 0) 22rem);
  animation: ambientDrift 12s ease-in-out infinite alternate;
  mix-blend-mode: multiply;
}

.section-transition-sweep {
  right: -10%;
  bottom: -3rem;
  z-index: 6;
  width: min(70vw, 64rem);
  height: min(40vw, 34rem);
  opacity: 0;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.74) 38%, rgba(13, 92, 63, 0.22) 50%, rgba(255, 255, 255, 0) 74%),
    repeating-linear-gradient(128deg, rgba(13, 92, 63, 0.22) 0 1px, rgba(255, 255, 255, 0) 1px 9px);
  filter: blur(0.7px);
  transform: translate3d(34%, 20%, 0) rotate(-4deg);
}

.cinematic-section.is-transition-active .section-transition-sweep {
  animation: fiberSweep 2100ms cubic-bezier(0.22, 0.8, 0.2, 1) 80ms both;
}

.cinematic-section:nth-of-type(even) .section-transition-sweep {
  right: auto;
  left: -18%;
  transform: translate3d(-22%, 18%, 0) rotate(4deg) scaleX(-1);
}

.motion-card {
  opacity: 0;
  transform: translate3d(0, 3rem, 0);
  transition:
    opacity 980ms cubic-bezier(0.22, 0.8, 0.2, 1),
    transform 980ms cubic-bezier(0.22, 0.8, 0.2, 1),
    box-shadow 260ms ease,
    filter 260ms ease;
  transition-delay: var(--motion-delay, 0ms);
}

.is-transition-active .motion-card,
.motion-card.is-motion-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.cinematic-section.is-transition-active > .container,
.cinematic-section.is-transition-active > [class*="__inner"],
.cinematic-section.is-transition-active > [class*="__stage"] {
  animation: sectionFocusLift 1200ms cubic-bezier(0.22, 0.8, 0.2, 1) both;
}

.motion-card:hover {
  filter: saturate(1.04);
  box-shadow:
    0 1.35rem 3.1rem rgba(18, 38, 28, 0.16),
    0 0 1.15rem rgba(13, 92, 63, 0.12);
}

@keyframes watermarkBreath {
  0%,
  100% {
    opacity: 0.03;
    transform: translate3d(-50%, calc(-50% + var(--watermark-y)), 0) scale(1.08);
  }

  48% {
    opacity: 0.095;
    transform: translate3d(-50%, calc(-50% + var(--watermark-y)), 0) scale(1);
  }
}

@keyframes ambientDrift {
  from {
    --ambient-x: 16%;
    transform: translate3d(-0.6rem, 0, 0);
  }

  to {
    --ambient-x: 28%;
    transform: translate3d(0.7rem, -0.45rem, 0);
  }
}

@keyframes fiberSweep {
  0% {
    opacity: 0;
    filter: blur(0.9px);
  }

  38% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    filter: blur(0.2px);
    transform: translate3d(-8%, -5%, 0) rotate(-4deg);
  }
}

@keyframes sectionFocusLift {
  from {
    opacity: 0.82;
    transform: translate3d(0, 2.4rem, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .homepage-watermark,
  .section-ambient-layer,
  .section-transition-sweep,
  .cinematic-section.is-transition-active .section-transition-sweep,
  .motion-card {
    animation: none !important;
    transition: none !important;
  }

  .motion-card {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Disable ambient drift and sweep on mobile — causes green layer flicker and horizontal overflow */
@media (max-width: 768px) {
  .section-ambient-layer {
    animation: none !important;
    transform: none !important;
    opacity: 0 !important;
  }

  .section-transition-sweep {
    display: none !important;
  }

  .cinematic-section.is-transition-active .section-transition-sweep {
    animation: none !important;
  }
}
