/*
 * Site-wide Scroll & Load Animations
 * All scoped under body.ip-animations
 */

/* ── Base: hidden before reveal ── */
body.ip-animations .anim-fade-up,
body.ip-animations .anim-fade-in,
body.ip-animations .anim-scale-in,
body.ip-animations .anim-slide-left,
body.ip-animations .anim-slide-right {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* ── Direction presets ── */
body.ip-animations .anim-fade-up {
  transform: translateY(32px);
}

body.ip-animations .anim-slide-left {
  transform: translateX(-40px);
}

body.ip-animations .anim-slide-right {
  transform: translateX(40px);
}

body.ip-animations .anim-scale-in {
  transform: scale(0.92);
}

/* ── Revealed state ── */
body.ip-animations .is-visible.anim-fade-up,
body.ip-animations .is-visible.anim-fade-in,
body.ip-animations .is-visible.anim-scale-in,
body.ip-animations .is-visible.anim-slide-left,
body.ip-animations .is-visible.anim-slide-right {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* ── Stagger children ── */
body.ip-animations .anim-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

body.ip-animations .anim-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

body.ip-animations .anim-stagger.is-visible > *:nth-child(1)  { transition-delay: 0.05s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(2)  { transition-delay: 0.10s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(3)  { transition-delay: 0.15s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(4)  { transition-delay: 0.20s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(5)  { transition-delay: 0.25s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(6)  { transition-delay: 0.30s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(7)  { transition-delay: 0.35s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(8)  { transition-delay: 0.40s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(9)  { transition-delay: 0.45s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(10) { transition-delay: 0.50s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(11) { transition-delay: 0.55s; }
body.ip-animations .anim-stagger.is-visible > *:nth-child(12) { transition-delay: 0.60s; }


/* ═══════════════════════════════════════
   Image Reveal — blur-up + scale
   ═══════════════════════════════════════ */

body.ip-animations .anim-img-wrap {
  position: relative;
  overflow: hidden;
  background: var(--color-background-alt, #f0f4f8);
}

body.ip-animations .anim-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-background-alt, #f0f4f8);
  transform-origin: right;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: 2;
}

body.ip-animations .anim-img-wrap.is-loaded::after {
  transform: scaleX(0);
}

body.ip-animations .anim-img-wrap img {
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.08);
  transition: opacity 0.6s ease 0.1s,
              filter 0.8s ease 0.1s,
              transform 0.8s ease 0.1s;
}

body.ip-animations .anim-img-wrap.is-loaded img {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

/* Shimmer placeholder before load */
body.ip-animations .anim-img-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    110deg,
    transparent 25%,
    rgba(255, 255, 255, 0.4) 37%,
    transparent 50%
  );
  background-size: 200% 100%;
  animation: ip-shimmer 1.8s infinite;
}

body.ip-animations .anim-img-wrap.is-loaded::before {
  display: none;
}

@keyframes ip-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════
   Section-specific targets
   ═══════════════════════════════════════ */

/* Section headers */
body.ip-animations .section-header {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

body.ip-animations .section-header.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Product / Post / Case cards */
body.ip-animations .products-grid > article,
body.ip-animations .posts-grid > article,
body.ip-animations .cases-grid > article,
body.ip-animations .cases-grid > div {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

body.ip-animations .products-grid.is-visible > :nth-child(1),
body.ip-animations .posts-grid.is-visible > :nth-child(1),
body.ip-animations .cases-grid.is-visible > :nth-child(1)  { opacity:1; transform:none; transition-delay:0.05s; }
body.ip-animations .products-grid.is-visible > :nth-child(2),
body.ip-animations .posts-grid.is-visible > :nth-child(2),
body.ip-animations .cases-grid.is-visible > :nth-child(2)  { opacity:1; transform:none; transition-delay:0.12s; }
body.ip-animations .products-grid.is-visible > :nth-child(3),
body.ip-animations .posts-grid.is-visible > :nth-child(3),
body.ip-animations .cases-grid.is-visible > :nth-child(3)  { opacity:1; transform:none; transition-delay:0.19s; }
body.ip-animations .products-grid.is-visible > :nth-child(4),
body.ip-animations .posts-grid.is-visible > :nth-child(4),
body.ip-animations .cases-grid.is-visible > :nth-child(4)  { opacity:1; transform:none; transition-delay:0.26s; }
body.ip-animations .products-grid.is-visible > :nth-child(5),
body.ip-animations .posts-grid.is-visible > :nth-child(5),
body.ip-animations .cases-grid.is-visible > :nth-child(5)  { opacity:1; transform:none; transition-delay:0.33s; }
body.ip-animations .products-grid.is-visible > :nth-child(6),
body.ip-animations .posts-grid.is-visible > :nth-child(6),
body.ip-animations .cases-grid.is-visible > :nth-child(6)  { opacity:1; transform:none; transition-delay:0.40s; }
body.ip-animations .products-grid.is-visible > :nth-child(7),
body.ip-animations .posts-grid.is-visible > :nth-child(7),
body.ip-animations .cases-grid.is-visible > :nth-child(7)  { opacity:1; transform:none; transition-delay:0.47s; }
body.ip-animations .products-grid.is-visible > :nth-child(8),
body.ip-animations .posts-grid.is-visible > :nth-child(8),
body.ip-animations .cases-grid.is-visible > :nth-child(8)  { opacity:1; transform:none; transition-delay:0.54s; }
body.ip-animations .products-grid.is-visible > :nth-child(9),
body.ip-animations .posts-grid.is-visible > :nth-child(9),
body.ip-animations .cases-grid.is-visible > :nth-child(9)  { opacity:1; transform:none; transition-delay:0.61s; }

/* Product thumbnails */
body.ip-animations .product-gallery__main {
  overflow: hidden;
}

/* CTA sections */
body.ip-animations .cta-section,
body.ip-animations .cta-box {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

body.ip-animations .cta-section.is-visible,
body.ip-animations .cta-box.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Page hero content */
body.ip-animations .page-hero__content {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

body.ip-animations .page-hero.is-visible .page-hero__content {
  opacity: 1;
  transform: translateY(0);
}

/* About overview image */
body.ip-animations .about-overview__image {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s,
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
}

body.ip-animations .about-overview__image.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* About highlights */
body.ip-animations .about-highlight {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

body.ip-animations .about-overview__highlights.is-visible .about-highlight:nth-child(1) { opacity:1; transform:none; transition-delay:0.1s; }
body.ip-animations .about-overview__highlights.is-visible .about-highlight:nth-child(2) { opacity:1; transform:none; transition-delay:0.2s; }
body.ip-animations .about-overview__highlights.is-visible .about-highlight:nth-child(3) { opacity:1; transform:none; transition-delay:0.3s; }


/* ═══════════════════════════════════════
   Reduced motion
   ═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  body.ip-animations .anim-fade-up,
  body.ip-animations .anim-fade-in,
  body.ip-animations .anim-scale-in,
  body.ip-animations .anim-slide-left,
  body.ip-animations .anim-slide-right,
  body.ip-animations .anim-stagger > *,
  body.ip-animations .section-header,
  body.ip-animations .products-grid > *,
  body.ip-animations .posts-grid > *,
  body.ip-animations .cases-grid > *,
  body.ip-animations .cta-section,
  body.ip-animations .cta-box,
  body.ip-animations .page-hero__content,
  body.ip-animations .about-overview__image,
  body.ip-animations .about-highlight,
  body.ip-animations .anim-img-wrap img,
  body.ip-animations .anim-img-wrap::after {
    transition-duration: 0.01s !important;
    animation-duration: 0.01s !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }
}
