/* ==========================================================================
   Footer logo reveal and social icon wave fills.
   Cult.svg is inlined in template-parts/footer/footer.php (#services) so
   assets/js/footer-animation.js can animate its individual paths instead of
   the plain CSS background-image. Shared footer layout stays in style.css;
   this file contains the logo and social icon motion.
   ========================================================================== */

#services {
  background-image: none;
}

/* Leave room below the footer for the fixed menu and iPhone safe area. */

.cn-footer-logo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.cn-footer-logo-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cn-logo-path {
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill-opacity: 1;
  stroke-opacity: 0;
}

/* Keep each letter hittable while its fill and outline fade during replay. */
.cn-footer-logo.is-hover-ready .cn-logo-path {
  pointer-events: all;
}

.cn-logo-c1 {
  fill: #124b90;
  stroke: #7fb1ff;
}

.cn-logo-c2 {
  fill: #f29120;
  stroke: #ffc978;
}

.cn-logo-shine {
  mix-blend-mode: soft-light;
}

/* Raise a rippling color layer through the original social icon geometry. */
@property --cn-social-wave-level {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 110%;
}

.site-footer{
  margin-bottom: 50px;
}

/* Equal icon canvases keep the four AI marks visually consistent. */
.site-footer .cn-ai-socials .cn-ai-social-link {
  box-sizing: border-box;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 8px;
  place-items: center;
}

.site-footer .cn-ai-socials .cn-ai-icon {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
  overflow: visible;
  vertical-align: middle;
}

/* Both footer social rows use the same slower scale interaction. */
.site-footer .social-link {
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.site-footer .cn-social-wave {
  --cn-social-wave-level: 110%;
  pointer-events: none;
  clip-path: polygon(
    0% calc(var(--cn-social-wave-level) - 4%),
    16% calc(var(--cn-social-wave-level) - 6%),
    33% calc(var(--cn-social-wave-level) - 1%),
    50% calc(var(--cn-social-wave-level) + 6%),
    67% calc(var(--cn-social-wave-level) + 8%),
    84% calc(var(--cn-social-wave-level) + 4%),
    100% calc(var(--cn-social-wave-level) - 3%),
    100% 100%, 0% 100%
  );
  transition: --cn-social-wave-level 1.8s cubic-bezier(0.22, 1, 0.36, 1);
  animation: cn-social-wave-ripple 2.2s ease-in-out infinite paused;
}

.site-footer .social-link:is(:hover, :focus-visible) .cn-social-wave {
  --cn-social-wave-level: -12%;
  animation-play-state: running;
}

.site-footer .social-link:focus-visible {
  outline: 2px solid #58a4ff;
  outline-offset: 3px;
  border-radius: 6px;
}

@keyframes cn-social-wave-ripple {
  50% {
    clip-path: polygon(
      0% calc(var(--cn-social-wave-level) + 6%),
      16% calc(var(--cn-social-wave-level) + 8%),
      33% calc(var(--cn-social-wave-level) + 4%),
      50% calc(var(--cn-social-wave-level) - 2%),
      67% calc(var(--cn-social-wave-level) - 7%),
      84% calc(var(--cn-social-wave-level) - 5%),
      100% calc(var(--cn-social-wave-level) + 1%),
      100% 100%, 0% 100%
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-footer .cn-social-wave {
    animation: none;
    transition: none;
  }

  .site-footer .social-link,
  .site-footer .social-link:hover {
    transition: none;
    transform: none;
  }
}

/* Give the logo its own row on phones so it stays clear of footer links. */
@media (max-width: 768px) {
  /* Match the lower social row to the AI row on small screens. */
  .site-footer .socials .social-link {
    box-sizing: border-box;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 8px;
    place-items: center;
  }

  .site-footer .socials .social-link svg {
    display: block;
    width: 28px;
    height: 28px;
    flex: none;
    vertical-align: middle;
  }

  .cn-footer-logo {
    position: relative;
    inset: auto;
    width: 100%;
    height: clamp(90px, 23vw, 176px);
    margin-bottom: 24px;
  }

  .cn-footer-logo-svg {
    /* The artwork occupies only the middle band of its square viewBox.
       Fit that band across the phone rather than cropping the wordmark. */
    position: absolute;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    top: 50%;
    left: 0;
    /* Percentage margins use the containing width (the SVG is square),
       leaving transform free for the reveal's scale animation. */
    margin-top: -43.3%;
  }
  .site-footer {
    padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  }
}
